]> git.argeo.org Git - lgpl/argeo-commons.git/blob - OpenGenericJcrQueryEditor.java
1169747068a2597d83cb9026a29ef215cda754f3
[lgpl/argeo-commons.git] / OpenGenericJcrQueryEditor.java
1 package org.argeo.eclipse.ui.jcr.commands;
2
3 import org.argeo.eclipse.ui.jcr.editors.JcrQueryEditorInput;
4 import org.eclipse.core.commands.AbstractHandler;
5 import org.eclipse.core.commands.ExecutionEvent;
6 import org.eclipse.core.commands.ExecutionException;
7 import org.eclipse.ui.IWorkbenchPage;
8 import org.eclipse.ui.handlers.HandlerUtil;
9
10 /** Open a JCR query editor. */
11 public class OpenGenericJcrQueryEditor extends AbstractHandler {
12 private String editorId;
13
14 public Object execute(ExecutionEvent event) throws ExecutionException {
15 try {
16 JcrQueryEditorInput editorInput = new JcrQueryEditorInput("", null);
17 IWorkbenchPage activePage = HandlerUtil.getActiveWorkbenchWindow(
18 event).getActivePage();
19 activePage.openEditor(editorInput, editorId);
20 } catch (Exception e) {
21 throw new ExecutionException("Cannot open editor", e);
22 }
23 return null;
24 }
25
26 public void setEditorId(String editorId) {
27 this.editorId = editorId;
28 }
29
30 }