* @throws NotHandledException
*/
public void executeCommand(String commandId) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
- IHandlerService handlerService = (IHandlerService) fControlView.getSite().getService(IHandlerService.class);
+ Object handlerServiceObject = fControlView.getSite().getService(IHandlerService.class);
+ IHandlerService handlerService = (IHandlerService) handlerServiceObject;
handlerService.executeCommand(COMMAND_CATEGORY_PREFIX + commandId, null);
waitForJobs();
}
@Override
public void run() {
try {
- IHandlerService handlerService = (IHandlerService) page.getActivePart().getSite().getService(IHandlerService.class);
+ Object service = page.getActivePart().getSite().getService(IHandlerService.class);
+ IHandlerService handlerService = (IHandlerService) service;
boolean executeCommand = ((element instanceof TmfTraceElement) || (element instanceof TmfAnalysisOutputElement));
if (!executeCommand && element instanceof TmfExperimentElement) {
@Override
public void run() {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IHandlerService handlerService = (IHandlerService) activePage.getActiveEditor().getSite().getService(IHandlerService.class);
- ICommandService cmdService = (ICommandService) activePage.getActiveEditor().getSite().getService(ICommandService.class);
+ Object handlerServiceObject = activePage.getActiveEditor().getSite().getService(IHandlerService.class);
+ IHandlerService handlerService = (IHandlerService) handlerServiceObject;
+ Object cmdServiceObject = activePage.getActiveEditor().getSite().getService(ICommandService.class);
+ ICommandService cmdService = (ICommandService) cmdServiceObject;
try {
HashMap<String, Object> parameters = new HashMap<>();
Command command = cmdService.getCommand(ExportToTextCommandHandler.COMMAND_ID);
public void setSite(ViewPart viewSite) {
fSite = viewSite;
fSite.getSite().setSelectionProvider(fSelProvider);
- IContextService service = (IContextService) fSite.getSite().getWorkbenchWindow().getService(IContextService.class);
+ Object serviceObject = fSite.getSite().getWorkbenchWindow().getService(IContextService.class);
+ IContextService service = (IContextService) serviceObject;
service.activateContext("org.eclipse.linuxtools.tmf.ui.view.uml2sd.context"); //$NON-NLS-1$
service.activateContext(IContextIds.CONTEXT_ID_WINDOW);
}
*/
private void initialize() {
fGoToMessageForKeyBinding = new MoveToMessage();
- IHandlerService service = (IHandlerService) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(IHandlerService.class);
+ Object serviceObject = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(IHandlerService.class);
+ IHandlerService service = (IHandlerService) serviceObject;
AbstractHandler handler = new AbstractHandler() {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
//During Eclipse shutdown the active workbench window is null
return;
}
- IHandlerService service = (IHandlerService) window.getService(IHandlerService.class);
+ Object serviceObject = window.getService(IHandlerService.class);
+ IHandlerService service = (IHandlerService) serviceObject;
for(IHandlerActivation activation : fHandlerActivations) {
service.deactivateHandler(activation);
}