aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-11-09 14:07:53 -0800
committerTor Norbye <tnorbye@google.com>2012-11-20 16:03:10 -0800
commit4b4a3cd814560bc51e1e0fb8cb1772bd03c087bc (patch)
tree0cc4a55542604c9138d4146c6a613b4bb04d5dbb /eclipse
parentfd3fb3d73dec09585c52a310019095877c2b2167 (diff)
downloadsdk-4b4a3cd814560bc51e1e0fb8cb1772bd03c087bc.zip
sdk-4b4a3cd814560bc51e1e0fb8cb1772bd03c087bc.tar.gz
sdk-4b4a3cd814560bc51e1e0fb8cb1772bd03c087bc.tar.bz2
Add AdtPlugin.getShell()
A lot of SWT and JFace methods require a Shell, and we had a lot of the following calls sprinkled throughout the codebase: AdtPlugin.getDisplay().getActiveShell() However, getActiveShell() can return null in quite a few cases (where it's not necessary), for example during focus transfers. This CL adds a new method, AdtPlugin.getShell(), which first tries the above call, but if that fails, will try harder to find another valid shell (e.g. the first shell in Display.getShells()). Change-Id: I3214ad56042be6eaf9b0fe0843c820e973fba8c0
Diffstat (limited to 'eclipse')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java45
-rw-r--r--[-rwxr-xr-x]eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/AddSupportJarAction.java2
-rw-r--r--[-rwxr-xr-x]eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/AvdManagerAction.java2
-rw-r--r--[-rwxr-xr-x]eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/SdkManagerAction.java4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/ConvertSwitchQuickFixProcessor.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ExportScreenshotAction.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderPreview.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderPreviewManager.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gre/ClientRulesEngine.java10
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/ConvertToDpFix.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintFixGenerator.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/RunLintAction.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/renamepackage/RenamePackageAction.java6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ResourceChooser.java6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreator.java6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewTemplatePage.java2
18 files changed, 67 insertions, 36 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
index 12a861b..f8971dc 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
@@ -326,19 +326,50 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger {
return sPlugin;
}
+ /**
+ * Returns the current display, if any
+ *
+ * @return the display
+ */
+ @NonNull
public static Display getDisplay() {
- IWorkbench bench = null;
synchronized (AdtPlugin.class) {
- if (sPlugin == null) {
- return null;
+ if (sPlugin != null) {
+ IWorkbench bench = sPlugin.getWorkbench();
+ if (bench != null) {
+ Display display = bench.getDisplay();
+ if (display != null) {
+ return display;
+ }
+ }
}
- bench = sPlugin.getWorkbench();
}
- if (bench != null) {
- return bench.getDisplay();
+ Display display = Display.getCurrent();
+ if (display != null) {
+ return display;
}
- return null;
+
+ return Display.getDefault();
+ }
+
+ /**
+ * Returns the shell, if any
+ *
+ * @return the shell, if any
+ */
+ @Nullable
+ public static Shell getShell() {
+ Display display = AdtPlugin.getDisplay();
+ Shell shell = display.getActiveShell();
+ if (shell == null) {
+ Shell[] shells = display.getShells();
+ if (shells.length > 0) {
+ shell = shells[0];
+ }
+ }
+
+ return shell;
}
/** Returns the adb path relative to the sdk folder */
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/AddSupportJarAction.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/AddSupportJarAction.java
index 44321aa..c21c8a4 100755..100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/AddSupportJarAction.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/AddSupportJarAction.java
@@ -184,7 +184,7 @@ public class AddSupportJarAction implements IObjectActionDelegate {
// and get the installation path of the library.
AdtUpdateDialog window = new AdtUpdateDialog(
- AdtPlugin.getDisplay().getActiveShell(),
+ AdtPlugin.getShell(),
new AdtConsoleSdkLog(),
sdkLocation);
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/AvdManagerAction.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/AvdManagerAction.java
index 46177b0..2597090 100755..100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/AvdManagerAction.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/AvdManagerAction.java
@@ -55,7 +55,7 @@ public class AvdManagerAction implements IWorkbenchWindowActionDelegate, IObject
// Runs the updater window, directing all logs to the ADT console.
AvdManagerWindow window = new AvdManagerWindow(
- AdtPlugin.getDisplay().getActiveShell(),
+ AdtPlugin.getShell(),
new AdtConsoleSdkLog(),
sdk.getSdkLocation(),
AvdInvocationContext.IDE);
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/SdkManagerAction.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/SdkManagerAction.java
index 9cae8a4..4155989 100755..100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/SdkManagerAction.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/actions/SdkManagerAction.java
@@ -137,7 +137,7 @@ public class SdkManagerAction implements IWorkbenchWindowActionDelegate, IObject
final AtomicBoolean returnValue = new AtomicBoolean(false);
final CloseableProgressMonitorDialog p =
- new CloseableProgressMonitorDialog(AdtPlugin.getDisplay().getActiveShell());
+ new CloseableProgressMonitorDialog(AdtPlugin.getShell());
p.setOpenOnRun(true);
try {
p.run(true /*fork*/, true /*cancelable*/, new IRunnableWithProgress() {
@@ -262,7 +262,7 @@ public class SdkManagerAction implements IWorkbenchWindowActionDelegate, IObject
// log window now.)
SdkUpdaterWindow window = new SdkUpdaterWindow(
- AdtPlugin.getDisplay().getActiveShell(),
+ AdtPlugin.getShell(),
new AdtConsoleSdkLog() {
@Override
public void info(@NonNull String msgFormat, Object... args) {
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/ConvertSwitchQuickFixProcessor.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/ConvertSwitchQuickFixProcessor.java
index 5a71edc..a99dc76 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/ConvertSwitchQuickFixProcessor.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/ConvertSwitchQuickFixProcessor.java
@@ -185,7 +185,7 @@ public class ConvertSwitchQuickFixProcessor implements IQuickFixProcessor {
@Override
public void apply(IDocument document) {
- Shell shell = AdtPlugin.getDisplay().getActiveShell();
+ Shell shell = AdtPlugin.getShell();
ConvertSwitchDialog dialog = new ConvertSwitchDialog(shell, mExpression);
dialog.open();
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ExportScreenshotAction.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ExportScreenshotAction.java
index 6829c40..ac3328d 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ExportScreenshotAction.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ExportScreenshotAction.java
@@ -42,7 +42,7 @@ class ExportScreenshotAction extends Action {
@Override
public void run() {
- Shell shell = AdtPlugin.getDisplay().getActiveShell();
+ Shell shell = AdtPlugin.getShell();
ImageOverlay imageOverlay = mCanvas.getImageOverlay();
BufferedImage image = imageOverlay.getAwtImage();
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java
index 445b295..051c568 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java
@@ -2366,7 +2366,7 @@ public class GraphicalEditorPart extends EditorPart
@SuppressWarnings("restriction")
String id = BuildPathsPropertyPage.PROP_ID;
PreferencesUtil.createPropertyDialogOn(
- AdtPlugin.getDisplay().getActiveShell(),
+ AdtPlugin.getShell(),
getProject(), id, null, null).open();
break;
case LINK_OPEN_CLASS:
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderPreview.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderPreview.java
index 5a926e8..496173a 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderPreview.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderPreview.java
@@ -813,7 +813,7 @@ public class RenderPreview implements IJobChangeListener {
if (x <= left) {
// Edit. For now, just rename
InputDialog d = new InputDialog(
- AdtPlugin.getDisplay().getActiveShell(),
+ AdtPlugin.getShell(),
"Rename Preview", // title
"Name:",
getDisplayName(),
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderPreviewManager.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderPreviewManager.java
index 0214433..4b0f484 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderPreviewManager.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderPreviewManager.java
@@ -682,7 +682,7 @@ public class RenderPreviewManager {
name = getUniqueName();
}
InputDialog d = new InputDialog(
- AdtPlugin.getDisplay().getActiveShell(),
+ AdtPlugin.getShell(),
"Add as Thumbnail Preview", // title
"Name of thumbnail:",
name,
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gre/ClientRulesEngine.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gre/ClientRulesEngine.java
index 5162a48..460ef21 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gre/ClientRulesEngine.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gre/ClientRulesEngine.java
@@ -150,7 +150,7 @@ class ClientRulesEngine implements IClientRulesEngine {
@Override
public void displayAlert(@NonNull String message) {
MessageDialog.openInformation(
- AdtPlugin.getDisplay().getActiveShell(),
+ AdtPlugin.getShell(),
mFqcn, // title
message);
}
@@ -175,7 +175,7 @@ class ClientRulesEngine implements IClientRulesEngine {
}
InputDialog d = new InputDialog(
- AdtPlugin.getDisplay().getActiveShell(),
+ AdtPlugin.getShell(),
mFqcn, // title
message,
value == null ? "" : value, //$NON-NLS-1$
@@ -324,7 +324,7 @@ class ClientRulesEngine implements IClientRulesEngine {
// get the resource repository for this project and the system resources.
ResourceRepository projectRepository =
ResourceManager.getInstance().getProjectResources(project);
- Shell shell = AdtPlugin.getDisplay().getActiveShell();
+ Shell shell = AdtPlugin.getShell();
if (shell == null) {
return null;
}
@@ -363,7 +363,7 @@ class ClientRulesEngine implements IClientRulesEngine {
GraphicalEditorPart editor = mRulesEngine.getEditor();
IProject project = editor.getProject();
if (project != null) {
- Shell shell = AdtPlugin.getDisplay().getActiveShell();
+ Shell shell = AdtPlugin.getShell();
if (shell == null) {
return null;
}
@@ -462,7 +462,7 @@ class ClientRulesEngine implements IClientRulesEngine {
scope = SearchEngine.createJavaSearchScope(subTypes, IJavaSearchScope.SOURCES);
}
- Shell parent = AdtPlugin.getDisplay().getActiveShell();
+ Shell parent = AdtPlugin.getShell();
final AtomicReference<String> returnValue =
new AtomicReference<String>();
final AtomicReference<SelectionDialog> dialogHolder =
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java
index d9aab14..31d4d0f 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java
@@ -606,7 +606,7 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
// open the chooser dialog. It'll fill 'response' with the device to use
// or the AVD to launch.
DeviceChooserDialog dialog = new DeviceChooserDialog(
- AdtPlugin.getDisplay().getActiveShell(),
+ AdtPlugin.getShell(),
response, launchInfo.getPackageName(),
desiredProjectTarget, minApiVersion);
if (dialog.open() == Dialog.OK) {
@@ -1377,7 +1377,7 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
}
}
} catch (CoreException e) {
- MessageDialog.openError(AdtPlugin.getDisplay().getActiveShell(),
+ MessageDialog.openError(AdtPlugin.getShell(),
"Launch Error", e.getStatus().getMessage());
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/ConvertToDpFix.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/ConvertToDpFix.java
index 44b676f..628972f 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/ConvertToDpFix.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/ConvertToDpFix.java
@@ -54,7 +54,7 @@ final class ConvertToDpFix extends DocumentFix implements IInputValidator {
@Override
protected void apply(IDocument document, IStructuredModel model, Node node, int start,
int end) {
- Shell shell = AdtPlugin.getDisplay().getActiveShell();
+ Shell shell = AdtPlugin.getShell();
InputDensityDialog densityDialog = new InputDensityDialog(shell);
if (densityDialog.open() == Window.OK) {
int dpi = densityDialog.getDensity();
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintFixGenerator.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintFixGenerator.java
index 5d2a2bb..4c356b7 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintFixGenerator.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintFixGenerator.java
@@ -505,7 +505,7 @@ public class LintFixGenerator implements IMarkerResolutionGenerator2, IQuickAssi
sb.append(issue.getMoreInfo());
}
- MessageDialog.openInformation(AdtPlugin.getDisplay().getActiveShell(), "More Info",
+ MessageDialog.openInformation(AdtPlugin.getShell(), "More Info",
sb.toString());
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/RunLintAction.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/RunLintAction.java
index e468a5a..1de903e 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/RunLintAction.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/RunLintAction.java
@@ -81,7 +81,7 @@ public class RunLintAction implements IObjectActionDelegate, IMenuCreator,
List<IProject> projects = AdtUtils.getSelectedProjects(selection);
if (projects.isEmpty() && warn) {
- MessageDialog.openWarning(AdtPlugin.getDisplay().getActiveShell(), "Lint",
+ MessageDialog.openWarning(AdtPlugin.getShell(), "Lint",
"Could not run Lint: Select an Android project first.");
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/renamepackage/RenamePackageAction.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/renamepackage/RenamePackageAction.java
index c556f14..bb475aa 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/renamepackage/RenamePackageAction.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/renamepackage/RenamePackageAction.java
@@ -102,7 +102,7 @@ public class RenamePackageAction implements IObjectActionDelegate {
// enforce a save as a convenience.
RefactoringSaveHelper save_helper = new RefactoringSaveHelper(
RefactoringSaveHelper.SAVE_ALL_ALWAYS_ASK);
- if (save_helper.saveEditors(AdtPlugin.getDisplay().getActiveShell())) {
+ if (save_helper.saveEditors(AdtPlugin.getShell())) {
promptNewName(project);
}
}
@@ -142,7 +142,7 @@ public class RenamePackageAction implements IObjectActionDelegate {
}
};
- InputDialog dialog = new InputDialog(AdtPlugin.getDisplay().getActiveShell(),
+ InputDialog dialog = new InputDialog(AdtPlugin.getShell(),
"Rename Application Package", "Enter new package name:", oldPackageNameString,
validator);
@@ -165,7 +165,7 @@ public class RenamePackageAction implements IObjectActionDelegate {
new ApplicationPackageNameRefactoringWizard(package_name_refactoring);
RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
try {
- op.run(AdtPlugin.getDisplay().getActiveShell(), package_name_refactoring.getName());
+ op.run(AdtPlugin.getShell(), package_name_refactoring.getName());
} catch (InterruptedException e) {
Status s = new Status(Status.ERROR, AdtPlugin.PLUGIN_ID, e.getMessage(), e);
AdtPlugin.getDefault().getLog().log(s);
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ResourceChooser.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ResourceChooser.java
index a215cdc..ce828cf 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ResourceChooser.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ResourceChooser.java
@@ -641,7 +641,7 @@ public class ResourceChooser extends AbstractElementListSelectionDialog implemen
@Nullable
private String createNewFile(ResourceType type) {
// Show a name/value dialog entering the key name and the value
- Shell shell = AdtPlugin.getDisplay().getActiveShell();
+ Shell shell = AdtPlugin.getShell();
if (shell == null) {
return null;
}
@@ -649,7 +649,7 @@ public class ResourceChooser extends AbstractElementListSelectionDialog implemen
ResourceNameValidator validator = ResourceNameValidator.create(true /*allowXmlExtension*/,
mProject, mResourceType);
InputDialog d = new InputDialog(
- AdtPlugin.getDisplay().getActiveShell(),
+ AdtPlugin.getShell(),
"Enter name", // title
"Enter name",
"", //$NON-NLS-1$
@@ -674,7 +674,7 @@ public class ResourceChooser extends AbstractElementListSelectionDialog implemen
@Nullable
private String createNewValue(ResourceType type) {
// Show a name/value dialog entering the key name and the value
- Shell shell = AdtPlugin.getDisplay().getActiveShell();
+ Shell shell = AdtPlugin.getShell();
if (shell == null) {
return null;
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreator.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreator.java
index 2f7ad7a..245d84e 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreator.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreator.java
@@ -522,10 +522,10 @@ public class NewProjectCreator {
if (core.getStatus().getCode() == IResourceStatus.CASE_VARIANT_EXISTS) {
// The error indicates the file system is not case sensitive
// and there's a resource with a similar name.
- MessageDialog.openError(AdtPlugin.getDisplay().getActiveShell(),
+ MessageDialog.openError(AdtPlugin.getShell(),
"Error", "Error: Case Variant Exists");
} else {
- ErrorDialog.openError(AdtPlugin.getDisplay().getActiveShell(),
+ ErrorDialog.openError(AdtPlugin.getShell(),
"Error", core.getMessage(), core.getStatus());
}
} else {
@@ -539,7 +539,7 @@ public class NewProjectCreator {
if (msg == null) {
msg = t.toString();
}
- MessageDialog.openError(AdtPlugin.getDisplay().getActiveShell(), "Error", msg);
+ MessageDialog.openError(AdtPlugin.getShell(), "Error", msg);
}
e.printStackTrace();
} catch (InterruptedException e) {
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewTemplatePage.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewTemplatePage.java
index 1cf5daf..1a2d3ca 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewTemplatePage.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewTemplatePage.java
@@ -811,7 +811,7 @@ public class NewTemplatePage extends WizardPage
scope = SearchEngine.createJavaSearchScope(classes, IJavaSearchScope.SOURCES);
}
- Shell parent = AdtPlugin.getDisplay().getActiveShell();
+ Shell parent = AdtPlugin.getShell();
final SelectionDialog dialog = JavaUI.createTypeDialog(
parent,
new ProgressMonitorDialog(parent),