diff options
author | Michael Rennie | 2006-11-16 17:09:24 +0000 |
---|---|---|
committer | Michael Rennie | 2006-11-16 17:09:24 +0000 |
commit | a6d8573a4ac98c999b1029a5e2206f2d1145b95f (patch) | |
tree | 21fe64c548814d5f745edd120cc858a9c7b8cb52 /org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup | |
parent | c130146e210d0c6b4c0330c63f9629144c06f4ad (diff) | |
download | eclipse.platform.debug-a6d8573a4ac98c999b1029a5e2206f2d1145b95f.tar.gz eclipse.platform.debug-a6d8573a4ac98c999b1029a5e2206f2d1145b95f.tar.xz eclipse.platform.debug-a6d8573a4ac98c999b1029a5e2206f2d1145b95f.zip |
Bug 164682
NPE SourceLookupPanel add external archive
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup')
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java | 29 | ||||
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupDialog.java | 17 |
2 files changed, 34 insertions, 12 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java index 4e7cd10c2..98e4dab60 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java @@ -24,6 +24,8 @@ import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupManager; import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupUIMessages; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.resource.JFaceColors; import org.eclipse.jface.window.Window; import org.eclipse.swt.SWT; @@ -163,9 +165,15 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE ISourceLocator locator = null; ILaunch launch = null; IAdaptable selection = DebugUITools.getDebugContext(); - - if(selection == null) return; - + if(selection == null) { + new MessageDialog(getSite().getShell(), + SourceLookupUIMessages.CommonSourceNotFoundEditor_0, + null, + SourceLookupUIMessages.CommonSourceNotFoundEditor_1, + MessageDialog.INFORMATION, + new String[] {IDialogConstants.OK_LABEL}, 0).open(); + return; + } if (selection.getAdapter(ILaunch.class) != null ) { launch = (ILaunch) selection.getAdapter(ILaunch.class); locator = launch.getSourceLocator(); @@ -174,15 +182,14 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE launch = ((IDebugElement)selection.getAdapter(IDebugElement.class)).getLaunch(); locator = launch.getSourceLocator(); } - else return; //should not occur - if (locator == null || !(locator instanceof AbstractSourceLookupDirector)) + else { + return; //should not occur + } + if (locator == null || !(locator instanceof AbstractSourceLookupDirector)) { return; - - final SourceLookupDialog dialog = - new SourceLookupDialog(DebugUIPlugin.getShell(),(AbstractSourceLookupDirector) locator); - - int result = dialog.open(); - if(result == Window.OK) { + } + final SourceLookupDialog dialog = new SourceLookupDialog(DebugUIPlugin.getShell(),(AbstractSourceLookupDirector) locator); + if(dialog.open() == Window.OK) { IWorkbenchPage page = getEditorSite().getPage(); SourceLookupManager.getDefault().displaySource(getArtifact(), page, true); closeEditor(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupDialog.java index 30c2fad6f..d479ad567 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupDialog.java @@ -10,6 +10,9 @@ *******************************************************************************/ package org.eclipse.debug.ui.sourcelookup; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; import org.eclipse.debug.internal.ui.DebugPluginImages; import org.eclipse.debug.internal.ui.DebugUIPlugin; @@ -85,6 +88,10 @@ public class SourceLookupDialog extends TitleAreaDialog { fPanel.createControl(composite); fPanel.initializeFrom(fDirector); Dialog.applyDialogFont(composite); + ILaunchConfiguration config = fDirector.getLaunchConfiguration(); + if(config != null && config.isReadOnly()) { + setErrorMessage(SourceLookupUIMessages.SourceLookupDialog_0+config.getName()+SourceLookupUIMessages.SourceLookupDialog_1); + } PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IDebugHelpContextIds.EDIT_SOURCELOOKUP_DIALOG); return composite; @@ -94,7 +101,15 @@ public class SourceLookupDialog extends TitleAreaDialog { * @see org.eclipse.jface.dialogs.Dialog#okPressed() */ protected void okPressed() { - fPanel.performApply(null); + ILaunchConfiguration config = fDirector.getLaunchConfiguration(); + ILaunchConfigurationWorkingCopy copy = null; + if(config != null) { + try { + copy = config.getWorkingCopy(); + } + catch (CoreException e) {DebugUIPlugin.log(e);} + } + fPanel.performApply(copy); super.okPressed(); } |