@Override protected String execute(Workflow workflow) throws Exception { if (isValid()) { IEditor editor = context.getService(config.getString("editor.id"), IEditor.class); editor.setMode(IEditor.Mode.VIEW); } return null; } });
@Override protected String execute(Workflow wf) throws Exception { Node docNode = getModel().getNode(); IEditorManager editorMgr = getPluginContext().getService( getPluginConfig().getString(IEditorManager.EDITOR_ID), IEditorManager.class); if (editorMgr != null) { JcrNodeModel docModel = new JcrNodeModel(docNode); IEditor editor = editorMgr.getEditor(docModel); if (editor == null) { editorMgr.openEditor(docModel); } else { editor.setMode(Mode.EDIT); } } else { log.warn("No editor found to edit {}", docNode.getPath()); } return null; } });
@Override protected String execute(Workflow wf) throws Exception { Node docNode = ((WorkflowDescriptorModel) EditingDefaultWorkflowPlugin.this.getDefaultModel()) .getNode(); IEditorManager editorMgr = getPluginContext().getService( getPluginConfig().getString(IEditorManager.EDITOR_ID), IEditorManager.class); if (editorMgr != null) { JcrNodeModel docModel = new JcrNodeModel(docNode); IEditor editor = editorMgr.getEditor(docModel); if (editor == null) { editorMgr.openEditor(docModel); } else { editor.setMode(Mode.VIEW); } } else { log.warn("No editor found to edit {}", docNode.getPath()); } return null; } });
editorMgr.openEditor(nodeModel); } else { editor.setMode(IEditor.Mode.EDIT);
private void openDocumentEditor(final String documentHandleUuid, final IEditor.Mode mode) { final IEditorManager editorManager = context.getService(editorManagerServiceId, IEditorManager.class); try { final Node documentHandle = UserSession.get().getJcrSession().getNodeByIdentifier(documentHandleUuid); final JcrNodeModel documentHandleModel = new JcrNodeModel(documentHandle); IEditor<?> editor = editorManager.getEditor(documentHandleModel); if (editor == null) { editor = editorManager.openEditor(documentHandleModel); } if (mode == IEditor.Mode.EDIT && editor.getMode() != IEditor.Mode.EDIT) { editor.setMode(mode); } editor.focus(); } catch (ItemNotFoundException e) { ChannelEditor.log.warn("Could not find document with uuid '{}'", documentHandleUuid, e); } catch (EditorException|RepositoryException|ServiceException e) { ChannelEditor.log.warn("Failed to open editor in '{}' mode for document with uuid '{}'", mode, documentHandleUuid, e); } } }