use of com.liferay.ide.kaleo.ui.IKaleoEditorHelper in project liferay-ide by liferay.
the class EditNotificationHandler method edit.
@Override
public Object edit(Element modelElement, Presentation context) {
Notification notification = modelElement.nearest(Notification.class);
IKaleoEditorHelper kaleoEditorHelper = KaleoUI.getKaleoEditorHelper(notification.getTemplateLanguage().text(true));
kaleoEditorHelper.openEditor(getPart(), notification, Notification.PROP_TEMPLATE);
return null;
}
use of com.liferay.ide.kaleo.ui.IKaleoEditorHelper in project liferay-ide by liferay.
the class EditScriptActionHandler method edit.
@Override
public Object edit(Element modelElement, Presentation context) {
Scriptable scriptable = modelElement.nearest(Scriptable.class);
IKaleoEditorHelper kaleoEditorHelper = KaleoUI.getKaleoEditorHelper(scriptable.getScriptLanguage().text(true));
kaleoEditorHelper.openEditor(context.part(), scriptable, Action.PROP_SCRIPT);
return null;
}
use of com.liferay.ide.kaleo.ui.IKaleoEditorHelper in project liferay-ide by liferay.
the class ScriptableOpenActionHandler method run.
@Override
protected Object run(Presentation context) {
try {
Scriptable scriptable = scriptable(context);
if (scriptable != null) {
IKaleoEditorHelper kaleoEditorHelper = KaleoUI.getKaleoEditorHelper(scriptable.getScriptLanguage().text(true));
kaleoEditorHelper.openEditor(context.part(), scriptable, Scriptable.PROP_SCRIPT);
}
} catch (Exception e) {
KaleoUI.logError("Could not open script editor.", e);
}
return null;
}
use of com.liferay.ide.kaleo.ui.IKaleoEditorHelper in project liferay-ide by liferay.
the class StateNodeAddActionHandler method postDiagramNodePartAdded.
@Override
public void postDiagramNodePartAdded(NewNodeOp op, CanTransition newNodeFromWizard, CanTransition newNode) {
NewStateNodeOp newStateNodeOp = op.nearest(NewStateNodeOp.class);
NewStateNode newStateNode = newNodeFromWizard.nearest(NewStateNode.class);
State state = newNode.nearest(State.class);
if ((newStateNode != null) && (state != null)) {
state.setName(newStateNode.getName().content());
NewStateType newStateType = newStateNodeOp.getType().content();
if (newStateType.equals(NewStateType.START)) {
state.setInitial(true);
} else if (newStateType.equals(NewStateType.END)) {
state.setEnd(true);
}
String workflowStatus = newStateNodeOp.getWorkflowStatus().content(false);
if (!empty(workflowStatus)) {
Action newAction = state.getActions().insert();
newAction.setName(state.getName().content());
newAction.setScriptLanguage(KaleoModelUtil.getDefaultValue(state, KaleoCore.DEFAULT_SCRIPT_LANGUAGE_KEY, ScriptLanguageType.GROOVY));
newAction.setExecutionType(Executable.DEFAULT_EXECUTION_TYPE);
IKaleoEditorHelper editorHelper = KaleoUI.getKaleoEditorHelper(newAction.getScriptLanguage().text());
if (editorHelper != null) {
try {
File statusUpdatesFolder = new File(FileLocator.toFileURL(Platform.getBundle(editorHelper.getContributorName()).getEntry("palette/Status Updates")).getFile());
File statusSnippet = new File(statusUpdatesFolder, workflowStatus + "." + editorHelper.getFileExtension());
if (FileUtil.exists(statusSnippet)) {
newAction.setScript(FileUtil.readContents(statusSnippet, true));
}
} catch (Exception e) {
}
}
}
if (!newStateType.equals(NewStateType.END) && (newStateNodeOp.getExitTransitionName().content() != null)) {
Transition newTransition = state.getTransitions().insert();
newTransition.setTarget(newStateNodeOp.getExitTransitionName().content());
newTransition.setName(newStateNodeOp.getExitTransitionName().content());
}
}
}
use of com.liferay.ide.kaleo.ui.IKaleoEditorHelper in project liferay-ide by liferay.
the class TemplateOpenActionHandler method run.
@Override
protected Object run(Presentation context) {
try {
Notification notification = notification(context);
IKaleoEditorHelper kaleoEditorHelper = KaleoUI.getKaleoEditorHelper(notification.getTemplateLanguage().text(true));
kaleoEditorHelper.openEditor(context.part(), notification, Notification.PROP_TEMPLATE);
} catch (Exception e) {
KaleoUI.logError("Could not open template editor.", e);
}
return null;
}
Aggregations