Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ferrazzutti2014-05-13 15:50:14 -0400
committerAlexander Kurtakov2014-05-14 02:03:45 -0400
commit5cf131f41006c3714ddf95c0317c792f8a8ab2f6 (patch)
treec2bd727629e900877758d59b8b7dd7fe1cb01ccd
parenta7e9d3f7b0d1327403c868c0f7b201218a638238 (diff)
downloadorg.eclipse.linuxtools-5cf131f41006c3714ddf95c0317c792f8a8ab2f6.tar.gz
org.eclipse.linuxtools-5cf131f41006c3714ddf95c0317c792f8a8ab2f6.tar.xz
org.eclipse.linuxtools-5cf131f41006c3714ddf95c0317c792f8a8ab2f6.zip
Systemtap: Hide inactive tool buttons on startup.
Prevent inactive Systemtap toolbar items from appearing on startup before their providing plugins are loaded. Do this by using activeWhen instead of enabledWhen. (Resolves EBZ #434802.) Change-Id: I1a514d06946289d1781e428cd75c7b05d7b85d16 Signed-off-by: Andrew Ferrazzutti <aferrazz@redhat.com> Reviewed-on: https://git.eclipse.org/r/26481 Tested-by: Hudson CI Reviewed-by: Alexander Kurtakov <akurtako@redhat.com> Tested-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/plugin.xml27
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/handlers/SaveGraphImageHandler.java5
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/plugin.xml64
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ExportDataSetHandler.java12
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/IDEHandler.java26
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportDataSetHandler.java3
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportTapsetHandler.java3
7 files changed, 89 insertions, 51 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/plugin.xml b/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/plugin.xml
index 1d7fec52b2..dbffe79b6e 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/plugin.xml
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/plugin.xml
@@ -35,8 +35,7 @@
name="%command.save.name"
description="%command.save.desc"
categoryId="org.eclipse.linuxtools.systemtap.graphing.ui.category.file"
- id="org.eclipse.linuxtools.systemtap.graphing.ui.commands.SaveGraphImage"
- defaultHandler="org.eclipse.linuxtools.internal.systemtap.graphing.ui.handlers.SaveGraphImageHandler"/>
+ id="org.eclipse.linuxtools.systemtap.graphing.ui.commands.SaveGraphImage"/>
</extension>
<extension
@@ -53,6 +52,17 @@
</extension>
<extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.linuxtools.internal.systemtap.graphing.ui.handlers.SaveGraphImageHandler"
+ commandId="org.eclipse.linuxtools.systemtap.graphing.ui.commands.SaveGraphImage">
+ <activeWhen>
+ <reference definitionId="org.eclipse.linuxtools.systemtap.graphing.ui.graphEditorEnablement"/>
+ </activeWhen>
+ </handler>
+ </extension>
+
+ <extension
point="org.eclipse.ui.editors">
<editor
class="org.eclipse.linuxtools.systemtap.graphing.ui.views.GraphSelectorEditor"
@@ -62,4 +72,17 @@
</editor>
</extension>
+ <extension
+ point="org.eclipse.core.expressions.definitions">
+ <definition
+ id="org.eclipse.linuxtools.systemtap.graphing.ui.graphEditorEnablement">
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.linuxtools.systemtap.graphing.ui.views.GraphSelectorEditor">
+ </equals>
+ </with>
+ </definition>
+ </extension>
+
</plugin>
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/handlers/SaveGraphImageHandler.java b/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/handlers/SaveGraphImageHandler.java
index d2c5ace4d7..77086f6c73 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/handlers/SaveGraphImageHandler.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/handlers/SaveGraphImageHandler.java
@@ -45,11 +45,6 @@ public class SaveGraphImageHandler extends AbstractHandler {
return null;
}
- @Override
- public boolean isEnabled() {
- return getActiveGraphEditor() != null;
- }
-
private GraphSelectorEditor getActiveGraphEditor() {
IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().
getActivePage().getActiveEditor();
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/plugin.xml b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/plugin.xml
index 1ea6facc0f..a181613143 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/plugin.xml
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/plugin.xml
@@ -272,8 +272,7 @@
name="%command.import.name"
description="%command.import.desc"
categoryId="org.eclipse.linuxtools.systemtap.ui.ide.category.file"
- id="org.eclipse.linuxtools.systemtap.ui.ide.commands.ImportTapset"
- defaultHandler="org.eclipse.linuxtools.internal.systemtap.ui.ide.actions.ImportTapsetHandler">
+ id="org.eclipse.linuxtools.systemtap.ui.ide.commands.ImportTapset">
</command>
<category
@@ -285,8 +284,7 @@
name="%action.run.name"
description="%action.run.desc"
categoryId="org.eclipse.linuxtools.systemtap.ui.ide.category.run"
- id="org.eclipse.linuxtools.systemtap.ui.ide.RunScriptCommand"
- defaultHandler="org.eclipse.linuxtools.internal.systemtap.ui.ide.actions.RunScriptHandler">
+ id="org.eclipse.linuxtools.systemtap.ui.ide.RunScriptCommand">
</command>
<category
@@ -298,15 +296,13 @@
name="%action.dataExport.name"
description="%action.dataExport.desc"
categoryId="org.eclipse.linuxtools.systemtap.ui.ide.category.data"
- id="org.eclipse.linuxtools.systemtap.ui.ide.ExportDataSetCommand"
- defaultHandler="org.eclipse.linuxtools.internal.systemtap.ui.ide.actions.ExportDataSetHandler">
+ id="org.eclipse.linuxtools.systemtap.ui.ide.ExportDataSetCommand">
</command>
<command
name="%action.dataImport.name"
description="%action.dataImport.desc"
categoryId="org.eclipse.linuxtools.systemtap.ui.ide.category.data"
- id="org.eclipse.linuxtools.systemtap.ui.ide.ImportDataSetCommand"
- defaultHandler="org.eclipse.linuxtools.internal.systemtap.ui.ide.actions.ImportDataSetHandler">
+ id="org.eclipse.linuxtools.systemtap.ui.ide.ImportDataSetCommand">
</command>
<category
@@ -358,6 +354,45 @@
<extension
point="org.eclipse.ui.handlers">
<handler
+ class="org.eclipse.linuxtools.internal.systemtap.ui.ide.actions.RunScriptHandler"
+ commandId="org.eclipse.linuxtools.systemtap.ui.ide.RunScriptCommand">
+ <activeWhen>
+ <with
+ variable="activeEditor">
+ <instanceof
+ value="org.eclipse.linuxtools.internal.systemtap.ui.ide.editors.stp.STPEditor">
+ </instanceof>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.eclipse.linuxtools.internal.systemtap.ui.ide.actions.ImportTapsetHandler"
+ commandId="org.eclipse.linuxtools.systemtap.ui.ide.commands.ImportTapset">
+ <activeWhen>
+ <reference
+ definitionId="org.eclipse.linuxtools.systemtap.ui.ide.perspectiveEnablement">
+ </reference>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.eclipse.linuxtools.internal.systemtap.ui.ide.actions.ImportDataSetHandler"
+ commandId="org.eclipse.linuxtools.systemtap.ui.ide.ImportDataSetCommand">
+ <activeWhen>
+ <reference
+ definitionId="org.eclipse.linuxtools.systemtap.ui.ide.perspectiveEnablement">
+ </reference>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.eclipse.linuxtools.internal.systemtap.ui.ide.actions.ExportDataSetHandler"
+ commandId="org.eclipse.linuxtools.systemtap.ui.ide.ExportDataSetCommand">
+ <activeWhen>
+ <reference
+ definitionId="org.eclipse.linuxtools.systemtap.graphing.ui.graphEditorEnablement">
+ </reference>
+ </activeWhen>
+ </handler>
+ <handler
class="org.eclipse.linuxtools.internal.systemtap.ui.ide.handlers.DefinitionHandler"
commandId="org.eclipse.linuxtools.systemtap.ui.ide.definitionMenu">
<enabledWhen>
@@ -522,4 +557,17 @@
</context>
</extension>
+ <extension
+ point="org.eclipse.core.expressions.definitions">
+ <definition
+ id="org.eclipse.linuxtools.systemtap.ui.ide.perspectiveEnablement">
+ <with
+ variable="activeWorkbenchWindow.activePerspective">
+ <equals
+ value="org.eclipse.linuxtools.systemtap.ui.ide.IDEPerspective">
+ </equals>
+ </with>
+ </definition>
+ </extension>
+
</plugin>
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ExportDataSetHandler.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ExportDataSetHandler.java
index 2e1e2fbf60..f42953ee4b 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ExportDataSetHandler.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ExportDataSetHandler.java
@@ -18,6 +18,7 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
/**
* This <code>Action</code> exports all data in the currently-active {@link GraphSelectorEditor}
@@ -26,14 +27,14 @@ import org.eclipse.ui.PlatformUI;
*/
public class ExportDataSetHandler extends AbstractHandler {
- private GraphSelectorEditor getActiveGraphEditor() {
- IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ private GraphSelectorEditor getActiveGraphEditor(ExecutionEvent event) {
+ IEditorPart editor = HandlerUtil.getActiveEditor(event);
return editor instanceof GraphSelectorEditor ? (GraphSelectorEditor) editor : null;
}
@Override
public Object execute(ExecutionEvent event) {
- GraphSelectorEditor editor = getActiveGraphEditor();
+ GraphSelectorEditor editor = getActiveGraphEditor(event);
if (editor == null) {
return null;
}
@@ -49,9 +50,4 @@ public class ExportDataSetHandler extends AbstractHandler {
return null;
}
- @Override
- public boolean isEnabled() {
- return getActiveGraphEditor() != null;
- }
-
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/IDEHandler.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/IDEHandler.java
deleted file mode 100644
index d70b78b321..0000000000
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/IDEHandler.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 Red Hat, Inc.
- * 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:
- * Red Hat - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.internal.systemtap.ui.ide.actions;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.linuxtools.internal.systemtap.ui.ide.IDEPerspective;
-import org.eclipse.ui.PlatformUI;
-
-public abstract class IDEHandler extends AbstractHandler {
-
- @Override
- public boolean isEnabled() {
- return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().
- getPerspective().getId().equals(IDEPerspective.ID);
- }
-
-}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportDataSetHandler.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportDataSetHandler.java
index 9beffcc308..040830657d 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportDataSetHandler.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportDataSetHandler.java
@@ -17,6 +17,7 @@ import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.Arrays;
+import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.linuxtools.internal.systemtap.ui.ide.IDEPerspective;
import org.eclipse.linuxtools.systemtap.graphing.core.datasets.IFilteredDataSet;
@@ -39,7 +40,7 @@ import org.eclipse.ui.WorkbenchException;
* into an external file, which can be imported back in later.
* @author Andrew Ferrazzutti
*/
-public class ImportDataSetHandler extends IDEHandler {
+public class ImportDataSetHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) {
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportTapsetHandler.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportTapsetHandler.java
index dc5e12a4a0..3f912c3c0e 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportTapsetHandler.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/ImportTapsetHandler.java
@@ -12,11 +12,12 @@
package org.eclipse.linuxtools.internal.systemtap.ui.ide.actions;
+import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.handlers.HandlerUtil;
-public class ImportTapsetHandler extends IDEHandler {
+public class ImportTapsetHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) {

Back to the top