diff options
Diffstat (limited to 'changelog')
7 files changed, 20 insertions, 26 deletions
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/ChangeLogAction.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/ChangeLogAction.java index 431f3b19b8..494afc2fdd 100644 --- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/ChangeLogAction.java +++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/ChangeLogAction.java @@ -44,6 +44,7 @@ import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.actions.WorkspaceModifyOperation; import org.eclipse.ui.ide.FileStoreEditorInput; import org.eclipse.ui.part.FileEditorInput; @@ -82,16 +83,12 @@ public abstract class ChangeLogAction extends Action { new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR, msg, e)); } - protected IWorkbench getWorkbench() { - return ChangelogPlugin.getDefault().getWorkbench(); - } - protected IWorkspaceRoot getWorkspaceRoot() { return ResourcesPlugin.getWorkspace().getRoot(); } protected IEditorPart openEditor(IFile diskresource) { - IWorkbench ws = getWorkbench(); + IWorkbench ws = PlatformUI.getWorkbench(); try { return org.eclipse.ui.ide.IDE.openEditor(ws @@ -112,7 +109,7 @@ public abstract class ChangeLogAction extends Action { protected IFile createChangeLog(IPath changelog) { IWorkspaceRoot myWorkspaceRoot = getWorkspaceRoot(); - IWorkbench ws = getWorkbench(); + IWorkbench ws = PlatformUI.getWorkbench(); final IFile changelog_File = myWorkspaceRoot.getFile(changelog); final InputStream initialContents = new ByteArrayInputStream( @@ -160,7 +157,7 @@ public abstract class ChangeLogAction extends Action { } protected IEditorPart askChangeLogLocation(String editorLoc) { - IWorkbench ws = getWorkbench(); + IWorkbench ws = PlatformUI.getWorkbench(); IWorkspaceRoot myWorkspaceRoot = getWorkspaceRoot(); IResource given_resource = myWorkspaceRoot.findMember(editorLoc); diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/FormatChangeLogAction.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/FormatChangeLogAction.java index 405946f38b..55f02cef9f 100644 --- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/FormatChangeLogAction.java +++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/FormatChangeLogAction.java @@ -17,9 +17,9 @@ import org.eclipse.core.commands.IHandlerListener; import org.eclipse.jface.action.Action; import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.SourceViewer; -import org.eclipse.linuxtools.internal.changelog.core.ChangelogPlugin; import org.eclipse.linuxtools.internal.changelog.core.editors.ChangeLogEditor; import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.PlatformUI; @@ -37,16 +37,14 @@ public class FormatChangeLogAction extends Action implements IHandler { super("Format ChangeLog"); //editor = te; try { - editor = (ChangeLogEditor)getWorkbench().getActiveWorkbenchWindow() + editor = (ChangeLogEditor)PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getActivePage().getActiveEditor(); } catch (Exception e) { // no editor is active now so do nothing return; } } - protected IWorkbench getWorkbench() { - return ChangelogPlugin.getDefault().getWorkbench(); - } + @Override public void run() { diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/InsertChangeLogKeyHandler.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/InsertChangeLogKeyHandler.java index b98f8911b6..b6ff4eb4bb 100644 --- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/InsertChangeLogKeyHandler.java +++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/InsertChangeLogKeyHandler.java @@ -24,6 +24,7 @@ import org.eclipse.linuxtools.internal.changelog.core.ChangeLogWriter; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindowActionDelegate; +import org.eclipse.ui.PlatformUI; /** @@ -100,7 +101,7 @@ public class InsertChangeLogKeyHandler extends ChangeLogAction implements public Object execute(ExecutionEvent event) throws ExecutionException { try { - currentEditor = getWorkbench().getActiveWorkbenchWindow() + currentEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getActivePage().getActiveEditor(); } catch (Exception e) { // no editor is active now so do nothing diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangeLogAction.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangeLogAction.java index 412f18d8cd..4a77a15d76 100644 --- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangeLogAction.java +++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangeLogAction.java @@ -63,6 +63,7 @@ import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.editors.text.FileDocumentProvider; import org.eclipse.ui.editors.text.StorageDocumentProvider; import org.eclipse.ui.part.FileEditorInput; @@ -153,7 +154,7 @@ public class PrepareChangeLogAction extends ChangeLogAction { } }; - ProgressMonitorDialog pd = new ProgressMonitorDialog(getWorkbench() + ProgressMonitorDialog pd = new ProgressMonitorDialog(PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell()); try { diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangelogKeyHandler.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangelogKeyHandler.java index badc14857b..d2874ee65f 100644 --- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangelogKeyHandler.java +++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareChangelogKeyHandler.java @@ -38,6 +38,7 @@ import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindowActionDelegate; +import org.eclipse.ui.PlatformUI; /** * @@ -58,7 +59,7 @@ public class PrepareChangelogKeyHandler extends ChangeLogAction implements IHand // try getting currently selected project try { - IWorkbenchPage ref = getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IWorkbenchPage ref = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IWorkbenchPart part = ref.getActivePart(); if (part instanceof IEditorPart) { // If we are in an editor, check if the file being edited is an IResource @@ -169,7 +170,7 @@ public class PrepareChangelogKeyHandler extends ChangeLogAction implements IHand * Returns active shell. */ protected Shell getActiveWorkbenchShell() { - IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow(); + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { return window.getShell(); } diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareCommitAction.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareCommitAction.java index 0f6285df70..e39180d601 100644 --- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareCommitAction.java +++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/actions/PrepareCommitAction.java @@ -49,6 +49,7 @@ import org.eclipse.ui.IContributorResourceAdapter; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.ide.IContributorResourceAdapter2; @@ -73,7 +74,7 @@ public class PrepareCommitAction extends ChangeLogAction { } }; - ProgressMonitorDialog pd = new ProgressMonitorDialog(getWorkbench() + ProgressMonitorDialog pd = new ProgressMonitorDialog(PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell()); try { @@ -127,7 +128,7 @@ public class PrepareCommitAction extends ChangeLogAction { IEditorPart currentEditor; try { - currentEditor = getWorkbench().getActiveWorkbenchWindow() + currentEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getActivePage().getActiveEditor(); } catch (Exception e) { // no editor is active now so do nothing @@ -252,7 +253,7 @@ public class PrepareCommitAction extends ChangeLogAction { private void populateClipboardBuffer(String input) { TextTransfer plainTextTransfer = TextTransfer.getInstance(); - Clipboard clipboard = new Clipboard(getWorkbench().getDisplay()); + Clipboard clipboard = new Clipboard(PlatformUI.getWorkbench().getDisplay()); clipboard.setContents( new String[]{input}, new Transfer[]{plainTextTransfer}); diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/editors/FileHyperlink.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/editors/FileHyperlink.java index f41aeb4ee8..388fdc926f 100644 --- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/editors/FileHyperlink.java +++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/editors/FileHyperlink.java @@ -13,9 +13,9 @@ package org.eclipse.linuxtools.internal.changelog.core.editors; import org.eclipse.core.resources.IFile; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.hyperlink.IHyperlink; -import org.eclipse.linuxtools.internal.changelog.core.ChangelogPlugin; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; /** * Hyperlink that opens up editor for a file. @@ -52,7 +52,7 @@ public class FileHyperlink implements IHyperlink { * Opens the hyperlink in new editor window. */ public void open() { - IWorkbench ws = getWorkbench(); + IWorkbench ws = PlatformUI.getWorkbench(); try { @@ -64,9 +64,4 @@ public class FileHyperlink implements IHyperlink { } } - - private IWorkbench getWorkbench() { - return ChangelogPlugin.getDefault().getWorkbench(); - } - } |