-
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
69f6e45
commit cbb8ac5
Showing
7 changed files
with
152 additions
and
2 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.workbench 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 | ||
Check warning on line 34 in bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/ui/activitysupport/IActivityManagerProxy.java Jenkins - Eclipse Platform / Compiler and API ToolsJavadoc
|
||
*/ | ||
public boolean isIdentifierEnabled(String identifierId); | ||
} |
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
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
...org.eclipse.ui.workbench/eclipseui/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 final IWorkbenchActivitySupport wbActivitySupport; | ||
|
||
public ActivityManagerProxy(IWorkbenchActivitySupport wbActivitySupport) { | ||
this.wbActivitySupport = wbActivitySupport; | ||
} | ||
|
||
@Override | ||
public boolean isIdentifierEnabled(String identifierId) { | ||
boolean isEnabled = wbActivitySupport.getActivityManager().getIdentifier(identifierId).isEnabled(); | ||
return isEnabled; | ||
} | ||
} |