From f25407a2dc7e6dd98c8d3d761a021a78b70171ea Mon Sep 17 00:00:00 2001 From: David Inglis Date: Tue, 24 Feb 2004 02:04:02 +0000 Subject: [PATCH] cleanup start of string cleanup improved error handling with targets --- .../make/internal/ui/MakeResources.properties | 3 + .../cdt/make/internal/ui/MakeUIImages.java | 12 ++-- .../cdt/make/internal/ui/MakeUIPlugin.java | 6 +- .../ui/editor/AddBuildTargetAction.java | 31 +++++----- .../ui/preferences/MakePreferencePage.java | 2 +- .../ui/properties/MakePropertyPage.java | 2 +- .../internal/ui/text/WordPartDetector.java | 2 +- .../cdt/make/ui/IMakeHelpContextIds.java | 6 +- .../cdt/make/ui/MakeContentProvider.java | 11 ++-- .../cdt/make/ui/MakeLabelProvider.java | 4 +- .../cdt/make/ui/TargetListViewerPart.java | 2 +- .../make/ui/actions/BuildTargetAction.java | 58 +++++++++---------- .../ui/actions/UpdateMakeProjectAction.java | 12 ++-- .../make/ui/dialogs/BuildPathInfoBlock.java | 15 ++--- .../cdt/make/ui/dialogs/MakeTargetDialog.java | 42 ++++++++------ .../cdt/make/ui/dialogs/SettingsBlock.java | 5 +- .../cdt/make/ui/views/AddTargetAction.java | 4 +- .../cdt/make/ui/views/BuildTargetAction.java | 2 +- .../cdt/make/ui/views/DeleteTargetAction.java | 2 +- .../cdt/make/ui/views/EditTargetAction.java | 4 +- 20 files changed, 120 insertions(+), 105 deletions(-) diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties index 012d7a24d54..0f5021a0b7f 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeResources.properties @@ -102,3 +102,6 @@ LexicalSortingAction.tooltip=Sort LexicalSortingAction.tooltip.on=Do Not 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 diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIImages.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIImages.java index d80f68560ea..11ce7eb0825 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIImages.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIImages.java @@ -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 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); @@ -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 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) { return createManaged(imageRegistry, prefix, name); @@ -109,9 +109,9 @@ public class MakeUIImages { */ public static void setImageDescriptors(IAction action, String type, String relPath) { relPath = relPath.substring(NAME_PREFIX_LENGTH); - action.setDisabledImageDescriptor(create("d" + type + "/", relPath)); //$NON-NLS-1$ - action.setHoverImageDescriptor(create("c" + type + "/", relPath)); //$NON-NLS-1$ - action.setImageDescriptor(create("e" + 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$ //$NON-NLS-2$ + action.setImageDescriptor(create("e" + type + "/", relPath)); //$NON-NLS-1$ //$NON-NLS-2$ } /** diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPlugin.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPlugin.java index 6e418f422fa..50909a4c3a6 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPlugin.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPlugin.java @@ -221,10 +221,8 @@ public class MakeUIPlugin extends AbstractUIPlugin implements IStartup { if (MessageDialog .openQuestion( getShell(), - "Update make projects", - "Older 'make' projects have been detected in your workspace. \n" - + "These projects are no longer supported, " - + "would you like to convert these now?") + MakeUIPlugin.getResourceString("MakeUIPlugin.update_project"), //$NON-NLS-1$ + MakeUIPlugin.getResourceString("MakeUIPlugin.update_project_message")) //$NON-NLS-1$ == true) { ProgressMonitorDialog pd = new ProgressMonitorDialog(getShell()); UpdateMakeProjectAction.run(false, pd, oldProject); diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/AddBuildTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/AddBuildTargetAction.java index 5e748ab7859..d5fa3060052 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/AddBuildTargetAction.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/AddBuildTargetAction.java @@ -32,16 +32,19 @@ import org.eclipse.ui.IFileEditorInput; public class AddBuildTargetAction extends Action { MakefileContentOutlinePage fOutliner; - static final ITargetRule[] EMPTY_TARGET_RULES = {}; - + static final ITargetRule[] EMPTY_TARGET_RULES = { + }; + public AddBuildTargetAction(MakefileContentOutlinePage outliner) { super("Add To Build Target"); setDescription("Add To Build Target"); - setToolTipText("Add To Build Target"); + setToolTipText("Add To Build Target"); fOutliner = outliner; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.jface.action.IAction#run() */ public void run() { @@ -56,7 +59,7 @@ public class AddBuildTargetAction extends Action { String name = rules[i].getTarget().toString().trim(); if (sbBuildName.length() == 0) { sbBuildName.append(name); - } else { + } else { sbBuildName.append('_').append(name); } if (sbMakefileTarget.length() == 0) { @@ -67,19 +70,20 @@ public class AddBuildTargetAction extends Action { } String buildName = sbBuildName.toString(); String makefileTarget = sbMakefileTarget.toString(); - IMakeTarget target = manager.findTarget(file.getParent(), buildName); - if (target == null) { - try { + IMakeTarget target; + try { + target = manager.findTarget(file.getParent(), buildName); + if (target == null) { String[] ids = manager.getTargetBuilders(file.getProject()); if (ids.length > 0) { target = manager.createTarget(file.getProject(), buildName, ids[0]); target.setBuildTarget(makefileTarget); 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. @@ -101,13 +105,12 @@ public class AddBuildTargetAction extends Action { IFile file = getFile(); if (file == null) return false; - if (! MakeCorePlugin.getDefault().getTargetManager().hasTargetBuilder(file.getProject())) + if (!MakeCorePlugin.getDefault().getTargetManager().hasTargetBuilder(file.getProject())) return false; } return true; } - private IFile getFile() { Object input = fOutliner.getInput(); if (input instanceof IFileEditorInput) { @@ -118,7 +121,7 @@ public class AddBuildTargetAction extends Action { private ITargetRule[] getTargetRules(ISelection sel) { if (!sel.isEmpty() && sel instanceof IStructuredSelection) { - List list= ((IStructuredSelection)sel).toList(); + List list = ((IStructuredSelection)sel).toList(); if (list.size() > 0) { List targets = new ArrayList(list.size()); Object[] elements = list.toArray(); diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakePreferencePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakePreferencePage.java index f165a1e4e60..ec629b5400d 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakePreferencePage.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakePreferencePage.java @@ -42,7 +42,7 @@ public class MakePreferencePage extends PreferencePage implements IWorkbenchPref public MakePreferencePage() { setPreferenceStore(MakeUIPlugin.getDefault().getPreferenceStore()); - setDescription("Make Project Preferences"); + setDescription(MakeUIPlugin.getResourceString("MakePreferencePage.description")); //$NON-NLS-1$ fOptionBlock = new MakeProjectOptionBlock(this); } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/properties/MakePropertyPage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/properties/MakePropertyPage.java index 4459fb51ad0..2c3ddd028bc 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/properties/MakePropertyPage.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/properties/MakePropertyPage.java @@ -72,7 +72,7 @@ public class MakePropertyPage extends PropertyPage implements ICOptionContainer */ public boolean performOk() { IRunnableWithProgress runnable = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + public void run(IProgressMonitor monitor) { fOptionBlock.performApply(monitor); } }; diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/WordPartDetector.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/WordPartDetector.java index 58994c399e8..fa1924ee5f5 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/WordPartDetector.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/WordPartDetector.java @@ -17,7 +17,7 @@ import org.eclipse.jface.text.ITextViewer; * Used to scan and detect for SQL keywords */ public class WordPartDetector { - String wordPart = ""; + String wordPart = ""; //$NON-NLS-1$ int offset; /** diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IMakeHelpContextIds.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IMakeHelpContextIds.java index c8f17f4ca20..4aaf08d4815 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IMakeHelpContextIds.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/IMakeHelpContextIds.java @@ -13,8 +13,8 @@ package org.eclipse.cdt.make.ui; import org.eclipse.cdt.make.internal.ui.MakeUIPlugin; 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_BUILDER_SETTINGS = PREFIX + "cdt_make_builder_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"; //$NON-NLS-1$ } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeContentProvider.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeContentProvider.java index 4b08da0f616..de4485cfd22 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeContentProvider.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeContentProvider.java @@ -47,6 +47,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis try { return MakeCorePlugin.getDefault().getTargetManager().getTargetBuilderProjects(); } catch (CoreException e) { + // ignore } } else if (obj instanceof IContainer) { ArrayList children = new ArrayList(); @@ -59,6 +60,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis } children.addAll(Arrays.asList(MakeCorePlugin.getDefault().getTargetManager().getTargets((IContainer) obj))); } catch (CoreException e) { + // ignore } return children.toArray(); } @@ -164,8 +166,6 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis return; } - // Get the affected resource - IResource resource = delta.getResource(); IResourceDelta[] affectedChildren = delta.getAffectedChildren(IResourceDelta.CHANGED); // 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++) { 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); if (affectedChildren.length > 0) { ArrayList affected = new ArrayList(affectedChildren.length); diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeLabelProvider.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeLabelProvider.java index 9829395843e..8cf1220f325 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeLabelProvider.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeLabelProvider.java @@ -48,7 +48,7 @@ public class MakeLabelProvider extends LabelProvider implements ITableLabelProvi } else if (obj instanceof IContainer) { return fLableProvider.getText(obj); } - return ""; + return ""; //$NON-NLS-1$ } public void dispose() { @@ -77,6 +77,6 @@ public class MakeLabelProvider extends LabelProvider implements ITableLabelProvi } } } - return ""; + return ""; //$NON-NLS-1$ } } \ No newline at end of file diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetListViewerPart.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetListViewerPart.java index ae02f6e1397..ee98fe1e6e1 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetListViewerPart.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetListViewerPart.java @@ -96,7 +96,7 @@ public class TargetListViewerPart extends StructuredViewerPart { break; } } catch (CoreException e) { - MakeUIPlugin.errorDialog(getControl().getShell(), "Error", "Error", e); + MakeUIPlugin.errorDialog(getControl().getShell(), "Error", "An error occurred performing the selected action", e); } } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildTargetAction.java index 4d0691504ca..514bd0885b2 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildTargetAction.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildTargetAction.java @@ -1,11 +1,10 @@ -/* +/*********************************************************************************************************************************** * Created on 25-Jul-2003 - * + * * Copyright (c) 2002,2003 QNX Software Systems Ltd. * - * Contributors: - * QNX Software Systems - Initial API and implementation -***********************************************************************/ + * Contributors: QNX Software Systems - Initial API and implementation + **********************************************************************************************************************************/ package org.eclipse.cdt.make.ui.actions; import org.eclipse.cdt.make.core.IMakeTarget; @@ -28,39 +27,38 @@ public class BuildTargetAction extends AbstractTargetAction { BuildTargetDialog dialog = new BuildTargetDialog(getShell(), container); String name = null; 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) { } - if ( name != null) { - IPath path = new Path(name); - name = path.segment(path.segmentCount() - 1); - IContainer targetContainer; - if ( path.segmentCount() > 1) { - path = path.removeLastSegments(1); - targetContainer = (IContainer) container.findMember(path); - } else { - targetContainer = container; + try { + if (name != null) { + IPath path = new Path(name); + name = path.segment(path.segmentCount() - 1); + IContainer targetContainer; + if (path.segmentCount() > 1) { + path = path.removeLastSegments(1); + targetContainer = (IContainer)container.findMember(path); + } 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 (target != null) - dialog.setTarget(target); - } - if (dialog.open() == Window.OK) { - IMakeTarget target = dialog.getTarget(); - if (target != null) { - try { - IPath path = target.getContainer().getProjectRelativePath().removeFirstSegments(container.getProjectRelativePath().segmentCount()); + if (dialog.open() == Window.OK) { + IMakeTarget target = dialog.getTarget(); + if (target != null) { + IPath path = + target.getContainer().getProjectRelativePath().removeFirstSegments( + container.getProjectRelativePath().segmentCount()); path = path.append(target.getName()); - container.setSessionProperty( - new QualifiedName(MakeUIPlugin.getUniqueIdentifier(), "lastTarget"), - path.toString()); - } catch (CoreException e1) { + container.setSessionProperty(new QualifiedName(MakeUIPlugin.getUniqueIdentifier(), "lastTarget"), //$NON-NLS-1$ + path.toString()); } } + } catch (CoreException e) { } } } - - } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/UpdateMakeProjectAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/UpdateMakeProjectAction.java index 628861584e3..2dc688127aa 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/UpdateMakeProjectAction.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/UpdateMakeProjectAction.java @@ -162,7 +162,7 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate { } IContainer container = (IContainer) proxy.requestResource(); 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); if (goal != null) { goal = goal.trim(); @@ -213,11 +213,11 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate { 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; 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"); + qName[LOCATION] = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildLocation"); //$NON-NLS-1$ + qName[FULL_ARGS] = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildFullArguments"); //$NON-NLS-1$ + qName[INC_ARGS] = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildIncrementalArguments"); //$NON-NLS-1$ + qName[STOP_ERORR] = new QualifiedName(CCorePlugin.PLUGIN_ID, "stopOnError"); //$NON-NLS-1$ + qName[USE_DEFAULT] = new QualifiedName(CCorePlugin.PLUGIN_ID, "useDefaultBuildCmd"); //$NON-NLS-1$ String property = project[i].getPersistentProperty(qName[LOCATION]); if (property != null) { diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/BuildPathInfoBlock.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/BuildPathInfoBlock.java index 45d95edbe6c..b7f561c2333 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/BuildPathInfoBlock.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/BuildPathInfoBlock.java @@ -27,6 +27,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Preferences; import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.window.Window; import org.eclipse.swt.SWT; import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; @@ -46,8 +47,8 @@ import org.eclipse.ui.help.WorkbenchHelp; public class BuildPathInfoBlock extends AbstractCOptionPage { private static final int PROJECT_LIST_MULTIPLIER = 10; - private static final String PREF_SYMBOLS = "ScannerSymbols"; - private static final String PREF_INCLUDES = "ScannerIncludes"; + private static final String PREF_SYMBOLS = "ScannerSymbols"; //$NON-NLS-1$ + private static final String PREF_INCLUDES = "ScannerIncludes"; //$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 PATHS = PREFIX + ".paths"; //$NON-NLS-1$ @@ -330,7 +331,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage { private String[] parseStringToList(String syms) { 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()); while (tok.hasMoreElements()) { list.add(tok.nextToken()); @@ -357,7 +358,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage { selItem, null); String newItem = null; - if (dialog.open() == InputDialog.OK) { + if (dialog.open() == Window.OK) { newItem = dialog.getValue(); if (newItem != null && !newItem.equals(selItem)) { pathList.setItem(index, newItem); @@ -384,7 +385,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage { selItem, null); String newItem = null; - if (dialog.open() == InputDialog.OK) { + if (dialog.open() == Window.OK) { newItem = dialog.getValue(); if (newItem != null && !newItem.equals(selItem)) { symbolList.setItem(index, newItem); @@ -490,7 +491,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage { // Popup an entry dialog InputDialog dialog = new InputDialog(shell, MakeUIPlugin.getResourceString(PATH_TITLE), MakeUIPlugin.getResourceString(PATH_LABEL), "", null); //$NON-NLS-1$ String path = null; - if (dialog.open() == InputDialog.OK) { + if (dialog.open() == Window.OK) { path = dialog.getValue(); } if (path != null && path.length() > 0) { @@ -504,7 +505,7 @@ public class BuildPathInfoBlock extends AbstractCOptionPage { // Popup an entry dialog InputDialog dialog = new InputDialog(shell, MakeUIPlugin.getResourceString(SYMBOL_TITLE), MakeUIPlugin.getResourceString(SYMBOL_LABEL), "", null); //$NON-NLS-1$ String symbol = null; - if (dialog.open() == InputDialog.OK) { + if (dialog.open() == Window.OK) { symbol = dialog.getValue(); } if (symbol != null && symbol.length() > 0) { diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/MakeTargetDialog.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/MakeTargetDialog.java index ad9a0f0a360..76e45040b69 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/MakeTargetDialog.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/MakeTargetDialog.java @@ -128,7 +128,7 @@ public class MakeTargetDialog extends Dialog { * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ protected Control createDialogArea(Composite parent) { - Composite composite = (Composite) super.createDialogArea(parent); + Composite composite = (Composite)super.createDialogArea(parent); initializeDialogUnits(composite); String title; @@ -154,8 +154,8 @@ public class MakeTargetDialog extends Dialog { protected void createNameControl(Composite parent) { Composite composite = ControlFactory.createComposite(parent, 2); - ((GridLayout) composite.getLayout()).makeColumnsEqualWidth = false; - ((GridLayout) composite.getLayout()).horizontalSpacing = 0; + ((GridLayout)composite.getLayout()).makeColumnsEqualWidth = false; + ((GridLayout)composite.getLayout()).horizontalSpacing = 0; composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label label = ControlFactory.createLabel(composite, MakeUIPlugin.getResourceString(TARGET_NAME_LABEL)); ((GridData) (label.getLayoutData())).horizontalAlignment = GridData.BEGINNING; @@ -169,16 +169,21 @@ 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 - && fTarget.getName().equals(newName) - || fTargetManager.findTarget(fContainer, newName) == null) { - fStatusLine.setErrorMessage(null); - getButton(IDialogConstants.OK_ID).setEnabled(true); - } else { - fStatusLine.setErrorMessage("Target with that name already exits"); - getButton(IDialogConstants.OK_ID).setEnabled(false); - } + } else + try { + if (fTarget != null + && fTarget.getName().equals(newName) + || fTargetManager.findTarget(fContainer, newName) == null) { + fStatusLine.setErrorMessage(null); + getButton(IDialogConstants.OK_ID).setEnabled(true); + } else { + 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); } else { targetNameText.setText(generateUniqueName(targetString)); - } + } targetNameText.selectAll(); } private String generateUniqueName(String targetString) { String newName = targetString; int i = 0; - while(fTargetManager.findTarget(fContainer, newName) != null) { - i++; - newName = targetString + " (" + Integer.toString(i) + ")"; + try { + while (fTargetManager.findTarget(fContainer, newName) != null) { + i++; + newName = targetString + " (" + Integer.toString(i) + ")"; + } + } catch (CoreException e) { } return newName; } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java index 002dfbaa748..20c844d8444 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java @@ -20,6 +20,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Preferences; +import org.eclipse.jface.window.Window; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -219,8 +220,8 @@ public class SettingsBlock extends AbstractCOptionPage { getShell(), getContainer().getProject(), true, - "Selection Locations to build from."); - if (dialog.open() == ContainerSelectionDialog.OK) { + "Selection Location to build from."); + if (dialog.open() == Window.OK) { Object[] selection = dialog.getResult(); if (selection.length > 0) { buildLocation.setText(((IPath) selection[0]).toOSString()); diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/AddTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/AddTargetAction.java index a80a1fa95c1..b92844256c7 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/AddTargetAction.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/AddTargetAction.java @@ -27,7 +27,7 @@ public class AddTargetAction extends SelectionListenerAction { this.shell = shell; 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() { @@ -36,7 +36,7 @@ public class AddTargetAction extends SelectionListenerAction { MakeTargetDialog dialog = new MakeTargetDialog(shell, (IContainer) getStructuredSelection().getFirstElement()); dialog.open(); } catch (CoreException e) { - MakeUIPlugin.errorDialog(shell, "Internal Error", "", e); + MakeUIPlugin.errorDialog(shell, "Internal Error", "Internal Error", e); } } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/BuildTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/BuildTargetAction.java index 54b2538acfa..f59427f8f4c 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/BuildTargetAction.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/BuildTargetAction.java @@ -26,7 +26,7 @@ public class BuildTargetAction extends SelectionListenerAction { this.shell = shell; 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() { diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/DeleteTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/DeleteTargetAction.java index 99d1aeb6dd7..a18f50e9bc7 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/DeleteTargetAction.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/DeleteTargetAction.java @@ -31,7 +31,7 @@ public class DeleteTargetAction extends SelectionListenerAction { this.shell = shell; 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$ } /** diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/EditTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/EditTargetAction.java index 60ab60fca52..00ce925e197 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/EditTargetAction.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/EditTargetAction.java @@ -27,7 +27,7 @@ public class EditTargetAction extends SelectionListenerAction { this.shell = shell; 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() { @@ -37,7 +37,7 @@ public class EditTargetAction extends SelectionListenerAction { dialog = new MakeTargetDialog(shell, (IMakeTarget) getStructuredSelection().getFirstElement()); dialog.open(); } catch (CoreException e) { - MakeUIPlugin.errorDialog(shell, "Internal Error", "", e); + MakeUIPlugin.errorDialog(shell, "Internal Error", "Error editing target.", e); } } }