mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 09:15: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;
|
IProject[] getTargetBuilderProjects() throws CoreException;
|
||||||
|
|
||||||
String getBuilderID(String targetBuilderID);
|
String getBuilderID(String targetBuilderID);
|
||||||
|
String[] getTargetBuilders(IProject project);
|
||||||
|
|
||||||
void addListener(IMakeTargetListener listener);
|
void addListener(IMakeTargetListener listener);
|
||||||
void removeListener(IMakeTargetListener listener);
|
void removeListener(IMakeTargetListener listener);
|
||||||
|
|
|
@ -139,7 +139,7 @@ public class MakeCorePlugin extends Plugin {
|
||||||
return BuildInfoFactory.create(args, builderID);
|
return BuildInfoFactory.create(args, builderID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMakeTargetManager getTargetProvider() {
|
public IMakeTargetManager getTargetManager() {
|
||||||
if ( fTargetManager == null) {
|
if ( fTargetManager == null) {
|
||||||
fTargetManager = new MakeTargetManager();
|
fTargetManager = new MakeTargetManager();
|
||||||
fTargetManager.startup();
|
fTargetManager.startup();
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class MakeTarget implements IMakeTarget {
|
||||||
|
|
||||||
public void build(IProgressMonitor monitor) throws CoreException {
|
public void build(IProgressMonitor monitor) throws CoreException {
|
||||||
IProject project = container.getProject();
|
IProject project = container.getProject();
|
||||||
String builderID = MakeCorePlugin.getDefault().getTargetProvider().getBuilderID(targetBuilderID);
|
String builderID = MakeCorePlugin.getDefault().getTargetManager().getBuilderID(targetBuilderID);
|
||||||
HashMap infoMap = new HashMap();
|
HashMap infoMap = new HashMap();
|
||||||
IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(infoMap, builderID);
|
IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(infoMap, builderID);
|
||||||
info.setBuildArguments(buildArguments);
|
info.setBuildArguments(buildArguments);
|
||||||
|
@ -95,6 +95,7 @@ public class MakeTarget implements IMakeTarget {
|
||||||
info.setStopOnError(isStopOnError);
|
info.setStopOnError(isStopOnError);
|
||||||
info.setFullBuildEnable(true);
|
info.setFullBuildEnable(true);
|
||||||
info.setFullBuildTarget(buildArguments);
|
info.setFullBuildTarget(buildArguments);
|
||||||
|
info.setBuildLocation(container.getLocation());
|
||||||
project.build(IncrementalProjectBuilder.FULL_BUILD, builderID, infoMap, monitor);
|
project.build(IncrementalProjectBuilder.FULL_BUILD, builderID, infoMap, monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,10 @@ import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.eclipse.cdt.make.core.IMakeTarget;
|
import org.eclipse.cdt.make.core.IMakeTarget;
|
||||||
import org.eclipse.cdt.make.core.IMakeTargetListener;
|
import org.eclipse.cdt.make.core.IMakeTargetListener;
|
||||||
|
@ -105,7 +108,30 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
||||||
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();
|
IProjectDescription description = project.getDescription();
|
||||||
ICommand builder[] = description.getBuildSpec();
|
ICommand builder[] = description.getBuildSpec();
|
||||||
for (int j = 0; j < builder.length; j++) {
|
for (int j = 0; j < builder.length; j++) {
|
||||||
|
@ -113,6 +139,8 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,13 +148,10 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
||||||
initializeBuilders();
|
initializeBuilders();
|
||||||
IProject project[] = ResourcesPlugin.getWorkspace().getRoot().getProjects();
|
IProject project[] = ResourcesPlugin.getWorkspace().getRoot().getProjects();
|
||||||
for (int i = 0; i < project.length; i++) {
|
for (int i = 0; i < project.length; i++) {
|
||||||
try {
|
|
||||||
if (hasTargetBuilder(project[i])) {
|
if (hasTargetBuilder(project[i])) {
|
||||||
fProjects.add(project[i]);
|
fProjects.add(project[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
|
ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
|
||||||
}
|
}
|
||||||
|
@ -161,50 +186,41 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
||||||
int flags = delta.getFlags();
|
int flags = delta.getFlags();
|
||||||
int deltaKind = delta.getKind();
|
int deltaKind = delta.getKind();
|
||||||
if (deltaKind == IResourceDelta.ADDED) {
|
if (deltaKind == IResourceDelta.ADDED) {
|
||||||
try {
|
|
||||||
if (hasTargetBuilder(project)) {
|
if (hasTargetBuilder(project)) {
|
||||||
fProjects.add(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) {
|
|
||||||
}
|
|
||||||
} else if (deltaKind == IResourceDelta.REMOVED) {
|
} else if (deltaKind == IResourceDelta.REMOVED) {
|
||||||
if (fProjects.contains(project)) {
|
if (fProjects.contains(project)) {
|
||||||
fProjects.remove(project);
|
fProjects.remove(project);
|
||||||
notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED, project));
|
notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED, project));
|
||||||
}
|
}
|
||||||
} else if (deltaKind == IResourceDelta.CHANGED) {
|
} else if (deltaKind == IResourceDelta.CHANGED) {
|
||||||
try {
|
|
||||||
if (0 != (flags & IResourceDelta.DESCRIPTION)) {
|
if (0 != (flags & IResourceDelta.DESCRIPTION)) {
|
||||||
if (fProjects.contains(project) && !hasTargetBuilder(project)) {
|
if (fProjects.contains(project) && !hasTargetBuilder(project)) {
|
||||||
fProjects.remove(project);
|
fProjects.remove(project);
|
||||||
notifyListeners(
|
notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED, project));
|
||||||
new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED, project));
|
|
||||||
} else if (!fProjects.contains(project) && hasTargetBuilder(project)) {
|
} else if (!fProjects.contains(project) && hasTargetBuilder(project)) {
|
||||||
fProjects.add(project);
|
fProjects.add(project);
|
||||||
notifyListeners(
|
notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_ADDED, project));
|
||||||
new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_ADDED, project));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (0 != (flags & IResourceDelta.OPEN)) {
|
if (0 != (flags & IResourceDelta.OPEN)) {
|
||||||
if (!project.isOpen() && fProjects.contains(project)) {
|
if (!project.isOpen() && fProjects.contains(project)) {
|
||||||
fProjects.remove(project);
|
fProjects.remove(project);
|
||||||
notifyListeners(
|
notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED, project));
|
||||||
new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_REMOVED, project));
|
|
||||||
} else if (project.isOpen() && hasTargetBuilder(project) && !fProjects.contains(project)) {
|
} else if (project.isOpen() && hasTargetBuilder(project) && !fProjects.contains(project)) {
|
||||||
fProjects.add(project);
|
fProjects.add(project);
|
||||||
notifyListeners(
|
notifyListeners(new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_ADDED, project));
|
||||||
new MakeTargetEvent(MakeTargetManager.this, MakeTargetEvent.PROJECT_ADDED, project));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return resource instanceof IWorkspaceRoot;
|
return resource instanceof IWorkspaceRoot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void writeTargets(ProjectTargets projectTargets) throws CoreException {
|
protected void writeTargets(ProjectTargets projectTargets) throws CoreException {
|
||||||
IPath targetFilePath = MakeCorePlugin.getDefault().getStateLocation().append(projectTargets.getProject().getName());
|
IPath targetFilePath = MakeCorePlugin.getDefault().getStateLocation().append(projectTargets.getProject().getName());
|
||||||
File targetFile = targetFilePath.toFile();
|
File targetFile = targetFilePath.toFile();
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
</menu>
|
</menu>
|
||||||
<action
|
<action
|
||||||
label="%ActionMakeBuildCreate.label"
|
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"
|
menubarPath="org.eclipse.cdt.make.ui.menu/group1"
|
||||||
enablesFor="1"
|
enablesFor="1"
|
||||||
id="org.eclipse.cdt.make.ui.createBuildAction">
|
id="org.eclipse.cdt.make.ui.createBuildAction">
|
||||||
|
@ -161,7 +161,7 @@
|
||||||
</visibility>
|
</visibility>
|
||||||
<action
|
<action
|
||||||
label="%ActionMakeUpdate.label"
|
label="%ActionMakeUpdate.label"
|
||||||
class="org.eclipse.cdt.make.internal.ui.wizards.UpdateMakeProjectAction"
|
class="org.eclipse.cdt.make.ui.actions.UpdateMakeProjectAction"
|
||||||
enablesFor="+"
|
enablesFor="+"
|
||||||
id="org.eclipse.cdt.make.ui.UpdateProjectMakeAction">
|
id="org.eclipse.cdt.make.ui.UpdateProjectMakeAction">
|
||||||
</action>
|
</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;
|
package org.eclipse.cdt.make.ui.actions;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.jface.action.IAction;
|
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.IWorkbenchWindow;
|
||||||
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
|
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 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) {
|
public Object[] getChildren(Object obj) {
|
||||||
if (obj instanceof IWorkspaceRoot) {
|
if (obj instanceof IWorkspaceRoot) {
|
||||||
try {
|
try {
|
||||||
return MakeCorePlugin.getDefault().getTargetProvider().getTargetBuilderProjects();
|
return MakeCorePlugin.getDefault().getTargetManager().getTargetBuilderProjects();
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
} else if (obj instanceof IContainer) {
|
} else if (obj instanceof IContainer) {
|
||||||
|
@ -51,7 +51,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
||||||
children.add(resource[i]);
|
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) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
return children.toArray();
|
return children.toArray();
|
||||||
|
@ -78,13 +78,13 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
if (viewer != null) {
|
if (viewer != null) {
|
||||||
MakeCorePlugin.getDefault().getTargetProvider().removeListener(this);
|
MakeCorePlugin.getDefault().getTargetManager().removeListener(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||||
if (this.viewer == null) {
|
if (this.viewer == null) {
|
||||||
MakeCorePlugin.getDefault().getTargetProvider().addListener(this);
|
MakeCorePlugin.getDefault().getTargetManager().addListener(this);
|
||||||
}
|
}
|
||||||
this.viewer = (TreeViewer) viewer;
|
this.viewer = (TreeViewer) viewer;
|
||||||
IWorkspace oldWorkspace = null;
|
IWorkspace oldWorkspace = null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue