From daa3c234bc64e1405a381b08fb881198400a9240 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Sat, 10 Aug 2019 05:50:51 +0200 Subject: Bug 549858 - Use PlatformUI.getWorkbench instead of AbstractUIPlugin.getWorkbench AbstractUIPlugin.getWorkbench is a simple wrapper around PlatformUI.getWorkbench . As we want to reduce the usage of activators, we are planning to deprecate AbstractUIPlugin.getWorkbench via Bug 549848. Activators can slow down the start of Eclipse applications and should be avoided if possible. Change-Id: Id61f894709d98534021f412405b1cde42318632f Signed-off-by: Lars Vogel --- .../ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java | 4 ++-- .../eclipse/debug/internal/ui/actions/expressions/WatchHandler.java | 3 ++- .../internal/ui/importexport/breakpoints/ExportBreakpoints.java | 3 ++- .../internal/ui/importexport/breakpoints/ImportBreakpoints.java | 3 ++- .../ui/launchConfigurations/ExportLaunchConfigurationAction.java | 3 ++- .../eclipse/debug/internal/ui/sourcelookup/SourceLookupPanel.java | 5 +++-- .../eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java | 2 +- .../debug/internal/ui/views/memory/AddMemoryRenderingDialog.java | 2 +- .../org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java | 4 ++-- .../eclipse/debug/internal/ui/views/memory/NewMemoryViewAction.java | 3 ++- .../ui/views/memory/renderings/AsyncTableRenderingViewer.java | 3 ++- .../debug/internal/ui/views/memory/renderings/GoToAddressAction.java | 3 +-- org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java | 3 ++- .../ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java | 2 +- 14 files changed, 25 insertions(+), 18 deletions(-) (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug') diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java index cf4f3b231..973c1dddd 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java @@ -1067,7 +1067,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener, } if (wait) { - IWorkbench workbench = DebugUIPlugin.getDefault().getWorkbench(); + IWorkbench workbench = PlatformUI.getWorkbench(); IProgressService progressService = workbench.getProgressService(); final IRunnableWithProgress runnable = monitor -> { /* @@ -1254,7 +1254,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener, } }; - IWorkbench workbench = DebugUIPlugin.getDefault().getWorkbench(); + IWorkbench workbench = PlatformUI.getWorkbench(); IProgressService progressService = workbench.getProgressService(); job.setPriority(Job.INTERACTIVE); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchHandler.java index 1c4955f02..a667e8d8e 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchHandler.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchHandler.java @@ -36,6 +36,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IViewPart; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.handlers.HandlerUtil; /** @@ -60,7 +61,7 @@ public class WatchHandler extends AbstractHandler { private void showExpressionsView() { - IWorkbenchPage page = DebugUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IViewPart part = page.findView(IDebugUIConstants.ID_EXPRESSION_VIEW); if (part == null) { try { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/ExportBreakpoints.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/ExportBreakpoints.java index 5079683e4..79fe533cc 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/ExportBreakpoints.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/ExportBreakpoints.java @@ -22,6 +22,7 @@ import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Event; +import org.eclipse.ui.PlatformUI; /** *

@@ -47,7 +48,7 @@ public class ExportBreakpoints extends AbstractDebugActionDelegate { @Override public void run(IAction action) { WizardExportBreakpoints wiz = new WizardExportBreakpoints(); - wiz.init(DebugUIPlugin.getDefault().getWorkbench(), getSelection()); + wiz.init(PlatformUI.getWorkbench(), getSelection()); WizardDialog wizdialog = new WizardDialog(DebugUIPlugin.getShell(), wiz); wizdialog.setBlockOnOpen(true); wizdialog.open(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/ImportBreakpoints.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/ImportBreakpoints.java index 5719e3b66..a5757b92d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/ImportBreakpoints.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/ImportBreakpoints.java @@ -21,6 +21,7 @@ import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Event; +import org.eclipse.ui.PlatformUI; /** * This class provides the aciton event for both the context menu in breakpoints view @@ -44,7 +45,7 @@ public class ImportBreakpoints extends AbstractDebugActionDelegate { @Override public void run(IAction action) { WizardImportBreakpoints wiz = new WizardImportBreakpoints(); - wiz.init(DebugUIPlugin.getDefault().getWorkbench(), null); + wiz.init(PlatformUI.getWorkbench(), null); WizardDialog wizdialog = new WizardDialog(DebugUIPlugin.getShell(), wiz); wizdialog.setBlockOnOpen(true); wizdialog.open(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ExportLaunchConfigurationAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ExportLaunchConfigurationAction.java index 863e656a8..41da22397 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ExportLaunchConfigurationAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ExportLaunchConfigurationAction.java @@ -22,6 +22,7 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.ui.PlatformUI; public class ExportLaunchConfigurationAction extends AbstractLaunchConfigurationAction { /** @@ -45,7 +46,7 @@ public class ExportLaunchConfigurationAction extends AbstractLaunchConfiguration } else { wizard = new ExportLaunchConfigurationsWizard(selection); } - wizard.init(DebugUIPlugin.getDefault().getWorkbench(), null); + wizard.init(PlatformUI.getWorkbench(), null); WizardDialog dialog = new WizardDialog(DebugUIPlugin.getShell(), wizard); dialog.open(); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupPanel.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupPanel.java index 9604c2931..4da977d92 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupPanel.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupPanel.java @@ -39,6 +39,7 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IWorkingSet; import org.eclipse.ui.IWorkingSetManager; +import org.eclipse.ui.PlatformUI; /** * The panel that contains the list of source containers. @@ -123,7 +124,7 @@ public class SourceLookupPanel extends AbstractLaunchConfigurationTab implements //listen to changes user made to the working sets, if a working set is being removed //check current list to validate working sets - IWorkingSetManager workingSetMgr = DebugUIPlugin.getDefault().getWorkbench().getWorkingSetManager(); + IWorkingSetManager workingSetMgr = PlatformUI.getWorkbench().getWorkingSetManager(); workingSetMgr.addPropertyChangeListener(this); /*Dialog.applyDialogFont(comp);*/ setControl(comp); @@ -380,7 +381,7 @@ public class SourceLookupPanel extends AbstractLaunchConfigurationTab implements super.dispose(); //listen to changes user made to the working sets, if a working set is being removed //check current list to validate working sets - IWorkingSetManager workingSetMgr = DebugUIPlugin.getDefault().getWorkbench().getWorkingSetManager(); + IWorkingSetManager workingSetMgr = PlatformUI.getWorkbench().getWorkingSetManager(); workingSetMgr.removePropertyChangeListener(this); } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java index 8b34b0fab..61f3c5c54 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java @@ -131,7 +131,7 @@ public class AddMemoryBlockAction extends Action implements IDebugContextListene return; } - Shell shell = DebugUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(); + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); // create dialog to ask for expression/address to block MonitorMemoryBlockDialog dialog = new MonitorMemoryBlockDialog(shell, retrieval, prefillExp, prefillLength); dialog.open(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java index 05b06559c..add3e0eb9 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java @@ -391,7 +391,7 @@ public class AddMemoryRenderingDialog extends SelectionDialog { selection = selectionProvider.getSelection(); } else { // otherwise, take selection from selection service - selection = DebugUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection(IDebugUIConstants.ID_MEMORY_VIEW); + selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection(IDebugUIConstants.ID_MEMORY_VIEW); } IMemoryBlock element = getMemoryBlock(selection); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java index 2214c74a4..109b3ea0d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java @@ -28,12 +28,12 @@ import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.IMemoryBlockExtension; import org.eclipse.debug.core.model.IMemoryBlockRetrieval; import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; -import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.progress.UIJob; /** @@ -124,7 +124,7 @@ public class MemoryViewUtil { if (e != null) detail = e.getMessage(); - Shell shell = DebugUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(); + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); MessageDialog.openError(shell, title, message + "\n" + detail); //$NON-NLS-1$ return Status.OK_STATUS; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/NewMemoryViewAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/NewMemoryViewAction.java index 04c8de8a7..dd09175bc 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/NewMemoryViewAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/NewMemoryViewAction.java @@ -26,6 +26,7 @@ import org.eclipse.ui.IViewActionDelegate; import org.eclipse.ui.IViewPart; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; /** * Action for opening a new memory view. @@ -45,7 +46,7 @@ public class NewMemoryViewAction implements IViewActionDelegate { String secondaryId = MemoryViewIdRegistry.getUniqueSecondaryId(IDebugUIConstants.ID_MEMORY_VIEW); try { - IWorkbenchPage page = DebugUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IViewPart newView = page.showView(IDebugUIConstants.ID_MEMORY_VIEW, secondaryId, IWorkbenchPage.VIEW_ACTIVATE); // set initial selection for new view diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java index 44c8a5b53..0e3ad4d09 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java @@ -58,6 +58,7 @@ import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Widget; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.progress.UIJob; public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer { @@ -576,7 +577,7 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer { public void showTableCursor(final boolean show) { - Display display = DebugUIPlugin.getDefault().getWorkbench().getDisplay(); + Display display = PlatformUI.getWorkbench().getDisplay(); if (Thread.currentThread() == display.getThread()) { if (!fTableCursor.isDisposed()) diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java index c3e126253..62ab45488 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java @@ -25,7 +25,6 @@ import org.eclipse.debug.core.model.IMemoryBlockExtension; import org.eclipse.debug.core.model.IMemoryBlockRetrieval; import org.eclipse.debug.core.model.IMemoryBlockRetrievalExtension; import org.eclipse.debug.internal.ui.DebugUIMessages; -import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.views.memory.MemoryViewUtil; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.IDebugUIConstants; @@ -65,7 +64,7 @@ public class GoToAddressAction extends Action { try { - Shell shell= DebugUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(); + Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); // create dialog to ask for expression/address to block GoToAddressDialog dialog = new GoToAddressDialog(shell); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java index 89cb28b9e..04cf4febd 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java @@ -30,6 +30,7 @@ import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.part.FileEditorInput; import org.eclipse.ui.texteditor.IDocumentProvider; import org.eclipse.ui.texteditor.ITextEditor; @@ -132,7 +133,7 @@ public class FileLink implements IConsoleHyperlink { private String getEditorId() { if (fEditorId == null) { - IWorkbench workbench= DebugUIPlugin.getDefault().getWorkbench(); + IWorkbench workbench= PlatformUI.getWorkbench(); // If there is a registered editor for the file use it. IEditorDescriptor desc = workbench.getEditorRegistry().getDefaultEditor(fFile.getName(), getFileContentType()); if (desc == null) { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java index 21e0887d0..122dab8e1 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java @@ -3432,7 +3432,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering } // update UI asynchronously - Display display = DebugUIPlugin.getDefault().getWorkbench().getDisplay(); + Display display = PlatformUI.getWorkbench().getDisplay(); display.asyncExec(() -> { updateLabels(); -- cgit v1.2.3