Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » How to call share Project command from my plugin java code(I am trying to call egit share project command Team->Share Project from my eclipse plugin java code . its not working please help .)
How to call share Project command from my plugin java code [message #1449325] Tue, 21 October 2014 07:26
reeta aggarwal is currently offline reeta aggarwalFriend
Messages: 1
Registered: October 2014
Junior Member
Following is my plugin code snippet . Please let me know what is wrong here.There is no exception on command execution but also nothing happens that's why i m not able to debug the issue in this code.

// Obtain IServiceLocator implementer, e.g. from PlatformUI.getWorkbench():
IServiceLocator serviceLocator = PlatformUI.getWorkbench();

ICommandService commandService = (ICommandService) serviceLocator
.getService(ICommandService.class);
IEvaluationService eService=(IEvaluationService) serviceLocator
.getService(IEvaluationService.class);
try {

SasPlugin.getDefault().log(
" Going to EXECUTE share project command for "
+ ((BPProjectWizard) getWizard())
.getFirstPage().getProjectName());
// Lookup commmand with its ID
Command command = commandService.
getCommand("org.eclipse.egit.ui.command.shareProject");


if (command.isEnabled()) {
SasPlugin.getDefault().log(
" The command is enabled" + command +" Category is "+command.getCategory());
}

Map params = new HashMap();
params.put(
"org.eclipse.egit.ui.command.projectNameParameter",
((BPProjectWizard) getWizard()).getFirstPage()
.getProjectName());

SasPlugin.getDefault().log("create execution event "+eService);

IEvaluationContext ecCurrent=eService.getCurrentState(); //hService.createContextSnapshot(true);
EvaluationContext ec = new EvaluationContext(
ecCurrent, ((BPProjectWizard) getWizard()).getFirstPage().getProjectHandle());



ec.addVariable("activeShell",
((BPProjectWizard) getWizard())
.getWorkbench()
.getActiveWorkbenchWindow()
.getShell());
ec.addVariable("activeWorkbenchWindow",
((BPProjectWizard) getWizard()).getWorkbench()
.getActiveWorkbenchWindow());

ExecutionEvent EE = new ExecutionEvent(command,params, null,
ec);



// Optionally pass a ExecutionEvent instance, default
// no-param arg creates blank event

command.executeWithChecks(EE);

SasPlugin.getDefault().log(" command EXECUTED ********* ");
Previous Topic:implement sparse checkout
Next Topic:Performance bad, possible to use native git?
Goto Forum:
  


Current Time: Sun Aug 25 23:28:34 GMT 2019

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

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

Back to the top