bug 23408
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/JavaSourceLookupDialog.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/JavaSourceLookupDialog.java
new file mode 100644
index 0000000..1397978
--- /dev/null
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/JavaSourceLookupDialog.java
Binary files differ
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/JavaUISourceLocator.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/JavaUISourceLocator.java
index 699afe3..be46a35 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/JavaUISourceLocator.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/JavaUISourceLocator.java
@@ -1,14 +1,14 @@
package org.eclipse.jdt.debug.ui;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
+/**********************************************************************
+Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
+This file is made available under the terms of the Common Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/cpl-v10.html
+**********************************************************************/
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.model.IPersistableSourceLocator;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.jdt.core.IJavaProject;
@@ -17,21 +17,9 @@
import org.eclipse.jdt.debug.core.IJavaStackFrame;
import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
import org.eclipse.jdt.internal.debug.ui.launcher.LauncherMessages;
-import org.eclipse.jdt.internal.debug.ui.launcher.SourceLookupBlock;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jdt.launching.sourcelookup.IJavaSourceLocation;
import org.eclipse.jdt.launching.sourcelookup.JavaSourceLocator;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.FontMetrics;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
/**
* A source locator that prompts the user to find source when source cannot
@@ -138,98 +126,22 @@
Runnable prompter = new Runnable() {
public void run() {
try {
- SourceLookupDialog dialog= new SourceLookupDialog(JDIDebugUIPlugin.getActiveWorkbenchShell(), frame.getDeclaringTypeName(), frame.getLaunch().getLaunchConfiguration(), JavaUISourceLocator.this);
- dialog.open();
- fAllowedToAsk= !dialog.isNotAskAgain();
- } catch (DebugException e) {
+ String message = LauncherMessages.getFormattedString("JavaUISourceLocator.selectprojects.message", frame.getDeclaringTypeName()); //$NON-NLS-1$
+ ILaunchConfiguration configuration = frame.getLaunch().getLaunchConfiguration();
+ JavaSourceLookupDialog dialog= new JavaSourceLookupDialog(JDIDebugUIPlugin.getActiveWorkbenchShell(), message, configuration);
+ int result = dialog.open();
+ if (result == dialog.OK) {
+ fAllowedToAsk= !dialog.isNotAskAgain();
+ JavaUISourceLocator.this.initializeDefaults(configuration);
+ }
+ } catch (CoreException e) {
JDIDebugUIPlugin.log(e);
}
}
};
JDIDebugUIPlugin.getStandardDisplay().syncExec(prompter);
}
-
- /**
- * Dialog that prompts for source lookup path.
- */
- private static class SourceLookupDialog extends Dialog {
- private SourceLookupBlock fSourceLookupBlock;
- private JavaUISourceLocator fLocator;
- private ILaunchConfiguration fConfiguration;
- private String fTypeName;
- private boolean fNotAskAgain;
- private Button fAskAgainCheckBox;
-
- public SourceLookupDialog(Shell shell, String typeName, ILaunchConfiguration configuration, JavaUISourceLocator locator) {
- super(shell);
- fSourceLookupBlock= new SourceLookupBlock();
- fTypeName= typeName;
- fNotAskAgain= false;
- fAskAgainCheckBox= null;
- fLocator = locator;
- fConfiguration = configuration;
- }
-
- public boolean isNotAskAgain() {
- return fNotAskAgain;
- }
-
-
- protected Control createDialogArea(Composite parent) {
- getShell().setText(LauncherMessages.getString("JavaUISourceLocator.selectprojects.title")); //$NON-NLS-1$
-
- Composite composite= (Composite) super.createDialogArea(parent);
- composite.setLayout(new GridLayout());
-
- Label message= new Label(composite, SWT.LEFT + SWT.WRAP);
- message.setText(LauncherMessages.getFormattedString("JavaUISourceLocator.selectprojects.message", fTypeName)); //$NON-NLS-1$
- GridData data= new GridData();
- data.widthHint= convertWidthInCharsToPixels(message, 70);
- message.setLayoutData(data);
-
- fSourceLookupBlock.createControl(composite);
- Control inner = fSourceLookupBlock.getControl();
- fSourceLookupBlock.initializeFrom(fConfiguration);
- inner.setLayoutData(new GridData(GridData.FILL_BOTH));
- fAskAgainCheckBox= new Button(composite, SWT.CHECK + SWT.WRAP);
- data= new GridData();
- data.widthHint= convertWidthInCharsToPixels(fAskAgainCheckBox, 70);
- fAskAgainCheckBox.setLayoutData(data);
- fAskAgainCheckBox.setText(LauncherMessages.getString("JavaUISourceLocator.askagain.message")); //$NON-NLS-1$
-
- return composite;
- }
-
- /**
- * @see Dialog#convertWidthInCharsToPixels(FontMetrics, int)
- */
- protected int convertWidthInCharsToPixels(Control control, int chars) {
- GC gc = new GC(control);
- gc.setFont(control.getFont());
- FontMetrics fontMetrics= gc.getFontMetrics();
- gc.dispose();
- return Dialog.convertWidthInCharsToPixels(fontMetrics, chars);
- }
-
- protected void okPressed() {
- try {
- if (fAskAgainCheckBox != null) {
- fNotAskAgain= fAskAgainCheckBox.getSelection();
- }
- ILaunchConfigurationWorkingCopy wc = fConfiguration.getWorkingCopy();
- fSourceLookupBlock.performApply(wc);
- if (!fConfiguration.contentsEqual(wc)) {
- fConfiguration = wc.doSave();
- fLocator.initializeDefaults(fConfiguration);
- }
- } catch (CoreException e) {
- JDIDebugUIPlugin.log(e);
- }
- super.okPressed();
- }
- }
-
/**
* @see IPersistableSourceLocator#getMemento()
*/