How to call share Project command from my plugin java code [message #1449325] |
Tue, 21 October 2014 07:26 |
reeta aggarwal 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 ********* ");
|
|
|
Powered by
FUDForum. Page generated in 0.02905 seconds