Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOtavio Pontes2012-07-03 19:02:06 +0000
committerOtavio Pontes2012-07-03 19:02:06 +0000
commit88b66d99f04923533a18e3e1d8f6356c9d873c71 (patch)
tree4e7356c1e57f6df37f12da65ca2c4c67227304f9
parent52ca2186516f8ff5a6e0f247263200c375e698c9 (diff)
downloadorg.eclipse.linuxtools-88b66d99f04923533a18e3e1d8f6356c9d873c71.tar.gz
org.eclipse.linuxtools-88b66d99f04923533a18e3e1d8f6356c9d873c71.tar.xz
org.eclipse.linuxtools-88b66d99f04923533a18e3e1d8f6356c9d873c71.zip
Revert "SystemTap: Adding EditorAction back to the api"
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/META-INF/MANIFEST.MF2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/actions/ActiveEditorAction.java2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/actions/EditorAction.java70
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/actions/file/OpenFileAction.java2
4 files changed, 72 insertions, 4 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/META-INF/MANIFEST.MF b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/META-INF/MANIFEST.MF
index bd89702045..2c5f268b95 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/META-INF/MANIFEST.MF
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %bundleName
Bundle-SymbolicName: org.eclipse.linuxtools.systemtap.ui.editor;singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.eclipse.linuxtools.internal.systemtap.ui.editor.EditorPlugin
Bundle-Vendor: %bundleProvider
Bundle-Localization: plugin
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/actions/ActiveEditorAction.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/actions/ActiveEditorAction.java
index 3e4b139e9f..fc204b30cd 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/actions/ActiveEditorAction.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/actions/ActiveEditorAction.java
@@ -11,8 +11,6 @@
package org.eclipse.linuxtools.internal.systemtap.ui.editor.actions;
-import org.eclipse.linuxtools.systemtap.ui.editor.EditorAction;
-
public abstract class ActiveEditorAction extends EditorAction {
public ActiveEditorAction() {
super();
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/actions/EditorAction.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/actions/EditorAction.java
new file mode 100644
index 0000000000..5b8bf34635
--- /dev/null
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/internal/systemtap/ui/editor/actions/EditorAction.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.systemtap.ui.editor.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+
+public abstract class EditorAction extends Action implements IWorkbenchWindowActionDelegate {
+ public EditorAction() {
+ super();
+ setEnabled(true);
+ }
+
+ public void init(IWorkbenchWindow window) {
+ this.window = window;
+ }
+
+ protected void updateState() {
+ IEditorPart editor = getActiveEditor();
+ setEnabled(editor != null && editor.isDirty());
+ }
+
+ protected IWorkbenchWindow getWorkbenchWindow() {
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ }
+
+ protected IWorkbenchPage getActivePage() {
+ return getWorkbenchWindow().getActivePage();
+ }
+
+ protected IEditorPart getActiveEditor() {
+ return getActivePage().getActiveEditor();
+ }
+
+ public void selectionChanged(IAction act, ISelection select) {
+ action = act;
+ buildEnablementChecks();
+ }
+
+ protected void buildEnablementChecks() {
+ setEnablement(true);
+ }
+
+ protected void setEnablement(boolean enabled) {
+ action.setEnabled(enabled);
+ }
+
+ public void dispose() {
+ window = null;
+ action = null;
+ }
+
+ protected IWorkbenchWindow window;
+ protected IAction action;
+}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/actions/file/OpenFileAction.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/actions/file/OpenFileAction.java
index 8d84bda5eb..cf873aac0b 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/actions/file/OpenFileAction.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.editor/src/org/eclipse/linuxtools/systemtap/ui/editor/actions/file/OpenFileAction.java
@@ -19,7 +19,7 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.linuxtools.internal.systemtap.ui.editor.Localization;
import org.eclipse.linuxtools.internal.systemtap.ui.editor.RecentFileLog;
-import org.eclipse.linuxtools.systemtap.ui.editor.EditorAction;
+import org.eclipse.linuxtools.internal.systemtap.ui.editor.actions.EditorAction;
import org.eclipse.linuxtools.systemtap.ui.editor.PathEditorInput;
import org.eclipse.linuxtools.systemtap.ui.editor.SimpleEditor;
import org.eclipse.swt.SWT;

Back to the top