本文整理汇总了Java中org.eclipse.core.commands.NotHandledException类的典型用法代码示例。如果您正苦于以下问题:Java NotHandledException类的具体用法?Java NotHandledException怎么用?Java NotHandledException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NotHandledException类属于org.eclipse.core.commands包,在下文中一共展示了NotHandledException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hookDoubleClickAction
import org.eclipse.core.commands.NotHandledException; //导入依赖的package包/类
private void hookDoubleClickAction() {
bookmarksTreeViewer.addDoubleClickListener(event -> {
ISelection selection = bookmarksTreeViewer.getSelection();
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
Bookmark bookmark = Adapters.adapt(firstElement, Bookmark.class);
if (bookmark instanceof BookmarkFolder) {
bookmarksTreeViewer.setExpandedState(firstElement, !bookmarksTreeViewer.getExpandedState(firstElement));
} else {
// sometimes, selection and part in the command handler are not set to the boomarks view when we double-click on a bookmark
getSite().getWorkbenchWindow().getActivePage().activate(this);
IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
try {
handlerService.executeCommand(COMMAND_ID_GOTO_FAVORI, null);
} catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) {
StatusHelper.logError("Could not go to bookmark", e);
}
}
});
}
示例2: performDrop
import org.eclipse.core.commands.NotHandledException; //导入依赖的package包/类
@Override
public boolean performDrop(Object data) {
IServiceLocator locator = Helper.getWB();
ICommandService svc = (ICommandService)locator.getService(
ICommandService.class);
Command cmd = svc.getCommand(CMD_ID_MOVE_ENTRY);
Map<String, String> params = new HashMap<>();
params.put("source", data.toString());
TreeNode en = (TreeNode)getCurrentTarget();
EntryData ed = EntryData.of(en);
params.put("target", String.valueOf(ed.entryID()));
try {
cmd.executeWithChecks(
new ExecutionEvent(cmd, params, getCurrentEvent(), null));
} catch (ExecutionException | NotDefinedException | NotEnabledException
| NotHandledException e) {
throw new RuntimeException(e);
}
return true;
}
示例3: callRuleGenerationCommand
import org.eclipse.core.commands.NotHandledException; //导入依赖的package包/类
private boolean callRuleGenerationCommand(EPackage ePack, PatternInstance pattern, IPath iPath) {
IServiceLocator serviceLocator = PlatformUI.getWorkbench();
ICommandService commandService = serviceLocator.getService(ICommandService.class);
IHandlerService handlerService = serviceLocator.getService(IHandlerService.class);
Command command = commandService.getCommand("org.mondo.collaboration.security.macl.tao.generation.rule");
try {
IParameter parameter = command.getParameter(MACLCommandContext.ID);
String contextId = UUID.randomUUID().toString();
Activator.put(contextId, context);
Parameterization parameterization = new Parameterization(parameter, contextId);
ParameterizedCommand parameterizedCommand = new ParameterizedCommand(command, new Parameterization[] { parameterization });
return (Boolean) handlerService.executeCommand(parameterizedCommand, null);
} catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e1) {
return false;
}
}
示例4: execute
import org.eclipse.core.commands.NotHandledException; //导入依赖的package包/类
@Override
public boolean execute(EPackage ePack, PatternInstance pattern, IPath iPath) {
IServiceLocator serviceLocator = PlatformUI.getWorkbench();
ICommandService commandService = serviceLocator.getService(ICommandService.class);
IHandlerService handlerService = serviceLocator.getService(IHandlerService.class);
Command command = commandService.getCommand("org.mondo.collaboration.security.macl.tao.generation");
try {
IParameter parameter = command.getParameter(MACLCommandContext.ID);
MACLCommandContext context = new MACLCommandContext(ePack, pattern, iPath);
String contextId = UUID.randomUUID().toString();
Activator.put(contextId, context);
Parameterization parameterization = new Parameterization(parameter, contextId);
ParameterizedCommand parameterizedCommand = new ParameterizedCommand(command, new Parameterization[] { parameterization });
return (Boolean) handlerService.executeCommand(parameterizedCommand, null);
} catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e1) {
return false;
}
}
示例5: executeCommand
import org.eclipse.core.commands.NotHandledException; //导入依赖的package包/类
private static Object executeCommand(String commandId, Map<String,?> parameters, Event event, ICommandService ics, IHandlerService ihs)
throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException, CommandException {
Object result = null;
if (ics != null && ihs != null) {
Command command = ics.getCommand(commandId);
if (command != null) {
try {
MarkUtils.setIgnoreDispatchId(true);
ParameterizedCommand pcommand = ParameterizedCommand.generateCommand(command, parameters);
if (pcommand != null) {
result = ihs.executeCommand(pcommand, event);
}
} finally {
MarkUtils.setIgnoreDispatchId(false);
}
}
}
return result;
}
示例6: performFinish
import org.eclipse.core.commands.NotHandledException; //导入依赖的package包/类
@Override
public boolean performFinish() {
String selectedOption = wizardPage.getSelectedOption();
String commandId = commandOptions.get(selectedOption);
Command selectedCommand = commandService.getCommand(commandId);
try{
selectedCommand.executeWithChecks(new ExecutionEvent());
}
catch(ExecutionException | NotDefinedException
| NotEnabledException | NotHandledException e){
MessageDialog.openError(getShell(), "Error", "The selected Command"
+ " could not be executed successfully.");
return false;
}
return true;
}
示例7: createEvent
import org.eclipse.core.commands.NotHandledException; //导入依赖的package包/类
private void createEvent(Command command, IPersistentObject po){
IStructuredSelection iStructuredSelection = null;
if (po != null) {
iStructuredSelection = new StructuredSelection(po);
}
PlatformUI.getWorkbench().getService(IEclipseContext.class)
.set(command.getId().concat(".selection"),
iStructuredSelection);
try {
command.executeWithChecks(
new ExecutionEvent(command, Collections.EMPTY_MAP, this, null));
} catch (ExecutionException | NotDefinedException | NotEnabledException
| NotHandledException e) {
logger.error("cannot executre local edit event", e);
}
}
示例8: startEditLocalDocument
import org.eclipse.core.commands.NotHandledException; //导入依赖的package包/类
/**
* If {@link Preferences#P_TEXT_EDIT_LOCAL} is set, the
* <code> ch.elexis.core.ui.command.startEditLocalDocument </code> command is called with the
* provided {@link Brief}, and the provided {@link IViewPart} is hidden.
*
* @param view
* @param brief
* @return returns true if edit local is started and view is hidden
*/
public static boolean startEditLocalDocument(IViewPart view, Brief brief){
if (CoreHub.localCfg.get(Preferences.P_TEXT_EDIT_LOCAL, false) && brief != null) {
// open for editing
ICommandService commandService =
(ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
Command command =
commandService.getCommand("ch.elexis.core.ui.command.startEditLocalDocument"); //$NON-NLS-1$
PlatformUI.getWorkbench().getService(IEclipseContext.class)
.set(command.getId().concat(".selection"), new StructuredSelection(brief));
try {
command.executeWithChecks(
new ExecutionEvent(command, Collections.EMPTY_MAP, view, null));
} catch (ExecutionException | NotDefinedException | NotEnabledException
| NotHandledException e) {
MessageDialog.openError(view.getSite().getShell(), Messages.TextView_errortitle,
Messages.TextView_errorlocaleditmessage);
}
view.getSite().getPage().hideView(view);
return true;
}
return false;
}
示例9: startLocalEdit
import org.eclipse.core.commands.NotHandledException; //导入依赖的package包/类
private void startLocalEdit(Brief brief){
if (brief != null) {
ICommandService commandService =
(ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
Command command =
commandService.getCommand("ch.elexis.core.ui.command.startEditLocalDocument"); //$NON-NLS-1$
PlatformUI.getWorkbench().getService(IEclipseContext.class)
.set(command.getId().concat(".selection"), new StructuredSelection(brief));
try {
command.executeWithChecks(
new ExecutionEvent(command, Collections.EMPTY_MAP, this, null));
} catch (ExecutionException | NotDefinedException | NotEnabledException
| NotHandledException e) {
MessageDialog.openError(Display.getDefault().getActiveShell(),
Messages.BriefAuswahl_errorttile,
Messages.BriefAuswahl_erroreditmessage);
}
}
}
示例10: endLocalEdit
import org.eclipse.core.commands.NotHandledException; //导入依赖的package包/类
private void endLocalEdit(StructuredSelection selection){
ICommandService commandService =
(ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
Command command = commandService.getCommand("ch.elexis.core.ui.command.endLocalDocument"); //$NON-NLS-1$
PlatformUI.getWorkbench().getService(IEclipseContext.class)
.set(command.getId().concat(".selection"), selection);
try {
command
.executeWithChecks(new ExecutionEvent(command, Collections.EMPTY_MAP, this, null));
tableViewer.setInput(service.getAll());
} catch (ExecutionException | NotDefinedException | NotEnabledException
| NotHandledException e) {
MessageDialog.openError(getShell(), Messages.LocalDocumentsDialog_errortitle,
Messages.LocalDocumentsDialog_errorendmessage);
}
}
示例11: abortLocalEdit
import org.eclipse.core.commands.NotHandledException; //导入依赖的package包/类
private void abortLocalEdit(StructuredSelection selection){
ICommandService commandService =
(ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
Command command = commandService.getCommand("ch.elexis.core.ui.command.abortLocalDocument"); //$NON-NLS-1$
PlatformUI.getWorkbench().getService(IEclipseContext.class)
.set(command.getId().concat(".selection"), selection);
try {
command.executeWithChecks(new ExecutionEvent(command, Collections.EMPTY_MAP, this, null));
tableViewer.setInput(service.getAll());
} catch (ExecutionException | NotDefinedException | NotEnabledException
| NotHandledException e) {
MessageDialog.openError(getShell(), Messages.LocalDocumentsDialog_errortitle,
Messages.LocalDocumentsDialog_errorabortmessage);
}
}
示例12: openSendMailDlg
import org.eclipse.core.commands.NotHandledException; //导入依赖的package包/类
private boolean openSendMailDlg(Patient patient, List<?> iOutboxElements,
ICommandService commandService,
String attachmentsString)
throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException{
Command sendMailCommand =
commandService.getCommand("ch.elexis.core.mail.ui.sendMail");
HashMap<String, String> params = new HashMap<String, String>();
params.put("ch.elexis.core.mail.ui.sendMail.attachments", attachmentsString);
if (patient != null) {
params.put("ch.elexis.core.mail.ui.sendMail.subject",
"Patient: " + patient.getLabel());
}
ParameterizedCommand parametrizedCommmand =
ParameterizedCommand.generateCommand(sendMailCommand, params);
Object obj = PlatformUI.getWorkbench().getService(IHandlerService.class)
.executeCommand(parametrizedCommmand, null);
return Boolean.TRUE.equals(obj);
}
示例13: setStatus
import org.eclipse.core.commands.NotHandledException; //导入依赖的package包/类
private void setStatus(String statusId){
ICommandService commandService = (ICommandService) PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getService(ICommandService.class);
Command command =
commandService.getCommand("at.medevit.elexis.agenda.ui.command.setStatus");
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("at.medevit.elexis.agenda.ui.command.parameter.statusId", statusId);
ExecutionEvent ev = new ExecutionEvent(command, parameters, null, null);
try {
command.executeWithChecks(ev);
} catch (ExecutionException | NotDefinedException | NotEnabledException
| NotHandledException ex) {
LoggerFactory.getLogger(getClass()).error("Error setting status", ex);
}
}
示例14: callEgitCommitCommand
import org.eclipse.core.commands.NotHandledException; //导入依赖的package包/类
private void callEgitCommitCommand(){
if (!isCommitCommandAvailable || !mainPrefs.getBoolean(PREF.CALL_COMMIT_COMMAND_AFTER_UPDATE)){
return;
}
try {
getSite().getSelectionProvider().setSelection(new StructuredSelection(proj.getProject()));
getSite().getService(IHandlerService.class).executeCommand(COMMAND.COMMIT_COMMAND_ID, null);
} catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) {
Log.log(Log.LOG_WARNING, "Could not execute command " + COMMAND.COMMIT_COMMAND_ID, e); //$NON-NLS-1$
ExceptionNotifier.notifyDefault(Messages.ProjectEditorDiffer_failed_egit_commit, e);
}
}
示例15: run
import org.eclipse.core.commands.NotHandledException; //导入依赖的package包/类
@Override
public void run() {
IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(IHandlerService.class);
try {
handlerService.executeCommand(Constants.GRAPH_PROPERTY_COMMAND_ID, null);
} catch ( ExecutionException| NotDefinedException| NotEnabledException| NotHandledException ex) {
throw new RuntimeException(Constants.GRAPH_PROPERTY_COMMAND_ID + "not found");
}
}