Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2019-08-13 18:10:38 -0400
committerLars Vogel2019-08-13 18:10:38 -0400
commita829029eb2163a134192291593a0e0d42913bf32 (patch)
tree2d09e08a0753273a4e2b5dc5efdb6bd6499b7952
parentdf69c5815c5638f7be55f5363e6521a11715e280 (diff)
downloadeclipse.platform.text-a829029eb2163a134192291593a0e0d42913bf32.tar.gz
eclipse.platform.text-a829029eb2163a134192291593a0e0d42913bf32.tar.xz
eclipse.platform.text-a829029eb2163a134192291593a0e0d42913bf32.zip
Bug 549858 - Use PlatformUI.getWorkbench instead of
AbstractUIPlugin.getWorkbench Change-Id: I68790f93741cc134199976229b1b6f4688c53a0f Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/AnnotationManagerTest.java4
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java2
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPlugin.java3
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/EditorOpener.java5
4 files changed, 9 insertions, 5 deletions
diff --git a/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/AnnotationManagerTest.java b/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/AnnotationManagerTest.java
index 0cad8d1f5..1ab30fb75 100644
--- a/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/AnnotationManagerTest.java
+++ b/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/AnnotationManagerTest.java
@@ -32,6 +32,8 @@ import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.ui.PlatformUI;
+
import org.eclipse.ui.texteditor.AnnotationTypeLookup;
import org.eclipse.ui.texteditor.ITextEditor;
@@ -116,7 +118,7 @@ public class AnnotationManagerTest {
NewSearchUI.runQueryInForeground(null, fQuery1);
FileSearchResult result= (FileSearchResult) fQuery1.getSearchResult();
IFile file= (IFile) result.getElements()[0];
- SearchTestPlugin.openTextEditor(SearchTestPlugin.getDefault().getWorkbench().getWorkbenchWindows()[0].getPages()[0], file);
+ SearchTestPlugin.openTextEditor(PlatformUI.getWorkbench().getWorkbenchWindows()[0].getPages()[0], file);
result.addMatch(new FileMatch(file));
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java
index 6a2333541..492de0e9c 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java
@@ -449,7 +449,7 @@ public class TextSearchVisitor {
*/
private Map<IFile, IDocument> evalNonFileBufferDocuments() {
Map<IFile, IDocument> result= new HashMap<>();
- IWorkbench workbench= SearchPlugin.getDefault().getWorkbench();
+ IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow[] windows= workbench.getWorkbenchWindows();
for (IWorkbenchWindow window : windows) {
IWorkbenchPage[] pages= window.getPages();
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPlugin.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPlugin.java
index d5860f28b..022ad0311 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPlugin.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPlugin.java
@@ -42,6 +42,7 @@ import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.search.internal.core.text.TextSearchEngineRegistry;
@@ -113,7 +114,7 @@ public class SearchPlugin extends AbstractUIPlugin {
* @return returns <code>null</code> if the active window is not a workbench window
*/
public static IWorkbenchWindow getActiveWorkbenchWindow() {
- IWorkbenchWindow window= fgSearchPlugin.getWorkbench().getActiveWorkbenchWindow();
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
final WindowRef windowRef= new WindowRef();
Display.getDefault().syncExec(() -> setActiveWorkbenchWindow(windowRef));
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/EditorOpener.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/EditorOpener.java
index 2c00d04fa..1474bad01 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/EditorOpener.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/EditorOpener.java
@@ -28,13 +28,13 @@ import org.eclipse.ui.IEditorRegistry;
import org.eclipse.ui.IReusableEditor;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.search.internal.ui.SearchMessages;
-import org.eclipse.search.internal.ui.SearchPlugin;
import org.eclipse.search.ui.NewSearchUI;
public class EditorOpener {
@@ -80,7 +80,8 @@ public class EditorOpener {
private String getEditorID(IFile file) throws PartInitException {
IEditorDescriptor desc = IDE.getEditorDescriptor(file, true, true);
if (desc == null)
- return SearchPlugin.getDefault().getWorkbench().getEditorRegistry().findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID).getId();
+ return PlatformUI.getWorkbench().getEditorRegistry().findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID)
+ .getId();
return desc.getId();
}

Back to the top