Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Subversive » Removing actions from Subversive view pop-up menu
Removing actions from Subversive view pop-up menu [message #485289] Fri, 11 September 2009 08:31 Go to next message
Jean-Marie Damas is currently offline Jean-Marie Damas
Messages: 29
Registered: July 2009
Junior Member
My objective is (trying) to disable some Action contributions in the
pop-up menu of a contributed view, all by the same plugin (Subversive).
I used the Subversive Capability and it disabled a lot of UI
contributions, but not these actions in context menus. Subversive plugin
adds directly these actions in the pop-up menu and does not define any
"ActionDefinitionId".

I integrate this plugin in my application and use some "team" views
(History and Synchronize), but I don't need its SVN actions contributions
in menus because I've redefined my proper actions (commands) in my proper
sub-menu and then calling the Subversive API, the job is done.

So, I need to remove the unnecessary SVN actions added by the Subversive
plugin in the pop-up menu of one view.
Is there a workbench API to do that ?
Should I associate the Actions to "Command Ids" and they will be disabled
by the Capability ? But how can I get these actions to set their
"ActionDefinitionId" ?

In cross posted this article in the eclipse.platform forum.
Thanks you for your help.
JM.D
Re: Removing actions from Subversive view pop-up menu [message #487714 is a reply to message #485289] Thu, 24 September 2009 08:41 Go to previous messageGo to next message
Igor Burilo is currently offline Igor Burilo
Messages: 435
Registered: July 2009
Senior Member
Hello Jean-Marie,

In what view do you want to disable Subversive actions, e.g. Synchronize,
History etc.? For completeness, please provide some names of actions you
want to disable.

> My objective is (trying) to disable some Action contributions in the
> pop-up menu of a contributed view, all by the same plugin (Subversive).
> I used the Subversive Capability and it disabled a lot of UI
> contributions, but not these actions in context menus. Subversive plugin
> adds directly these actions in the pop-up menu and does not define any
> "ActionDefinitionId".
>
> I integrate this plugin in my application and use some "team" views
> (History and Synchronize), but I don't need its SVN actions contributions
> in menus because I've redefined my proper actions (commands) in my proper
> sub-menu and then calling the Subversive API, the job is done.
> So, I need to remove the unnecessary SVN actions added by the Subversive
> plugin in the pop-up menu of one view. Is there a workbench API to do that
> ? Should I associate the Actions to "Command Ids" and they will be
> disabled by the Capability ? But how can I get these actions to set their
> "ActionDefinitionId" ?
>
> In cross posted this article in the eclipse.platform forum.
> Thanks you for your help.
> JM.D
>
Re: Removing actions from Subversive view pop-up menu [message #487921 is a reply to message #487714] Thu, 24 September 2009 19:35 Go to previous messageGo to next message
Jean-Marie Damas is currently offline Jean-Marie Damas
Messages: 29
Registered: July 2009
Junior Member
Igor Burilo a écrit :
> Hello Jean-Marie,
>
> In what view do you want to disable Subversive actions, e.g. Synchronize,
> History etc.? For completeness, please provide some names of actions you
> want to disable.
>
Hello Igor.
I want to disable :
- the "Commit..." action in the "Synchronize" view
- the "Branch from ..." and "Tag from ..." actions in the "History" view.

Thank's for your help.
JM.D
Re: Removing actions from Subversive view pop-up menu [message #488119 is a reply to message #487921] Fri, 25 September 2009 15:33 Go to previous messageGo to next message
Jean-Marie Damas is currently offline Jean-Marie Damas
Messages: 29
Registered: July 2009
Junior Member
Jean-Marie Damas wrote on Thu, 24 September 2009 15:35

Hello Igor.
I want to disable :
- the "Commit..." action in the "Synchronize" view



My first idea is to :
- add my own "Synchronize Participant", using a class that extends "UpdateModelParticipant",
- override the management of actions, maybe by overriding "getActionGroups()" method ?

But : my participant doesn't appear in the "Synchronize" view ...
I'm certainly forgetting a lot of things ...

Here is my plugin.xml :
   <extension
         point="org.eclipse.team.ui.synchronizeParticipants">
      <participant
            class="com.airbus.forges.client.team.subversive.ForgesSynchronizeParticipant"
            id="com.airbus.forges.client.team.subversive.ForgesParticipant"
            name="FORGES"
            persistent="true">
      </participant>
   </extension>

Here is my class :
public class ForgesSynchronizeParticipant extends UpdateModelParticipant {
	
	public ForgesSynchronizeParticipant() {
		super();
	}
	
	public ForgesSynchronizeParticipant(SynchronizationContext context) {
		super(context);
		try {
			setInitializationData(TeamUI.getSynchronizeManager().getParticipantDescriptor("com.airbus.forges.client.team.subversive.ForgesParticipant")); //$NON-NLS-1$
		} catch (CoreException e) {			
			UILoggedOperation.reportError(this.getClass().getName(), e);
		}
		setSecondaryId(Long.toString(System.currentTimeMillis()));
		this.isConsultChangeSets = isConsultChangeSets(context.getScopeManager());		
	}

	protected Collection<AbstractSynchronizeActionGroup> getActionGroups() {
		Collection actionGroups = super.getActionGroups();
		// do my stuff ...
		return actionGroups;
	}
}
Re: Removing actions from Subversive view pop-up menu [message #488555 is a reply to message #488119] Tue, 29 September 2009 08:56 Go to previous messageGo to next message
Jean-Marie Damas is currently offline Jean-Marie Damas
Messages: 29
Registered: July 2009
Junior Member
Jean-Marie Damas wrote on Fri, 25 September 2009 11:33
I'm certainly forgetting a lot of things ...

So, I've also created my own synchronization wizard (extending SynchronizeWizard) to be able to contribute to the Synchronize view, adding my own Participant in a Synchronize Page and then, overriding the initializeConfiguration() method (see below), I try to remove a menu group.

	@Override
	protected void initializeConfiguration(
			ISynchronizePageConfiguration configuration) {

		super.initializeConfiguration(configuration);
		
		// Get the Synchronize view context menu groups
		String[] menuGroups = (String[])configuration.getProperty(ISynchronizePageConfiguration.P_CONTEXT_MENU);
		ArrayList<String> myMenuGroups = new ArrayList<String>(menuGroups.length);
		for (int i = 0; i < menuGroups.length; i++) {
			String menuGroup = menuGroups[i];
			// Remove the "edit" menu group
			if (! menuGroup.equals(ISynchronizePageConfiguration.EDIT_GROUP)) {
				// Keep other menu groups into My Synchronize menu
				myMenuGroups.add(menuGroup);
			}
		}
		// Update the Synchronize view context menu groups
		configuration.setMenuGroups(ISynchronizePageConfiguration.P_CONTEXT_MENU,
				(String[]) myMenuGroups.toArray(new String[myMenuGroups.size()]));
	}


But that isn't effective ... Dead
May be I should not call the initializeConfiguration() method of the super class ?
Should I have to deal with ActionContributions instead (seams more complicated) ?

Has someone a good entry point in some documentation explaining the action contributions life cycle in the Team framework ???
Thank for your help
JM.D
Re: Removing actions from Subversive view pop-up menu [message #488580 is a reply to message #488555] Tue, 29 September 2009 10:42 Go to previous message
Jean-Marie Damas is currently offline Jean-Marie Damas
Messages: 29
Registered: July 2009
Junior Member
Jean-Marie Damas wrote on Tue, 29 September 2009 04:56
Has someone a good entry point in some documentation explaining the action contributions life cycle in the Team framework ???

Think it is all explained there : http:// help.eclipse.org/ganymede/topic/org.eclipse.platform.doc.isv /reference/api/org/eclipse/team/ui/synchronize/SynchronizePa geActionGroup.html
Reading ...
Previous Topic:Subversive in RCP app
Next Topic:[Bug ?] Subversive key bindings definition
Goto Forum:
  


Current Time: Mon Oct 20 21:20:00 GMT 2014

Powered by FUDForum. Page generated in 0.01816 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software