mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +02:00
Proper enablement of Build Configurations Build/Clean commands.
Change-Id: I7446a357cc2bafdb5015c3a988a1ad0b6f23a8c6
This commit is contained in:
parent
0b62fee46c
commit
093b2efacf
22 changed files with 419 additions and 423 deletions
|
@ -2,15 +2,15 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.ui; singleton:=true
|
||||
Bundle-Version: 8.2.1.qualifier
|
||||
Bundle-Version: 8.2.2.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Bundle-Localization: plugin
|
||||
Export-Package: org.eclipse.cdt.managedbuilder.ui.preferences,
|
||||
Export-Package: org.eclipse.cdt.managedbuilder.internal.ui.commands;x-internal:=true,
|
||||
org.eclipse.cdt.managedbuilder.internal.ui.workingsets;x-internal:=true,
|
||||
org.eclipse.cdt.managedbuilder.ui.preferences,
|
||||
org.eclipse.cdt.managedbuilder.ui.properties,
|
||||
org.eclipse.cdt.managedbuilder.ui.wizards,
|
||||
org.eclipse.cdt.managedbuilder.internal.ui.actions;x-internal:=true,
|
||||
org.eclipse.cdt.managedbuilder.internal.ui.workingsets;x-internal:=true
|
||||
org.eclipse.cdt.managedbuilder.ui.wizards
|
||||
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
|
||||
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
|
||||
org.eclipse.core.variables;bundle-version="[3.1.100,4.0.0)",
|
||||
|
|
|
@ -36,17 +36,23 @@ propSettingsPrefName=Property Pages Settings
|
|||
# The Resource Property page
|
||||
MngResourceProp.name=C/C++ Build
|
||||
|
||||
# The Project Converter page
|
||||
command.convertTarget.label=Convert To...
|
||||
command.convertTarget.name=Convert To
|
||||
|
||||
# Build/clean selected files actions
|
||||
# Build/clean commands and the corresponding menu items.
|
||||
command.buildFiles.label=Build Selected &File(s)
|
||||
command.buildFiles.name=Build Selected File(s)
|
||||
command.buildFiles.description=Rebuilds the selected source files
|
||||
command.cleanFiles.label=C&lean Selected File(s)
|
||||
command.cleanFiles.name=Clean Selected File(s)
|
||||
command.cleanFiles.description=Deletes build output files for the selected source files
|
||||
command.buildAllConfigurations.label=Build All
|
||||
command.buildAllConfigurations.name=Build All Configurations
|
||||
command.cleanAllConfigurations.label=Clean All
|
||||
command.cleanAllConfigurations.name=Clean All Configurations
|
||||
command.rebuildConfigurations.label=Build Selected...
|
||||
command.rebuildConfigurations.name=Build Selected Configurations
|
||||
|
||||
# The Project Converter page
|
||||
command.convertTarget.label=Convert To...
|
||||
command.convertTarget.name=Convert To
|
||||
|
||||
# New CDT project model - property pages names
|
||||
page.c.build=C/C++ Build
|
||||
|
@ -60,13 +66,6 @@ CDTVariablesProperty.name=Build Variables
|
|||
Discovery.options=Discovery Options
|
||||
Environment=Environment
|
||||
|
||||
BuildCfgMenu.label=Build configurations
|
||||
BuildAllConfigurationsMenu.label=Build All
|
||||
CleanAllConfigurationsMenu.label=Clean All
|
||||
RebuildConfigurationsMenu.label=Build Selected...
|
||||
BuildMenu.label=Build
|
||||
CleanMenu.label=Clean
|
||||
|
||||
Build.System.Wizard=Build System Wizard
|
||||
Make.Project.Wizard=Make Project Wizard
|
||||
|
||||
|
@ -107,8 +106,13 @@ PropertyPage.defaults=Property Page Settings
|
|||
MBSPerProjectProfile.name=Managed Build System - per project scanner info profile
|
||||
multicfg=Multiple Configurations Edit
|
||||
|
||||
DiscoveryTab.name = (Single) Discovery Options
|
||||
CPropertyVarsTab.name = (Single) CDT Vars (macros)
|
||||
ToolChainEditTab.name = (Single) Tool chain edit
|
||||
EnvironmentTab.name = (Single) Environment
|
||||
|
||||
# menu labels
|
||||
Configurations.menu=Build Configurations
|
||||
|
||||
buildDefinitionsUI.ep.name = Build Definitions UI
|
||||
extension-point.name = Custom MBS New Wizard Pages
|
||||
extension-point.name = Custom MBS New Wizard Pages
|
||||
|
|
|
@ -40,16 +40,28 @@
|
|||
name="%category.build.name"
|
||||
description="%category.build.description"
|
||||
id="org.eclipse.cdt.managedbuilder.ui.category.build"/>
|
||||
<command
|
||||
name="%command.buildFiles.name"
|
||||
description="%command.buildFiles.description"
|
||||
categoryId="org.eclipse.cdt.managedbuilder.ui.category.build"
|
||||
id="org.eclipse.cdt.managedbuilder.ui.buildFiles"/>
|
||||
<command
|
||||
name="%command.cleanFiles.name"
|
||||
description="%command.cleanFiles.description"
|
||||
categoryId="org.eclipse.cdt.managedbuilder.ui.category.build"
|
||||
id="org.eclipse.cdt.managedbuilder.ui.cleanFiles"/>
|
||||
<command
|
||||
name="%command.buildFiles.name"
|
||||
description="%command.buildFiles.description"
|
||||
name="%command.buildAllConfigurations.name"
|
||||
categoryId="org.eclipse.cdt.managedbuilder.ui.category.build"
|
||||
id="org.eclipse.cdt.managedbuilder.ui.buildFiles"/>
|
||||
id="org.eclipse.cdt.managedbuilder.ui.buildAllConfigurations"/>
|
||||
<command
|
||||
name="%command.cleanAllConfigurations.name"
|
||||
categoryId="org.eclipse.cdt.managedbuilder.ui.category.build"
|
||||
id="org.eclipse.cdt.managedbuilder.ui.cleanAllConfigurations"/>
|
||||
<command
|
||||
name="%command.rebuildConfigurations.name"
|
||||
categoryId="org.eclipse.cdt.managedbuilder.ui.category.build"
|
||||
id="org.eclipse.cdt.managedbuilder.ui.rebuildConfigurations"/>
|
||||
<command
|
||||
name="%command.convertTarget.name"
|
||||
categoryId="org.eclipse.ui.category.project"
|
||||
|
@ -59,13 +71,22 @@
|
|||
<extension
|
||||
point="org.eclipse.ui.handlers">
|
||||
<handler
|
||||
class="org.eclipse.cdt.managedbuilder.internal.ui.actions.CleanFilesHandler"
|
||||
commandId="org.eclipse.cdt.managedbuilder.ui.cleanFiles"/>
|
||||
<handler
|
||||
class="org.eclipse.cdt.managedbuilder.internal.ui.actions.BuildFilesHandler"
|
||||
class="org.eclipse.cdt.managedbuilder.internal.ui.commands.BuildFilesHandler"
|
||||
commandId="org.eclipse.cdt.managedbuilder.ui.buildFiles"/>
|
||||
<handler
|
||||
class="org.eclipse.cdt.managedbuilder.internal.ui.actions.ConvertTargetHandler"
|
||||
class="org.eclipse.cdt.managedbuilder.internal.ui.commands.CleanFilesHandler"
|
||||
commandId="org.eclipse.cdt.managedbuilder.ui.cleanFiles"/>
|
||||
<handler
|
||||
class="org.eclipse.cdt.managedbuilder.internal.ui.commands.BuildAllConfigurationsHandler"
|
||||
commandId="org.eclipse.cdt.managedbuilder.ui.buildAllConfigurations"/>
|
||||
<handler
|
||||
class="org.eclipse.cdt.managedbuilder.internal.ui.commands.CleanAllConfigurationsHandler"
|
||||
commandId="org.eclipse.cdt.managedbuilder.ui.cleanAllConfigurations"/>
|
||||
<handler
|
||||
class="org.eclipse.cdt.managedbuilder.internal.ui.commands.RebuildConfigurationsHandler"
|
||||
commandId="org.eclipse.cdt.managedbuilder.ui.rebuildConfigurations"/>
|
||||
<handler
|
||||
class="org.eclipse.cdt.managedbuilder.internal.ui.commands.ConvertTargetHandler"
|
||||
commandId="org.eclipse.cdt.managedbuilder.ui.convertTarget"/>
|
||||
</extension>
|
||||
|
||||
|
@ -73,27 +94,6 @@
|
|||
point="org.eclipse.ui.menus">
|
||||
<menuContribution
|
||||
locationURI="popup:org.eclipse.ui.popup.any?before=additions">
|
||||
<command
|
||||
commandId="org.eclipse.cdt.managedbuilder.ui.cleanFiles"
|
||||
label="%command.cleanFiles.label"
|
||||
style="push">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<and>
|
||||
<test property="org.eclipse.cdt.ui.checkPreference"
|
||||
value="org.eclipse.core.resources/description.autobuilding=false"/>
|
||||
<or>
|
||||
<reference
|
||||
definitionId="org.eclipse.cdt.managedbuilder.ui.isBuildableFileOpenInEditor"/>
|
||||
<with variable="selection">
|
||||
<iterate ifEmpty="false">
|
||||
<reference
|
||||
definitionId="org.eclipse.cdt.managedbuilder.ui.isBuildableFile"/>
|
||||
</iterate>
|
||||
</with>
|
||||
</or>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command
|
||||
commandId="org.eclipse.cdt.managedbuilder.ui.buildFiles"
|
||||
label="%command.buildFiles.label"
|
||||
|
@ -115,6 +115,93 @@
|
|||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command
|
||||
commandId="org.eclipse.cdt.managedbuilder.ui.cleanFiles"
|
||||
label="%command.cleanFiles.label"
|
||||
style="push">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<and>
|
||||
<test property="org.eclipse.cdt.ui.checkPreference"
|
||||
value="org.eclipse.core.resources/description.autobuilding=false"/>
|
||||
<or>
|
||||
<reference
|
||||
definitionId="org.eclipse.cdt.managedbuilder.ui.isBuildableFileOpenInEditor"/>
|
||||
<with variable="selection">
|
||||
<iterate ifEmpty="false">
|
||||
<reference
|
||||
definitionId="org.eclipse.cdt.managedbuilder.ui.isBuildableFile"/>
|
||||
</iterate>
|
||||
</with>
|
||||
</or>
|
||||
</and>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
<menuContribution
|
||||
locationURI="popup:org.eclipse.ui.popup.any?after=buildGroup">
|
||||
<menu
|
||||
id="org.eclipse.cdt.ui.cfgmenu"
|
||||
label="%Configurations.menu">
|
||||
<separator name="manage"/>
|
||||
<separator name="build" visible="true"/>
|
||||
<command
|
||||
commandId="org.eclipse.cdt.managedbuilder.ui.buildAllConfigurations"
|
||||
label="%command.buildAllConfigurations.label"
|
||||
style="push">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection">
|
||||
<iterate ifEmpty="false">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<and>
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="org.eclipse.cdt.managedbuilder.core.managedBuildNature"/>
|
||||
<test property="org.eclipse.cdt.ui.projectBuilder"
|
||||
value="org.eclipse.cdt.managedbuilder.core.genmakebuilder"/>
|
||||
</and>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command
|
||||
commandId="org.eclipse.cdt.managedbuilder.ui.cleanAllConfigurations"
|
||||
label="%command.cleanAllConfigurations.label"
|
||||
style="push">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection">
|
||||
<iterate ifEmpty="false">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<and>
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="org.eclipse.cdt.managedbuilder.core.managedBuildNature"/>
|
||||
<test property="org.eclipse.cdt.ui.projectBuilder"
|
||||
value="org.eclipse.cdt.managedbuilder.core.genmakebuilder"/>
|
||||
</and>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
<command
|
||||
commandId="org.eclipse.cdt.managedbuilder.ui.rebuildConfigurations"
|
||||
label="%command.rebuildConfigurations.label"
|
||||
style="push">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection">
|
||||
<iterate ifEmpty="false">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
<and>
|
||||
<test property="org.eclipse.core.resources.projectNature"
|
||||
value="org.eclipse.cdt.managedbuilder.core.managedBuildNature"/>
|
||||
<test property="org.eclipse.cdt.ui.projectBuilder"
|
||||
value="org.eclipse.cdt.managedbuilder.core.genmakebuilder"/>
|
||||
</and>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menu>
|
||||
</menuContribution>
|
||||
<!-- This menu command doesn't belong here. It should be contributed
|
||||
by the plug-ins that contribute target converters. -->
|
||||
|
@ -125,7 +212,7 @@
|
|||
label="%command.convertTarget.label"
|
||||
style="push">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection" >
|
||||
<with variable="selection">
|
||||
<count value="1"/>
|
||||
<iterate ifEmpty="false">
|
||||
<adapt type="org.eclipse.core.resources.IProject">
|
||||
|
@ -148,48 +235,16 @@
|
|||
<extension
|
||||
point="org.eclipse.core.expressions.propertyTesters">
|
||||
<propertyTester
|
||||
class="org.eclipse.cdt.managedbuilder.internal.ui.actions.ProjectPropertyTester"
|
||||
class="org.eclipse.cdt.managedbuilder.internal.ui.commands.ProjectPropertyTester"
|
||||
id="org.eclipse.cdt.managedbuilder.ui.projectPropertyTester"
|
||||
namespace="org.eclipse.cdt.managedbuilder.ui"
|
||||
properties="hasTargetConverters"
|
||||
type="org.eclipse.core.resources.IProject"/>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.ui.popupMenus">
|
||||
<objectContribution
|
||||
objectClass="org.eclipse.core.resources.IProject"
|
||||
adaptable="true"
|
||||
id="org.eclipse.cdt.managedbuilder.ui.popupMenu.BuildAll">
|
||||
<action
|
||||
class="org.eclipse.cdt.managedbuilder.internal.ui.actions.CleanAndBuildAction"
|
||||
enablesFor="+"
|
||||
id="org.eclipse.cdt.managedbuilder.ui.rebuildConfigurationsAction"
|
||||
label="%RebuildConfigurationsMenu.label"
|
||||
menubarPath="org.eclipse.cdt.ui.cfgmenu/build"/>
|
||||
<action
|
||||
class="org.eclipse.cdt.managedbuilder.internal.ui.actions.CleanAllConfigurationsAction"
|
||||
enablesFor="+"
|
||||
id="org.eclipse.cdt.managedbuilder.ui.cleanAllConfigurationsAction"
|
||||
label="%CleanAllConfigurationsMenu.label"
|
||||
menubarPath="org.eclipse.cdt.ui.cfgmenu/build"/>
|
||||
<action
|
||||
class="org.eclipse.cdt.managedbuilder.internal.ui.actions.BuildAllConfigurationsAction"
|
||||
enablesFor="+"
|
||||
id="org.eclipse.cdt.managedbuilder.ui.buildAllConfigurationsAction"
|
||||
label="%BuildAllConfigurationsMenu.label"
|
||||
menubarPath="org.eclipse.cdt.ui.cfgmenu/build"/>
|
||||
<visibility>
|
||||
<objectState
|
||||
name="projectNature"
|
||||
value="org.eclipse.cdt.managedbuilder.core.managedBuildNature"/>
|
||||
</visibility>
|
||||
</objectContribution>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.ui.newWizards">
|
||||
<!-- Managed Make Builder Projects -->
|
||||
<!-- Managed Make Builder Projects -->
|
||||
<wizard
|
||||
category="org.eclipse.cdt.ui.newCWizards"
|
||||
class="org.eclipse.cdt.managedbuilder.ui.wizards.ConvertToMakeWizard"
|
||||
|
@ -317,7 +372,7 @@
|
|||
<tab
|
||||
class="org.eclipse.cdt.managedbuilder.ui.properties.DiscoveryTab"
|
||||
icon="icons/elcl16/discovery.gif"
|
||||
name="(Single) Discovery.options"
|
||||
name="%DiscoveryTab.name"
|
||||
weight="050"
|
||||
helpId="cdt_u_prop_build_discovery"
|
||||
parent="org.eclipse.cdt.managedbuilder.ui.properties.Page_Discovery"/>
|
||||
|
@ -365,12 +420,12 @@
|
|||
weight="050"/>
|
||||
<tab
|
||||
class="org.eclipse.cdt.managedbuilder.ui.properties.CPropertyVarsTab"
|
||||
name="(Single) CDT Vars (macros)"
|
||||
name="%CPropertyVarsTab.name"
|
||||
helpId="cdt_u_prop_build_variables"
|
||||
parent="org.eclipse.cdt.managedbuilder.ui.properties.Page_Variables"/>
|
||||
<tab
|
||||
class="org.eclipse.cdt.managedbuilder.ui.properties.ToolChainEditTab"
|
||||
name="(Single) Tool chain edit"
|
||||
name="%ToolChainEditTab.name"
|
||||
helpId="cdt_u_prop_build_toolchain"
|
||||
parent="org.eclipse.cdt.managedbuilder.ui.properties.Page_ToolChain"/>
|
||||
|
||||
|
@ -445,7 +500,7 @@
|
|||
<tab
|
||||
class="org.eclipse.cdt.ui.newui.EnvironmentTab"
|
||||
icon="icons/obj16/environment.gif"
|
||||
name="(Single) Environment"
|
||||
name="%EnvironmentTab.name"
|
||||
weight="050"
|
||||
helpId="cdt_u_prop_build_environment"
|
||||
parent="org.eclipse.cdt.managedbuilder.ui.properties.Page_Environment"/>
|
||||
|
@ -509,12 +564,12 @@
|
|||
<tab
|
||||
class="org.eclipse.cdt.ui.newui.EnvironmentTab"
|
||||
icon="icons/obj16/environment.gif"
|
||||
name="(Single) Environment"
|
||||
name="%EnvironmentTab.name"
|
||||
helpId="cdt_u_prop_build_environment"
|
||||
parent="org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_Env"/>
|
||||
<tab
|
||||
class="org.eclipse.cdt.managedbuilder.ui.properties.CPropertyVarsTab"
|
||||
name="(Single) CDT Vars (macros)"
|
||||
name="%CPropertyVarsTab.name"
|
||||
helpId="cdt_u_prop_build_variables"
|
||||
parent="org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_Vars"/>
|
||||
<tab
|
||||
|
@ -849,16 +904,16 @@
|
|||
class="org.eclipse.cdt.managedbuilder.internal.ui.language.settings.providers.ScannerDiscoveryGlobalConsole">
|
||||
</CBuildConsole>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.keywords">
|
||||
<keyword
|
||||
id="org.eclipse.cdt.managedbuilder.ui.keyword.toolchain1"
|
||||
label="%CDTToolchainProperty.keyword.toolchain1">
|
||||
</keyword>
|
||||
<keyword
|
||||
id="org.eclipse.cdt.managedbuilder.ui.keyword.toolchain2"
|
||||
label="%CDTToolchainProperty.keyword.toolchain2">
|
||||
</keyword>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.keywords">
|
||||
<keyword
|
||||
id="org.eclipse.cdt.managedbuilder.ui.keyword.toolchain1"
|
||||
label="%CDTToolchainProperty.keyword.toolchain1">
|
||||
</keyword>
|
||||
<keyword
|
||||
id="org.eclipse.cdt.managedbuilder.ui.keyword.toolchain2"
|
||||
label="%CDTToolchainProperty.keyword.toolchain2">
|
||||
</keyword>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -20,9 +20,6 @@ public class Messages extends NLS {
|
|||
public static String ArtifactTab_1;
|
||||
public static String ArtifactTab_2;
|
||||
public static String ArtifactTab_3;
|
||||
public static String BuildConfigurationsJob_BuildError;
|
||||
public static String BuildConfigurationsJob_Building;
|
||||
public static String BuildConfigurationsJob_Cleaning;
|
||||
public static String BuilderSettingsTab_0;
|
||||
public static String BuilderSettingsTab_1;
|
||||
public static String BuilderSettingsTab_10;
|
||||
|
@ -76,11 +73,6 @@ public class Messages extends NLS {
|
|||
public static String CConfigWizardPage_7;
|
||||
public static String CConfigWizardPage_8;
|
||||
public static String CDTConfigWizardPage_0;
|
||||
public static String CleanAndBuildDialog_Active;
|
||||
public static String CleanAndBuildDialog_BuildConfigurations;
|
||||
public static String CleanAndBuildDialog_CleanConfigurations;
|
||||
public static String CleanAndBuildDialog_RebuildConfigurations;
|
||||
public static String CleanAndBuildDialog_SelectConfigurations;
|
||||
public static String CMainWizardPage_0;
|
||||
public static String CMainWizardPage_1;
|
||||
public static String CNewWizard_0;
|
||||
|
|
|
@ -10,16 +10,6 @@
|
|||
# Andrew Gvozdev (Quoin Inc.) - Combined managedbuilder.ui bundles to NLS message format, bug 318812
|
||||
###############################################################################
|
||||
|
||||
BuildConfigurationsJob_BuildError=Build error
|
||||
BuildConfigurationsJob_Building=Building {1}[{2}], ... [{0}]
|
||||
BuildConfigurationsJob_Cleaning=Cleaning {1}[{2}], ... [{0}]
|
||||
|
||||
CleanAndBuildDialog_Active=[Active]
|
||||
CleanAndBuildDialog_BuildConfigurations=Build selected configurations
|
||||
CleanAndBuildDialog_CleanConfigurations=Clean selected configurations
|
||||
CleanAndBuildDialog_RebuildConfigurations=Clean and Rebuild Configurations
|
||||
CleanAndBuildDialog_SelectConfigurations=Select configurations to rebuild.
|
||||
|
||||
BuilderSettingsTab_0=Builder
|
||||
BuilderSettingsTab_1=Builder &type:
|
||||
BuilderSettingsTab_2=External builder
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010, 2010 Andrew Gvozdev and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Gvozdev (Quoin Inc.) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.actions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.ui.IObjectActionDelegate;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.internal.ide.actions.BuildUtilities;
|
||||
|
||||
/**
|
||||
* Action which builds all configurations of the selected projects
|
||||
*/
|
||||
public class BuildAllConfigurationsAction implements IObjectActionDelegate {
|
||||
private ArrayList<IProject> projects = null;
|
||||
|
||||
@Override
|
||||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
projects = CleanAndBuildAction.getSelectedCdtProjects(selection);
|
||||
action.setEnabled(projects.size() > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(IAction action) {
|
||||
// Setup the global build console
|
||||
CUIPlugin.getDefault().startGlobalConsole();
|
||||
|
||||
for (IProject project : projects) {
|
||||
ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(project, false);
|
||||
if (prjd != null) {
|
||||
ICConfigurationDescription[] cfgds = prjd.getConfigurations();
|
||||
if (cfgds != null && cfgds.length > 0) {
|
||||
// save all dirty editors
|
||||
BuildUtilities.saveEditors(null);
|
||||
|
||||
Job buildFilesJob = new BuildConfigurationsJob(cfgds, 0, IncrementalProjectBuilder.INCREMENTAL_BUILD);
|
||||
buildFilesJob.schedule();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010, 2010 Andrew Gvozdev and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Gvozdev (Quoin Inc.) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.actions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.ui.IObjectActionDelegate;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.internal.ide.actions.BuildUtilities;
|
||||
|
||||
/**
|
||||
* Action which cleans all configurations of the selected projects
|
||||
*/
|
||||
public class CleanAllConfigurationsAction implements IObjectActionDelegate {
|
||||
private ArrayList<IProject> projects = null;
|
||||
|
||||
@Override
|
||||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
projects = CleanAndBuildAction.getSelectedCdtProjects(selection);
|
||||
action.setEnabled(projects.size() > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(IAction action) {
|
||||
// Setup the global build console
|
||||
CUIPlugin.getDefault().startGlobalConsole();
|
||||
|
||||
for (IProject project : projects) {
|
||||
ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(project, false);
|
||||
if (prjd != null) {
|
||||
ICConfigurationDescription[] cfgds = prjd.getConfigurations();
|
||||
if (cfgds != null && cfgds.length > 0) {
|
||||
// save all dirty editors
|
||||
BuildUtilities.saveEditors(null);
|
||||
|
||||
Job buildFilesJob = new BuildConfigurationsJob(cfgds, IncrementalProjectBuilder.CLEAN_BUILD, 0);
|
||||
buildFilesJob.schedule();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
||||
}
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010, 2010 Andrew Gvozdev and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Gvozdev (Quoin Inc.) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.actions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.ui.IObjectActionDelegate;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
/**
|
||||
* Action which cleans and rebuilds selected configurations. User selects
|
||||
* which configurations to rebuild via {@link CleanAndBuildDialog}.
|
||||
*/
|
||||
public class CleanAndBuildAction implements IObjectActionDelegate {
|
||||
private ArrayList<IProject> projects = null;
|
||||
|
||||
@Override
|
||||
public void run(IAction action) {
|
||||
if (projects!=null) {
|
||||
CleanAndBuildDialog dialog = new CleanAndBuildDialog(projects.toArray(new IProject[projects.size()]));
|
||||
dialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
projects = getSelectedCdtProjects(selection);
|
||||
action.setEnabled(projects.size() > 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list of CDT projects from the selection.
|
||||
*
|
||||
* @param selection - selected items.
|
||||
*/
|
||||
public static ArrayList<IProject> getSelectedCdtProjects(ISelection selection) {
|
||||
ArrayList<IProject> projects = new ArrayList<IProject>();
|
||||
|
||||
if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
|
||||
Object[] selected = ((IStructuredSelection)selection).toArray();
|
||||
if (selected.length > 0) {
|
||||
for (Object sel : selected) {
|
||||
IProject prj = null;
|
||||
if (sel instanceof IProject)
|
||||
prj = (IProject)sel;
|
||||
else if (sel instanceof ICProject)
|
||||
prj = ((ICProject)sel).getProject();
|
||||
|
||||
if (prj != null && CoreModel.getDefault().isNewStyleProject(prj)) {
|
||||
projects.add(prj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return projects;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010, 2010 Andrew Gvozdev and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Gvozdev (Quoin Inc.) - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.internal.ui.util.AbstractResourceActionHandler;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.ui.internal.ide.actions.BuildUtilities;
|
||||
|
||||
/**
|
||||
* Implementation of the command that builds all configurations of the selected projects.
|
||||
*/
|
||||
public class BuildAllConfigurationsHandler extends AbstractResourceActionHandler {
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
List<IProject> projects =
|
||||
RebuildConfigurationsHandler.getSelectedCdtProjects(getSelection(event));
|
||||
if (!projects.isEmpty()) {
|
||||
// Setup the global build console.
|
||||
CUIPlugin.getDefault().startGlobalConsole();
|
||||
|
||||
for (IProject project : projects) {
|
||||
ICProjectDescription projectDescription =
|
||||
CoreModel.getDefault().getProjectDescription(project, false);
|
||||
if (projectDescription != null) {
|
||||
ICConfigurationDescription[] cfgds = projectDescription.getConfigurations();
|
||||
if (cfgds != null && cfgds.length > 0) {
|
||||
// Save all dirty editors.
|
||||
BuildUtilities.saveEditors(null);
|
||||
|
||||
Job buildJob =
|
||||
new BuildConfigurationsJob(cfgds, 0, IncrementalProjectBuilder.INCREMENTAL_BUILD);
|
||||
buildJob.schedule();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnabled(Object evaluationContext) {
|
||||
super.setEnabled(evaluationContext);
|
||||
setBaseEnabled(!RebuildConfigurationsHandler.getSelectedCdtProjects(getSelection()).isEmpty());
|
||||
}
|
||||
}
|
|
@ -8,12 +8,11 @@
|
|||
* Contributors:
|
||||
* Andrew Gvozdev (Quoin Inc) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.actions;
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.commands;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
|
@ -38,10 +37,10 @@ public class BuildConfigurationsJob extends Job {
|
|||
String firstConfigurationName = cfgDescriptions[0].getName();
|
||||
if (isCleaning) {
|
||||
return MessageFormat.format(Messages.BuildConfigurationsJob_Cleaning,
|
||||
new Object[] {""+cfgDescriptions.length, firstProjectName, firstConfigurationName}); //$NON-NLS-1$
|
||||
new Object[] { cfgDescriptions.length, firstProjectName, firstConfigurationName });
|
||||
} else {
|
||||
return MessageFormat.format(Messages.BuildConfigurationsJob_Building,
|
||||
new Object[] {""+cfgDescriptions.length, firstProjectName, firstConfigurationName}); //$NON-NLS-1$
|
||||
new Object[] { cfgDescriptions.length, firstProjectName, firstConfigurationName });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,30 +55,27 @@ public class BuildConfigurationsJob extends Job {
|
|||
* {@link IncrementalProjectBuilder#AUTO_BUILD}
|
||||
*/
|
||||
public BuildConfigurationsJob(ICConfigurationDescription[] cfgDescriptions, int cleanKind, int buildKind) {
|
||||
super(composeJobName(cfgDescriptions, buildKind==0));
|
||||
super(composeJobName(cfgDescriptions, buildKind == 0));
|
||||
|
||||
this.cfgDescriptions = cfgDescriptions;
|
||||
this.cleanKind = cleanKind;
|
||||
this.buildKind = buildKind;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
// Setup the global build console
|
||||
CUIPlugin.getDefault().startGlobalConsole();
|
||||
|
||||
IConfiguration[] cfgs = new IConfiguration[cfgDescriptions.length];
|
||||
for (int i=0; i<cfgDescriptions.length; i++) {
|
||||
for (int i= 0; i < cfgDescriptions.length; i++) {
|
||||
cfgs[i] = ManagedBuildManager.getConfigurationForDescription(cfgDescriptions[i]);
|
||||
}
|
||||
try {
|
||||
if (cleanKind==IncrementalProjectBuilder.CLEAN_BUILD) {
|
||||
if (cleanKind == IncrementalProjectBuilder.CLEAN_BUILD) {
|
||||
ManagedBuildManager.buildConfigurations(cfgs, null, monitor, true, cleanKind);
|
||||
}
|
||||
if (buildKind!=0) {
|
||||
if (buildKind != 0) {
|
||||
ManagedBuildManager.buildConfigurations(cfgs, null, monitor, true, buildKind);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
|
@ -92,9 +88,6 @@ public class BuildConfigurationsJob extends Job {
|
|||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.jobs.Job#belongsTo(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean belongsTo(Object family) {
|
||||
return ResourcesPlugin.FAMILY_MANUAL_BUILD == family;
|
|
@ -9,7 +9,7 @@
|
|||
* Texas Instruments - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.actions;
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
|
@ -0,0 +1,64 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010, 2010 Andrew Gvozdev and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Gvozdev (Quoin Inc.) - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.internal.ui.util.AbstractResourceActionHandler;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.ui.internal.ide.actions.BuildUtilities;
|
||||
|
||||
/**
|
||||
* Implementation of the command that cleans all configurations of the selected projects.
|
||||
*/
|
||||
public class CleanAllConfigurationsHandler extends AbstractResourceActionHandler {
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
List<IProject> projects =
|
||||
RebuildConfigurationsHandler.getSelectedCdtProjects(getSelection(event));
|
||||
if (!projects.isEmpty()) {
|
||||
// Setup the global build console.
|
||||
CUIPlugin.getDefault().startGlobalConsole();
|
||||
|
||||
for (IProject project : projects) {
|
||||
ICProjectDescription projectDescription =
|
||||
CoreModel.getDefault().getProjectDescription(project, false);
|
||||
if (projectDescription != null) {
|
||||
ICConfigurationDescription[] cfgds = projectDescription.getConfigurations();
|
||||
if (cfgds != null && cfgds.length > 0) {
|
||||
// Save all dirty editors.
|
||||
BuildUtilities.saveEditors(null);
|
||||
|
||||
Job buildJob =
|
||||
new BuildConfigurationsJob(cfgds, IncrementalProjectBuilder.CLEAN_BUILD, 0);
|
||||
buildJob.schedule();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnabled(Object evaluationContext) {
|
||||
super.setEnabled(evaluationContext);
|
||||
setBaseEnabled(!RebuildConfigurationsHandler.getSelectedCdtProjects(getSelection()).isEmpty());
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
* Texas Instruments - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.actions;
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
|
@ -10,7 +10,7 @@
|
|||
* Anna Dushistova (MontaVista) - [366771] Converter fails to convert a CDT makefile project
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.actions;
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
|
@ -10,7 +10,7 @@
|
|||
* Anna Dushistova (MontaVista) - [366771] Converter fails to convert a CDT makefile project
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.actions;
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -10,13 +10,21 @@
|
|||
* IBM Corporation
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.actions;
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.commands;
|
||||
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
|
||||
class Messages extends NLS {
|
||||
public static String BuildConfigurationsJob_BuildError;
|
||||
public static String BuildConfigurationsJob_Building;
|
||||
public static String BuildConfigurationsJob_Cleaning;
|
||||
public static String BuildFilesHandler_buildingSelectedFiles;
|
||||
public static String CleanFilesHandler_cleaningFiles;
|
||||
public static String RebuildConfigurationsDialog_Active;
|
||||
public static String RebuildConfigurationsDialog_BuildConfigurations;
|
||||
public static String RebuildConfigurationsDialog_CleanConfigurations;
|
||||
public static String RebuildConfigurationsDialog_RebuildConfigurations;
|
||||
public static String RebuildConfigurationsDialog_SelectConfigurations;
|
||||
public static String ConvertTargetHandler_No_Converter;
|
||||
public static String ProjectConvert_noConverterErrorDialog_message;
|
||||
public static String ProjectConvert_title;
|
|
@ -11,10 +11,20 @@
|
|||
# Sergey Prigogin (Google)
|
||||
###############################################################################
|
||||
|
||||
BuildConfigurationsJob_BuildError=Build error
|
||||
BuildConfigurationsJob_Building=Building {1}[{2}], ... [{0}]
|
||||
BuildConfigurationsJob_Cleaning=Cleaning {1}[{2}], ... [{0}]
|
||||
|
||||
BuildFilesHandler_buildingSelectedFiles=Building Selected Files
|
||||
CleanFilesHandler_cleanSelectedFiles=Cleaning Selected Files
|
||||
CleanFilesHandler_cleaningFiles=Cleaning files
|
||||
|
||||
RebuildConfigurationsDialog_Active=[Active]
|
||||
RebuildConfigurationsDialog_BuildConfigurations=Build selected configurations
|
||||
RebuildConfigurationsDialog_CleanConfigurations=Clean selected configurations
|
||||
RebuildConfigurationsDialog_RebuildConfigurations=Clean and Rebuild Configurations
|
||||
RebuildConfigurationsDialog_SelectConfigurations=Select configurations to rebuild.
|
||||
|
||||
# Project Conversion Dialog messages
|
||||
ProjectConvert_conversionErrordialog_title=Project Conversion Error
|
||||
ProjectConvert_conversionErrordialog_message=Error has occurred during the conversion of the project {0} .
|
|
@ -8,7 +8,7 @@
|
|||
* Contributors:
|
||||
* Sergey Prigogin (Google) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.actions;
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.commands;
|
||||
|
||||
import org.eclipse.core.expressions.PropertyTester;
|
||||
import org.eclipse.core.resources.IProject;
|
|
@ -8,7 +8,7 @@
|
|||
* Contributors:
|
||||
* Andrew Gvozdev (Quoin Inc.) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.actions;
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -16,7 +16,6 @@ import java.util.List;
|
|||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
||||
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIImages;
|
||||
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
@ -51,7 +50,7 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
|
|||
/**
|
||||
* Dialog to let the user to clean and rebuild configurations of the selected projects.
|
||||
*/
|
||||
public class CleanAndBuildDialog extends MessageDialog {
|
||||
public class RebuildConfigurationsDialog extends MessageDialog {
|
||||
private static final String DIALOG_SETTINGS_SECTION = "RebuildConfigurationsDialogSettings"; //$NON-NLS-1$
|
||||
private static final String DIALOG_ORIGIN_X = "DIALOG_X_ORIGIN"; //$NON-NLS-1$
|
||||
private static final String DIALOG_ORIGIN_Y = "DIALOG_Y_ORIGIN"; //$NON-NLS-1$
|
||||
|
@ -68,8 +67,7 @@ public class CleanAndBuildDialog extends MessageDialog {
|
|||
private int cleanKind;
|
||||
private int buildKind;
|
||||
|
||||
|
||||
private class ConfigurationLabelProvider implements ILabelProvider {
|
||||
private static class ConfigurationLabelProvider implements ILabelProvider {
|
||||
WorkbenchLabelProvider workbenchLabelProvider = new WorkbenchLabelProvider();
|
||||
|
||||
@Override
|
||||
|
@ -105,7 +103,7 @@ public class CleanAndBuildDialog extends MessageDialog {
|
|||
ICConfigurationDescription cfgDescription = (ICConfigurationDescription) element;
|
||||
String name = cfgDescription.getName();
|
||||
if (cfgDescription.isActive()) {
|
||||
return name + ' ' + Messages.CleanAndBuildDialog_Active;
|
||||
return name + ' ' + Messages.RebuildConfigurationsDialog_Active;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
@ -115,31 +113,19 @@ public class CleanAndBuildDialog extends MessageDialog {
|
|||
}
|
||||
|
||||
private class ConfigurationContentProvider implements ITreeContentProvider {
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
return getChildren(inputElement);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean hasChildren(Object element) {
|
||||
if (element instanceof IProject[])
|
||||
|
@ -157,9 +143,6 @@ public class CleanAndBuildDialog extends MessageDialog {
|
|||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object getParent(Object element) {
|
||||
if (element instanceof IProject) {
|
||||
|
@ -172,9 +155,6 @@ public class CleanAndBuildDialog extends MessageDialog {
|
|||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object[] getChildren(Object parentElement) {
|
||||
if (parentElement instanceof IProject[])
|
||||
|
@ -197,19 +177,14 @@ public class CleanAndBuildDialog extends MessageDialog {
|
|||
*
|
||||
* @param projects - the currently selected projects
|
||||
*/
|
||||
public CleanAndBuildDialog(IProject[] projects) {
|
||||
super(CUIPlugin.getActiveWorkbenchShell(), Messages.CleanAndBuildDialog_RebuildConfigurations, null,
|
||||
Messages.CleanAndBuildDialog_SelectConfigurations, NONE,
|
||||
public RebuildConfigurationsDialog(IProject[] projects) {
|
||||
super(CUIPlugin.getActiveWorkbenchShell(), Messages.RebuildConfigurationsDialog_RebuildConfigurations, null,
|
||||
Messages.RebuildConfigurationsDialog_SelectConfigurations, NONE,
|
||||
new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL },
|
||||
0);
|
||||
this.projects = projects;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
|
||||
*/
|
||||
@Override
|
||||
protected void buttonPressed(int buttonId) {
|
||||
super.buttonPressed(buttonId);
|
||||
|
@ -217,30 +192,26 @@ public class CleanAndBuildDialog extends MessageDialog {
|
|||
return;
|
||||
}
|
||||
|
||||
// save all dirty editors
|
||||
// Save all dirty editors.
|
||||
BuildUtilities.saveEditors(null);
|
||||
|
||||
if (selected!=null) {
|
||||
List<ICConfigurationDescription> cfgDescriptions = new ArrayList<ICConfigurationDescription>();
|
||||
if (selected != null) {
|
||||
List<ICConfigurationDescription> cfgDescriptions = new ArrayList<>();
|
||||
for (Object sel : selected) {
|
||||
if (sel instanceof ICConfigurationDescription) {
|
||||
cfgDescriptions.add((ICConfigurationDescription)sel);
|
||||
}
|
||||
}
|
||||
|
||||
if (cleanKind!=0 || buildKind!=0) {
|
||||
ICConfigurationDescription[] cfgdArray = cfgDescriptions.toArray(new ICConfigurationDescription[cfgDescriptions.size()]);
|
||||
if (cleanKind != 0 || buildKind != 0) {
|
||||
ICConfigurationDescription[] cfgdArray =
|
||||
cfgDescriptions.toArray(new ICConfigurationDescription[cfgDescriptions.size()]);
|
||||
Job buildJob = new BuildConfigurationsJob(cfgdArray, cleanKind, buildKind);
|
||||
buildJob.schedule();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.dialogs.MessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
@Override
|
||||
protected Control createCustomArea(Composite parent) {
|
||||
Composite area = new Composite(parent, SWT.NONE);
|
||||
|
@ -257,19 +228,19 @@ public class CleanAndBuildDialog extends MessageDialog {
|
|||
}
|
||||
};
|
||||
|
||||
// second row
|
||||
// Second row.
|
||||
createProjectSelectionTable(area);
|
||||
|
||||
// third row
|
||||
// Third row.
|
||||
cleanCheckbox = new Button(parent, SWT.CHECK);
|
||||
cleanCheckbox.setText(Messages.CleanAndBuildDialog_CleanConfigurations);
|
||||
cleanCheckbox.setText(Messages.RebuildConfigurationsDialog_CleanConfigurations);
|
||||
cleanCheckbox.setSelection(true);
|
||||
cleanCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
|
||||
cleanCheckbox.addSelectionListener(updateEnablement);
|
||||
cleanKind = cleanCheckbox.getSelection() ? IncrementalProjectBuilder.CLEAN_BUILD : 0;
|
||||
|
||||
buildCheckbox = new Button(parent, SWT.CHECK);
|
||||
buildCheckbox.setText(Messages.CleanAndBuildDialog_BuildConfigurations);
|
||||
buildCheckbox.setText(Messages.RebuildConfigurationsDialog_BuildConfigurations);
|
||||
buildCheckbox.setSelection(true);
|
||||
buildCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
|
||||
buildCheckbox.addSelectionListener(updateEnablement);
|
||||
|
@ -289,7 +260,7 @@ public class CleanAndBuildDialog extends MessageDialog {
|
|||
data.heightHint = IDialogConstants.ENTRY_FIELD_WIDTH;
|
||||
cfgCheckboxViewer.getControl().setLayoutData(data);
|
||||
|
||||
ArrayList<ICConfigurationDescription> initialSelection = new ArrayList<ICConfigurationDescription>(projects.length);
|
||||
List<ICConfigurationDescription> initialSelection = new ArrayList<>(projects.length);
|
||||
for (IProject prj : projects) {
|
||||
ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(prj, false);
|
||||
if (prjd == null)
|
||||
|
@ -310,42 +281,27 @@ public class CleanAndBuildDialog extends MessageDialog {
|
|||
}
|
||||
|
||||
/**
|
||||
* Updates the enablement of the dialog's ok button based on the current choices in the dialog.
|
||||
* Updates the enablement of the dialog's OK button based on the current choices in the dialog.
|
||||
*/
|
||||
protected void updateEnablement() {
|
||||
cleanKind = cleanCheckbox.getSelection() ? IncrementalProjectBuilder.CLEAN_BUILD : 0;
|
||||
buildKind = buildCheckbox.getSelection() ? IncrementalProjectBuilder.INCREMENTAL_BUILD : 0;
|
||||
boolean enabled = cfgCheckboxViewer.getCheckedElements().length>0 && (cleanKind!=0 || buildKind!=0);
|
||||
boolean enabled = cfgCheckboxViewer.getCheckedElements().length > 0 && (cleanKind != 0 || buildKind != 0);
|
||||
getButton(OK).setEnabled(enabled);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.window.Window#close()
|
||||
*/
|
||||
@Override
|
||||
public boolean close() {
|
||||
persistDialogSettings(getShell(), DIALOG_SETTINGS_SECTION);
|
||||
return super.close();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.window.Window#getInitialLocation(org.eclipse.swt.graphics.Point)
|
||||
*/
|
||||
@Override
|
||||
protected Point getInitialLocation(Point initialSize) {
|
||||
Point p = getInitialLocation(DIALOG_SETTINGS_SECTION);
|
||||
return p != null ? p : super.getInitialLocation(initialSize);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.window.Window#getInitialSize()
|
||||
*/
|
||||
@Override
|
||||
protected Point getInitialSize() {
|
||||
Point p = super.getInitialSize();
|
||||
|
@ -353,9 +309,9 @@ public class CleanAndBuildDialog extends MessageDialog {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the initial location which is persisted in the IDE Plugin dialog settings under the provided
|
||||
* dialog settings section name. If location is not persisted in the settings, the {@code null} is
|
||||
* returned.
|
||||
* Returns the initial location which is persisted in the IDE Plugin dialog settings under
|
||||
* the provided dialog settings section name. If location is not persisted in the settings,
|
||||
* the {@code null} is returned.
|
||||
*
|
||||
* @param dialogSettingsSectionName - The name of the dialog settings section
|
||||
* @return The initial location or {@code null}
|
||||
|
@ -381,8 +337,8 @@ public class CleanAndBuildDialog extends MessageDialog {
|
|||
}
|
||||
|
||||
/**
|
||||
* Persists the location and dimensions of the shell and other user settings in the plugin's dialog
|
||||
* settings under the provided dialog settings section name
|
||||
* Persists the location and dimensions of the shell and other user settings in the plugin's
|
||||
* dialog settings under the provided dialog settings section name.
|
||||
*
|
||||
* @param shell - The shell whose geometry is to be stored
|
||||
* @param dialogSettingsSectionName - The name of the dialog settings section
|
||||
|
@ -398,9 +354,9 @@ public class CleanAndBuildDialog extends MessageDialog {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the initial size which is the larger of the <code>initialSize</code> or the size persisted in
|
||||
* the IDE UI Plugin dialog settings under the provided dialog setttings section name. If no size is
|
||||
* persisted in the settings, the {@code initialSize} is returned.
|
||||
* Returns the initial size which is the larger of the {@code initialSize} or the size
|
||||
* persisted in the IDE UI Plugin dialog settings under the provided dialog settings section
|
||||
* name. If no size is persisted in the settings, the {@code initialSize} is returned.
|
||||
*
|
||||
* @param initialSize - The initialSize to compare against
|
||||
* @param dialogSettingsSectionName - The name of the dialog settings section
|
||||
|
@ -418,11 +374,6 @@ public class CleanAndBuildDialog extends MessageDialog {
|
|||
return initialSize;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.dialogs.Dialog#isResizable()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isResizable() {
|
||||
return true;
|
|
@ -0,0 +1,71 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010, 2010 Andrew Gvozdev and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Gvozdev (Quoin Inc.) - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.managedbuilder.internal.ui.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.internal.ui.util.AbstractResourceActionHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
||||
/**
|
||||
* Implementation of the command that cleans and rebuilds selected configurations.
|
||||
* User selects which configurations to rebuild via {@link RebuildConfigurationsDialog}.
|
||||
*/
|
||||
public class RebuildConfigurationsHandler extends AbstractResourceActionHandler {
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
List<IProject> projects = getSelectedCdtProjects(getSelection(event));
|
||||
if (!projects.isEmpty()) {
|
||||
RebuildConfigurationsDialog dialog =
|
||||
new RebuildConfigurationsDialog(projects.toArray(new IProject[projects.size()]));
|
||||
dialog.open();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnabled(Object evaluationContext) {
|
||||
super.setEnabled(evaluationContext);
|
||||
setBaseEnabled(!RebuildConfigurationsHandler.getSelectedCdtProjects(getSelection()).isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of CDT projects from the selection.
|
||||
*/
|
||||
public static List<IProject> getSelectedCdtProjects(IStructuredSelection selection) {
|
||||
if (selection.isEmpty())
|
||||
return Collections.emptyList();
|
||||
|
||||
List<IProject> projects = new ArrayList<>();
|
||||
|
||||
for (Object element : selection.toArray()) {
|
||||
IProject project = null;
|
||||
if (element instanceof IProject) {
|
||||
project = (IProject) element;
|
||||
} else if (element instanceof ICProject) {
|
||||
project = ((ICProject) element).getProject();
|
||||
}
|
||||
|
||||
if (project != null && CoreModel.getDefault().isNewStyleProject(project)) {
|
||||
projects.add(project);
|
||||
}
|
||||
}
|
||||
return projects;
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: org.eclipse.cdt.ui; singleton:=true
|
||||
Bundle-Version: 5.8.0.qualifier
|
||||
Bundle-Version: 5.8.1.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.ui.CUIPlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Bundle-Localization: plugin
|
||||
|
|
|
@ -64,7 +64,7 @@ public abstract class AbstractResourceActionHandler extends AbstractHandler {
|
|||
return selection;
|
||||
}
|
||||
|
||||
protected IStructuredSelection getSelection(ExecutionEvent event) throws ExecutionException {
|
||||
protected static IStructuredSelection getSelection(ExecutionEvent event) throws ExecutionException {
|
||||
Object selection = HandlerUtil.getActiveMenuSelection(event);
|
||||
if (selection == null) {
|
||||
selection = HandlerUtil.getCurrentSelectionChecked(event);
|
||||
|
@ -133,7 +133,7 @@ public abstract class AbstractResourceActionHandler extends AbstractHandler {
|
|||
/**
|
||||
* Returns the selected resources.
|
||||
*/
|
||||
protected Collection<IResource> getSelectedResources(ExecutionEvent event) throws ExecutionException {
|
||||
protected static Collection<IResource> getSelectedResources(ExecutionEvent event) throws ExecutionException {
|
||||
IStructuredSelection selection = getSelection(event);
|
||||
return getSelectedResources(selection);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue