]>
git.argeo.org Git - gpl/argeo-suite.git/blob - argeo/suite/workbench/commands/OpenDashboardEditor.java
1 package org
.argeo
.suite
.workbench
.commands
;
4 import javax
.jcr
.Repository
;
5 import javax
.jcr
.RepositoryException
;
6 import javax
.jcr
.Session
;
8 import org
.argeo
.connect
.ui
.workbench
.util
.EntityEditorInput
;
9 import org
.argeo
.jcr
.JcrUtils
;
10 import org
.argeo
.node
.NodeUtils
;
11 import org
.argeo
.suite
.SuiteException
;
12 import org
.argeo
.suite
.workbench
.AsUiPlugin
;
13 import org
.argeo
.suite
.workbench
.parts
.DefaultDashboardEditor
;
14 import org
.eclipse
.core
.commands
.AbstractHandler
;
15 import org
.eclipse
.core
.commands
.ExecutionEvent
;
16 import org
.eclipse
.core
.commands
.ExecutionException
;
17 import org
.eclipse
.ui
.IEditorPart
;
18 import org
.eclipse
.ui
.IWorkbenchPage
;
19 import org
.eclipse
.ui
.PartInitException
;
20 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
22 /** Workaround to enable opening of a default editor */
23 public class OpenDashboardEditor
extends AbstractHandler
{
24 public final static String ID
= AsUiPlugin
.PLUGIN_ID
+ ".openDashboardEditor";
26 private Repository repository
;
28 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
29 Session session
= null;
32 session
= repository
.login();
33 IWorkbenchPage iwPage
= HandlerUtil
.getActiveWorkbenchWindow(event
).getActivePage();
34 Node homeNode
= NodeUtils
.getUserHome(session
);
35 EntityEditorInput eei
= new EntityEditorInput(homeNode
.getIdentifier());
36 IEditorPart iep
= iwPage
.findEditor(eei
);
38 iwPage
.openEditor(eei
, DefaultDashboardEditor
.ID
);
41 } catch (RepositoryException
| PartInitException re
) {
42 throw new SuiteException("Unable to open dashboard", re
);
44 JcrUtils
.logoutQuietly(session
);
49 public void setRepository(Repository repository
) {
50 this.repository
= repository
;