mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
finish up project convertion to convert old make target to new targets
finish up build target dialog - add/remove/delete now working - displayed as a table
This commit is contained in:
parent
428e119084
commit
ad843c5751
7 changed files with 316 additions and 158 deletions
|
@ -1,35 +0,0 @@
|
|||
package org.eclipse.cdt.make.internal.ui.part;
|
||||
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.StructuredViewer;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
public class ListViewerPart extends StructuredViewerPart {
|
||||
|
||||
public ListViewerPart(String[] buttonLabels) {
|
||||
super(buttonLabels);
|
||||
}
|
||||
|
||||
protected StructuredViewer createStructuredViewer(Composite parent, int style) {
|
||||
TableViewer tableViewer = new TableViewer(parent, SWT.SINGLE | SWT.BORDER);
|
||||
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
public void selectionChanged(SelectionChangedEvent e) {
|
||||
ListViewerPart.this.selectionChanged((IStructuredSelection) e.getSelection());
|
||||
}
|
||||
});
|
||||
return tableViewer;
|
||||
}
|
||||
|
||||
protected void buttonSelected(Button button, int index) {
|
||||
}
|
||||
|
||||
protected void selectionChanged(IStructuredSelection selection) {
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -145,9 +145,13 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
|||
ctrl.getDisplay().syncExec(new Runnable() {
|
||||
public void run() {
|
||||
if (ctrl != null && !ctrl.isDisposed()) {
|
||||
if (bFlatten) {
|
||||
viewer.refresh();
|
||||
} else {
|
||||
viewer.refresh(event.getTarget().getContainer());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -9,11 +9,12 @@ import org.eclipse.cdt.make.core.IMakeTarget;
|
|||
import org.eclipse.cdt.make.internal.ui.MakeUIImages;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.jface.viewers.ITableLabelProvider;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.ui.model.WorkbenchLabelProvider;
|
||||
|
||||
public class MakeLabelProvider extends LabelProvider {
|
||||
public class MakeLabelProvider extends LabelProvider implements ITableLabelProvider {
|
||||
private IPath pathPrefix;
|
||||
|
||||
WorkbenchLabelProvider fLableProvider = new WorkbenchLabelProvider();
|
||||
|
@ -42,32 +43,12 @@ public class MakeLabelProvider extends LabelProvider {
|
|||
* @see ILabelProvider#getText(Object)
|
||||
*/
|
||||
public String getText(Object obj) {
|
||||
StringBuffer str = new StringBuffer();
|
||||
if (obj instanceof IMakeTarget) {
|
||||
if ( pathPrefix != null) {
|
||||
IPath targetPath = ((IMakeTarget)obj).getContainer().getProjectRelativePath();
|
||||
if ( pathPrefix.isPrefixOf(targetPath) ) {
|
||||
targetPath = targetPath.removeFirstSegments(pathPrefix.segmentCount());
|
||||
}
|
||||
str.append(targetPath.toString());
|
||||
if (targetPath.segmentCount() > 0) {
|
||||
str.append("/");
|
||||
}
|
||||
}
|
||||
str.append(((IMakeTarget)obj).getName());
|
||||
return ((IMakeTarget) obj).getName();
|
||||
} else if (obj instanceof IContainer) {
|
||||
if ( pathPrefix != null ) {
|
||||
IPath targetPath = ((IContainer)obj).getProjectRelativePath();
|
||||
if ( pathPrefix.isPrefixOf(targetPath) ) {
|
||||
targetPath = targetPath.removeFirstSegments(pathPrefix.segmentCount());
|
||||
}
|
||||
str.append(targetPath.toString());
|
||||
str.append("/");
|
||||
} else {
|
||||
return fLableProvider.getText(obj);
|
||||
}
|
||||
}
|
||||
return str.toString();
|
||||
return "";
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
|
@ -75,4 +56,27 @@ public class MakeLabelProvider extends LabelProvider {
|
|||
fLableProvider.dispose();
|
||||
}
|
||||
|
||||
public Image getColumnImage(Object obj, int columnIndex) {
|
||||
return columnIndex == 0 ? getImage(obj) : null;
|
||||
}
|
||||
|
||||
public String getColumnText(Object obj, int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 0 :
|
||||
return getText(obj);
|
||||
case 1 :
|
||||
if (obj instanceof IMakeTarget) {
|
||||
if (pathPrefix != null) {
|
||||
IPath targetPath = ((IMakeTarget) obj).getContainer().getProjectRelativePath();
|
||||
if (pathPrefix.isPrefixOf(targetPath)) {
|
||||
targetPath = targetPath.removeFirstSegments(pathPrefix.segmentCount());
|
||||
}
|
||||
if (targetPath.segmentCount() > 0) {
|
||||
return targetPath.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,137 @@
|
|||
package org.eclipse.cdt.make.ui;
|
||||
|
||||
import org.eclipse.cdt.make.core.IMakeTarget;
|
||||
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.make.internal.ui.part.StructuredViewerPart;
|
||||
import org.eclipse.cdt.make.ui.dialogs.MakeTargetDialog;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.jface.viewers.ColumnWeightData;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.jface.viewers.StructuredViewer;
|
||||
import org.eclipse.jface.viewers.TableLayout;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerFilter;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.TableColumn;
|
||||
|
||||
public class TargetListViewerPart extends StructuredViewerPart {
|
||||
|
||||
private TableViewer tableViewer;
|
||||
private IMakeTarget fSelectedTarget;
|
||||
private final int ADD_TARGET = 0;
|
||||
private final int REMOVE_TARGET = 1;
|
||||
private final int EDIT_TARGET = 2;
|
||||
private IContainer fContainer;
|
||||
|
||||
public TargetListViewerPart(IContainer container) {
|
||||
super(new String[] { "Add Target...", "Remove Target", "Edit Target..." });
|
||||
fContainer = container;
|
||||
}
|
||||
|
||||
protected StructuredViewer createStructuredViewer(Composite parent, int style) {
|
||||
tableViewer = new TableViewer(parent, SWT.SINGLE | SWT.BORDER);
|
||||
Table table = (Table) tableViewer.getControl();
|
||||
TableLayout layout = new TableLayout();
|
||||
table.setLayout(layout);
|
||||
table.setHeaderVisible(true);
|
||||
|
||||
layout.addColumnData(new ColumnWeightData(50));
|
||||
TableColumn tc = new TableColumn(table, SWT.NONE);
|
||||
tc.setText("Targets");
|
||||
layout.addColumnData(new ColumnWeightData(50));
|
||||
tc = new TableColumn(table, SWT.NONE);
|
||||
tc.setText("Location");
|
||||
|
||||
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
public void selectionChanged(SelectionChangedEvent e) {
|
||||
TargetListViewerPart.this.selectionChanged((IStructuredSelection) e.getSelection());
|
||||
}
|
||||
});
|
||||
tableViewer.setContentProvider(new MakeContentProvider(true));
|
||||
tableViewer.addFilter(new ViewerFilter() {
|
||||
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||
return (element instanceof IMakeTarget);
|
||||
}
|
||||
});
|
||||
tableViewer.setLabelProvider(new MakeLabelProvider(fContainer.getProjectRelativePath()));
|
||||
tableViewer.setInput(fContainer);
|
||||
|
||||
if (fSelectedTarget != null) {
|
||||
tableViewer.setSelection(new StructuredSelection(fSelectedTarget), true);
|
||||
}
|
||||
return tableViewer;
|
||||
}
|
||||
|
||||
protected void buttonSelected(Button button, int index) {
|
||||
try {
|
||||
switch (index) {
|
||||
case ADD_TARGET :
|
||||
{
|
||||
MakeTargetDialog dialog = new MakeTargetDialog(getControl().getShell(), fContainer);
|
||||
dialog.open();
|
||||
}
|
||||
break;
|
||||
case REMOVE_TARGET :
|
||||
IMakeTargetManager manager = MakeCorePlugin.getDefault().getTargetManager();
|
||||
manager.removeTarget((IMakeTarget) ((IStructuredSelection) getViewer().getSelection()).getFirstElement());
|
||||
break;
|
||||
case EDIT_TARGET :
|
||||
{
|
||||
MakeTargetDialog dialog =
|
||||
new MakeTargetDialog(
|
||||
getControl().getShell(),
|
||||
(IMakeTarget) ((IStructuredSelection) getViewer().getSelection()).getFirstElement());
|
||||
dialog.open();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
MakeUIPlugin.errorDialog(getControl().getShell(), "Error", "Error", e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void selectionChanged(IStructuredSelection selection) {
|
||||
fSelectedTarget = (IMakeTarget) selection.getFirstElement();
|
||||
updateEnabledState();
|
||||
}
|
||||
|
||||
public void setSelectedTarget(IMakeTarget target) {
|
||||
if (tableViewer != null) {
|
||||
tableViewer.setSelection(new StructuredSelection(fSelectedTarget), true);
|
||||
} else {
|
||||
fSelectedTarget = target;
|
||||
}
|
||||
}
|
||||
|
||||
public IMakeTarget getSelectedTarget() {
|
||||
return fSelectedTarget;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.ui.part.SharedPart#updateEnabledState()
|
||||
*/
|
||||
protected void updateEnabledState() {
|
||||
super.updateEnabledState();
|
||||
setButtonEnabled(REMOVE_TARGET, fSelectedTarget != null && isEnabled());
|
||||
setButtonEnabled(EDIT_TARGET, fSelectedTarget != null && isEnabled());
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.internal.ui.part.SharedPart#createControl(org.eclipse.swt.widgets.Composite, int, int)
|
||||
*/
|
||||
public void createControl(Composite parent, int style, int span) {
|
||||
super.createControl(parent, style, span);
|
||||
updateEnabledState();
|
||||
}
|
||||
|
||||
}
|
|
@ -14,13 +14,19 @@ import java.util.ArrayList;
|
|||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.make.core.IMakeBuilderInfo;
|
||||
import org.eclipse.cdt.make.core.IMakeTarget;
|
||||
import org.eclipse.cdt.make.core.IMakeTargetManager;
|
||||
import org.eclipse.cdt.make.core.MakeBuilder;
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.cdt.make.core.MakeProjectNature;
|
||||
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||
import org.eclipse.cdt.make.ui.wizards.UpdateMakeProjectWizard;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IResourceProxy;
|
||||
import org.eclipse.core.resources.IResourceProxyVisitor;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
@ -103,6 +109,57 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
public static class TargetConvertVisitor implements IResourceProxyVisitor {
|
||||
private final int TOTAL_WORK = 100;
|
||||
private int halfWay = TOTAL_WORK / 2;
|
||||
private int currentIncrement = 4;
|
||||
private int nextProgress = currentIncrement;
|
||||
private int worked = 0;
|
||||
IProgressMonitor monitor;
|
||||
|
||||
public TargetConvertVisitor(IProgressMonitor monitor) {
|
||||
this.monitor = monitor;
|
||||
monitor.beginTask("Converting Make Targets...", TOTAL_WORK);
|
||||
}
|
||||
|
||||
public boolean visit(IResourceProxy proxy) throws CoreException {
|
||||
try {
|
||||
if (proxy.getType() != IResource.FOLDER && proxy.getType() != IResource.PROJECT) {
|
||||
return false;
|
||||
}
|
||||
IContainer container = (IContainer) proxy.requestResource();
|
||||
monitor.subTask(container.getProjectRelativePath().toString());
|
||||
QualifiedName qName = new QualifiedName("org.eclipse.cdt.make", "goals");
|
||||
String goal = container.getPersistentProperty(qName);
|
||||
if (goal != null) {
|
||||
goal = goal.trim();
|
||||
IMakeTargetManager manager = MakeCorePlugin.getDefault().getTargetManager();
|
||||
String[] builder = manager.getTargetBuilders(container.getProject());
|
||||
IMakeTarget target = manager.createTarget(container.getProject(), goal, builder[0]);
|
||||
target.setBuildTarget(goal);
|
||||
manager.addTarget(container, target);
|
||||
container.setPersistentProperty(qName, null);
|
||||
}
|
||||
return true;
|
||||
} finally {
|
||||
if (--nextProgress <= 0) {
|
||||
//we have exhausted the current increment, so report progress
|
||||
monitor.worked(1);
|
||||
worked++;
|
||||
if (worked >= halfWay) {
|
||||
//we have passed the current halfway point, so double the
|
||||
//increment and reset the halfway point.
|
||||
currentIncrement *= 2;
|
||||
halfWay += (TOTAL_WORK - halfWay) / 2;
|
||||
}
|
||||
//reset the progress counter to another full increment
|
||||
nextProgress = currentIncrement;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected static void doProjectUpdate(IProgressMonitor monitor, IProject[] project) throws CoreException {
|
||||
monitor.beginTask("Updating make Projects...", project.length * 3);
|
||||
try {
|
||||
|
@ -120,21 +177,36 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
|
|||
|
||||
// move existing build properties to new
|
||||
IMakeBuilderInfo newInfo = MakeCorePlugin.createBuildInfo(project[i], MakeBuilder.BUILDER_ID);
|
||||
QualifiedName qlocation = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildLocation");
|
||||
String location = project[i].getPersistentProperty(qlocation);
|
||||
if ( location != null) {
|
||||
newInfo.setBuildCommand(new Path(location));
|
||||
}
|
||||
final int LOCATION = 0, FULL_ARGS = 1, INC_ARGS = 2, STOP_ERORR = 3, USE_DEFAULT = 4;
|
||||
QualifiedName[] qName = new QualifiedName[USE_DEFAULT + 1];
|
||||
qName[LOCATION] = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildLocation");
|
||||
qName[FULL_ARGS] = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildFullArguments");
|
||||
qName[INC_ARGS] = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildIncrementalArguments");
|
||||
qName[STOP_ERORR] = new QualifiedName(CCorePlugin.PLUGIN_ID, "stopOnError");
|
||||
qName[USE_DEFAULT] = new QualifiedName(CCorePlugin.PLUGIN_ID, "useDefaultBuildCmd");
|
||||
|
||||
//remove old properties
|
||||
QualifiedName[] qName =
|
||||
{
|
||||
new QualifiedName(CCorePlugin.PLUGIN_ID, "buildFullArguments"),
|
||||
new QualifiedName(CCorePlugin.PLUGIN_ID, "buildIncrementalArguments"),
|
||||
new QualifiedName("org.eclipse.cdt", "make.goals")};
|
||||
String property = project[i].getPersistentProperty(qName[LOCATION]);
|
||||
if (property != null) {
|
||||
newInfo.setBuildCommand(new Path(property));
|
||||
}
|
||||
property = project[i].getPersistentProperty(qName[FULL_ARGS]);
|
||||
if (property != null) {
|
||||
newInfo.setBuildArguments(property);
|
||||
}
|
||||
property = project[i].getPersistentProperty(qName[STOP_ERORR]);
|
||||
if (property != null) {
|
||||
newInfo.setStopOnError(Boolean.valueOf(property).booleanValue());
|
||||
}
|
||||
property = project[i].getPersistentProperty(qName[USE_DEFAULT]);
|
||||
if (property != null) {
|
||||
newInfo.setUseDefaultBuildCmd(Boolean.valueOf(property).booleanValue());
|
||||
}
|
||||
for (int j = 0; j < qName.length; j++) {
|
||||
project[i].setPersistentProperty(qName[j], null);
|
||||
}
|
||||
|
||||
IProgressMonitor subMon = new SubProgressMonitor(monitor, 1, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
|
||||
project[i].accept(new TargetConvertVisitor(subMon), 0);
|
||||
monitor.worked(1);
|
||||
}
|
||||
} finally {
|
||||
|
@ -145,5 +217,4 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
|
|||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
fSelection = selection;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,20 +1,13 @@
|
|||
package org.eclipse.cdt.make.ui.dialogs;
|
||||
|
||||
import org.eclipse.cdt.make.core.IMakeTarget;
|
||||
import org.eclipse.cdt.make.internal.ui.part.ListViewerPart;
|
||||
import org.eclipse.cdt.make.ui.MakeContentProvider;
|
||||
import org.eclipse.cdt.make.ui.MakeLabelProvider;
|
||||
import org.eclipse.cdt.make.ui.TargetBuild;
|
||||
import org.eclipse.cdt.make.ui.TargetListViewerPart;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.jface.viewers.StructuredViewer;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerFilter;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
|
@ -24,22 +17,21 @@ import org.eclipse.swt.widgets.Label;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
public class BuildTargetDialog extends Dialog {
|
||||
|
||||
private IMakeTarget fSelected;
|
||||
private StructuredViewer listViewer;
|
||||
private TargetListViewerPart targetPart;
|
||||
private IContainer fContainer;
|
||||
|
||||
public BuildTargetDialog(Shell shell, IContainer container) {
|
||||
super(shell);
|
||||
fContainer = container;
|
||||
targetPart = new TargetListViewerPart(fContainer);
|
||||
}
|
||||
|
||||
public void setTarget(IMakeTarget targets) {
|
||||
fSelected = targets;
|
||||
public void setTarget(IMakeTarget target) {
|
||||
targetPart.setSelectedTarget(target);
|
||||
}
|
||||
|
||||
public IMakeTarget getTarget() {
|
||||
return fSelected;
|
||||
return targetPart.getSelectedTarget();
|
||||
}
|
||||
|
||||
protected void configureShell(Shell newShell) {
|
||||
|
@ -61,38 +53,25 @@ public class BuildTargetDialog extends Dialog {
|
|||
gd.horizontalSpan = 2;
|
||||
title.setLayoutData(gd);
|
||||
title.setText("Make Targets for: " + fContainer.getFullPath().toString().substring(1));
|
||||
ListViewerPart part = new ListViewerPart(new String[] { "Add Target...", "Remove Target", "Edit Target..." });
|
||||
part.createControl(composite, SWT.NULL, 2);
|
||||
listViewer = part.getViewer();
|
||||
listViewer.setContentProvider(new MakeContentProvider(true));
|
||||
listViewer.addFilter(new ViewerFilter() {
|
||||
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||
return (element instanceof IMakeTarget);
|
||||
}
|
||||
});
|
||||
listViewer.setLabelProvider(new MakeLabelProvider(fContainer.getProjectRelativePath()));
|
||||
listViewer.addDoubleClickListener(new IDoubleClickListener() {
|
||||
targetPart.createControl(composite, SWT.NULL, 2);
|
||||
|
||||
gd = (GridData) targetPart.getControl().getLayoutData();
|
||||
gd.heightHint = convertHeightInCharsToPixels(15);
|
||||
gd.widthHint = convertWidthInCharsToPixels(50);
|
||||
targetPart.getControl().setLayoutData(gd);
|
||||
targetPart.getViewer().addDoubleClickListener(new IDoubleClickListener() {
|
||||
public void doubleClick(DoubleClickEvent event) {
|
||||
okPressed();
|
||||
}
|
||||
});
|
||||
|
||||
gd = (GridData) part.getControl().getLayoutData();
|
||||
gd.heightHint = convertHeightInCharsToPixels(15);
|
||||
gd.widthHint = convertWidthInCharsToPixels(50);
|
||||
part.getControl().setLayoutData(gd);
|
||||
|
||||
listViewer.setInput(fContainer);
|
||||
if (fSelected != null)
|
||||
listViewer.setSelection(new StructuredSelection(fSelected), true);
|
||||
|
||||
return composite;
|
||||
}
|
||||
|
||||
protected void okPressed() {
|
||||
fSelected = (IMakeTarget) ((IStructuredSelection) listViewer.getSelection()).getFirstElement();
|
||||
if (fSelected != null) {
|
||||
TargetBuild.runWithProgressDialog(getShell(), new IMakeTarget[] { fSelected });
|
||||
IMakeTarget selected = targetPart.getSelectedTarget();
|
||||
if (selected != null) {
|
||||
TargetBuild.runWithProgressDialog(getShell(), new IMakeTarget[] { selected });
|
||||
}
|
||||
super.okPressed();
|
||||
}
|
||||
|
|
|
@ -175,7 +175,8 @@ public class MakeTargetDialog extends Dialog {
|
|||
if (newName.equals("")) {
|
||||
fStatusLine.setErrorMessage("Must specify a target name.");
|
||||
getButton(IDialogConstants.OK_ID).setEnabled(false);
|
||||
} else if (fTarget != null
|
||||
} else if (
|
||||
fTarget != null
|
||||
&& fTarget.getName().equals(newName)
|
||||
|| fTargetManager.findTarget(fContainer, newName) == null) {
|
||||
fStatusLine.setErrorMessage(null);
|
||||
|
@ -298,8 +299,9 @@ public class MakeTargetDialog extends Dialog {
|
|||
|
||||
protected void okPressed() {
|
||||
IMakeTarget target = fTarget;
|
||||
try {
|
||||
if (fTarget == null) {
|
||||
target = fTargetManager.createTarget(targetNameText.getText().trim(), targetBuildID);
|
||||
target = fTargetManager.createTarget(fContainer.getProject(), targetNameText.getText().trim(), targetBuildID);
|
||||
}
|
||||
|
||||
target.setStopOnError(isStopOnError());
|
||||
|
@ -330,18 +332,14 @@ public class MakeTargetDialog extends Dialog {
|
|||
target.setBuildTarget(targetText.getText().trim());
|
||||
|
||||
if (fTarget == null) {
|
||||
try {
|
||||
fTargetManager.addTarget(fContainer, target);
|
||||
} catch (CoreException e) {
|
||||
MakeUIPlugin.errorDialog(getShell(), "Make Target Error", "Error adding target", e);
|
||||
}
|
||||
} else {
|
||||
if (!target.getName().equals(targetNameText.getText().trim())) {
|
||||
try {
|
||||
fTargetManager.renameTarget(target, targetNameText.getText().trim());
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
}
|
||||
MakeUIPlugin.errorDialog(getShell(), "Make Target Error", "Error adding target", e);
|
||||
}
|
||||
super.okPressed();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue