diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpPostSaveListener.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpPostSaveListener.java index e8010fbefb9..3a31eaf25c3 100644 --- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpPostSaveListener.java +++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpPostSaveListener.java @@ -71,7 +71,6 @@ import org.eclipse.jface.text.Position; import org.eclipse.jface.text.Region; -import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.PreferencesUtil; import org.eclipse.ltk.core.refactoring.Change; @@ -474,7 +473,7 @@ private int showStatus(RefactoringStatus status) { if (!status.hasError()) return Window.OK; - Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + Shell shell= JavaPlugin.getActiveWorkbenchShell(); Dialog dialog= RefactoringUI.createRefactoringStatusDialog(status, shell, "", false); //$NON-NLS-1$ return dialog.open(); @@ -674,7 +673,7 @@ private void showSlowCleanUpsWarning(HashSet slowCleanUps) { private void showSlowCleanUpDialog(final StringBuilder cleanUpNames) { if (OptionalMessageDialog.isDialogEnabled(SlowCleanUpWarningDialog.ID)) { - Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + Shell shell= JavaPlugin.getActiveWorkbenchShell(); new SlowCleanUpWarningDialog(shell, FixMessages.CleanUpPostSaveListener_SlowCleanUpDialog_title, cleanUpNames.toString()).open(); } } diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringExecutionStarter.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringExecutionStarter.java index 660a66b19fb..4331fdd2bae 100644 --- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringExecutionStarter.java +++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringExecutionStarter.java @@ -36,8 +36,6 @@ import org.eclipse.jface.text.ITextSelection; -import org.eclipse.ui.PlatformUI; - import org.eclipse.ltk.core.refactoring.Refactoring; import org.eclipse.ltk.core.refactoring.RefactoringCore; import org.eclipse.ltk.core.refactoring.RefactoringStatus; @@ -109,6 +107,7 @@ import org.eclipse.jdt.ui.refactoring.RefactoringSaveHelper; import org.eclipse.jdt.ui.refactoring.RenameSupport; +import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.actions.ActionMessages; import org.eclipse.jdt.internal.ui.fix.CleanUpRefactoringWizard; import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings; @@ -249,7 +248,7 @@ public static void startCleanupRefactoring(ICompilationUnit[] cus, ICleanUp[] cl if (refactoring.getCleanUpTargetsSize() > 1) { context= new ProgressMonitorDialog(shell); } else { - context= PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + context= JavaPlugin.getActiveWorkbenchWindow(); } RefactoringExecutionHelper helper= new RefactoringExecutionHelper(refactoring, IStatus.INFO, IRefactoringSaveModes.SAVE_REFACTORING, shell, context); diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/JavaPlugin.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/JavaPlugin.java index d95a28904d9..78de1a795fa 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/JavaPlugin.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/JavaPlugin.java @@ -284,11 +284,18 @@ public static IWorkspace getWorkspace() { } public static IWorkbenchPage getActivePage() { - return getDefault().internalGetActivePage(); + IWorkbenchWindow window= getActiveWorkbenchWindow(); + if (window != null) { + return window.getActivePage(); + } + return null; } public static IWorkbenchWindow getActiveWorkbenchWindow() { - return PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (PlatformUI.isWorkbenchRunning()) { + return PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + } + return null; } public static Shell getActiveWorkbenchShell() { @@ -544,13 +551,6 @@ public void stop(BundleContext context) throws Exception { } } - private IWorkbenchPage internalGetActivePage() { - IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (window == null) - return null; - return window.getActivePage(); - } - /** * Private deprecated method to avoid deprecation warnings * diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/AddGetterSetterTypeProposal.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/AddGetterSetterTypeProposal.java index ab929f5f734..680e1068488 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/AddGetterSetterTypeProposal.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/AddGetterSetterTypeProposal.java @@ -23,7 +23,6 @@ import org.eclipse.jface.text.IDocument; import org.eclipse.ui.IWorkbenchSite; -import org.eclipse.ui.PlatformUI; import org.eclipse.jdt.core.IType; @@ -33,6 +32,7 @@ import org.eclipse.jdt.ui.actions.AddGetterSetterAction; import org.eclipse.jdt.ui.text.java.correction.ChangeCorrectionProposal; +import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.JavaPluginImages; import org.eclipse.jdt.internal.ui.text.correction.CorrectionMessages; @@ -68,7 +68,7 @@ public void apply(IDocument document) { Display.getDefault().syncExec(() -> { try { IStructuredSelection selection= new StructuredSelection(fType); - IWorkbenchSite site= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getSite(); + IWorkbenchSite site= JavaPlugin.getActiveWorkbenchWindow().getActivePage().getActiveEditor().getSite(); new AddGetterSetterAction(site).run(selection); } catch (NullPointerException e) { // do nothing diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/EnablePreviewFeaturesAction.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/EnablePreviewFeaturesAction.java index b07cd16b6df..63a0ae8f20a 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/EnablePreviewFeaturesAction.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/EnablePreviewFeaturesAction.java @@ -34,7 +34,6 @@ import org.eclipse.ui.IObjectActionDelegate; import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.PreferencesUtil; import org.eclipse.jdt.core.IJavaProject; @@ -106,7 +105,7 @@ public void run(IAction action) { map.put(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED); fJavaProject.setOptions(map); - Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + Shell shell= JavaPlugin.getActiveWorkbenchShell(); Map data= new HashMap<>(); data.put(CompliancePreferencePage.DATA_SELECT_OPTION_KEY, JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES); data.put(CompliancePreferencePage.DATA_SELECT_OPTION_QUALIFIER, JavaCore.PLUGIN_ID); diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/HashCodeEqualsTypeProposal.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/HashCodeEqualsTypeProposal.java index 4c24a78cbf5..a0fba4e7f95 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/HashCodeEqualsTypeProposal.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/HashCodeEqualsTypeProposal.java @@ -23,7 +23,6 @@ import org.eclipse.jface.text.IDocument; import org.eclipse.ui.IWorkbenchSite; -import org.eclipse.ui.PlatformUI; import org.eclipse.jdt.core.IType; @@ -33,6 +32,7 @@ import org.eclipse.jdt.ui.actions.GenerateHashCodeEqualsAction; import org.eclipse.jdt.ui.text.java.correction.ChangeCorrectionProposal; +import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.JavaPluginImages; import org.eclipse.jdt.internal.ui.text.correction.CorrectionMessages; @@ -68,7 +68,7 @@ public void apply(IDocument document) { Display.getDefault().syncExec(() -> { try { IStructuredSelection selection= new StructuredSelection(fType); - IWorkbenchSite site= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getSite(); + IWorkbenchSite site= JavaPlugin.getActivePage().getActiveEditor().getSite(); new GenerateHashCodeEqualsAction(site).run(selection); } catch (NullPointerException e) { // do nothing diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/SurroundWithTemplateMenuAction.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/SurroundWithTemplateMenuAction.java index c5078456224..ae19bf66889 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/SurroundWithTemplateMenuAction.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/SurroundWithTemplateMenuAction.java @@ -22,7 +22,6 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.swt.widgets.Shell; import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.CoreException; @@ -95,14 +94,11 @@ public ConfigureTemplatesAction() { @Override public void run() { - PreferenceDialog preferenceDialog= PreferencesUtil.createPreferenceDialogOn(getShell(), JAVA_TEMPLATE_PREFERENCE_PAGE_ID, new String[] { JAVA_TEMPLATE_PREFERENCE_PAGE_ID, CODE_TEMPLATE_PREFERENCE_PAGE_ID }, null); + PreferenceDialog preferenceDialog= PreferencesUtil.createPreferenceDialogOn(JavaPlugin.getActiveWorkbenchShell(), JAVA_TEMPLATE_PREFERENCE_PAGE_ID, new String[] { JAVA_TEMPLATE_PREFERENCE_PAGE_ID, CODE_TEMPLATE_PREFERENCE_PAGE_ID }, null); preferenceDialog.getTreeViewer().expandAll(); preferenceDialog.open(); } - private Shell getShell() { - return JavaPlugin.getActiveWorkbenchWindow().getShell(); - } } private static Action NONE_APPLICABLE_ACTION= new Action(ActionMessages.SurroundWithTemplateMenuAction_NoneApplicable) { diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ToStringTypeProposal.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ToStringTypeProposal.java index df707d3e832..b352d114931 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ToStringTypeProposal.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ToStringTypeProposal.java @@ -23,7 +23,6 @@ import org.eclipse.jface.text.IDocument; import org.eclipse.ui.IWorkbenchSite; -import org.eclipse.ui.PlatformUI; import org.eclipse.jdt.core.IType; @@ -33,6 +32,7 @@ import org.eclipse.jdt.ui.actions.GenerateToStringAction; import org.eclipse.jdt.ui.text.java.correction.ChangeCorrectionProposal; +import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.JavaPluginImages; import org.eclipse.jdt.internal.ui.text.correction.CorrectionMessages; @@ -68,7 +68,7 @@ public void apply(IDocument document) { Display.getDefault().syncExec(() -> { try { IStructuredSelection selection= new StructuredSelection(fType); - IWorkbenchSite site= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getSite(); + IWorkbenchSite site= JavaPlugin.getActivePage().getActiveEditor().getSite(); new GenerateToStringAction(site).run(selection); } catch (NullPointerException e) { // do nothing diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/compare/JavaCompareWithEditionActionImpl.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/compare/JavaCompareWithEditionActionImpl.java index 85e7eefd451..fada4a05546 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/compare/JavaCompareWithEditionActionImpl.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/compare/JavaCompareWithEditionActionImpl.java @@ -21,14 +21,13 @@ import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.PlatformUI; - import org.eclipse.compare.CompareConfiguration; import org.eclipse.compare.CompareUI; import org.eclipse.jdt.core.IMember; import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; +import org.eclipse.jdt.internal.ui.JavaPlugin; /** @@ -67,7 +66,7 @@ public void run(ISelection selection) { ci.setHelpContextId(IJavaHelpContextIds.COMPARE_ELEMENT_WITH_HISTORY_DIALOG); CompareUI.openCompareDialog(ci); } else { - TeamUI.showHistoryFor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), input, pageSource); + TeamUI.showHistoryFor(JavaPlugin.getActivePage(), input, pageSource); } } } diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/JavadocView.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/JavadocView.java index d01793a9195..405cb3417c4 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/JavadocView.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/JavadocView.java @@ -792,7 +792,7 @@ protected Object computeInput(Object input) { return null; IWorkbenchPart part= null; - IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + IWorkbenchWindow window= JavaPlugin.getActiveWorkbenchWindow(); if (window != null) { IWorkbenchPage page= window.getActivePage(); if (page != null) { diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/jarpackager/CreateJarActionDelegate.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/jarpackager/CreateJarActionDelegate.java index 2c44c5ecd83..223e394eafa 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/jarpackager/CreateJarActionDelegate.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/jarpackager/CreateJarActionDelegate.java @@ -32,8 +32,6 @@ import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.ui.PlatformUI; - import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels; import org.eclipse.jdt.internal.corext.util.Messages; @@ -97,7 +95,7 @@ private IStatus export(JarPackageData[] jarPackages) { Shell shell= getShell(); IJarExportRunnable op= jarPackages[0].createJarExportRunnable(jarPackages, shell); try { - PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(false, true, op); + JavaPlugin.getActiveWorkbenchWindow().run(false, true, op); //PlatformUI.getWorkbench().getProgressService().run(false, true, op); // see bug 118152 } catch (InvocationTargetException ex) { if (ex.getTargetException() != null) { diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaElementImplementationHyperlink.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaElementImplementationHyperlink.java index 7cd12046cd7..da1267ea018 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaElementImplementationHyperlink.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaElementImplementationHyperlink.java @@ -35,7 +35,6 @@ import org.eclipse.jface.text.hyperlink.IHyperlink; import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.PlatformUI; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IMember; @@ -290,7 +289,7 @@ public void acceptSearchMatch(SearchMatch match) throws CoreException { IStatus status= new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.OK, Messages.format(JavaEditorMessages.JavaElementImplementationHyperlink_error_status_message, javaElement.getElementName()), e.getCause()); JavaPlugin.log(status); - ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), + ErrorDialog.openError(JavaPlugin.getActiveWorkbenchShell(), JavaEditorMessages.JavaElementImplementationHyperlink_hyperlinkText, JavaEditorMessages.JavaElementImplementationHyperlink_error_no_implementations_found_message, status); } catch (InterruptedException e) { diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/GetterSetterCorrectionSubProcessor.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/GetterSetterCorrectionSubProcessor.java index f2ae641428d..510de5e5f7b 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/GetterSetterCorrectionSubProcessor.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/GetterSetterCorrectionSubProcessor.java @@ -29,7 +29,6 @@ import org.eclipse.jface.text.IDocument; import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; import org.eclipse.ltk.core.refactoring.RefactoringStatus; import org.eclipse.ltk.core.refactoring.TextFileChange; @@ -105,7 +104,7 @@ public void apply(IDocument document) { refactoring.setConsiderVisibility(false);//private field references are just searched in local file }); if (fNoDialog) { - IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + IWorkbenchWindow window= JavaPlugin.getActiveWorkbenchWindow(); final RefactoringExecutionHelper helper= new RefactoringExecutionHelper(compositeRefactoring, RefactoringStatus.ERROR, IRefactoringSaveModes.SAVE_REFACTORING, JavaPlugin.getActiveWorkbenchShell(), window); if (Display.getCurrent() != null) { try { diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/PreviewFeaturesSubProcessor.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/PreviewFeaturesSubProcessor.java index 54832830e3a..3b21b8a6b43 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/PreviewFeaturesSubProcessor.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/PreviewFeaturesSubProcessor.java @@ -143,7 +143,7 @@ public static void getOpenCompliancePageToEnablePreviewFeaturesProposal(IInvocat @Override public void apply(IDocument document) { - Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + Shell shell= JavaPlugin.getActiveWorkbenchShell(); boolean usePropertyPage; if (!hasProjectSpecificOptions) { diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/proposals/FixCorrectionProposal.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/proposals/FixCorrectionProposal.java index b5256dd5251..acbc8e7cef2 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/proposals/FixCorrectionProposal.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/proposals/FixCorrectionProposal.java @@ -35,8 +35,6 @@ import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.contentassist.ICompletionProposalExtension2; -import org.eclipse.ui.PlatformUI; - import org.eclipse.ltk.core.refactoring.RefactoringCore; import org.eclipse.jdt.core.dom.CompilationUnit; @@ -108,7 +106,7 @@ public void resolve(MultiFixTarget[] targets, final IProgressMonitor monitor) th IRunnableContext context= (fork, cancelable, runnable) -> runnable.run(monitor == null ? new NullProgressMonitor() : monitor); - Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + Shell shell= JavaPlugin.getActiveWorkbenchShell(); RefactoringExecutionHelper helper= new RefactoringExecutionHelper(refactoring, IStatus.INFO, IRefactoringSaveModes.SAVE_REFACTORING, shell, context); try { helper.perform(true, true); @@ -208,7 +206,7 @@ public void apply(ITextViewer viewer, char trigger, int stateMask, int offset) { int stopSeverity= RefactoringCore.getConditionCheckingFailedSeverity(); Shell shell= JavaPlugin.getActiveWorkbenchShell(); - IRunnableContext context= PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + IRunnableContext context= JavaPlugin.getActiveWorkbenchWindow(); RefactoringExecutionHelper executer= new RefactoringExecutionHelper(refactoring, stopSeverity, IRefactoringSaveModes.SAVE_NOTHING, shell, context); try { executer.perform(true, true); diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaContentAssistHandler.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaContentAssistHandler.java index 79f19b80452..9bf1dd422d0 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaContentAssistHandler.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaContentAssistHandler.java @@ -20,10 +20,10 @@ import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; import org.eclipse.ui.texteditor.ITextEditor; +import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; import org.eclipse.jdt.internal.ui.javaeditor.SpecificContentAssistExecutor; @@ -56,7 +56,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException { } private ITextEditor getActiveEditor() { - IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + IWorkbenchWindow window= JavaPlugin.getActiveWorkbenchWindow(); if (window != null) { IWorkbenchPage page= window.getActivePage(); if (page != null) { diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/hover/AbstractAnnotationHover.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/hover/AbstractAnnotationHover.java index 346ffb02e0f..c044102ed71 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/hover/AbstractAnnotationHover.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/hover/AbstractAnnotationHover.java @@ -81,7 +81,6 @@ import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IStorageEditorInput; -import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.PreferencesUtil; import org.eclipse.ui.texteditor.AnnotationPreference; @@ -656,7 +655,7 @@ public ConfigureAnnotationsAction(Annotation annotation, IInformationControl inf */ @Override public void run() { - Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + Shell shell= JavaPlugin.getActiveWorkbenchShell(); Object data= null; AnnotationPreference preference= getAnnotationPreference(fAnnotation); diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/hover/ConfigureProblemSeverityAction.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/hover/ConfigureProblemSeverityAction.java index 8871155f382..02b44a0921a 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/hover/ConfigureProblemSeverityAction.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/hover/ConfigureProblemSeverityAction.java @@ -25,7 +25,6 @@ import org.eclipse.jface.text.IInformationControl; -import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.PreferencesUtil; import org.eclipse.jdt.core.IJavaProject; @@ -34,6 +33,7 @@ import org.eclipse.jdt.ui.JavaElementLabels; +import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.JavaPluginImages; import org.eclipse.jdt.internal.ui.dialogs.OptionalMessageDialog; import org.eclipse.jdt.internal.ui.preferences.ComplianceConfigurationBlock; @@ -85,7 +85,7 @@ public ConfigureProblemSeverityAction(IJavaProject project, String optionId, Str public void run() { boolean showPropertyPage; - Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + Shell shell= JavaPlugin.getActiveWorkbenchShell(); if (!hasProjectSpecificOptions()) { String message= Messages.format( diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/javadoc/JavaDocAutoIndentStrategy.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/javadoc/JavaDocAutoIndentStrategy.java index 12690865297..4481064d8ab 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/javadoc/JavaDocAutoIndentStrategy.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/javadoc/JavaDocAutoIndentStrategy.java @@ -28,7 +28,6 @@ import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; import org.eclipse.ui.texteditor.ITextEditorExtension3; @@ -528,7 +527,7 @@ private static IMethod getInheritedMethod(IMethod method) throws JavaModelExcept */ private static ICompilationUnit getCompilationUnit() { - IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + IWorkbenchWindow window= JavaPlugin.getActiveWorkbenchWindow(); if (window == null) return null;