Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-10-31 12:26:31 -0400
committerUwe Stieber2013-11-02 04:19:03 -0400
commit157cae093a3e5883bcd5118e5cad2c734ab078c7 (patch)
treef3c1892b68f4c16ed97a7338c199dee32413b9cf /target_explorer
parent421b38896f812f85e342d1464e9cf5823efc2745 (diff)
downloadorg.eclipse.tcf-157cae093a3e5883bcd5118e5cad2c734ab078c7.tar.gz
org.eclipse.tcf-157cae093a3e5883bcd5118e5cad2c734ab078c7.tar.xz
org.eclipse.tcf-157cae093a3e5883bcd5118e5cad2c734ab078c7.zip
Target Explorer: Allow delegation of the customizable tree viewer column and filter activation to a context specific process monitor UI delegate.
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml58
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/interfaces/IProcessMonitorUIDelegate.java20
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/PropertyTester.java48
3 files changed, 126 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml
index fd27be258..f073f9d1a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml
@@ -49,6 +49,17 @@
</service>
</extension>
+<!-- Eclipse core expressions property tester -->
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.eclipse.tcf.te.tcf.processes.ui.internal.properties.PropertyTester"
+ id="org.eclipse.tcf.te.tcf.processes.ui.properties"
+ namespace="processMonitor.delegatedActivation"
+ properties="isColumnActive,isFilterActive"
+ type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel">
+ </propertyTester>
+ </extension>
+
<!-- Common navigator contributions -->
<extension point="org.eclipse.ui.navigator.viewer">
<viewerContentBinding
@@ -599,6 +610,13 @@
resizable="true"
visible="true"
width="250">
+ <activation>
+ <with variable="input">
+ <adapt type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel">
+ <test property="processMonitor.delegatedActivation.isColumnActive" args="name" value="true"/>
+ </adapt>
+ </with>
+ </activation>
</column>
<column
comparator="org.eclipse.tcf.te.tcf.processes.ui.editor.tree.columns.PIDComparator"
@@ -609,6 +627,13 @@
resizable="true"
visible="true"
width="50">
+ <activation>
+ <with variable="input">
+ <adapt type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel">
+ <test property="processMonitor.delegatedActivation.isColumnActive" args="PID" value="true"/>
+ </adapt>
+ </with>
+ </activation>
</column>
<column
comparator="org.eclipse.tcf.te.tcf.processes.ui.editor.tree.columns.PPIDComparator"
@@ -619,6 +644,13 @@
resizable="true"
visible="false"
width="50">
+ <activation>
+ <with variable="input">
+ <adapt type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel">
+ <test property="processMonitor.delegatedActivation.isColumnActive" args="PPID" value="true"/>
+ </adapt>
+ </with>
+ </activation>
</column>
<column
comparator="org.eclipse.tcf.te.tcf.processes.ui.editor.tree.columns.StateComparator"
@@ -629,6 +661,13 @@
resizable="true"
visible="true"
width="50">
+ <activation>
+ <with variable="input">
+ <adapt type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel">
+ <test property="processMonitor.delegatedActivation.isColumnActive" args="state" value="true"/>
+ </adapt>
+ </with>
+ </activation>
</column>
<column
comparator="org.eclipse.tcf.te.tcf.processes.ui.editor.tree.columns.UserComparator"
@@ -639,6 +678,13 @@
resizable="true"
visible="true"
width="50">
+ <activation>
+ <with variable="input">
+ <adapt type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel">
+ <test property="processMonitor.delegatedActivation.isColumnActive" args="user" value="true"/>
+ </adapt>
+ </with>
+ </activation>
</column>
<column
comparator="org.eclipse.tcf.te.tcf.processes.ui.editor.tree.columns.CommandLineComparator"
@@ -649,6 +695,13 @@
resizable="true"
visible="true"
width="100">
+ <activation>
+ <with variable="input">
+ <adapt type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel">
+ <test property="processMonitor.delegatedActivation.isColumnActive" args="cmdline" value="true"/>
+ </adapt>
+ </with>
+ </activation>
</column>
</columnContribution>
@@ -659,6 +712,11 @@
enabled="true"
id="org.eclipse.tcf.te.tcf.processes.ui.navigator.filter.singleThread"
name="%singlethreadfilter.name">
+ <activation>
+ <with variable="input">
+ <test property="processMonitor.delegatedActivation.isFilterActive" args="singleThread" value="true"/>
+ </with>
+ </activation>
</filter>
</filterContribution>
</extension>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/interfaces/IProcessMonitorUIDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/interfaces/IProcessMonitorUIDelegate.java
index fe0c3dee4..677e4105d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/interfaces/IProcessMonitorUIDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/interfaces/IProcessMonitorUIDelegate.java
@@ -39,6 +39,26 @@ public interface IProcessMonitorUIDelegate {
public String getText(Object context, String columnId, String text);
/**
+ * Returns if or if not the given column is active for the given context.
+ *
+ * @param context The context. Must not be <code>null</code>.
+ * @param columnId The column id. Must not be <code>null</code>.
+ *
+ * @return <code>True</code> if the column is active for the given context, <code>false</code> otherwise.
+ */
+ public boolean isColumnActive(Object context, String columnId);
+
+ /**
+ * Returns if or if not the given filter is active for the given context.
+ *
+ * @param context The context. Must not be <code>null</code>.
+ * @param filterId The filter id. Must not be <code>null</code>.
+ *
+ * @return <code>True</code> if the filter is active for the given context, <code>false</code> otherwise.
+ */
+ public boolean isFilterActive(Object context, String filterId);
+
+ /**
* Returns the list of searchables to use to find processes in the
* process monitor.
*
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/PropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/PropertyTester.java
new file mode 100644
index 000000000..f09b70ee6
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/properties/PropertyTester.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Wind River Systems, Inc. and others. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.processes.ui.internal.properties;
+
+import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
+import org.eclipse.tcf.te.tcf.processes.ui.interfaces.IProcessMonitorUIDelegate;
+
+
+/**
+ * Process monitor property tester (UI).
+ */
+public class PropertyTester extends org.eclipse.core.expressions.PropertyTester {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ @Override
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ // Get the UI delegate for the context (== receiver)
+ IUIService service = ServiceManager.getInstance().getService(receiver, IUIService.class);
+ IProcessMonitorUIDelegate delegate = service != null ? service.getDelegate(receiver, IProcessMonitorUIDelegate.class) : null;
+
+ if ("isColumnActive".equals(property) || "isFilterActive".equals(property)) { //$NON-NLS-1$ //$NON-NLS-2$
+ // If no delegate is registered for the context, the column or filter are treated as active (== no activation expression)
+ if (delegate == null) return true;
+
+ // Column or the filter id is the only argument to be passed in
+ String id = args.length > 0 && args[0] instanceof String ? (String)args[0] : null;
+ if (id != null) {
+ boolean isActive = "isColumnActive".equals(property) ? delegate.isColumnActive(receiver, id) : delegate.isFilterActive(receiver, id); //$NON-NLS-1$
+ if (expectedValue instanceof Boolean) {
+ return ((Boolean)expectedValue).equals(Boolean.valueOf(isActive));
+ }
+ }
+ }
+
+ return false;
+ }
+
+}

Back to the top