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%2FOpenDashboardEditor.java;fp=org.argeo.suite.workbench.rap%2Fsrc%2Forg%2Fargeo%2Fsuite%2Fworkbench%2Fcommands%2FOpenDashboardEditor.java;h=0000000000000000000000000000000000000000;hp=2b7a2d154350f67355394b77f633324bdca5dd3b;hb=a5e5ab1e12391c0d6514ac7fa8fd3a242340b4a0;hpb=812bfa3846793ca50eb108850aff4489066bd138 diff --git a/org.argeo.suite.workbench.rap/src/org/argeo/suite/workbench/commands/OpenDashboardEditor.java b/org.argeo.suite.workbench.rap/src/org/argeo/suite/workbench/commands/OpenDashboardEditor.java deleted file mode 100644 index 2b7a2d1..0000000 --- a/org.argeo.suite.workbench.rap/src/org/argeo/suite/workbench/commands/OpenDashboardEditor.java +++ /dev/null @@ -1,52 +0,0 @@ -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.util.EntityEditorInput; -import org.argeo.jcr.JcrUtils; -import org.argeo.node.NodeUtils; -import org.argeo.suite.SuiteException; -import org.argeo.suite.workbench.AsUiPlugin; -import org.argeo.suite.workbench.parts.DefaultDashboardEditor; -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.handlers.HandlerUtil; - -/** Workaround to enable opening of a default editor */ -public class OpenDashboardEditor extends AbstractHandler { - public final static String ID = AsUiPlugin.PLUGIN_ID + ".openDashboardEditor"; - - private Repository repository; - - public Object execute(ExecutionEvent event) throws ExecutionException { - Session session = null; - try { - // TODO check roles - session = repository.login(); - IWorkbenchPage iwPage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage(); - Node homeNode = NodeUtils.getUserHome(session); - EntityEditorInput eei = new EntityEditorInput(homeNode.getIdentifier()); - IEditorPart iep = iwPage.findEditor(eei); - if (iep == null) { - iwPage.openEditor(eei, DefaultDashboardEditor.ID); - } else - iwPage.activate(iep); - } catch (RepositoryException | PartInitException re) { - throw new SuiteException("Unable to open dashboard", re); - } finally { - JcrUtils.logoutQuietly(session); - } - return null; - } - - public void setRepository(Repository repository) { - this.repository = repository; - } -}