mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 01:05:38 +02:00
work in progress - create/edit target dialog
This commit is contained in:
parent
46969ea9ba
commit
a31b9f5d4f
9 changed files with 239 additions and 104 deletions
|
@ -23,6 +23,7 @@ public interface IMakeTargetManager {
|
|||
IProject[] getTargetBuilderProjects() throws CoreException;
|
||||
|
||||
String getBuilderID(String targetBuilderID);
|
||||
String[] getTargetBuilders(IProject project);
|
||||
|
||||
void addListener(IMakeTargetListener listener);
|
||||
void removeListener(IMakeTargetListener listener);
|
||||
|
|
|
@ -139,7 +139,7 @@ public class MakeCorePlugin extends Plugin {
|
|||
return BuildInfoFactory.create(args, builderID);
|
||||
}
|
||||
|
||||
public IMakeTargetManager getTargetProvider() {
|
||||
public IMakeTargetManager getTargetManager() {
|
||||
if ( fTargetManager == null) {
|
||||
fTargetManager = new MakeTargetManager();
|
||||
fTargetManager.startup();
|
||||
|
|
|
@ -86,7 +86,7 @@ public class MakeTarget implements IMakeTarget {
|
|||
|
||||
public void build(IProgressMonitor monitor) throws CoreException {
|
||||
IProject project = container.getProject();
|
||||
String builderID = MakeCorePlugin.getDefault().getTargetProvider().getBuilderID(targetBuilderID);
|
||||
String builderID = MakeCorePlugin.getDefault().getTargetManager().getBuilderID(targetBuilderID);
|
||||
HashMap infoMap = new HashMap();
|
||||
IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(infoMap, builderID);
|
||||
info.setBuildArguments(buildArguments);
|
||||
|
@ -95,6 +95,7 @@ public class MakeTarget implements IMakeTarget {
|
|||
info.setStopOnError(isStopOnError);
|
||||
info.setFullBuildEnable(true);
|
||||
info.setFullBuildTarget(buildArguments);
|
||||
info.setBuildLocation(container.getLocation());
|
||||
project.build(IncrementalProjectBuilder.FULL_BUILD, builderID, infoMap, monitor);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,10 @@ import java.io.FileNotFoundException;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.eclipse.cdt.make.core.IMakeTarget;
|
||||
import org.eclipse.cdt.make.core.IMakeTargetListener;
|
||||
|
@ -57,7 +60,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
if (container instanceof IWorkspaceRoot) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeCorePlugin.getResourceString("MakeTargetManager.add_to_workspace_root"), null)); //$NON-NLS-1$
|
||||
}
|
||||
ProjectTargets projectTargets = (ProjectTargets) projectMap.get(container.getProject());
|
||||
ProjectTargets projectTargets = (ProjectTargets)projectMap.get(container.getProject());
|
||||
if (projectTargets == null) {
|
||||
projectTargets = readTargets(container.getProject());
|
||||
}
|
||||
|
@ -70,7 +73,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
|
||||
public void removeTarget(IMakeTarget target) throws CoreException {
|
||||
IProject project = target.getContainer().getProject();
|
||||
ProjectTargets projectTargets = (ProjectTargets) projectMap.get(project);
|
||||
ProjectTargets projectTargets = (ProjectTargets)projectMap.get(project);
|
||||
if (projectTargets == null) {
|
||||
projectTargets = readTargets(project);
|
||||
}
|
||||
|
@ -81,20 +84,20 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
|
||||
public void renameTarget(IMakeTarget target, String name) throws CoreException {
|
||||
IProject project = target.getContainer().getProject();
|
||||
ProjectTargets projectTargets = (ProjectTargets) projectMap.get(project);
|
||||
ProjectTargets projectTargets = (ProjectTargets)projectMap.get(project);
|
||||
if (projectTargets == null) {
|
||||
projectTargets = readTargets(project);
|
||||
}
|
||||
if (!projectTargets.contains((MakeTarget) target)) {
|
||||
if (!projectTargets.contains((MakeTarget)target)) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeCorePlugin.getResourceString("MakeTargetManager.target_exists"), null)); //$NON-NLS-1$
|
||||
}
|
||||
((MakeTarget) target).setName(name);
|
||||
((MakeTarget)target).setName(name);
|
||||
writeTargets(projectTargets);
|
||||
notifyListeners(new MakeTargetEvent(this, MakeTargetEvent.TARGET_CHANGED, target));
|
||||
}
|
||||
|
||||
public IMakeTarget[] getTargets(IContainer container) throws CoreException {
|
||||
ProjectTargets projectTargets = (ProjectTargets) projectMap.get(container.getProject());
|
||||
ProjectTargets projectTargets = (ProjectTargets)projectMap.get(container.getProject());
|
||||
if (projectTargets == null) {
|
||||
projectTargets = readTargets(container.getProject());
|
||||
}
|
||||
|
@ -102,10 +105,33 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
}
|
||||
|
||||
public IProject[] getTargetBuilderProjects() throws CoreException {
|
||||
return (IProject[]) fProjects.toArray(new IProject[fProjects.size()]);
|
||||
return (IProject[])fProjects.toArray(new IProject[fProjects.size()]);
|
||||
}
|
||||
|
||||
protected boolean hasTargetBuilder(IProject project) throws CoreException {
|
||||
public String[] getTargetBuilders(IProject project) {
|
||||
if (fProjects.contains(project)) {
|
||||
try {
|
||||
Vector ids = new Vector();
|
||||
IProjectDescription description = project.getDescription();
|
||||
ICommand builder[] = description.getBuildSpec();
|
||||
for (int i = 0; i < builder.length; i++) {
|
||||
Iterator entries = builderMap.entrySet().iterator();
|
||||
while (entries.hasNext()) {
|
||||
Map.Entry entry = (Entry)entries.next();
|
||||
if (entry.getValue().equals(builder[i].getBuilderName())) {
|
||||
ids.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
return (String[])ids.toArray(new String[ids.size()]);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
}
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
protected boolean hasTargetBuilder(IProject project) {
|
||||
try {
|
||||
IProjectDescription description = project.getDescription();
|
||||
ICommand builder[] = description.getBuildSpec();
|
||||
for (int j = 0; j < builder.length; j++) {
|
||||
|
@ -113,6 +139,8 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
return true;
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -120,13 +148,10 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
initializeBuilders();
|
||||
IProject project[] = ResourcesPlugin.getWorkspace().getRoot().getProjects();
|
||||
for (int i = 0; i < project.length; i++) {
|
||||
try {
|
||||
if (hasTargetBuilder(project[i])) {
|
||||
fProjects.add(project[i]);
|
||||
break;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
}
|
||||
ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
|
||||
}
|
||||
|
@ -157,54 +182,45 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
}
|
||||
IResource resource = delta.getResource();
|
||||
if (resource.getType() == IResource.PROJECT) {
|
||||
IProject project = (IProject) resource;
|
||||
IProject project = (IProject)resource;
|
||||
int flags = delta.getFlags();
|
||||
int deltaKind = delta.getKind();
|
||||
if (deltaKind == IResourceDelta.ADDED) {
|
||||
try {
|
||||
if (hasTargetBuilder(project)) {
|
||||
fProjects.add(project);
|
||||
notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_ADDED, project));
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
} else if (deltaKind == IResourceDelta.REMOVED) {
|
||||
if (fProjects.contains(project)) {
|
||||
fProjects.remove(project);
|
||||
notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED, project));
|
||||
}
|
||||
} else if (deltaKind == IResourceDelta.CHANGED) {
|
||||
try {
|
||||
if (0 != (flags & IResourceDelta.DESCRIPTION)) {
|
||||
if (fProjects.contains(project) && !hasTargetBuilder(project)) {
|
||||
fProjects.remove(project);
|
||||
notifyListeners(
|
||||
new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED, project));
|
||||
notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED, project));
|
||||
} else if (!fProjects.contains(project) && hasTargetBuilder(project)) {
|
||||
fProjects.add(project);
|
||||
notifyListeners(
|
||||
new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_ADDED, project));
|
||||
notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_ADDED, project));
|
||||
}
|
||||
}
|
||||
if (0 != (flags & IResourceDelta.OPEN)) {
|
||||
if (!project.isOpen() && fProjects.contains(project)) {
|
||||
fProjects.remove(project);
|
||||
notifyListeners(
|
||||
new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED, project));
|
||||
notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED, project));
|
||||
} else if (project.isOpen() && hasTargetBuilder(project) && !fProjects.contains(project)) {
|
||||
fProjects.add(project);
|
||||
notifyListeners(
|
||||
new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_ADDED, project));
|
||||
notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_ADDED, project));
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return resource instanceof IWorkspaceRoot;
|
||||
}
|
||||
}
|
||||
|
||||
protected void writeTargets(ProjectTargets projectTargets) throws CoreException {
|
||||
IPath targetFilePath = MakeCorePlugin.getDefault().getStateLocation().append(projectTargets.getProject().getName());
|
||||
File targetFile = targetFilePath.toFile();
|
||||
|
@ -251,7 +267,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
protected void notifyListeners(MakeTargetEvent event) {
|
||||
Object[] list = listeners.getListeners();
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
((IMakeTargetListener) list[i]).targetChanged(event);
|
||||
((IMakeTargetListener)list[i]).targetChanged(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,6 +280,6 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
}
|
||||
|
||||
public String getBuilderID(String targetBuilderID) {
|
||||
return (String) builderMap.get(targetBuilderID);
|
||||
return (String)builderMap.get(targetBuilderID);
|
||||
}
|
||||
}
|
|
@ -89,7 +89,7 @@
|
|||
</menu>
|
||||
<action
|
||||
label="%ActionMakeBuildCreate.label"
|
||||
class="org.eclipse.cdt.make.internal.ui.actions.MakeCreateBuildAction"
|
||||
class="org.eclipse.cdt.make.ui.actions.CreateBuildAction"
|
||||
menubarPath="org.eclipse.cdt.make.ui.menu/group1"
|
||||
enablesFor="1"
|
||||
id="org.eclipse.cdt.make.ui.createBuildAction">
|
||||
|
@ -161,7 +161,7 @@
|
|||
</visibility>
|
||||
<action
|
||||
label="%ActionMakeUpdate.label"
|
||||
class="org.eclipse.cdt.make.internal.ui.wizards.UpdateMakeProjectAction"
|
||||
class="org.eclipse.cdt.make.ui.actions.UpdateMakeProjectAction"
|
||||
enablesFor="+"
|
||||
id="org.eclipse.cdt.make.ui.UpdateProjectMakeAction">
|
||||
</action>
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* Created on 18-Aug-2003
|
||||
*
|
||||
* Copyright (c) 2002,2003 QNX Software Systems Ltd.
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.make.ui.actions;
|
||||
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IObjectActionDelegate;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.actions.ActionDelegate;
|
||||
|
||||
public abstract class AbstractMakeBuilderAction extends ActionDelegate implements IObjectActionDelegate {
|
||||
IWorkbenchPart part;
|
||||
ISelection fSelection;
|
||||
|
||||
public AbstractMakeBuilderAction() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
|
||||
*/
|
||||
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
||||
part = targetPart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IActionDelegate#selectionChanged(IAction, ISelection)
|
||||
*/
|
||||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
fSelection = selection;
|
||||
}
|
||||
|
||||
protected Shell getShell() {
|
||||
return part.getSite().getShell();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
package org.eclipse.cdt.make.ui.actions;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.eclipse.cdt.make.core.IMakeBuilderInfo;
|
||||
import org.eclipse.cdt.make.core.IMakeTargetManager;
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||
import org.eclipse.cdt.utils.ui.controls.RadioButtonsArea;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.jface.dialogs.TitleAreaDialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
public class BuildTargetDialog extends TitleAreaDialog {
|
||||
private static final String PREFIX = "SettingsBlock"; //$NON-NLS-1$
|
||||
|
||||
private static final String MAKE_SETTING_GROUP = PREFIX + ".makeSetting.group_label"; //$NON-NLS-1$
|
||||
private static final String MAKE_SETTING_KEEP_GOING = PREFIX + ".makeSetting.keepOnGoing"; //$NON-NLS-1$
|
||||
private static final String MAKE_SETTING_STOP_ERROR = PREFIX + ".makeSetting.stopOnError"; //$NON-NLS-1$
|
||||
|
||||
private static final String MAKE_CMD_GROUP = PREFIX + ".makeCmd.group_label"; //$NON-NLS-1$
|
||||
private static final String MAKE_CMD_USE_DEFAULT = PREFIX + ".makeCmd.use_default"; //$NON-NLS-1$
|
||||
private static final String MAKE_CMD_LABEL = PREFIX + ".makeCmd.label"; //$NON-NLS-1$
|
||||
|
||||
private static final String KEEP_ARG = "keep"; //$NON-NLS-1$
|
||||
private static final String STOP_ARG = "stop"; //$NON-NLS-1$
|
||||
|
||||
RadioButtonsArea stopRadioButtons;
|
||||
Text buildCommand;
|
||||
Button defButton;
|
||||
|
||||
IMakeBuilderInfo fBuildInfo;
|
||||
IMakeTargetManager fTargetManager;
|
||||
|
||||
/**
|
||||
* @param parentShell
|
||||
*/
|
||||
public BuildTargetDialog(Shell parentShell, IContainer container) {
|
||||
super(parentShell);
|
||||
fTargetManager = MakeCorePlugin.getDefault().getTargetManager();
|
||||
String[] id = fTargetManager.getTargetBuilders(container.getProject());
|
||||
if ( id != null) {
|
||||
fBuildInfo = MakeCorePlugin.createBuildInfo(new HashMap(), id[0]);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
Control control = super.createDialogArea(parent);
|
||||
|
||||
createSettingControls(parent);
|
||||
createBuildCmdControls(parent);
|
||||
|
||||
return control;
|
||||
}
|
||||
|
||||
protected void createSettingControls(Composite parent) {
|
||||
String[][] radios = new String[][] { { MakeUIPlugin.getResourceString(MAKE_SETTING_STOP_ERROR), STOP_ARG }, {
|
||||
MakeUIPlugin.getResourceString(MAKE_SETTING_KEEP_GOING), KEEP_ARG }
|
||||
};
|
||||
stopRadioButtons = new RadioButtonsArea(parent, MakeUIPlugin.getResourceString(MAKE_SETTING_GROUP), 1, radios);
|
||||
GridLayout layout = new GridLayout();
|
||||
layout.marginHeight = 0;
|
||||
layout.marginWidth = 0;
|
||||
stopRadioButtons.setLayout(layout);
|
||||
if (fBuildInfo.isStopOnError())
|
||||
stopRadioButtons.setSelectValue(STOP_ARG);
|
||||
else
|
||||
stopRadioButtons.setSelectValue(KEEP_ARG);
|
||||
}
|
||||
|
||||
protected void createBuildCmdControls(Composite parent) {
|
||||
Group group = ControlFactory.createGroup(parent, MakeUIPlugin.getResourceString(MAKE_CMD_GROUP), 1);
|
||||
GridLayout layout = new GridLayout();
|
||||
layout.numColumns = 2;
|
||||
layout.makeColumnsEqualWidth = false;
|
||||
layout.horizontalSpacing = 0;
|
||||
group.setLayout(layout);
|
||||
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
defButton = ControlFactory.createCheckBox(group, MakeUIPlugin.getResourceString(MAKE_CMD_USE_DEFAULT));
|
||||
defButton.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
if (defButton.getSelection() == true) {
|
||||
buildCommand.setEnabled(false);
|
||||
stopRadioButtons.setEnabled(true);
|
||||
} else {
|
||||
buildCommand.setEnabled(true);
|
||||
stopRadioButtons.setEnabled(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
gd.horizontalSpan = 2;
|
||||
defButton.setLayoutData(gd);
|
||||
Label label = ControlFactory.createLabel(group, MakeUIPlugin.getResourceString(MAKE_CMD_LABEL));
|
||||
((GridData) (label.getLayoutData())).horizontalAlignment = GridData.BEGINNING;
|
||||
((GridData) (label.getLayoutData())).grabExcessHorizontalSpace = false;
|
||||
buildCommand = ControlFactory.createTextField(group, SWT.SINGLE | SWT.BORDER);
|
||||
((GridData) (buildCommand.getLayoutData())).horizontalAlignment = GridData.FILL;
|
||||
((GridData) (buildCommand.getLayoutData())).grabExcessHorizontalSpace = true;
|
||||
buildCommand.addListener(SWT.Modify, new Listener() {
|
||||
public void handleEvent(Event e) {
|
||||
}
|
||||
});
|
||||
if (fBuildInfo.getBuildCommand() != null) {
|
||||
StringBuffer cmd = new StringBuffer(fBuildInfo.getBuildCommand().toOSString());
|
||||
if (!fBuildInfo.isDefaultBuildCmd()) {
|
||||
String args = fBuildInfo.getBuildArguments();
|
||||
if (args != null && !args.equals("")) { //$NON-NLS-1$
|
||||
cmd.append(" "); //$NON-NLS-1$
|
||||
cmd.append(args);
|
||||
}
|
||||
}
|
||||
buildCommand.setText(cmd.toString());
|
||||
}
|
||||
if (fBuildInfo.isDefaultBuildCmd()) {
|
||||
buildCommand.setEnabled(false);
|
||||
} else {
|
||||
stopRadioButtons.setEnabled(false);
|
||||
}
|
||||
defButton.setSelection(fBuildInfo.isDefaultBuildCmd());
|
||||
}
|
||||
|
||||
}
|
|
@ -8,16 +8,37 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.make.ui.actions;
|
||||
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
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;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
|
||||
import org.eclipse.ui.actions.ActionDelegate;
|
||||
|
||||
public class CreateBuildAction extends AbstractMakeBuilderAction implements IWorkbenchWindowActionDelegate {
|
||||
public class CreateBuildAction extends ActionDelegate implements IObjectActionDelegate, IWorkbenchWindowActionDelegate {
|
||||
|
||||
IWorkbenchPart fPart;
|
||||
IContainer fContainer;
|
||||
|
||||
public void run(IAction action) {
|
||||
BuildTargetDialog dialog = new BuildTargetDialog(fPart.getSite().getShell(), fContainer);
|
||||
dialog.open();
|
||||
}
|
||||
|
||||
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
||||
fPart = targetPart;
|
||||
}
|
||||
|
||||
public void init(IWorkbenchWindow window) {
|
||||
}
|
||||
|
||||
public void run(IAction action) {
|
||||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
if ( selection instanceof IStructuredSelection ) {
|
||||
fContainer = (IContainer)((IStructuredSelection)selection).getFirstElement();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
|||
public Object[] getChildren(Object obj) {
|
||||
if (obj instanceof IWorkspaceRoot) {
|
||||
try {
|
||||
return MakeCorePlugin.getDefault().getTargetProvider().getTargetBuilderProjects();
|
||||
return MakeCorePlugin.getDefault().getTargetManager().getTargetBuilderProjects();
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
} else if (obj instanceof IContainer) {
|
||||
|
@ -51,7 +51,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
|||
children.add(resource[i]);
|
||||
}
|
||||
}
|
||||
children.addAll(Arrays.asList(MakeCorePlugin.getDefault().getTargetProvider().getTargets((IContainer) obj)));
|
||||
children.addAll(Arrays.asList(MakeCorePlugin.getDefault().getTargetManager().getTargets((IContainer) obj)));
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
return children.toArray();
|
||||
|
@ -78,13 +78,13 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
|||
|
||||
public void dispose() {
|
||||
if (viewer != null) {
|
||||
MakeCorePlugin.getDefault().getTargetProvider().removeListener(this);
|
||||
MakeCorePlugin.getDefault().getTargetManager().removeListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
if (this.viewer == null) {
|
||||
MakeCorePlugin.getDefault().getTargetProvider().addListener(this);
|
||||
MakeCorePlugin.getDefault().getTargetManager().addListener(this);
|
||||
}
|
||||
this.viewer = (TreeViewer) viewer;
|
||||
IWorkspace oldWorkspace = null;
|
||||
|
|
Loading…
Add table
Reference in a new issue