-
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
cc770ec
commit 30f6fc5
Showing
7 changed files
with
124 additions
and
7 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
37 changes: 37 additions & 0 deletions
37
...org.eclipse.e4.ui.workbench/src/org/eclipse/ui/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,37 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Advantest Europe GmbH and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Raghunandana Murthappa | ||
*******************************************************************************/ | ||
package org.eclipse.ui.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 1.16 | ||
*/ | ||
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
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
32 changes: 32 additions & 0 deletions
32
...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,32 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Advantest Europe GmbH and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Raghunandana Murthappa | ||
*******************************************************************************/ | ||
package org.eclipse.ui.internal.util; | ||
|
||
import org.eclipse.ui.activities.IWorkbenchActivitySupport; | ||
import org.eclipse.ui.activitysupport.IActivityManagerProxy; | ||
|
||
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; | ||
} | ||
} |
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