1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

Bug 323848 - Add Build (was Make) Targets to the Project Navigator

Change-Id: Ia1da4a5e57a7a19732deaf0fa384702139220432
This commit is contained in:
Doug Schaefer 2016-08-15 15:31:03 -04:00
parent 5c00a7c049
commit 11d5df1274
15 changed files with 469 additions and 68 deletions

View file

@ -58,8 +58,8 @@ public class TestMakeTargets extends AbstractTest {
projectExplorer.bot().tree().getTreeItem(projectName).select(); projectExplorer.bot().tree().getTreeItem(projectName).select();
clickContextMenu(projectExplorer.bot().tree().select(projectName), clickContextMenu(projectExplorer.bot().tree().select(projectName),
"Make Targets", "Build..."); "Build Targets", "Build...");
shell = bot.shell("Make Targets"); shell = bot.shell("Build Targets");
shell.activate(); shell.activate();
bot.table().getTableItem("info").select(); bot.table().getTableItem("info").select();
bot.button("Build").click(); bot.button("Build").click();
@ -69,8 +69,8 @@ public class TestMakeTargets extends AbstractTest {
bot.waitUntil(consoleTextMatches(consoleView, p)); bot.waitUntil(consoleTextMatches(consoleView, p));
// Make Targets using right-click on project. // Make Targets using right-click on project.
clickProjectContextMenu("Make Targets", "Build..."); clickProjectContextMenu("Build Targets", "Build...");
shell = bot.shell("Make Targets"); shell = bot.shell("Build Targets");
shell.activate(); shell.activate();
bot.table().getTableItem("check").select(); bot.table().getTableItem("check").select();
bot.button("Build").click(); bot.button("Build").click();

View file

@ -10,7 +10,8 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.autotools.ui.tests; 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.io.File;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -231,7 +232,7 @@ public class TestToolActions extends AbstractTest {
consoleView.setFocus(); consoleView.setFocus();
// Verify we got some help output to the console // Verify we got some help output to the console
Pattern p = Pattern.compile(".*Invoking libtoolize in.*" + projectName 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)); bot.waitUntil(consoleTextMatches(consoleView, p));
} }

View file

@ -48,8 +48,8 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
private IContainer container; private IContainer container;
private int appendEnvironment = USE_PROJECT_ENV_SETTING; private int appendEnvironment = USE_PROJECT_ENV_SETTING;
private boolean appendProjectEnvironment = true; private boolean appendProjectEnvironment = true;
private Map<String, String> buildEnvironment = new HashMap<String, String>(); private Map<String, String> buildEnvironment = new HashMap<>();
private final Map<String, String> targetAttributes = new HashMap<String, String>(); private final Map<String, String> targetAttributes = new HashMap<>();
public MakeTarget(MakeTargetManager manager, IProject project, String targetBuilderID, String name) throws CoreException { public MakeTarget(MakeTargetManager manager, IProject project, String targetBuilderID, String name) throws CoreException {
this.manager = manager; this.manager = manager;
@ -238,7 +238,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
env.putAll(getEnvironment()); 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); boolean win32 = Platform.getOS().equals(Constants.OS_WIN32);
for (Entry<String, String> entry : env.entrySet()) { for (Entry<String, String> entry : env.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
@ -273,7 +273,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
@Override @Override
public void setEnvironment(Map<String, String> env) throws CoreException { public void setEnvironment(Map<String, String> env) throws CoreException {
buildEnvironment = new HashMap<String, String>(env); buildEnvironment = new HashMap<>(env);
manager.updateTarget(this); manager.updateTarget(this);
} }
@ -322,7 +322,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
@Override @Override
public void build(IProgressMonitor monitor) throws CoreException { public void build(IProgressMonitor monitor) throws CoreException {
final String builderID = manager.getBuilderID(targetBuilderID); 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); IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(infoMap, builderID);
info.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "make")); //$NON-NLS-1$ 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);
}
} }

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.make.ui; singleton:=true 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-Activator: org.eclipse.cdt.make.internal.ui.MakeUIPlugin
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-Localization: plugin Bundle-Localization: plugin

View file

@ -25,16 +25,16 @@ WizardNewCCMakeProject.description=Create a new C++ Project which uses a simple
WizardConvertMakeProject.name=Convert to a C/C++ Project WizardConvertMakeProject.name=Convert to a C/C++ Project
WizardConvertMakeProject.description=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... ActionMakeCreateTarget.label=Create...
ActionMakeBuildTarget.label=Build... ActionMakeBuildTarget.label=Build...
ActionMakeUpdate.label=Update Old Make Project... ActionMakeUpdate.label=Update Old Make Project...
ActionMakeUpdate.tooltip=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. 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. CommandTargetCreate.description=Create a new make build target for the selected container.
LastTargetBuild.name=Rebuild Last Target LastTargetBuild.name=Rebuild Last Target
LastTargetBuild.description=Rebuild the last make target for the selected container or project. 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 LanguageSettingsProvidersTab.tooltip=Language settings providers
PreferenceMakeProject.name=New Make Projects PreferenceMakeProject.name=New Make Projects
PreferenceMake.name=Make Targets PreferenceMake.name=Build Targets
PreferenceMakefileEditor.name=Makefile Editor PreferenceMakefileEditor.name=Makefile Editor
PreferenceMakefileSettings.name= Settings PreferenceMakefileSettings.name= Settings
@ -89,7 +89,7 @@ Includes.tooltip=Includes list
Symbols=Symbols Symbols=Symbols
Symbols.tooltip=Macros list Symbols.tooltip=Macros list
# menu label # menu label
Make.targets.menu=Make Targets Make.targets.menu=Build Targets
# Makefile compare font # Makefile compare font
makeCompareFontDefinition.label= Makefile compare text font makeCompareFontDefinition.label= Makefile compare text font

View file

@ -6,7 +6,7 @@
<extension <extension
point="org.eclipse.ui.popupMenus"> point="org.eclipse.ui.popupMenus">
<objectContribution <objectContribution
objectClass="org.eclipse.core.resources.IResource" objectClass="org.eclipse.core.resources.IContainer"
adaptable="true" adaptable="true"
id="org.eclipse.cdt.make.ui.popupMenu.NavigatorContribution"> id="org.eclipse.cdt.make.ui.popupMenu.NavigatorContribution">
<action <action
@ -50,6 +50,30 @@
</or> </or>
</visibility> </visibility>
</objectContribution> </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 <viewerContribution
targetID="#MakefileRulerContext" targetID="#MakefileRulerContext"
id="org.eclipse.cdt.ui.editor.MakefileEditorRulerPopupActions"> id="org.eclipse.cdt.ui.editor.MakefileEditorRulerPopupActions">
@ -550,4 +574,59 @@
</description> </description>
</transfer> </transfer>
</extension> </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> </plugin>

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<version>7.2.0-SNAPSHOT</version> <version>7.3.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.make.ui</artifactId> <artifactId>org.eclipse.cdt.make.ui</artifactId>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>
</project> </project>

View file

@ -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);
}
});
}
}
}
}

View file

@ -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;
}
}
}

View file

@ -95,16 +95,16 @@ TargetBlock.target.label=Target name:
ErrorParserBlock.label.missingBuilderInformation=Builder is missing or disabled on project. ErrorParserBlock.label.missingBuilderInformation=Builder is missing or disabled on project.
BuildTarget.target.group_label=Make Target BuildTarget.target.group_label=Build Target
BuildTarget.target.label=Make target: BuildTarget.target.label=Build target:
MakeTargetsPreferencePage.buildTargetInBackground.label=Build make targets in background. MakeTargetsPreferencePage.buildTargetInBackground.label=Build make targets in background.
MakeDocumentProvider.exception.createElementInfo=Error creating element. MakeDocumentProvider.exception.createElementInfo=Error creating element.
AddBuildTargetAction.title=Add make Target AddBuildTargetAction.title=Add build Target
AddBuildTargetAction.description=Add make Target AddBuildTargetAction.description=Add build Target
AddBuildTargetAction.tooltip= Add make Target AddBuildTargetAction.tooltip= Add build Target
AddBuildTargetAction.exception.internal=Internal Error AddBuildTargetAction.exception.internal=Internal Error
OpenIncludeAction.title=Open include directive OpenIncludeAction.title=Open include directive
@ -126,20 +126,20 @@ TargetListViewer.exception.message=An error occurred performing the selected act
UpdateMakeProjectAction.exception.error=Error UpdateMakeProjectAction.exception.error=Error
UpdateMakeProjectAction.eception.message=Error updating Make Projects 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... UpdateMakeProjectAction.monitor.update=Updating make Projects...
BuildPathInfoBlock.button.browse=Browse... BuildPathInfoBlock.button.browse=Browse...
BuildPathInfoBlock.description=Set the include paths and preprocessor symbols for this project BuildPathInfoBlock.description=Set the include paths and preprocessor symbols for this project
BuildPathInfoBlock.monitor.settingScannerInfo=Setting Scanner Info BuildPathInfoBlock.monitor.settingScannerInfo=Setting Scanner Info
BuildTargetDialog.title.buildTarget=Make Targets BuildTargetDialog.title.buildTarget=Build Targets
BuildTargetDialog.button.build=Build 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.exception.noTargetBuilderOnProject=Not target builders on the project
MakeTargetDialog.title.createMakeTarget=Create Make Target MakeTargetDialog.title.createMakeTarget=Create Build Target
MakeTargetDialog.title.modifyMakeTarget=Modify Make Target MakeTargetDialog.title.modifyMakeTarget=Modify Build Target
MakeTargetDialog.message.mustSpecifyName=Must specify a non-empty target name MakeTargetDialog.message.mustSpecifyName=Must specify a non-empty target name
MakeTargetDialog.message.targetWithNameExists=Target with that name already exists MakeTargetDialog.message.targetWithNameExists=Target with that name already exists
MakeTargetDialog.message.mustSpecifyBuildCommand=Must specify a build command 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.makeTargetError=Internal error, see logs for details
MakeTargetDialog.exception.errorAddingTarget=Error adding target MakeTargetDialog.exception.errorAddingTarget=Error adding target
MakeTargetDnD.moving=Moving make targets to MakeTargetDnD.moving=Moving build targets to
MakeTargetDnD.moving.one=Moving target MakeTargetDnD.moving.one=Moving target
MakeTargetDnD.copying=Copying make targets to MakeTargetDnD.copying=Copying build targets to
MakeTargetDnD.copying.one=Copying target MakeTargetDnD.copying.one=Copying target
MakeTargetDnD.deleting=Deleting make targets MakeTargetDnD.deleting=Deleting build targets
MakeTargetDnD.deleting.one=Deleting target 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.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.title.createError=Create Build Target Error
MakeTargetDnD.message.createError=There were errors creating make targets in Make Target View. See log for more details. MakeTargetDnD.message.createError=There were errors creating make targets in Build Targets View. See log for more details.
MakeTargetDnD.title.createFromTextConfirm=Confirm Creating Make Targets MakeTargetDnD.title.createFromTextConfirm=Confirm Creating Build Targets
MakeTargetDnD.message.createFromTextConfirm=Do you really want to create multiple make targets ({0}) from the multiline text?\n\n MakeTargetDnD.message.createFromTextConfirm=Do you really want to create multiple build targets ({0}) from the multiline text?\n\n
MakeTargetDnD.title.overwriteTargetConfirm=Confirm Overwriting Make Target MakeTargetDnD.title.overwriteTargetConfirm=Confirm Overwriting Build Target
MakeTargetDnD.message.overwriteTargetConfirm=Make target "{0}" exists in this folder. Do you want to overwrite it? 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.toggle.applyToAll=Apply action to all conflicting targets
MakeTargetDnD.button.rename=&Rename MakeTargetDnD.button.rename=&Rename
MakeTargetDnD.copyOf.uniqueName=Copy of {0} MakeTargetDnD.copyOf.uniqueName=Copy of {0}
@ -174,38 +174,38 @@ SettingsBlock.monitor.applyingSettings=Applying Settings...
SettingsBlock.message.mustEnterBuildCommand=Must enter a build command SettingsBlock.message.mustEnterBuildCommand=Must enter a build command
DeleteTargetAction.label=&Delete DeleteTargetAction.label=&Delete
DeleteTargetAction.tooltip=Delete Make Target DeleteTargetAction.tooltip=Delete Build Target
DeleteTargetAction.title.confirmDeletion=Confirm Target Deletion DeleteTargetAction.title.confirmDeletion=Confirm Target Deletion
DeleteTargetAction.message.confirmDeleteion=Are you sure you want to delete ''{0}''? DeleteTargetAction.message.confirmDeleteion=Are you sure you want to delete ''{0}''?
DeleteTargetAction.title.confirmMultipleDeletion=Confirm Multiple Target Deletion DeleteTargetAction.title.confirmMultipleDeletion=Confirm Multiple Target Deletion
DeleteTargetAction.message.confirmMultipleDeletion=Are you sure you want to delete these {0} targets? DeleteTargetAction.message.confirmMultipleDeletion=Are you sure you want to delete these {0} targets?
DeleteTargetAction.exception.removeError=Make Target Remove Error DeleteTargetAction.exception.removeError=Build Target Remove Error
DeleteTargetAction.exception.errorDeletingBuildTarget=Error deleting Make target DeleteTargetAction.exception.errorDeletingBuildTarget=Error deleting Build target
BuildTargetAction.label=Build &Target BuildTargetAction.label=Build &Target
BuildTargetAction.tooltip=Build Make Target BuildTargetAction.tooltip=Build the Target
BuildLastTargetAction.label=Rebuild &Last 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... ActionMakeBuildTarget.label=Build...
EditTargetAction.label=&Edit... EditTargetAction.label=&Edit...
EditTargetAction.tooltip=Edit Make Target EditTargetAction.tooltip=Edit Build Target
EditTargetAction.exception.internalError=Internal Error EditTargetAction.exception.internalError=Internal Error
EditTargetAction.exception.errorEditingTarget=Error editing target. EditTargetAction.exception.errorEditingTarget=Error editing target.
AddTargetAction.label=&New... AddTargetAction.label=&New...
AddTargetAction.tooltip=New Make Target AddTargetAction.tooltip=New Build Target
AddTargetAction.exception.title=Error Adding Make Target AddTargetAction.exception.title=Error Adding Build Target
AddTargetAction.exception.message=There was an error adding make target in Make Target View. See log for more details. AddTargetAction.exception.message=There was an error adding make target in Build Targets View. See log for more details.
CopyTargetAction.label=&Copy CopyTargetAction.label=&Copy
CopyTargetAction.tooltip=Copy Make Target CopyTargetAction.tooltip=Copy Build Target
CopyTargetAction.title.clipboardProblem=Problem Copying to Clipboard CopyTargetAction.title.clipboardProblem=Problem Copying to Clipboard
CopyTargetAction.message.clipboardProblem=There was a problem when accessing the system clipboard. CopyTargetAction.message.clipboardProblem=There was a problem when accessing the system clipboard.
PasteTargetAction.label=&Paste PasteTargetAction.label=&Paste
PasteTargetAction.tooltip=Paste Make Target PasteTargetAction.tooltip=Paste Build Target
FilterEmptyFolderAction.label=Hide Empty Folders FilterEmptyFolderAction.label=Hide Empty Folders
FilterEmptyFolderAction.tooltip=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 # Prefernece Page
MakePreferencePage.description=Specify the settings used as defaults by the New Standard Make Project creation wizard. 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.title=Rebuild Last Target
MakeTargetPreferencePage.buildLastTarget.project=From selected &project MakeTargetPreferencePage.buildLastTarget.project=From selected &project
MakeTargetPreferencePage.buildLastTarget.resource=From selected &folder MakeTargetPreferencePage.buildLastTarget.resource=From selected &folder
@ -327,3 +327,5 @@ MultipleInputDialog.2=Varia&bles...
# --- Compare --- # --- Compare ---
MakefileMergeViewer.title=Make Compare Viewer MakefileMergeViewer.title=Make Compare Viewer
BuildTargets.name=Build Targets

View file

@ -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);
}
}

View file

@ -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;
}
}

View file

@ -16,6 +16,7 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.make.core.IMakeTarget; import org.eclipse.cdt.make.core.IMakeTarget;
import org.eclipse.cdt.make.core.MakeCorePlugin; 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.internal.ui.MakeUIPlugin;
import org.eclipse.cdt.make.ui.TargetSourceContainer; import org.eclipse.cdt.make.ui.TargetSourceContainer;
import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IContainer;
@ -89,6 +90,8 @@ public abstract class AbstractTargetAction
} }
} else if (obj instanceof TargetSourceContainer) { } else if (obj instanceof TargetSourceContainer) {
fContainer = ((TargetSourceContainer)obj).getContainer(); fContainer = ((TargetSourceContainer)obj).getContainer();
} else if (obj instanceof MakeTargetsContainer) {
fContainer = ((MakeTargetsContainer) obj).getContainer();
} else if (obj instanceof IMakeTarget) { } else if (obj instanceof IMakeTarget) {
fContainer = ((IMakeTarget)obj).getContainer(); fContainer = ((IMakeTarget)obj).getContainer();
} else { } else {

View file

@ -47,11 +47,15 @@ public class CopyTargetAction extends SelectionListenerAction {
/** /**
* Constructor setting internal private fields and initializing the action. * Constructor setting internal private fields and initializing the action.
* *
* @param shell - the shell in which to show any dialogs. * @param shell
* @param clipboard - system clipboard. * - the shell in which to show any dialogs.
* @param pasteAction -associated paste action. May be {@code null}. * @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$ super(MakeUIPlugin.getResourceString("CopyTargetAction.label")); //$NON-NLS-1$
this.shell = shell; this.shell = shell;
this.clipboard = clipboard; this.clipboard = clipboard;

View file

@ -49,10 +49,13 @@ public class PasteTargetAction extends SelectionListenerAction {
/** /**
* Constructor setting internal private fields and initializing the action. * Constructor setting internal private fields and initializing the action.
* *
* @param shell - the shell in which to show any dialogs. * @param shell
* @param clipboard - system clipboard. * - 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$ super(MakeUIPlugin.getResourceString("PasteTargetAction.label")); //$NON-NLS-1$
this.shell = shell; this.shell = shell;
this.clipboard = clipboard; this.clipboard = clipboard;