X-Git-Url: https://git.argeo.org/?p=gpl%2Fargeo-suite.git;a=blobdiff_plain;f=org.argeo.suite.workbench.rap%2Fsrc%2Forg%2Fargeo%2Fsuite%2Fworkbench%2Fcommands%2FOpenEntityEditor.java;h=433ed71b6f2d9b9a24b42709936262ffb824a4dd;hp=aad084b485d4b1d2b09cec435aa56a13efd96516;hb=e51dee49ebe0d118c9ce3a5cbf06054e7e2df516;hpb=6fcadd5457518ce2e3aa05bdfd1cbc874ed8deab diff --git a/org.argeo.suite.workbench.rap/src/org/argeo/suite/workbench/commands/OpenEntityEditor.java b/org.argeo.suite.workbench.rap/src/org/argeo/suite/workbench/commands/OpenEntityEditor.java index aad084b..433ed71 100644 --- a/org.argeo.suite.workbench.rap/src/org/argeo/suite/workbench/commands/OpenEntityEditor.java +++ b/org.argeo.suite.workbench.rap/src/org/argeo/suite/workbench/commands/OpenEntityEditor.java @@ -1,68 +1,71 @@ package org.argeo.suite.workbench.commands; -import javax.jcr.Node; -import javax.jcr.Repository; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import org.argeo.connect.ui.workbench.AppWorkbenchService; -import org.argeo.connect.ui.workbench.NodeEditorInput; -import org.argeo.jcr.JcrUtils; -import org.argeo.suite.SuiteException; -import org.argeo.suite.workbench.AsUiPlugin; -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.handlers.HandlerUtil; +public class OpenEntityEditor{} -/** Workaround to enable opening of a default editor */ -public class OpenEntityEditor extends AbstractHandler { - public final static String ID = AsUiPlugin.PLUGIN_ID + ".openEntityEditor"; - - public final static String PARAM_JCR_ID = "param.jcrId"; - // public final static String PARAM_OPEN_FOR_EDIT = "param.openForEdit"; - // public final static String PARAM_CTAB_ID = "param.cTabId"; - - private Repository repository; - private AppWorkbenchService appWorkbenchService; - - public Object execute(ExecutionEvent event) throws ExecutionException { - NodeEditorInput eei = null; - Node entity = null; - Session session = null; - String jcrId = event.getParameter(PARAM_JCR_ID); - try { - session = repository.login(); - if (jcrId != null) { - entity = session.getNodeByIdentifier(jcrId); - eei = new NodeEditorInput(jcrId); - } else - return null; - - String editorId = appWorkbenchService.getEntityEditorId(entity); - if (editorId != null) { - IWorkbenchWindow iww = HandlerUtil.getActiveWorkbenchWindow(event); - IWorkbenchPage iwp = iww.getActivePage(); - iwp.openEditor(eei, editorId); - } - } catch (PartInitException pie) { - throw new SuiteException("Unexpected PartInitException while opening entity editor", pie); - } catch (RepositoryException e) { - throw new SuiteException("unexpected JCR error while opening editor", e); - } finally { - JcrUtils.logoutQuietly(session); - } - return null; - } - - public void setRepository(Repository repository) { - this.repository = repository; - } - - public void setAppWorkbenchService(AppWorkbenchService appWorkbenchService) { - this.appWorkbenchService = appWorkbenchService; - } -} +//import javax.jcr.Node; +//import javax.jcr.Repository; +//import javax.jcr.RepositoryException; +//import javax.jcr.Session; +// +//import org.argeo.connect.ui.workbench.AppWorkbenchService; +//import org.argeo.connect.ui.workbench.NodeEditorInput; +//import org.argeo.jcr.JcrUtils; +//import org.argeo.suite.SuiteException; +//import org.argeo.suite.workbench.AsUiPlugin; +//import org.eclipse.core.commands.AbstractHandler; +//import org.eclipse.core.commands.ExecutionEvent; +//import org.eclipse.core.commands.ExecutionException; +//import org.eclipse.ui.IWorkbenchPage; +//import org.eclipse.ui.IWorkbenchWindow; +//import org.eclipse.ui.PartInitException; +//import org.eclipse.ui.handlers.HandlerUtil; +// +///** Workaround to enable opening of a default editor */ +//public class OpenEntityEditor extends AbstractHandler { +// public final static String ID = AsUiPlugin.PLUGIN_ID + ".openEntityEditor"; +// +// public final static String PARAM_JCR_ID = "param.jcrId"; +// // public final static String PARAM_OPEN_FOR_EDIT = "param.openForEdit"; +// // public final static String PARAM_CTAB_ID = "param.cTabId"; +// +// private Repository repository; +// private AppWorkbenchService appWorkbenchService; +// +// public Object execute(ExecutionEvent event) throws ExecutionException { +// NodeEditorInput eei = null; +// Node entity = null; +// Session session = null; +// String jcrId = event.getParameter(PARAM_JCR_ID); +// try { +// session = repository.login(); +// if (jcrId != null) { +// entity = session.getNodeByIdentifier(jcrId); +// eei = new NodeEditorInput(jcrId); +// } else +// return null; +// +// String editorId = appWorkbenchService.getEntityEditorId(entity); +// if (editorId != null) { +// IWorkbenchWindow iww = HandlerUtil.getActiveWorkbenchWindow(event); +// IWorkbenchPage iwp = iww.getActivePage(); +// iwp.openEditor(eei, editorId); +// } +// } catch (PartInitException pie) { +// throw new SuiteException("Unexpected PartInitException while opening entity editor", pie); +// } catch (RepositoryException e) { +// throw new SuiteException("unexpected JCR error while opening editor", e); +// } finally { +// JcrUtils.logoutQuietly(session); +// } +// return null; +// } +// +// public void setRepository(Repository repository) { +// this.repository = repository; +// } +// +// public void setAppWorkbenchService(AppWorkbenchService appWorkbenchService) { +// this.appWorkbenchService = appWorkbenchService; +// } +//}