Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2016-08-15 15:31:03 -0400
committerDoug Schaefer2016-08-16 14:23:31 -0400
commit11d5df1274403d06008976b2e44027ea35a2481f (patch)
tree874d845ecc107e0176bb4079973758eb58242dd4
parent5c00a7c04977c5f8f8552a6a87b387b34f1112c1 (diff)
downloadorg.eclipse.cdt-11d5df1274403d06008976b2e44027ea35a2481f.tar.gz
org.eclipse.cdt-11d5df1274403d06008976b2e44027ea35a2481f.tar.xz
org.eclipse.cdt-11d5df1274403d06008976b2e44027ea35a2481f.zip
Bug 323848 - Add Build (was Make) Targets to the Project Navigator
-rw-r--r--build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestMakeTargets.java8
-rw-r--r--build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestToolActions.java5
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java20
-rw-r--r--build/org.eclipse.cdt.make.ui/META-INF/MANIFEST.MF2
-rw-r--r--build/org.eclipse.cdt.make.ui/plugin.properties10
-rw-r--r--build/org.eclipse.cdt.make.ui/plugin.xml81
-rw-r--r--build/org.eclipse.cdt.make.ui/pom.xml2
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeNavContentProvider.java115
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeNavLabelProvider.java38
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties66
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeTargetActionProvider.java109
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeTargetsContainer.java57
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/AbstractTargetAction.java3
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/CopyTargetAction.java12
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/PasteTargetAction.java9
15 files changed, 469 insertions, 68 deletions
diff --git a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestMakeTargets.java b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestMakeTargets.java
index d87684596c..a77fdced7b 100644
--- a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestMakeTargets.java
+++ b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestMakeTargets.java
@@ -58,8 +58,8 @@ public class TestMakeTargets extends AbstractTest {
projectExplorer.bot().tree().getTreeItem(projectName).select();
clickContextMenu(projectExplorer.bot().tree().select(projectName),
- "Make Targets", "Build...");
- shell = bot.shell("Make Targets");
+ "Build Targets", "Build...");
+ shell = bot.shell("Build Targets");
shell.activate();
bot.table().getTableItem("info").select();
bot.button("Build").click();
@@ -69,8 +69,8 @@ public class TestMakeTargets extends AbstractTest {
bot.waitUntil(consoleTextMatches(consoleView, p));
// Make Targets using right-click on project.
- clickProjectContextMenu("Make Targets", "Build...");
- shell = bot.shell("Make Targets");
+ clickProjectContextMenu("Build Targets", "Build...");
+ shell = bot.shell("Build Targets");
shell.activate();
bot.table().getTableItem("check").select();
bot.button("Build").click();
diff --git a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestToolActions.java b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestToolActions.java
index adb587b7be..08900103db 100644
--- a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestToolActions.java
+++ b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestToolActions.java
@@ -10,7 +10,8 @@
*******************************************************************************/
package org.eclipse.cdt.autotools.ui.tests;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import java.io.File;
import java.util.regex.Pattern;
@@ -231,7 +232,7 @@ public class TestToolActions extends AbstractTest {
consoleView.setFocus();
// Verify we got some help output to the console
Pattern p = Pattern.compile(".*Invoking libtoolize in.*" + projectName
- + ".*libtoolize --help.*Usage: libtoolize.*", Pattern.DOTALL);
+ + ".*libtoolize --help.*Usage: .*libtoolize.*", Pattern.DOTALL);
bot.waitUntil(consoleTextMatches(consoleView, p));
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java
index 21c3ec3b0a..eae2049332 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java
@@ -48,8 +48,8 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
private IContainer container;
private int appendEnvironment = USE_PROJECT_ENV_SETTING;
private boolean appendProjectEnvironment = true;
- private Map<String, String> buildEnvironment = new HashMap<String, String>();
- private final Map<String, String> targetAttributes = new HashMap<String, String>();
+ private Map<String, String> buildEnvironment = new HashMap<>();
+ private final Map<String, String> targetAttributes = new HashMap<>();
public MakeTarget(MakeTargetManager manager, IProject project, String targetBuilderID, String name) throws CoreException {
this.manager = manager;
@@ -238,7 +238,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
env.putAll(getEnvironment());
}
- HashMap<String, String> envMap = new HashMap<String, String>(env.entrySet().size());
+ HashMap<String, String> envMap = new HashMap<>(env.entrySet().size());
boolean win32 = Platform.getOS().equals(Constants.OS_WIN32);
for (Entry<String, String> entry : env.entrySet()) {
String key = entry.getKey();
@@ -273,7 +273,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
@Override
public void setEnvironment(Map<String, String> env) throws CoreException {
- buildEnvironment = new HashMap<String, String>(env);
+ buildEnvironment = new HashMap<>(env);
manager.updateTarget(this);
}
@@ -322,7 +322,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
@Override
public void build(IProgressMonitor monitor) throws CoreException {
final String builderID = manager.getBuilderID(targetBuilderID);
- final HashMap<String, String> infoMap = new HashMap<String, String>();
+ final HashMap<String, String> infoMap = new HashMap<>();
IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(infoMap, builderID);
info.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "make")); //$NON-NLS-1$
@@ -372,14 +372,4 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
}
}
- @Override
- @SuppressWarnings("unchecked")
- public <T> T getAdapter(Class<T> adapter) {
- if (adapter.equals(IProject.class)) {
- return (T) getProject();
- } else if (adapter.equals(IResource.class)) {
- return (T) container;
- }
- return super.getAdapter(adapter);
- }
}
diff --git a/build/org.eclipse.cdt.make.ui/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.make.ui/META-INF/MANIFEST.MF
index 3e6b3b3f0e..69cc08e6ad 100644
--- a/build/org.eclipse.cdt.make.ui/META-INF/MANIFEST.MF
+++ b/build/org.eclipse.cdt.make.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.make.ui; singleton:=true
-Bundle-Version: 7.2.0.qualifier
+Bundle-Version: 7.3.0.qualifier
Bundle-Activator: org.eclipse.cdt.make.internal.ui.MakeUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/build/org.eclipse.cdt.make.ui/plugin.properties b/build/org.eclipse.cdt.make.ui/plugin.properties
index 98bbc7cbdd..27da735834 100644
--- a/build/org.eclipse.cdt.make.ui/plugin.properties
+++ b/build/org.eclipse.cdt.make.ui/plugin.properties
@@ -25,16 +25,16 @@ WizardNewCCMakeProject.description=Create a new C++ Project which uses a simple
WizardConvertMakeProject.name=Convert to a C/C++ Project
WizardConvertMakeProject.description=Convert to a C/C++ Project
-Make.Target.label=Make Target
+Make.Target.label=Build Targets
ActionMakeCreateTarget.label=Create...
ActionMakeBuildTarget.label=Build...
ActionMakeUpdate.label=Update Old Make Project...
ActionMakeUpdate.tooltip=Update Old Make Project
-CommandTargetBuild.name=Make Target Build
+CommandTargetBuild.name=Build Target Build
CommandTargetBuild.description=Invoke a make target build for the selected container.
-CommandTargetCreate.name=Create Make Target
+CommandTargetCreate.name=Create Build Target
CommandTargetCreate.description=Create a new make build target for the selected container.
LastTargetBuild.name=Rebuild Last Target
LastTargetBuild.description=Rebuild the last make target for the selected container or project.
@@ -47,7 +47,7 @@ LanguageSettingsProvidersTab.name=Discovery
LanguageSettingsProvidersTab.tooltip=Language settings providers
PreferenceMakeProject.name=New Make Projects
-PreferenceMake.name=Make Targets
+PreferenceMake.name=Build Targets
PreferenceMakefileEditor.name=Makefile Editor
PreferenceMakefileSettings.name= Settings
@@ -89,7 +89,7 @@ Includes.tooltip=Includes list
Symbols=Symbols
Symbols.tooltip=Macros list
# menu label
-Make.targets.menu=Make Targets
+Make.targets.menu=Build Targets
# Makefile compare font
makeCompareFontDefinition.label= Makefile compare text font
diff --git a/build/org.eclipse.cdt.make.ui/plugin.xml b/build/org.eclipse.cdt.make.ui/plugin.xml
index 5913e06021..0554661e40 100644
--- a/build/org.eclipse.cdt.make.ui/plugin.xml
+++ b/build/org.eclipse.cdt.make.ui/plugin.xml
@@ -6,7 +6,7 @@
<extension
point="org.eclipse.ui.popupMenus">
<objectContribution
- objectClass="org.eclipse.core.resources.IResource"
+ objectClass="org.eclipse.core.resources.IContainer"
adaptable="true"
id="org.eclipse.cdt.make.ui.popupMenu.NavigatorContribution">
<action
@@ -50,6 +50,30 @@
</or>
</visibility>
</objectContribution>
+ <objectContribution
+ objectClass="org.eclipse.cdt.make.internal.ui.MakeTargetsContainer"
+ adaptable="false"
+ id="org.eclipse.cdt.make.ui.popupMenu.NavigatorContribution2">
+ <action
+ label="%LastTargetBuild.name"
+ class="org.eclipse.cdt.make.ui.actions.BuildLastTargetAction"
+ id="org.eclipse.cdt.make.ui.NavigatorBuildLastTargetAction2"
+ enablesFor="1"
+ definitionId="org.eclipse.cdt.make.ui.targetBuildLastCommand">
+ </action>
+ <action
+ label="%ActionMakeBuildTarget.label"
+ class="org.eclipse.cdt.make.ui.actions.BuildTargetAction"
+ enablesFor="1"
+ id="org.eclipse.cdt.make.ui.NavigatorBuildTargetAction2">
+ </action>
+ <action
+ label="%ActionMakeCreateTarget.label"
+ class="org.eclipse.cdt.make.ui.actions.CreateTargetAction"
+ enablesFor="1"
+ id="org.eclipse.cdt.make.ui.CViewCreateTargetAction2">
+ </action>
+ </objectContribution>
<viewerContribution
targetID="#MakefileRulerContext"
id="org.eclipse.cdt.ui.editor.MakefileEditorRulerPopupActions">
@@ -550,4 +574,59 @@
</description>
</transfer>
</extension>
+ <extension
+ point="org.eclipse.ui.navigator.navigatorContent">
+ <navigatorContent
+ activeByDefault="true"
+ contentProvider="org.eclipse.cdt.make.internal.ui.MakeNavContentProvider"
+ id="org.eclipse.cdt.make.ui.makeTargets.content"
+ labelProvider="org.eclipse.cdt.make.internal.ui.MakeNavLabelProvider"
+ name="Build Targets">
+ <triggerPoints>
+ <or>
+ <and>
+ <instanceof
+ value="org.eclipse.core.resources.IContainer">
+ </instanceof>
+ <test
+ property="org.eclipse.core.resources.projectNature"
+ value="org.eclipse.cdt.core.cnature">
+ </test>
+ </and>
+ <instanceof
+ value="org.eclipse.cdt.core.model.ICContainer">
+ </instanceof>
+ </or>
+ </triggerPoints>
+ </navigatorContent>
+ <actionProvider
+ class="org.eclipse.cdt.make.internal.ui.MakeTargetActionProvider"
+ id="org.eclipse.cdt.make.ui.makeTargets.actions">
+ <enablement>
+ <instanceof
+ value="org.eclipse.cdt.make.core.IMakeTarget">
+ </instanceof>
+ </enablement>
+ </actionProvider>
+ </extension>
+ <extension
+ point="org.eclipse.ui.navigator.viewer">
+ <viewerContentBinding
+ viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <contentExtension
+ isRoot="false"
+ pattern="org.eclipse.cdt.make.ui.makeTargets.*">
+ </contentExtension>
+ </includes>
+ </viewerContentBinding>
+ <viewerActionBinding
+ viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <actionExtension
+ pattern="org.eclipse.cdt.make.ui.makeTargets.*">
+ </actionExtension>
+ </includes>
+ </viewerActionBinding>
+ </extension>
</plugin>
diff --git a/build/org.eclipse.cdt.make.ui/pom.xml b/build/org.eclipse.cdt.make.ui/pom.xml
index 945a62c7d8..1ad2cb3024 100644
--- a/build/org.eclipse.cdt.make.ui/pom.xml
+++ b/build/org.eclipse.cdt.make.ui/pom.xml
@@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
- <version>7.2.0-SNAPSHOT</version>
+ <version>7.3.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.make.ui</artifactId>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeNavContentProvider.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeNavContentProvider.java
new file mode 100644
index 0000000000..935e47abce
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeNavContentProvider.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2016 QNX Software Systems 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
+ *******************************************************************************/
+package org.eclipse.cdt.make.internal.ui;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.cdt.core.model.ICContainer;
+import org.eclipse.cdt.make.core.IMakeTarget;
+import org.eclipse.cdt.make.core.IMakeTargetListener;
+import org.eclipse.cdt.make.core.MakeCorePlugin;
+import org.eclipse.cdt.make.core.MakeTargetEvent;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
+
+public class MakeNavContentProvider implements ITreeContentProvider, IMakeTargetListener {
+
+ private StructuredViewer viewer;
+
+ public MakeNavContentProvider() {
+ MakeCorePlugin.getDefault().getTargetManager().addListener(this);
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ this.viewer = (StructuredViewer) viewer;
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ // We're not a root provider so this won't get called
+ return null;
+ }
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof IContainer) {
+ IContainer container = (IContainer) parentElement;
+ return getContainer(container);
+ } else if (parentElement instanceof ICContainer) {
+ IContainer container = ((ICContainer) parentElement).getResource();
+ return getContainer(container);
+ } else if (parentElement instanceof MakeTargetsContainer) {
+ return ((MakeTargetsContainer) parentElement).getTargets();
+ }
+ return new Object[0];
+ }
+
+ private MakeTargetsContainer[] getContainer(IContainer container) {
+ try {
+ IMakeTarget[] targets = MakeCorePlugin.getDefault().getTargetManager().getTargets(container);
+ if (targets != null && targets.length > 0) {
+ return new MakeTargetsContainer[] { new MakeTargetsContainer(container, targets) };
+ }
+ } catch (CoreException e) {
+ MakeUIPlugin.log(e.getStatus());
+ }
+ return new MakeTargetsContainer[0];
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ if (element instanceof IMakeTarget || element instanceof MakeTargetsContainer) {
+ // TODO need this?
+ return null;
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ if (element instanceof IContainer || element instanceof ICContainer
+ || element instanceof MakeTargetsContainer) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public void targetChanged(MakeTargetEvent event) {
+ if (viewer == null || viewer.getControl().isDisposed()) {
+ return;
+ }
+
+ switch (event.getType()) {
+ case MakeTargetEvent.TARGET_ADD:
+ case MakeTargetEvent.TARGET_REMOVED:
+ Set<Object> elements = new HashSet<>();
+
+ for (IMakeTarget target : event.getTargets()) {
+ IContainer container = target.getContainer();
+ elements.add(container);
+ }
+
+ if (!elements.isEmpty()) {
+ viewer.getControl().getDisplay().asyncExec(() -> {
+ for (Object element : elements) {
+ viewer.refresh(element);
+ }
+ });
+ }
+ }
+ }
+
+}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeNavLabelProvider.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeNavLabelProvider.java
new file mode 100644
index 0000000000..cd5f74bc4c
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeNavLabelProvider.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2016 QNX Software Systems 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
+ *******************************************************************************/
+package org.eclipse.cdt.make.internal.ui;
+
+import org.eclipse.cdt.make.core.IMakeTarget;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+public class MakeNavLabelProvider extends LabelProvider {
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof IMakeTarget) {
+ return ((IMakeTarget) element).getName();
+ } else if (element instanceof MakeTargetsContainer) {
+ return MakeUIPlugin.getResourceString("BuildTargets.name"); //$NON-NLS-1$
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof IMakeTarget) {
+ return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_TARGET);
+ } else if (element instanceof MakeTargetsContainer) {
+ return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_TARGET);
+ } else {
+ return null;
+ }
+ }
+
+}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties
index e06330b470..cceb9a9833 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties
@@ -95,16 +95,16 @@ TargetBlock.target.label=Target name:
ErrorParserBlock.label.missingBuilderInformation=Builder is missing or disabled on project.
-BuildTarget.target.group_label=Make Target
-BuildTarget.target.label=Make target:
+BuildTarget.target.group_label=Build Target
+BuildTarget.target.label=Build target:
MakeTargetsPreferencePage.buildTargetInBackground.label=Build make targets in background.
MakeDocumentProvider.exception.createElementInfo=Error creating element.
-AddBuildTargetAction.title=Add make Target
-AddBuildTargetAction.description=Add make Target
-AddBuildTargetAction.tooltip= Add make Target
+AddBuildTargetAction.title=Add build Target
+AddBuildTargetAction.description=Add build Target
+AddBuildTargetAction.tooltip= Add build Target
AddBuildTargetAction.exception.internal=Internal Error
OpenIncludeAction.title=Open include directive
@@ -126,20 +126,20 @@ TargetListViewer.exception.message=An error occurred performing the selected act
UpdateMakeProjectAction.exception.error=Error
UpdateMakeProjectAction.eception.message=Error updating Make Projects
-UpdateMakeProjectAction.monitor.convert=Converting Make Targets...
+UpdateMakeProjectAction.monitor.convert=Converting Build Targets...
UpdateMakeProjectAction.monitor.update=Updating make Projects...
BuildPathInfoBlock.button.browse=Browse...
BuildPathInfoBlock.description=Set the include paths and preprocessor symbols for this project
BuildPathInfoBlock.monitor.settingScannerInfo=Setting Scanner Info
-BuildTargetDialog.title.buildTarget=Make Targets
+BuildTargetDialog.title.buildTarget=Build Targets
BuildTargetDialog.button.build=Build
-BuildTargetDialog.title.makeTargetsFor=Make Targets for:
+BuildTargetDialog.title.makeTargetsFor=Build Targets for:
MakeTargetDialog.exception.noTargetBuilderOnProject=Not target builders on the project
-MakeTargetDialog.title.createMakeTarget=Create Make Target
-MakeTargetDialog.title.modifyMakeTarget=Modify Make Target
+MakeTargetDialog.title.createMakeTarget=Create Build Target
+MakeTargetDialog.title.modifyMakeTarget=Modify Build Target
MakeTargetDialog.message.mustSpecifyName=Must specify a non-empty target name
MakeTargetDialog.message.targetWithNameExists=Target with that name already exists
MakeTargetDialog.message.mustSpecifyBuildCommand=Must specify a build command
@@ -148,21 +148,21 @@ MakeTargetDialog.button.create=Create
MakeTargetDialog.exception.makeTargetError=Internal error, see logs for details
MakeTargetDialog.exception.errorAddingTarget=Error adding target
-MakeTargetDnD.moving=Moving make targets to
+MakeTargetDnD.moving=Moving build targets to
MakeTargetDnD.moving.one=Moving target
-MakeTargetDnD.copying=Copying make targets to
+MakeTargetDnD.copying=Copying build targets to
MakeTargetDnD.copying.one=Copying target
-MakeTargetDnD.deleting=Deleting make targets
+MakeTargetDnD.deleting=Deleting build targets
MakeTargetDnD.deleting.one=Deleting target
-MakeTargetDnD.title.createInfo=Create Make Target Information
+MakeTargetDnD.title.createInfo=Create Build Target Information
MakeTargetDnD.message.createNonFileTargetAttempt=Attempt to create non-file targets will be ignored. Only file selection is supported by this operation.
-MakeTargetDnD.title.createError=Create Make Target Error
-MakeTargetDnD.message.createError=There were errors creating make targets in Make Target View. See log for more details.
-MakeTargetDnD.title.createFromTextConfirm=Confirm Creating Make Targets
-MakeTargetDnD.message.createFromTextConfirm=Do you really want to create multiple make targets ({0}) from the multiline text?\n\n
-MakeTargetDnD.title.overwriteTargetConfirm=Confirm Overwriting Make Target
-MakeTargetDnD.message.overwriteTargetConfirm=Make target "{0}" exists in this folder. Do you want to overwrite it?
+MakeTargetDnD.title.createError=Create Build Target Error
+MakeTargetDnD.message.createError=There were errors creating make targets in Build Targets View. See log for more details.
+MakeTargetDnD.title.createFromTextConfirm=Confirm Creating Build Targets
+MakeTargetDnD.message.createFromTextConfirm=Do you really want to create multiple build targets ({0}) from the multiline text?\n\n
+MakeTargetDnD.title.overwriteTargetConfirm=Confirm Overwriting Build Target
+MakeTargetDnD.message.overwriteTargetConfirm=Build target "{0}" exists in this folder. Do you want to overwrite it?
MakeTargetDnD.toggle.applyToAll=Apply action to all conflicting targets
MakeTargetDnD.button.rename=&Rename
MakeTargetDnD.copyOf.uniqueName=Copy of {0}
@@ -174,38 +174,38 @@ SettingsBlock.monitor.applyingSettings=Applying Settings...
SettingsBlock.message.mustEnterBuildCommand=Must enter a build command
DeleteTargetAction.label=&Delete
-DeleteTargetAction.tooltip=Delete Make Target
+DeleteTargetAction.tooltip=Delete Build Target
DeleteTargetAction.title.confirmDeletion=Confirm Target Deletion
DeleteTargetAction.message.confirmDeleteion=Are you sure you want to delete ''{0}''?
DeleteTargetAction.title.confirmMultipleDeletion=Confirm Multiple Target Deletion
DeleteTargetAction.message.confirmMultipleDeletion=Are you sure you want to delete these {0} targets?
-DeleteTargetAction.exception.removeError=Make Target Remove Error
-DeleteTargetAction.exception.errorDeletingBuildTarget=Error deleting Make target
+DeleteTargetAction.exception.removeError=Build Target Remove Error
+DeleteTargetAction.exception.errorDeletingBuildTarget=Error deleting Build target
BuildTargetAction.label=Build &Target
-BuildTargetAction.tooltip=Build Make Target
+BuildTargetAction.tooltip=Build the Target
BuildLastTargetAction.label=Rebuild &Last Target
-BuildLastTargetAction.tooltip=Rebuild the last make target for the selected container or project.
+BuildLastTargetAction.tooltip=Rebuild the last build target for the selected container or project.
ActionMakeBuildTarget.label=Build...
EditTargetAction.label=&Edit...
-EditTargetAction.tooltip=Edit Make Target
+EditTargetAction.tooltip=Edit Build Target
EditTargetAction.exception.internalError=Internal Error
EditTargetAction.exception.errorEditingTarget=Error editing target.
AddTargetAction.label=&New...
-AddTargetAction.tooltip=New Make Target
-AddTargetAction.exception.title=Error Adding Make Target
-AddTargetAction.exception.message=There was an error adding make target in Make Target View. See log for more details.
+AddTargetAction.tooltip=New Build Target
+AddTargetAction.exception.title=Error Adding Build Target
+AddTargetAction.exception.message=There was an error adding make target in Build Targets View. See log for more details.
CopyTargetAction.label=&Copy
-CopyTargetAction.tooltip=Copy Make Target
+CopyTargetAction.tooltip=Copy Build Target
CopyTargetAction.title.clipboardProblem=Problem Copying to Clipboard
CopyTargetAction.message.clipboardProblem=There was a problem when accessing the system clipboard.
PasteTargetAction.label=&Paste
-PasteTargetAction.tooltip=Paste Make Target
+PasteTargetAction.tooltip=Paste Build Target
FilterEmptyFolderAction.label=Hide Empty Folders
FilterEmptyFolderAction.tooltip=Hide Empty Folders
@@ -216,7 +216,7 @@ MakeUIPlugin.update_project_message=Older \'make\' projects have been detected i
# Prefernece Page
MakePreferencePage.description=Specify the settings used as defaults by the New Standard Make Project creation wizard.
-MakeTargetPreferencePage.buildTargetInBackground.label=Build Make target in the background.
+MakeTargetPreferencePage.buildTargetInBackground.label=Build target in the background.
MakeTargetPreferencePage.buildLastTarget.title=Rebuild Last Target
MakeTargetPreferencePage.buildLastTarget.project=From selected &project
MakeTargetPreferencePage.buildLastTarget.resource=From selected &folder
@@ -327,3 +327,5 @@ MultipleInputDialog.2=Varia&bles...
# --- Compare ---
MakefileMergeViewer.title=Make Compare Viewer
+
+BuildTargets.name=Build Targets
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeTargetActionProvider.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeTargetActionProvider.java
new file mode 100644
index 0000000000..a7eb22687d
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeTargetActionProvider.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2016 QNX Software Systems 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
+ *******************************************************************************/
+package org.eclipse.cdt.make.internal.ui;
+
+import org.eclipse.cdt.make.core.IMakeTarget;
+import org.eclipse.cdt.make.ui.views.BuildTargetAction;
+import org.eclipse.cdt.make.ui.views.CopyTargetAction;
+import org.eclipse.cdt.make.ui.views.DeleteTargetAction;
+import org.eclipse.cdt.make.ui.views.EditTargetAction;
+import org.eclipse.cdt.make.ui.views.PasteTargetAction;
+import org.eclipse.cdt.make.ui.views.RebuildLastTargetAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchCommandConstants;
+import org.eclipse.ui.actions.ActionContext;
+import org.eclipse.ui.actions.TextActionHandler;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+
+public class MakeTargetActionProvider extends CommonActionProvider {
+
+ private EditTargetAction editTargetAction;
+ private CopyTargetAction copyTargetAction;
+ private PasteTargetAction pasteTargetAction;
+ private DeleteTargetAction deleteTargetAction;
+ private BuildTargetAction buildTargetAction;
+ private RebuildLastTargetAction buildLastTargetAction;
+
+ private Clipboard clipboard;
+
+ @Override
+ public void init(ICommonActionExtensionSite aSite) {
+ super.init(aSite);
+
+ Shell shell = aSite.getViewSite().getShell();
+ clipboard = new Clipboard(shell.getDisplay());
+
+ editTargetAction = new EditTargetAction(aSite.getViewSite().getShell());
+ pasteTargetAction = new PasteTargetAction(shell, clipboard);
+ copyTargetAction = new CopyTargetAction(shell, clipboard, pasteTargetAction);
+ deleteTargetAction = new DeleteTargetAction(shell);
+ buildTargetAction = new BuildTargetAction(shell);
+ buildLastTargetAction = new RebuildLastTargetAction();
+
+ deleteTargetAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE);
+
+ aSite.getStructuredViewer().addDoubleClickListener(new IDoubleClickListener() {
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ Object element = selection.getFirstElement();
+ if (element instanceof IMakeTarget) {
+ buildTargetAction.run();
+ }
+ }
+ });
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ clipboard.dispose();
+ }
+
+ @Override
+ public void fillContextMenu(IMenuManager menu) {
+ menu.add(editTargetAction);
+ menu.add(new Separator());
+ menu.add(copyTargetAction);
+ menu.add(pasteTargetAction);
+ menu.add(deleteTargetAction);
+ menu.add(new Separator());
+ menu.add(buildTargetAction);
+ menu.add(buildLastTargetAction);
+ }
+
+ @Override
+ public void fillActionBars(IActionBars actionBars) {
+ TextActionHandler handler = new TextActionHandler(actionBars);
+ handler.setCopyAction(copyTargetAction);
+ handler.setPasteAction(pasteTargetAction);
+ handler.setDeleteAction(deleteTargetAction);
+ }
+
+ @Override
+ public void setContext(ActionContext context) {
+ super.setContext(context);
+
+ IStructuredSelection selection = (IStructuredSelection) context.getSelection();
+ editTargetAction.selectionChanged(selection);
+ copyTargetAction.selectionChanged(selection);
+ pasteTargetAction.selectionChanged(selection);
+ deleteTargetAction.selectionChanged(selection);
+ buildTargetAction.selectionChanged(selection);
+ buildLastTargetAction.selectionChanged(selection);
+ }
+
+}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeTargetsContainer.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeTargetsContainer.java
new file mode 100644
index 0000000000..f6fb3afd0d
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeTargetsContainer.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2016 QNX Software Systems 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
+ *******************************************************************************/
+package org.eclipse.cdt.make.internal.ui;
+
+import org.eclipse.cdt.make.core.IMakeTarget;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.runtime.PlatformObject;
+
+public class MakeTargetsContainer extends PlatformObject {
+
+ private final IContainer container;
+ private final IMakeTarget[] targets;
+
+ public MakeTargetsContainer(IContainer container, IMakeTarget[] targets) {
+ this.container = container;
+ this.targets = targets;
+ }
+
+ public IContainer getContainer() {
+ return container;
+ }
+
+ public IMakeTarget[] getTargets() {
+ return targets;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ MakeTargetsContainer other = (MakeTargetsContainer) obj;
+ if (container == null) {
+ if (other.container != null)
+ return false;
+ } else if (!container.equals(other.container))
+ return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((container == null) ? 0 : container.hashCode());
+ return result;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/AbstractTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/AbstractTargetAction.java
index dbaf441cec..0956f8d20e 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/AbstractTargetAction.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/AbstractTargetAction.java
@@ -16,6 +16,7 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.make.core.IMakeTarget;
import org.eclipse.cdt.make.core.MakeCorePlugin;
+import org.eclipse.cdt.make.internal.ui.MakeTargetsContainer;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.cdt.make.ui.TargetSourceContainer;
import org.eclipse.core.resources.IContainer;
@@ -89,6 +90,8 @@ public abstract class AbstractTargetAction
}
} else if (obj instanceof TargetSourceContainer) {
fContainer = ((TargetSourceContainer)obj).getContainer();
+ } else if (obj instanceof MakeTargetsContainer) {
+ fContainer = ((MakeTargetsContainer) obj).getContainer();
} else if (obj instanceof IMakeTarget) {
fContainer = ((IMakeTarget)obj).getContainer();
} else {
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/CopyTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/CopyTargetAction.java
index 23f2b523bb..cf9b46dbb4 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/CopyTargetAction.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/CopyTargetAction.java
@@ -47,11 +47,15 @@ public class CopyTargetAction extends SelectionListenerAction {
/**
* Constructor setting internal private fields and initializing the action.
*
- * @param shell - the shell in which to show any dialogs.
- * @param clipboard - system clipboard.
- * @param pasteAction -associated paste action. May be {@code null}.
+ * @param shell
+ * - the shell in which to show any dialogs.
+ * @param clipboard
+ * - system clipboard.
+ * @param pasteAction
+ * -associated paste action. May be {@code null}.
+ * @since 7.3
*/
- protected CopyTargetAction(Shell shell, Clipboard clipboard, PasteTargetAction pasteAction) {
+ public CopyTargetAction(Shell shell, Clipboard clipboard, PasteTargetAction pasteAction) {
super(MakeUIPlugin.getResourceString("CopyTargetAction.label")); //$NON-NLS-1$
this.shell = shell;
this.clipboard = clipboard;
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/PasteTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/PasteTargetAction.java
index bac70d0113..b0f253b248 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/PasteTargetAction.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/PasteTargetAction.java
@@ -49,10 +49,13 @@ public class PasteTargetAction extends SelectionListenerAction {
/**
* Constructor setting internal private fields and initializing the action.
*
- * @param shell - the shell in which to show any dialogs.
- * @param clipboard - system clipboard.
+ * @param shell
+ * - the shell in which to show any dialogs.
+ * @param clipboard
+ * - system clipboard.
+ * @since 7.3
*/
- protected PasteTargetAction(Shell shell, Clipboard clipboard) {
+ public PasteTargetAction(Shell shell, Clipboard clipboard) {
super(MakeUIPlugin.getResourceString("PasteTargetAction.label")); //$NON-NLS-1$
this.shell = shell;
this.clipboard = clipboard;

Back to the top