mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
cleanup
start of string cleanup improved error handling with targets
This commit is contained in:
parent
181ceb45e7
commit
f25407a2dc
20 changed files with 120 additions and 105 deletions
|
@ -102,3 +102,6 @@ LexicalSortingAction.tooltip=Sort
|
||||||
LexicalSortingAction.tooltip.on=Do Not Sort
|
LexicalSortingAction.tooltip.on=Do Not Sort
|
||||||
LexicalSortingAction.tooltip.off=Sort
|
LexicalSortingAction.tooltip.off=Sort
|
||||||
|
|
||||||
|
MakeUIPlugin.update_project=Update make projects
|
||||||
|
MakeUIPlugin.update_project_message=Older \'make\' projects have been detected in your workspace. \n These projects are no longer supported, would you like to convert these now?
|
||||||
|
MakePreferencePage.description=Make Project Preferences
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class MakeUIImages {
|
||||||
public static final String IMG_OBJS_BUILD_TARGET = NAME_PREFIX + "target_obj.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_BUILD_TARGET = NAME_PREFIX + "target_obj.gif"; //$NON-NLS-1$
|
||||||
public static final ImageDescriptor DESC_BUILD_TARGET = createManaged(OBJ, IMG_OBJS_BUILD_TARGET);
|
public static final ImageDescriptor DESC_BUILD_TARGET = createManaged(OBJ, IMG_OBJS_BUILD_TARGET);
|
||||||
|
|
||||||
public static final String IMG_OBJS_ERROR = NAME_PREFIX + "error_obj.gif";
|
public static final String IMG_OBJS_ERROR = NAME_PREFIX + "error_obj.gif"; //$NON-NLS-1$
|
||||||
public static final ImageDescriptor DESC_OBJ_ERROR = createManaged(OBJ, IMG_OBJS_ERROR);
|
public static final ImageDescriptor DESC_OBJ_ERROR = createManaged(OBJ, IMG_OBJS_ERROR);
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,9 +71,9 @@ public class MakeUIImages {
|
||||||
public static final String IMG_OBJS_MAKEFILE_INCLUDE = NAME_PREFIX + "include_obj.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_MAKEFILE_INCLUDE = NAME_PREFIX + "include_obj.gif"; //$NON-NLS-1$
|
||||||
public static final ImageDescriptor DESC_MAKEFILE_INCLUDE = createManaged(OBJ, IMG_OBJS_MAKEFILE_INCLUDE);
|
public static final ImageDescriptor DESC_MAKEFILE_INCLUDE = createManaged(OBJ, IMG_OBJS_MAKEFILE_INCLUDE);
|
||||||
|
|
||||||
public static final String IMG_TOOLS_ALPHA_SORTING= NAME_PREFIX + "alphab_sort_co.gif";
|
public static final String IMG_TOOLS_ALPHA_SORTING= NAME_PREFIX + "alphab_sort_co.gif"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final String IMG_TOOLS_MAKEFILE_SEGMENT_EDIT= NAME_PREFIX + "segment_edit.gif";
|
public static final String IMG_TOOLS_MAKEFILE_SEGMENT_EDIT= NAME_PREFIX + "segment_edit.gif"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static ImageDescriptor createManaged(String prefix, String name) {
|
private static ImageDescriptor createManaged(String prefix, String name) {
|
||||||
return createManaged(imageRegistry, prefix, name);
|
return createManaged(imageRegistry, prefix, name);
|
||||||
|
@ -109,9 +109,9 @@ public class MakeUIImages {
|
||||||
*/
|
*/
|
||||||
public static void setImageDescriptors(IAction action, String type, String relPath) {
|
public static void setImageDescriptors(IAction action, String type, String relPath) {
|
||||||
relPath = relPath.substring(NAME_PREFIX_LENGTH);
|
relPath = relPath.substring(NAME_PREFIX_LENGTH);
|
||||||
action.setDisabledImageDescriptor(create("d" + type + "/", relPath)); //$NON-NLS-1$
|
action.setDisabledImageDescriptor(create("d" + type + "/", relPath)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
action.setHoverImageDescriptor(create("c" + type + "/", relPath)); //$NON-NLS-1$
|
action.setHoverImageDescriptor(create("c" + type + "/", relPath)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
action.setImageDescriptor(create("e" + type + "/", relPath)); //$NON-NLS-1$
|
action.setImageDescriptor(create("e" + type + "/", relPath)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -221,10 +221,8 @@ public class MakeUIPlugin extends AbstractUIPlugin implements IStartup {
|
||||||
if (MessageDialog
|
if (MessageDialog
|
||||||
.openQuestion(
|
.openQuestion(
|
||||||
getShell(),
|
getShell(),
|
||||||
"Update make projects",
|
MakeUIPlugin.getResourceString("MakeUIPlugin.update_project"), //$NON-NLS-1$
|
||||||
"Older 'make' projects have been detected in your workspace. \n"
|
MakeUIPlugin.getResourceString("MakeUIPlugin.update_project_message")) //$NON-NLS-1$
|
||||||
+ "These projects are no longer supported, "
|
|
||||||
+ "would you like to convert these now?")
|
|
||||||
== true) {
|
== true) {
|
||||||
ProgressMonitorDialog pd = new ProgressMonitorDialog(getShell());
|
ProgressMonitorDialog pd = new ProgressMonitorDialog(getShell());
|
||||||
UpdateMakeProjectAction.run(false, pd, oldProject);
|
UpdateMakeProjectAction.run(false, pd, oldProject);
|
||||||
|
|
|
@ -32,16 +32,19 @@ import org.eclipse.ui.IFileEditorInput;
|
||||||
public class AddBuildTargetAction extends Action {
|
public class AddBuildTargetAction extends Action {
|
||||||
|
|
||||||
MakefileContentOutlinePage fOutliner;
|
MakefileContentOutlinePage fOutliner;
|
||||||
static final ITargetRule[] EMPTY_TARGET_RULES = {};
|
static final ITargetRule[] EMPTY_TARGET_RULES = {
|
||||||
|
};
|
||||||
|
|
||||||
public AddBuildTargetAction(MakefileContentOutlinePage outliner) {
|
public AddBuildTargetAction(MakefileContentOutlinePage outliner) {
|
||||||
super("Add To Build Target");
|
super("Add To Build Target");
|
||||||
setDescription("Add To Build Target");
|
setDescription("Add To Build Target");
|
||||||
setToolTipText("Add To Build Target");
|
setToolTipText("Add To Build Target");
|
||||||
fOutliner = outliner;
|
fOutliner = outliner;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.jface.action.IAction#run()
|
* @see org.eclipse.jface.action.IAction#run()
|
||||||
*/
|
*/
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -56,7 +59,7 @@ public class AddBuildTargetAction extends Action {
|
||||||
String name = rules[i].getTarget().toString().trim();
|
String name = rules[i].getTarget().toString().trim();
|
||||||
if (sbBuildName.length() == 0) {
|
if (sbBuildName.length() == 0) {
|
||||||
sbBuildName.append(name);
|
sbBuildName.append(name);
|
||||||
} else {
|
} else {
|
||||||
sbBuildName.append('_').append(name);
|
sbBuildName.append('_').append(name);
|
||||||
}
|
}
|
||||||
if (sbMakefileTarget.length() == 0) {
|
if (sbMakefileTarget.length() == 0) {
|
||||||
|
@ -67,19 +70,20 @@ public class AddBuildTargetAction extends Action {
|
||||||
}
|
}
|
||||||
String buildName = sbBuildName.toString();
|
String buildName = sbBuildName.toString();
|
||||||
String makefileTarget = sbMakefileTarget.toString();
|
String makefileTarget = sbMakefileTarget.toString();
|
||||||
IMakeTarget target = manager.findTarget(file.getParent(), buildName);
|
IMakeTarget target;
|
||||||
if (target == null) {
|
try {
|
||||||
try {
|
target = manager.findTarget(file.getParent(), buildName);
|
||||||
|
if (target == null) {
|
||||||
String[] ids = manager.getTargetBuilders(file.getProject());
|
String[] ids = manager.getTargetBuilders(file.getProject());
|
||||||
if (ids.length > 0) {
|
if (ids.length > 0) {
|
||||||
target = manager.createTarget(file.getProject(), buildName, ids[0]);
|
target = manager.createTarget(file.getProject(), buildName, ids[0]);
|
||||||
target.setBuildTarget(makefileTarget);
|
target.setBuildTarget(makefileTarget);
|
||||||
manager.addTarget(file.getParent(), target);
|
manager.addTarget(file.getParent(), target);
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
|
||||||
MakeUIPlugin.errorDialog(shell, "Internal Error", "", e);
|
|
||||||
target = null;
|
|
||||||
}
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
MakeUIPlugin.errorDialog(shell, "Internal Error", "", e);
|
||||||
|
target = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always popup the dialog.
|
// Always popup the dialog.
|
||||||
|
@ -101,13 +105,12 @@ public class AddBuildTargetAction extends Action {
|
||||||
IFile file = getFile();
|
IFile file = getFile();
|
||||||
if (file == null)
|
if (file == null)
|
||||||
return false;
|
return false;
|
||||||
if (! MakeCorePlugin.getDefault().getTargetManager().hasTargetBuilder(file.getProject()))
|
if (!MakeCorePlugin.getDefault().getTargetManager().hasTargetBuilder(file.getProject()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private IFile getFile() {
|
private IFile getFile() {
|
||||||
Object input = fOutliner.getInput();
|
Object input = fOutliner.getInput();
|
||||||
if (input instanceof IFileEditorInput) {
|
if (input instanceof IFileEditorInput) {
|
||||||
|
@ -118,7 +121,7 @@ public class AddBuildTargetAction extends Action {
|
||||||
|
|
||||||
private ITargetRule[] getTargetRules(ISelection sel) {
|
private ITargetRule[] getTargetRules(ISelection sel) {
|
||||||
if (!sel.isEmpty() && sel instanceof IStructuredSelection) {
|
if (!sel.isEmpty() && sel instanceof IStructuredSelection) {
|
||||||
List list= ((IStructuredSelection)sel).toList();
|
List list = ((IStructuredSelection)sel).toList();
|
||||||
if (list.size() > 0) {
|
if (list.size() > 0) {
|
||||||
List targets = new ArrayList(list.size());
|
List targets = new ArrayList(list.size());
|
||||||
Object[] elements = list.toArray();
|
Object[] elements = list.toArray();
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class MakePreferencePage extends PreferencePage implements IWorkbenchPref
|
||||||
|
|
||||||
public MakePreferencePage() {
|
public MakePreferencePage() {
|
||||||
setPreferenceStore(MakeUIPlugin.getDefault().getPreferenceStore());
|
setPreferenceStore(MakeUIPlugin.getDefault().getPreferenceStore());
|
||||||
setDescription("Make Project Preferences");
|
setDescription(MakeUIPlugin.getResourceString("MakePreferencePage.description")); //$NON-NLS-1$
|
||||||
fOptionBlock = new MakeProjectOptionBlock(this);
|
fOptionBlock = new MakeProjectOptionBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class MakePropertyPage extends PropertyPage implements ICOptionContainer
|
||||||
*/
|
*/
|
||||||
public boolean performOk() {
|
public boolean performOk() {
|
||||||
IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
||||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
public void run(IProgressMonitor monitor) {
|
||||||
fOptionBlock.performApply(monitor);
|
fOptionBlock.performApply(monitor);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.jface.text.ITextViewer;
|
||||||
* Used to scan and detect for SQL keywords
|
* Used to scan and detect for SQL keywords
|
||||||
*/
|
*/
|
||||||
public class WordPartDetector {
|
public class WordPartDetector {
|
||||||
String wordPart = "";
|
String wordPart = ""; //$NON-NLS-1$
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,8 +13,8 @@ package org.eclipse.cdt.make.ui;
|
||||||
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||||
|
|
||||||
public interface IMakeHelpContextIds {
|
public interface IMakeHelpContextIds {
|
||||||
public static final String PREFIX = MakeUIPlugin.getUniqueIdentifier() + ".";
|
public static final String PREFIX = MakeUIPlugin.getUniqueIdentifier() + "."; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final String MAKE_PATH_SYMBOL_SETTINGS = PREFIX + "cdt_paths_symbols_page";
|
public static final String MAKE_PATH_SYMBOL_SETTINGS = PREFIX + "cdt_paths_symbols_page"; //$NON-NLS-1$
|
||||||
public static final String MAKE_BUILDER_SETTINGS = PREFIX + "cdt_make_builder_page";
|
public static final String MAKE_BUILDER_SETTINGS = PREFIX + "cdt_make_builder_page"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
||||||
try {
|
try {
|
||||||
return MakeCorePlugin.getDefault().getTargetManager().getTargetBuilderProjects();
|
return MakeCorePlugin.getDefault().getTargetManager().getTargetBuilderProjects();
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
// ignore
|
||||||
}
|
}
|
||||||
} else if (obj instanceof IContainer) {
|
} else if (obj instanceof IContainer) {
|
||||||
ArrayList children = new ArrayList();
|
ArrayList children = new ArrayList();
|
||||||
|
@ -59,6 +60,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
||||||
}
|
}
|
||||||
children.addAll(Arrays.asList(MakeCorePlugin.getDefault().getTargetManager().getTargets((IContainer) obj)));
|
children.addAll(Arrays.asList(MakeCorePlugin.getDefault().getTargetManager().getTargets((IContainer) obj)));
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
// ignore
|
||||||
}
|
}
|
||||||
return children.toArray();
|
return children.toArray();
|
||||||
}
|
}
|
||||||
|
@ -164,8 +166,6 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the affected resource
|
|
||||||
IResource resource = delta.getResource();
|
|
||||||
IResourceDelta[] affectedChildren = delta.getAffectedChildren(IResourceDelta.CHANGED);
|
IResourceDelta[] affectedChildren = delta.getAffectedChildren(IResourceDelta.CHANGED);
|
||||||
|
|
||||||
// Not interested in Content changes.
|
// Not interested in Content changes.
|
||||||
|
@ -175,12 +175,15 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle changed children recursively.
|
// Handle changed children recursively.
|
||||||
for (int i = 0; i < affectedChildren.length; i++) {
|
for (int i = 0; i < affectedChildren.length; i++) {
|
||||||
processDelta(affectedChildren[i]);
|
processDelta(affectedChildren[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle removed children. Issue one update for all removals.
|
// Get the affected resource
|
||||||
|
IResource resource = delta.getResource();
|
||||||
|
|
||||||
|
// Handle removed children. Issue one update for all removals.
|
||||||
affectedChildren = delta.getAffectedChildren(IResourceDelta.REMOVED);
|
affectedChildren = delta.getAffectedChildren(IResourceDelta.REMOVED);
|
||||||
if (affectedChildren.length > 0) {
|
if (affectedChildren.length > 0) {
|
||||||
ArrayList affected = new ArrayList(affectedChildren.length);
|
ArrayList affected = new ArrayList(affectedChildren.length);
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class MakeLabelProvider extends LabelProvider implements ITableLabelProvi
|
||||||
} else if (obj instanceof IContainer) {
|
} else if (obj instanceof IContainer) {
|
||||||
return fLableProvider.getText(obj);
|
return fLableProvider.getText(obj);
|
||||||
}
|
}
|
||||||
return "";
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
@ -77,6 +77,6 @@ public class MakeLabelProvider extends LabelProvider implements ITableLabelProvi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -96,7 +96,7 @@ public class TargetListViewerPart extends StructuredViewerPart {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
MakeUIPlugin.errorDialog(getControl().getShell(), "Error", "Error", e);
|
MakeUIPlugin.errorDialog(getControl().getShell(), "Error", "An error occurred performing the selected action", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
/*
|
/***********************************************************************************************************************************
|
||||||
* Created on 25-Jul-2003
|
* Created on 25-Jul-2003
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002,2003 QNX Software Systems Ltd.
|
* Copyright (c) 2002,2003 QNX Software Systems Ltd.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors: QNX Software Systems - Initial API and implementation
|
||||||
* QNX Software Systems - Initial API and implementation
|
**********************************************************************************************************************************/
|
||||||
***********************************************************************/
|
|
||||||
package org.eclipse.cdt.make.ui.actions;
|
package org.eclipse.cdt.make.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.cdt.make.core.IMakeTarget;
|
import org.eclipse.cdt.make.core.IMakeTarget;
|
||||||
|
@ -28,39 +27,38 @@ public class BuildTargetAction extends AbstractTargetAction {
|
||||||
BuildTargetDialog dialog = new BuildTargetDialog(getShell(), container);
|
BuildTargetDialog dialog = new BuildTargetDialog(getShell(), container);
|
||||||
String name = null;
|
String name = null;
|
||||||
try {
|
try {
|
||||||
name = (String) container.getSessionProperty(new QualifiedName(MakeUIPlugin.getUniqueIdentifier(), "lastTarget"));
|
name = (String)container.getSessionProperty(new QualifiedName(MakeUIPlugin.getUniqueIdentifier(), "lastTarget")); //$NON-NLS-1$
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
if ( name != null) {
|
try {
|
||||||
IPath path = new Path(name);
|
if (name != null) {
|
||||||
name = path.segment(path.segmentCount() - 1);
|
IPath path = new Path(name);
|
||||||
IContainer targetContainer;
|
name = path.segment(path.segmentCount() - 1);
|
||||||
if ( path.segmentCount() > 1) {
|
IContainer targetContainer;
|
||||||
path = path.removeLastSegments(1);
|
if (path.segmentCount() > 1) {
|
||||||
targetContainer = (IContainer) container.findMember(path);
|
path = path.removeLastSegments(1);
|
||||||
} else {
|
targetContainer = (IContainer)container.findMember(path);
|
||||||
targetContainer = container;
|
} else {
|
||||||
|
targetContainer = container;
|
||||||
|
}
|
||||||
|
IMakeTarget target = MakeCorePlugin.getDefault().getTargetManager().findTarget(targetContainer, name);
|
||||||
|
if (target != null)
|
||||||
|
dialog.setTarget(target);
|
||||||
}
|
}
|
||||||
IMakeTarget target = MakeCorePlugin.getDefault().getTargetManager().findTarget(targetContainer, name);
|
if (dialog.open() == Window.OK) {
|
||||||
if (target != null)
|
IMakeTarget target = dialog.getTarget();
|
||||||
dialog.setTarget(target);
|
if (target != null) {
|
||||||
}
|
IPath path =
|
||||||
if (dialog.open() == Window.OK) {
|
target.getContainer().getProjectRelativePath().removeFirstSegments(
|
||||||
IMakeTarget target = dialog.getTarget();
|
container.getProjectRelativePath().segmentCount());
|
||||||
if (target != null) {
|
|
||||||
try {
|
|
||||||
IPath path = target.getContainer().getProjectRelativePath().removeFirstSegments(container.getProjectRelativePath().segmentCount());
|
|
||||||
path = path.append(target.getName());
|
path = path.append(target.getName());
|
||||||
container.setSessionProperty(
|
container.setSessionProperty(new QualifiedName(MakeUIPlugin.getUniqueIdentifier(), "lastTarget"), //$NON-NLS-1$
|
||||||
new QualifiedName(MakeUIPlugin.getUniqueIdentifier(), "lastTarget"),
|
path.toString());
|
||||||
path.toString());
|
|
||||||
} catch (CoreException e1) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
|
||||||
}
|
}
|
||||||
IContainer container = (IContainer) proxy.requestResource();
|
IContainer container = (IContainer) proxy.requestResource();
|
||||||
monitor.subTask(container.getProjectRelativePath().toString());
|
monitor.subTask(container.getProjectRelativePath().toString());
|
||||||
QualifiedName qName = new QualifiedName("org.eclipse.cdt.make", "goals");
|
QualifiedName qName = new QualifiedName("org.eclipse.cdt.make", "goals"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
String goal = container.getPersistentProperty(qName);
|
String goal = container.getPersistentProperty(qName);
|
||||||
if (goal != null) {
|
if (goal != null) {
|
||||||
goal = goal.trim();
|
goal = goal.trim();
|
||||||
|
@ -213,11 +213,11 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
|
||||||
IMakeBuilderInfo newInfo = MakeCorePlugin.createBuildInfo(project[i], MakeBuilder.BUILDER_ID);
|
IMakeBuilderInfo newInfo = MakeCorePlugin.createBuildInfo(project[i], MakeBuilder.BUILDER_ID);
|
||||||
final int LOCATION = 0, FULL_ARGS = 1, INC_ARGS = 2, STOP_ERORR = 3, USE_DEFAULT = 4;
|
final int LOCATION = 0, FULL_ARGS = 1, INC_ARGS = 2, STOP_ERORR = 3, USE_DEFAULT = 4;
|
||||||
QualifiedName[] qName = new QualifiedName[USE_DEFAULT + 1];
|
QualifiedName[] qName = new QualifiedName[USE_DEFAULT + 1];
|
||||||
qName[LOCATION] = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildLocation");
|
qName[LOCATION] = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildLocation"); //$NON-NLS-1$
|
||||||
qName[FULL_ARGS] = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildFullArguments");
|
qName[FULL_ARGS] = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildFullArguments"); //$NON-NLS-1$
|
||||||
qName[INC_ARGS] = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildIncrementalArguments");
|
qName[INC_ARGS] = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildIncrementalArguments"); //$NON-NLS-1$
|
||||||
qName[STOP_ERORR] = new QualifiedName(CCorePlugin.PLUGIN_ID, "stopOnError");
|
qName[STOP_ERORR] = new QualifiedName(CCorePlugin.PLUGIN_ID, "stopOnError"); //$NON-NLS-1$
|
||||||
qName[USE_DEFAULT] = new QualifiedName(CCorePlugin.PLUGIN_ID, "useDefaultBuildCmd");
|
qName[USE_DEFAULT] = new QualifiedName(CCorePlugin.PLUGIN_ID, "useDefaultBuildCmd"); //$NON-NLS-1$
|
||||||
|
|
||||||
String property = project[i].getPersistentProperty(qName[LOCATION]);
|
String property = project[i].getPersistentProperty(qName[LOCATION]);
|
||||||
if (property != null) {
|
if (property != null) {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Preferences;
|
import org.eclipse.core.runtime.Preferences;
|
||||||
import org.eclipse.jface.dialogs.InputDialog;
|
import org.eclipse.jface.dialogs.InputDialog;
|
||||||
|
import org.eclipse.jface.window.Window;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.MouseAdapter;
|
import org.eclipse.swt.events.MouseAdapter;
|
||||||
import org.eclipse.swt.events.MouseEvent;
|
import org.eclipse.swt.events.MouseEvent;
|
||||||
|
@ -46,8 +47,8 @@ import org.eclipse.ui.help.WorkbenchHelp;
|
||||||
public class BuildPathInfoBlock extends AbstractCOptionPage {
|
public class BuildPathInfoBlock extends AbstractCOptionPage {
|
||||||
private static final int PROJECT_LIST_MULTIPLIER = 10;
|
private static final int PROJECT_LIST_MULTIPLIER = 10;
|
||||||
|
|
||||||
private static final String PREF_SYMBOLS = "ScannerSymbols";
|
private static final String PREF_SYMBOLS = "ScannerSymbols"; //$NON-NLS-1$
|
||||||
private static final String PREF_INCLUDES = "ScannerIncludes";
|
private static final String PREF_INCLUDES = "ScannerIncludes"; //$NON-NLS-1$
|
||||||
private static final String PREFIX = "BuildPathInfoBlock"; //$NON-NLS-1$
|
private static final String PREFIX = "BuildPathInfoBlock"; //$NON-NLS-1$
|
||||||
private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
|
private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
|
||||||
private static final String PATHS = PREFIX + ".paths"; //$NON-NLS-1$
|
private static final String PATHS = PREFIX + ".paths"; //$NON-NLS-1$
|
||||||
|
@ -330,7 +331,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
|
||||||
|
|
||||||
private String[] parseStringToList(String syms) {
|
private String[] parseStringToList(String syms) {
|
||||||
if (syms != null && syms.length() > 0) {
|
if (syms != null && syms.length() > 0) {
|
||||||
StringTokenizer tok = new StringTokenizer(syms, ";");
|
StringTokenizer tok = new StringTokenizer(syms, ";"); //$NON-NLS-1$
|
||||||
ArrayList list = new ArrayList(tok.countTokens());
|
ArrayList list = new ArrayList(tok.countTokens());
|
||||||
while (tok.hasMoreElements()) {
|
while (tok.hasMoreElements()) {
|
||||||
list.add(tok.nextToken());
|
list.add(tok.nextToken());
|
||||||
|
@ -357,7 +358,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
|
||||||
selItem,
|
selItem,
|
||||||
null);
|
null);
|
||||||
String newItem = null;
|
String newItem = null;
|
||||||
if (dialog.open() == InputDialog.OK) {
|
if (dialog.open() == Window.OK) {
|
||||||
newItem = dialog.getValue();
|
newItem = dialog.getValue();
|
||||||
if (newItem != null && !newItem.equals(selItem)) {
|
if (newItem != null && !newItem.equals(selItem)) {
|
||||||
pathList.setItem(index, newItem);
|
pathList.setItem(index, newItem);
|
||||||
|
@ -384,7 +385,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
|
||||||
selItem,
|
selItem,
|
||||||
null);
|
null);
|
||||||
String newItem = null;
|
String newItem = null;
|
||||||
if (dialog.open() == InputDialog.OK) {
|
if (dialog.open() == Window.OK) {
|
||||||
newItem = dialog.getValue();
|
newItem = dialog.getValue();
|
||||||
if (newItem != null && !newItem.equals(selItem)) {
|
if (newItem != null && !newItem.equals(selItem)) {
|
||||||
symbolList.setItem(index, newItem);
|
symbolList.setItem(index, newItem);
|
||||||
|
@ -490,7 +491,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
|
||||||
// Popup an entry dialog
|
// Popup an entry dialog
|
||||||
InputDialog dialog = new InputDialog(shell, MakeUIPlugin.getResourceString(PATH_TITLE), MakeUIPlugin.getResourceString(PATH_LABEL), "", null); //$NON-NLS-1$
|
InputDialog dialog = new InputDialog(shell, MakeUIPlugin.getResourceString(PATH_TITLE), MakeUIPlugin.getResourceString(PATH_LABEL), "", null); //$NON-NLS-1$
|
||||||
String path = null;
|
String path = null;
|
||||||
if (dialog.open() == InputDialog.OK) {
|
if (dialog.open() == Window.OK) {
|
||||||
path = dialog.getValue();
|
path = dialog.getValue();
|
||||||
}
|
}
|
||||||
if (path != null && path.length() > 0) {
|
if (path != null && path.length() > 0) {
|
||||||
|
@ -504,7 +505,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage {
|
||||||
// Popup an entry dialog
|
// Popup an entry dialog
|
||||||
InputDialog dialog = new InputDialog(shell, MakeUIPlugin.getResourceString(SYMBOL_TITLE), MakeUIPlugin.getResourceString(SYMBOL_LABEL), "", null); //$NON-NLS-1$
|
InputDialog dialog = new InputDialog(shell, MakeUIPlugin.getResourceString(SYMBOL_TITLE), MakeUIPlugin.getResourceString(SYMBOL_LABEL), "", null); //$NON-NLS-1$
|
||||||
String symbol = null;
|
String symbol = null;
|
||||||
if (dialog.open() == InputDialog.OK) {
|
if (dialog.open() == Window.OK) {
|
||||||
symbol = dialog.getValue();
|
symbol = dialog.getValue();
|
||||||
}
|
}
|
||||||
if (symbol != null && symbol.length() > 0) {
|
if (symbol != null && symbol.length() > 0) {
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class MakeTargetDialog extends Dialog {
|
||||||
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
|
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
|
||||||
*/
|
*/
|
||||||
protected Control createDialogArea(Composite parent) {
|
protected Control createDialogArea(Composite parent) {
|
||||||
Composite composite = (Composite) super.createDialogArea(parent);
|
Composite composite = (Composite)super.createDialogArea(parent);
|
||||||
initializeDialogUnits(composite);
|
initializeDialogUnits(composite);
|
||||||
|
|
||||||
String title;
|
String title;
|
||||||
|
@ -154,8 +154,8 @@ public class MakeTargetDialog extends Dialog {
|
||||||
|
|
||||||
protected void createNameControl(Composite parent) {
|
protected void createNameControl(Composite parent) {
|
||||||
Composite composite = ControlFactory.createComposite(parent, 2);
|
Composite composite = ControlFactory.createComposite(parent, 2);
|
||||||
((GridLayout) composite.getLayout()).makeColumnsEqualWidth = false;
|
((GridLayout)composite.getLayout()).makeColumnsEqualWidth = false;
|
||||||
((GridLayout) composite.getLayout()).horizontalSpacing = 0;
|
((GridLayout)composite.getLayout()).horizontalSpacing = 0;
|
||||||
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
Label label = ControlFactory.createLabel(composite, MakeUIPlugin.getResourceString(TARGET_NAME_LABEL));
|
Label label = ControlFactory.createLabel(composite, MakeUIPlugin.getResourceString(TARGET_NAME_LABEL));
|
||||||
((GridData) (label.getLayoutData())).horizontalAlignment = GridData.BEGINNING;
|
((GridData) (label.getLayoutData())).horizontalAlignment = GridData.BEGINNING;
|
||||||
|
@ -169,16 +169,21 @@ public class MakeTargetDialog extends Dialog {
|
||||||
if (newName.equals("")) {
|
if (newName.equals("")) {
|
||||||
fStatusLine.setErrorMessage("Must specify a target name.");
|
fStatusLine.setErrorMessage("Must specify a target name.");
|
||||||
getButton(IDialogConstants.OK_ID).setEnabled(false);
|
getButton(IDialogConstants.OK_ID).setEnabled(false);
|
||||||
} else if (
|
} else
|
||||||
fTarget != null
|
try {
|
||||||
&& fTarget.getName().equals(newName)
|
if (fTarget != null
|
||||||
|| fTargetManager.findTarget(fContainer, newName) == null) {
|
&& fTarget.getName().equals(newName)
|
||||||
fStatusLine.setErrorMessage(null);
|
|| fTargetManager.findTarget(fContainer, newName) == null) {
|
||||||
getButton(IDialogConstants.OK_ID).setEnabled(true);
|
fStatusLine.setErrorMessage(null);
|
||||||
} else {
|
getButton(IDialogConstants.OK_ID).setEnabled(true);
|
||||||
fStatusLine.setErrorMessage("Target with that name already exits");
|
} else {
|
||||||
getButton(IDialogConstants.OK_ID).setEnabled(false);
|
fStatusLine.setErrorMessage("Target with that name already exits");
|
||||||
}
|
getButton(IDialogConstants.OK_ID).setEnabled(false);
|
||||||
|
}
|
||||||
|
} catch (CoreException ex) {
|
||||||
|
fStatusLine.setErrorMessage(ex.getLocalizedMessage());
|
||||||
|
getButton(IDialogConstants.OK_ID).setEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -281,16 +286,19 @@ public class MakeTargetDialog extends Dialog {
|
||||||
targetNameText.setText(targetName);
|
targetNameText.setText(targetName);
|
||||||
} else {
|
} else {
|
||||||
targetNameText.setText(generateUniqueName(targetString));
|
targetNameText.setText(generateUniqueName(targetString));
|
||||||
}
|
}
|
||||||
targetNameText.selectAll();
|
targetNameText.selectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateUniqueName(String targetString) {
|
private String generateUniqueName(String targetString) {
|
||||||
String newName = targetString;
|
String newName = targetString;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while(fTargetManager.findTarget(fContainer, newName) != null) {
|
try {
|
||||||
i++;
|
while (fTargetManager.findTarget(fContainer, newName) != null) {
|
||||||
newName = targetString + " (" + Integer.toString(i) + ")";
|
i++;
|
||||||
|
newName = targetString + " (" + Integer.toString(i) + ")";
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
return newName;
|
return newName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Preferences;
|
import org.eclipse.core.runtime.Preferences;
|
||||||
|
import org.eclipse.jface.window.Window;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
@ -219,8 +220,8 @@ public class SettingsBlock extends AbstractCOptionPage {
|
||||||
getShell(),
|
getShell(),
|
||||||
getContainer().getProject(),
|
getContainer().getProject(),
|
||||||
true,
|
true,
|
||||||
"Selection Locations to build from.");
|
"Selection Location to build from.");
|
||||||
if (dialog.open() == ContainerSelectionDialog.OK) {
|
if (dialog.open() == Window.OK) {
|
||||||
Object[] selection = dialog.getResult();
|
Object[] selection = dialog.getResult();
|
||||||
if (selection.length > 0) {
|
if (selection.length > 0) {
|
||||||
buildLocation.setText(((IPath) selection[0]).toOSString());
|
buildLocation.setText(((IPath) selection[0]).toOSString());
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class AddTargetAction extends SelectionListenerAction {
|
||||||
this.shell = shell;
|
this.shell = shell;
|
||||||
|
|
||||||
setToolTipText("Add Build Target");
|
setToolTipText("Add Build Target");
|
||||||
MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_MAKE_TARGET_ADD);
|
MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_MAKE_TARGET_ADD); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -36,7 +36,7 @@ public class AddTargetAction extends SelectionListenerAction {
|
||||||
MakeTargetDialog dialog = new MakeTargetDialog(shell, (IContainer) getStructuredSelection().getFirstElement());
|
MakeTargetDialog dialog = new MakeTargetDialog(shell, (IContainer) getStructuredSelection().getFirstElement());
|
||||||
dialog.open();
|
dialog.open();
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
MakeUIPlugin.errorDialog(shell, "Internal Error", "", e);
|
MakeUIPlugin.errorDialog(shell, "Internal Error", "Internal Error", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class BuildTargetAction extends SelectionListenerAction {
|
||||||
this.shell = shell;
|
this.shell = shell;
|
||||||
|
|
||||||
setToolTipText("Build Target");
|
setToolTipText("Build Target");
|
||||||
MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_MAKE_TARGET_BUILD);
|
MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_MAKE_TARGET_BUILD); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class DeleteTargetAction extends SelectionListenerAction {
|
||||||
this.shell = shell;
|
this.shell = shell;
|
||||||
|
|
||||||
setToolTipText("Delete Build Target");
|
setToolTipText("Delete Build Target");
|
||||||
MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_MAKE_TARGET_DELETE);
|
MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_MAKE_TARGET_DELETE); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class EditTargetAction extends SelectionListenerAction {
|
||||||
this.shell = shell;
|
this.shell = shell;
|
||||||
|
|
||||||
setToolTipText("Edit Build Target");
|
setToolTipText("Edit Build Target");
|
||||||
MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_MAKE_TARGET_EDIT);
|
MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_MAKE_TARGET_EDIT); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -37,7 +37,7 @@ public class EditTargetAction extends SelectionListenerAction {
|
||||||
dialog = new MakeTargetDialog(shell, (IMakeTarget) getStructuredSelection().getFirstElement());
|
dialog = new MakeTargetDialog(shell, (IMakeTarget) getStructuredSelection().getFirstElement());
|
||||||
dialog.open();
|
dialog.open();
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
MakeUIPlugin.errorDialog(shell, "Internal Error", "", e);
|
MakeUIPlugin.errorDialog(shell, "Internal Error", "Error editing target.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue