Skip to content

Commit d3dd4bf

Browse files
committed
Enhance the IContributionFactory to filter contributions
Currently there is no way for filtering a contribution to the model on a global level. This adds a new method to IContributionFactory#isEnabled that allows extenders to mark a given contribution as being disabled. See eclipse-platform/eclipse.platform.ui#2217
1 parent 29bc65f commit d3dd4bf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/contributions/IContributionFactory.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
import org.eclipse.e4.core.contexts.IEclipseContext;
1717
import org.osgi.framework.Bundle;
1818

19-
// TBD this became an utility method to create object from a bundle.
20-
// Change it into an utility method somewhere.
19+
/**
20+
* {@link IContributionFactory} is responsible to create contributions and check
21+
* if a contribution is enabled
22+
*/
2123
public interface IContributionFactory {
2224

2325
Object create(String uriString, IEclipseContext context);
@@ -26,4 +28,8 @@ public interface IContributionFactory {
2628

2729
Bundle getBundle(String uriString);
2830

31+
default boolean isEnabled(String uriString) {
32+
return uriString != null;
33+
}
34+
2935
}

0 commit comments

Comments
 (0)