Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStéphane Bégaudeau2018-10-10 09:07:34 +0000
committerStéphane Bégaudeau2018-10-10 09:07:34 +0000
commita547d4ebd7c18bd23fa8157ff737a8c2db7cfe51 (patch)
tree18b7975136ebd2c7e67b7a2ac3015d7b86394b42
parentfe5521fd681ee818644e167d299f25eecb580aaa (diff)
downloadorg.eclipse.eef-a547d4ebd7c18bd23fa8157ff737a8c2db7cfe51.tar.gz
org.eclipse.eef-a547d4ebd7c18bd23fa8157ff737a8c2db7cfe51.tar.xz
org.eclipse.eef-a547d4ebd7c18bd23fa8157ff737a8c2db7cfe51.zip
[531547] Improve the filter tab descriptor extension point
Two additional parameters are now available in order to filter a tab descriptor: - The current workbench part - The current selection Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=531547 Change-Id: I53a389857d75f38815030c57544b936a11ec3a05 Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
-rw-r--r--doc/org.eclipse.eef.documentation/pages/releasenotes.html7
-rw-r--r--doc/org.eclipse.eef.documentation/pages/releasenotes.textile4
-rw-r--r--plugins/org.eclipse.eef.properties.ui/schema/eefTabDescriptorFilter.exsd5
-rw-r--r--plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/api/IEEFTabDescriptorFilter.java24
-rw-r--r--plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/internal/registry/EEFTabbedPropertyRegistry.java10
5 files changed, 45 insertions, 5 deletions
diff --git a/doc/org.eclipse.eef.documentation/pages/releasenotes.html b/doc/org.eclipse.eef.documentation/pages/releasenotes.html
index b9f8aa587..6f04b0313 100644
--- a/doc/org.eclipse.eef.documentation/pages/releasenotes.html
+++ b/doc/org.eclipse.eef.documentation/pages/releasenotes.html
@@ -12,6 +12,9 @@
<a href="#ReleaseNotesforEclipseEEF">Release Notes for Eclipse EEF</a>
<ol style="list-style: disc;">
<li>
+ <a href="#eef2.2.0">Changes in EEF 2.2.0</a>
+ </li>
+ <li>
<a href="#eef2.1.0">Changes in EEF 2.1.0</a>
</li>
<li>
@@ -57,6 +60,10 @@
</li>
</ol>
<p>This document contains the release notes for recent major releases of EEF.</p>
+ <h3 id="eef2.2.0">Changes in EEF 2.2.0</h3>
+ <ul>
+ <li><span class="label label-info">Modified</span> Add the workbench part and the selection to the tab descriptor filter extension point.</li>
+ </ul>
<h3 id="eef2.1.0">Changes in EEF 2.1.0</h3>
<ul>
<li><span class="label label-info">Modified</span> Update the releng process</li>
diff --git a/doc/org.eclipse.eef.documentation/pages/releasenotes.textile b/doc/org.eclipse.eef.documentation/pages/releasenotes.textile
index b73df0215..090f4b4e8 100644
--- a/doc/org.eclipse.eef.documentation/pages/releasenotes.textile
+++ b/doc/org.eclipse.eef.documentation/pages/releasenotes.textile
@@ -4,6 +4,10 @@ h2. Release Notes for Eclipse EEF
This document contains the release notes for recent major releases of EEF.
+h3(#eef2.2.0). Changes in EEF 2.2.0
+
+* <span class="label label-info">Modified</span> Add the workbench part and the selection to the tab descriptor filter extension point.
+
h3(#eef2.1.0). Changes in EEF 2.1.0
* <span class="label label-info">Modified</span> Update the releng process
diff --git a/plugins/org.eclipse.eef.properties.ui/schema/eefTabDescriptorFilter.exsd b/plugins/org.eclipse.eef.properties.ui/schema/eefTabDescriptorFilter.exsd
index bbe07f680..75cb39b22 100644
--- a/plugins/org.eclipse.eef.properties.ui/schema/eefTabDescriptorFilter.exsd
+++ b/plugins/org.eclipse.eef.properties.ui/schema/eefTabDescriptorFilter.exsd
@@ -118,11 +118,13 @@ Example of IEEFTabDescriptorFilter contribution. In this example, we are providi
&lt;pre&gt;
import org.eclipse.eef.properties.ui.api.IEEFTabDescriptor;
import org.eclipse.eef.properties.ui.api.IEEFTabDescriptorFilter;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
public class SampleTabDescriptorFilter implements IEEFTabDescriptorFilter {
@Override
- public boolean filter(IEEFTabDescriptor tabDescriptor) {
+ public boolean filter(IEEFTabDescriptor tabDescriptor, IWorkbenchPart part, ISelection selection) {
// Write here a useful condition
return false;
}
@@ -133,6 +135,7 @@ This example requires at least the following dependencies:
&lt;ul&gt;
&lt;li&gt;org.eclipse.eef.common&lt;/li&gt;
&lt;li&gt;org.eclipse.eef.properties.ui&lt;/li&gt;
+ &lt;li&gt;org.eclipse.ui&lt;/li&gt;
&lt;/ul&gt;
</documentation>
</annotation>
diff --git a/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/api/IEEFTabDescriptorFilter.java b/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/api/IEEFTabDescriptorFilter.java
index 3c3d87332..6ce3eac47 100644
--- a/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/api/IEEFTabDescriptorFilter.java
+++ b/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/api/IEEFTabDescriptorFilter.java
@@ -11,6 +11,9 @@
*******************************************************************************/
package org.eclipse.eef.properties.ui.api;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
+
/**
* This interface is used to filter {@link IEEFTabDescriptor}.
*
@@ -25,5 +28,24 @@ public interface IEEFTabDescriptorFilter {
*
* @return <code>true</code> if the tab descriptor should be used, <code>false</code> otherwise
*/
- boolean filter(IEEFTabDescriptor tabDescriptor);
+ @Deprecated
+ default boolean filter(IEEFTabDescriptor tabDescriptor) {
+ return true;
+ }
+
+ /**
+ * Returns if a tab descriptor must be filtered or not.
+ *
+ * @param tabDescriptor
+ * The tab descriptor
+ * @param part
+ * The workbench part
+ * @param selection
+ * The selection
+ *
+ * @return <code>true</code> if the tab descriptor should be used, <code>false</code> otherwise
+ */
+ default boolean filter(IEEFTabDescriptor tabDescriptor, IWorkbenchPart part, ISelection selection) {
+ return this.filter(tabDescriptor);
+ }
}
diff --git a/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/internal/registry/EEFTabbedPropertyRegistry.java b/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/internal/registry/EEFTabbedPropertyRegistry.java
index d77e190ef..264d67aa1 100644
--- a/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/internal/registry/EEFTabbedPropertyRegistry.java
+++ b/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/internal/registry/EEFTabbedPropertyRegistry.java
@@ -80,7 +80,7 @@ public class EEFTabbedPropertyRegistry {
IEEFTabDescriptorProvider eefTabDescriptorProvider = itemDescriptor.getItem();
for (IEEFTabDescriptor eefTabDescriptor : eefTabDescriptorProvider.get(part, input, contributor)) {
String eefTabDescriptorId = eefTabDescriptor.getId();
- if (!eefTabDescriptors.containsKey(eefTabDescriptorId) && filter(eefTabDescriptor)) {
+ if (!eefTabDescriptors.containsKey(eefTabDescriptorId) && filter(eefTabDescriptor, part, input)) {
eefTabDescriptors.put(eefTabDescriptorId, eefTabDescriptor);
}
}
@@ -93,14 +93,18 @@ public class EEFTabbedPropertyRegistry {
*
* @param eefTabDescriptor
* The tab descriptor
+ * @param part
+ * the workbench part
+ * @param selection
+ * The selection
* @return <code>true</code> if the tab descriptor should be used, <code>false</code> otherwise
*/
- private boolean filter(IEEFTabDescriptor eefTabDescriptor) {
+ private boolean filter(IEEFTabDescriptor eefTabDescriptor, IWorkbenchPart part, ISelection selection) {
IItemRegistry<IEEFTabDescriptorFilter> eefTabDescriptorFilterRegistry = EEFTabbedPropertyViewPlugin.getPlugin()
.getEEFTabDescriptorFilterRegistry();
for (IItemDescriptor<IEEFTabDescriptorFilter> itemDescriptor : eefTabDescriptorFilterRegistry.getItemDescriptors()) {
IEEFTabDescriptorFilter eefTabDescriptorFilter = itemDescriptor.getItem();
- if (!eefTabDescriptorFilter.filter(eefTabDescriptor)) {
+ if (!eefTabDescriptorFilter.filter(eefTabDescriptor, part, selection)) {
return false;
}
}

Back to the top