use of com.liferay.ide.kaleo.ui.KaleoUI in project liferay-ide by liferay.
the class WorkflowDefinitionEditor method createPages.
@Override
protected void createPages() {
super.createPages();
try {
IWorkbench workBench = PlatformUI.getWorkbench();
IWorkbenchWindow workBenchWindow = workBench.getActiveWorkbenchWindow();
IWorkbenchPage workBenchPage = workBenchWindow.getActivePage();
IPerspectiveDescriptor descripter = workBenchPage.getPerspective();
String id = descripter.getId();
if (WorkflowDesignerPerspectiveFactory.ID.equals(id)) {
return;
}
} catch (Exception e) {
}
KaleoUI kaleoUI = KaleoUI.getDefault();
IPreferenceStore preferenceStore = kaleoUI.getPreferenceStore();
String perspectiveSwitch = preferenceStore.getString(KaleoUIPreferenceConstants.EDITOR_PERSPECTIVE_SWITCH);
boolean remember = false;
boolean openPerspective = false;
if (MessageDialogWithToggle.PROMPT.equals(perspectiveSwitch)) {
String descriptFile = "This kind of file is associated with the Kaleo Designer perspective.\n\n";
String descriptPerspective = "This perspective is designed to support Kaleo Workflow development. ";
String descriptPlace = "It places the Properties and Palette views in optimal location relative to the editor area.\n\n";
String descriptHint = "Do you want to open this perspective now?";
MessageDialogWithToggle toggleDialog = MessageDialogWithToggle.openYesNoQuestion(getSite().getShell(), "Open Kaleo Designer Perspective?", descriptFile + descriptPerspective + descriptPlace + descriptHint, "Remember my decision", false, KaleoUI.getDefault().getPreferenceStore(), KaleoUIPreferenceConstants.EDITOR_PERSPECTIVE_SWITCH);
remember = toggleDialog.getToggleState();
openPerspective = toggleDialog.getReturnCode() == IDialogConstants.YES_ID;
if (remember) {
KaleoUI.getPrefStore().setValue(KaleoUIPreferenceConstants.EDITOR_PERSPECTIVE_SWITCH, openPerspective ? MessageDialogWithToggle.ALWAYS : MessageDialogWithToggle.NEVER);
}
} else if (MessageDialogWithToggle.ALWAYS.equals(perspectiveSwitch)) {
openPerspective = true;
}
if (openPerspective) {
_switchToKaleoDesignerPerspective();
}
}
Aggregations