-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement activity support filtering for e4 dynamic menu contribution.
Similar to PluginActionContributionItem we can support activity filtering of menu item to be shown or not. see #2217
- Loading branch information
1 parent
a801237
commit 69e65fa
Showing
6 changed files
with
99 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...e.e4.ui.workbench3/src/org/eclipse/ui/internal/activitysupport/IActivityManagerProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.eclipse.ui.internal.activitysupport; | ||
|
||
/** | ||
* A bridge between org.eclipse.ui.workbenk and | ||
* org.eclipse.e4.ui.workbench.renderers.swt. | ||
* | ||
* Service for this interface is bound to Platform.class bundle at | ||
* Workbench.class. We cannot depend on org.eclipse.ui.workbench from | ||
* org.eclipse.e4.ui.workbench.renderers.swt | ||
* | ||
* @since 0.18 | ||
*/ | ||
public interface IActivityManagerProxy { | ||
/** | ||
* Checks whether the given element is enabled or not in the workbench activity | ||
* support. | ||
* | ||
* @param identifierId A qualified id if the contribution. Which has format of | ||
* bundle-id/element. Ex: | ||
* org.eclipse.pde.spy.core/org.eclipse.pde.spy.core.SpyProcessor | ||
* @return | ||
*/ | ||
public boolean isIdentifierEnabled(String identifierId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...rg.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/ActivityManagerProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.eclipse.ui.internal.util; | ||
|
||
import org.eclipse.ui.activities.IWorkbenchActivitySupport; | ||
import org.eclipse.ui.internal.activitysupport.IActivityManagerProxy; | ||
|
||
/** | ||
* @since 3.5 | ||
* | ||
*/ | ||
public class ActivityManagerProxy implements IActivityManagerProxy { | ||
|
||
private IWorkbenchActivitySupport wbActivitySupport; | ||
|
||
public ActivityManagerProxy(IWorkbenchActivitySupport wbActivitySupport) { | ||
this.wbActivitySupport = wbActivitySupport; | ||
} | ||
|
||
@Override | ||
public boolean isIdentifierEnabled(String identifierId) { | ||
boolean isEnabled = wbActivitySupport.getActivityManager().getIdentifier(identifierId).isEnabled(); | ||
return isEnabled; | ||
} | ||
} |