List of usage examples for org.eclipse.jface.preference IPreferenceStore getBoolean
boolean getBoolean(String name);
From source file:com.boothen.jsonedit.editor.JsonTextEditor.java
License:Open Source License
private void doAutoFormatOnSave() { IPreferenceStore store = getPreferenceStore(); boolean autoFormatOnSave = store.getBoolean(JsonPreferences.AUTO_FORMAT_ON_SAVE); if (autoFormatOnSave) { ISourceViewer viewer = getSourceViewer(); IContentFormatter formatter = viewerConfiguration.getContentFormatter(viewer); IDocument document = viewer.getDocument(); formatter.format(document, null); }//from ww w. ja va 2 s. c o m }
From source file:com.boothen.jsonedit.preferences.JsonPreferenceStore.java
License:Open Source License
public Boolean getSpacesForTab() { IPreferenceStore preferenceStore = getIPreferenceStore(); if (preferenceStore.getBoolean(OVERRIDE_TAB_SETTING)) { return preferenceStore.getBoolean(SPACES_FOR_TABS); }/*from ww w. jav a 2s.com*/ IPreferenceStore editorPreferenceStore = getEditorPreferenceStore(); return editorPreferenceStore.getBoolean("spacesForTabs"); }
From source file:com.boothen.jsonedit.preferences.JsonPreferenceStore.java
License:Open Source License
public int getTabWidth() { IPreferenceStore preferenceStore = getIPreferenceStore(); if (preferenceStore.getBoolean(OVERRIDE_TAB_SETTING)) { return preferenceStore.getInt(NUM_SPACES); }//from w ww . j a v a 2 s . c o m IPreferenceStore editorPreferenceStore = getEditorPreferenceStore(); return editorPreferenceStore.getInt("tabWidth"); }
From source file:com.buildml.eclipse.ImportSubEditor.java
License:Open Source License
@Override public void updateOptionsFromPreferenceStore() { IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore(); setOption(EditorOptions.OPT_COALESCE_DIRS, prefStore.getBoolean(PreferenceConstants.PREF_COALESCE_DIRS)); /*//from w w w. j a v a 2 s. c o m * Determine where the BuildML binaries and libraries are kept. By default we get * them from within the plugin jar file, although the user is permitted * to override that path. If they do, however, they should be warned. */ String buildMlPath = null; URL url = FileLocator.find(Activator.getDefault().getBundle(), new Path("/files"), null); if (url != null) { try { URL filesDirUrl = FileLocator.toFileURL(url); buildMlPath = filesDirUrl.getPath(); } catch (IOException e) { /* nothing - buildMlPath stays null, which indicates an error */ } } /* * If we can't locate the /files directory within the plugin, that's likely because we're * running this plugin within the eclipse PDE (as opposed to the plugin being installed * and executed in the normal way). If this is the case, then buildMlPath == null. * * In any situation, the user is welcome to override the value of buildMlPath with their * own setting. However, if they're not using the plugin jar's copy of the files, we * should warn them. */ String prefBuildMlPath = prefStore.getString(PreferenceConstants.PREF_BUILDML_HOME); if (!prefBuildMlPath.isEmpty() && !warnedAboutPathOverride) { if (buildMlPath != null) { AlertDialog.displayWarningDialog("Overriding BUILDML_HOME setting", "Although the bin and lib directories have been found in the plugin jar file, " + "you have chosen to override the path. Please go into the BuildML preferences " + "if you wish to remove this override."); warnedAboutPathOverride = true; } buildMlPath = prefBuildMlPath; } /* * Check that the BUILDML_HOME preference is set, is a directory, and contains subdirectories * "lib" and "bin". */ if ((buildMlPath == null) || buildMlPath.isEmpty()) { AlertDialog.displayErrorDialog("Missing Preference Setting", "The preference setting: \"Directory containing BuildML's bin and lib directories\" " + "is not defined. Please go into the BuildML preferences and set a suitable value."); } else { File buildMlPathFile = new File(buildMlPath); if (!(buildMlPathFile.isDirectory()) || (!new File(buildMlPathFile, "bin").isDirectory()) || (!new File(buildMlPathFile, "lib").isDirectory())) { AlertDialog.displayErrorDialog("Invalid Preference Setting", "The preference setting: \"Directory containing BuildML's bin and lib directories\" " + "does not refer to a valid directory."); } /* * Else, the path is good. The only additional requirement is that the 'cfs' command * be executable. This won't be the case if the /files directory has just been * extracted into the Eclipse configuration directory for the first time. Note that * chmod can fail if the files aren't owned by the current user, but that's not a * problem for us. */ else { System.setProperty("BUILDML_HOME", buildMlPath); SystemUtils.chmod(buildMlPath + "/bin/cfs", 0755); } } }
From source file:com.centurylink.mdw.plugin.designer.dialogs.ExportAsDialog.java
License:Apache License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite.getShell().setText("Export Process"); GridLayout gl = new GridLayout(); gl.numColumns = 2;// ww w . j a v a 2 s . c o m composite.setLayout(gl); Label msgLabel = new Label(composite, SWT.NONE); msgLabel.setText("Save process '" + processVersion.getName() + "' as image."); GridData gd = new GridData(GridData.BEGINNING); gd.horizontalSpan = 2; msgLabel.setLayoutData(gd); Group exportFormatGroup = new Group(composite, SWT.NONE); exportFormatGroup.setText("Format to Export"); gl = new GridLayout(); exportFormatGroup.setLayout(gl); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL); exportFormatGroup.setLayoutData(gd); bpmnButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT); bpmnButton.setText(BPMN2); htmlButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT); htmlButton.setText(HTML); docxButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT); docxButton.setText(MS_WORD); jpegButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT); jpegButton.setText("JPEG"); jpegButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { boolean sel = jpegButton.getSelection(); if (sel) { docButton.setSelection(false); attrsButton.setSelection(false); varsButton.setSelection(false); } docButton.setEnabled(!sel); attrsButton.setEnabled(!sel); varsButton.setEnabled(!sel); } }); pngButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT); pngButton.setText(PNG); pngButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { boolean sel = pngButton.getSelection(); if (sel) { docButton.setSelection(false); attrsButton.setSelection(false); varsButton.setSelection(false); } docButton.setEnabled(!sel); attrsButton.setEnabled(!sel); varsButton.setEnabled(!sel); } }); rtfButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT); rtfButton.setText(RTF); pdfButton = new Button(exportFormatGroup, SWT.RADIO | SWT.LEFT); pdfButton.setText(PDF); IPreferenceStore prefsStore = MdwPlugin.getDefault().getPreferenceStore(); String format = prefsStore.getString(PreferenceConstants.PREFS_PROCESS_EXPORT_FORMAT); if (FORMATS.get(HTML).equals(format) || format == null) htmlButton.setSelection(true); else if (FORMATS.get(MS_WORD).equals(format)) docxButton.setSelection(true); else if (FORMATS.get(JPG).equals(format)) jpegButton.setSelection(true); else if (FORMATS.get(PNG).equals(format)) pngButton.setSelection(true); else if (FORMATS.get(BPMN2).equals(format)) bpmnButton.setSelection(true); else if (FORMATS.get(RTF).equals(format)) rtfButton.setSelection(true); else if (FORMATS.get(PDF).equals(format)) pdfButton.setSelection(true); Composite comp2 = new Composite(composite, SWT.NONE); gl = new GridLayout(); gl.marginTop = -5; comp2.setLayout(gl); // inclusion options Group optionsGroup = new Group(comp2, SWT.NONE); optionsGroup.setText("Include"); gl = new GridLayout(); optionsGroup.setLayout(gl); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL); optionsGroup.setLayoutData(gd); docButton = new Button(optionsGroup, SWT.CHECK | SWT.LEFT); docButton.setText("Documentation"); attrsButton = new Button(optionsGroup, SWT.CHECK | SWT.LEFT); attrsButton.setText("Attributes"); varsButton = new Button(optionsGroup, SWT.CHECK | SWT.LEFT); varsButton.setText("Variables"); docButton.setSelection(prefsStore.getBoolean(PreferenceConstants.PREFS_PROCESS_EXPORT_DOCUMENTATION)); attrsButton.setSelection(prefsStore.getBoolean(PreferenceConstants.PREFS_PROCESS_EXPORT_ATTRIBUTES)); varsButton.setSelection(prefsStore.getBoolean(PreferenceConstants.PREFS_PROCESS_EXPORT_VARIABLES)); // activity order Group activityOrderGroup = new Group(comp2, SWT.NONE); activityOrderGroup.setText("Element Order"); activityOrderGroup.setLayout(new GridLayout()); activityOrderGroup .setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL)); sequenceIdButton = new Button(activityOrderGroup, SWT.RADIO | SWT.LEFT); sequenceIdButton.setText("Sequence Number"); referenceIdButton = new Button(activityOrderGroup, SWT.RADIO | SWT.LEFT); referenceIdButton.setText("Reference ID"); logicalIdButton = new Button(activityOrderGroup, SWT.RADIO | SWT.LEFT); logicalIdButton.setText("Logical ID"); String sort = prefsStore.getString(PreferenceConstants.PREFS_PROCESS_EXPORT_ELEMENT_ORDER); if (Node.ID_REFERENCE.equals(sort)) referenceIdButton.setSelection(true); else if (Node.ID_LOGICAL.equals(sort)) logicalIdButton.setSelection(true); else sequenceIdButton.setSelection(true); filepathText = new Text(composite, SWT.SINGLE | SWT.BORDER); gd = new GridData(GridData.BEGINNING | GridData.HORIZONTAL_ALIGN_FILL); gd.widthHint = 250; filepathText.setLayoutData(gd); filepathText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { filepath = filepathText.getText().trim(); getButton(IDialogConstants.OK_ID).setEnabled(filepath.length() > 0); } }); browseButton = new Button(composite, SWT.PUSH); browseButton.setText("Browse..."); browseButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { FileSaveDialog dlg = new FileSaveDialog(getShell()); dlg.setFilterExtensions(new String[] { "*." + getFileExtension() }); dlg.setFileName(getFileName()); String filepath = dlg.open(); if (filepath != null) filepathText.setText(filepath); } }); return composite; }
From source file:com.centurylink.mdw.plugin.designer.dialogs.ProcessSaveDialog.java
License:Apache License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite.getShell().setText("Save Process"); String msg = "'" + process.getName() + "'"; if (respondingToClose) msg += " has been modified. Save changes?"; new Label(composite, SWT.NONE).setText(msg); String oldEmbedded = getProcess().getAttribute("process_old_embedded"); // MDW3 Group radioGroup = new Group(composite, SWT.NONE); radioGroup.setText("Process Version to Save"); GridLayout gl = new GridLayout(); radioGroup.setLayout(gl);/*www . j a v a 2 s . c o m*/ GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL); radioGroup.setLayoutData(gd); overwriteButton = new Button(radioGroup, SWT.RADIO | SWT.LEFT); if (oldEmbedded != null || !allowForceUpdate) overwriteButton.setEnabled(false); overwriteButton.setText("Overwrite current version: " + process.getVersionString()); overwriteButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { versionButtonSelected(e); } }); newMinorButton = new Button(radioGroup, SWT.RADIO | SWT.LEFT); newMinorButton.setText("Save as new minor version: " + process.getNewVersionString(false)); newMinorButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { versionButtonSelected(e); } }); newMajorButton = new Button(radioGroup, SWT.RADIO | SWT.LEFT); newMajorButton.setText("Save as new major version: " + process.getNewVersionString(true)); newMajorButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { versionButtonSelected(e); } }); if (oldEmbedded != null) new Label(composite, SWT.NONE) .setText("This process contains MDW 3.* subprocesses.\nYou must save it as a new version."); IPreferenceStore prefsStore = MdwPlugin.getDefault().getPreferenceStore(); String prefsIncrement = prefsStore.getString(PreferenceConstants.PREFS_PROCESS_SAVE_INCREMENT); boolean rememberSelection = !prefsIncrement.isEmpty(); if (prefsIncrement.isEmpty()) prefsIncrement = Increment.Minor.toString(); Increment increment = Increment.valueOf(prefsIncrement); if (increment == Increment.Overwrite) overwriteButton.setSelection(true); else if (increment == Increment.Major) newMajorButton.setSelection(true); else newMinorButton.setSelection(true); rememberSelectionCheckbox = new Button(composite, SWT.CHECK); rememberSelectionCheckbox.setText("Remember this selection for future saves"); rememberSelectionCheckbox.setSelection(rememberSelection); enforceValidationCheckbox = new Button(composite, SWT.CHECK); enforceValidationCheckbox.setText("Enforce process validation rules"); enforceValidationCheckbox .setSelection(prefsStore.getBoolean(PreferenceConstants.PREFS_ENFORCE_PROCESS_VALIDATION_RULES)); if (process.getProject().isFilePersist()) { boolean overwrite = overwriteButton.getSelection(); // override attributes carryOverrideAttributesCheckbox = new Button(composite, SWT.CHECK); carryOverrideAttributesCheckbox.setText("Carry forward override attributes"); boolean enabled = process.overrideAttributesApplied() && !overwrite; boolean checked = overwrite ? true : process.overrideAttributesApplied(); enableCarryOverrideAttrs(enabled, checked); carryOverrideAttributesCheckbox.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (carryOverrideAttributesCheckbox.getSelection()) { WarningTray tray = getWarningTray(); if (tray.getMessage().startsWith("Any override attributes")) { tray.close(); getButton(Dialog.OK).setText(respondingToClose ? "Save" : "OK"); } } } }); } else { keepLockedCheckbox = new Button(composite, SWT.CHECK); keepLockedCheckbox.setText("Keep process locked after saving"); keepLockedCheckbox.setSelection( prefsStore.getBoolean(PreferenceConstants.PREFS_KEEP_PROCESSES_LOCKED_WHEN_SAVING)); } return composite; }
From source file:com.centurylink.mdw.plugin.designer.dialogs.VersionableImportDialog.java
License:Apache License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite.getShell().setText("Import " + versionable.getTitle() + ": " + versionable.getName()); GridLayout gl = new GridLayout(); gl.numColumns = 2;//w w w.j a va 2 s . c o m composite.setLayout(gl); // file text Label lbl = new Label(composite, SWT.NONE); GridData gd = new GridData(SWT.LEFT); gd.horizontalSpan = 2; lbl.setLayoutData(gd); lbl.setText("File"); fileText = new Text(composite, SWT.BORDER | SWT.SINGLE); gd = new GridData(SWT.LEFT); gd.widthHint = 300; fileText.setLayoutData(gd); fileText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { filePath = fileText.getText().trim(); if (versionable.getProject().isProduction()) importButton.setEnabled(filePath.length() > 0 && commentText.getText().trim().length() > 0); else importButton.setEnabled(filePath.length() > 0); } }); // browse button fileBrowseButton = new Button(composite, SWT.PUSH); fileBrowseButton.setText("Browse..."); fileBrowseButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { FileDialog dlg = new FileDialog(getShell()); dlg.setFileName(filePath); if (versionable.getExtension() != null) dlg.setFilterExtensions(new String[] { "*" + versionable.getExtension() }); String result = dlg.open(); if (result != null) { filePath = result; fileText.setText(filePath); } } }); // comments text lbl = new Label(composite, SWT.NONE); gd = new GridData(SWT.LEFT); gd.horizontalSpan = 2; gd.verticalIndent = 5; lbl.setLayoutData(gd); lbl.setText("Comments"); commentText = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.WRAP); gd = new GridData(SWT.LEFT); gd.widthHint = 365; gd.heightHint = 75; gd.horizontalSpan = 2; commentText.setLayoutData(gd); commentText.setTextLimit(1000); commentText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { versionComment = commentText.getText().trim(); if (versionable.getProject().isProduction()) importButton.setEnabled(versionComment.length() > 0 && !fileText.getText().isEmpty()); } }); // keep locked checkbox keepLockedCheckbox = new Button(composite, SWT.CHECK); gd = new GridData(SWT.LEFT); gd.horizontalSpan = 2; gd.verticalIndent = 5; keepLockedCheckbox.setLayoutData(gd); keepLockedCheckbox.setText("Keep " + versionable.getTitle() + " locked after saving"); IPreferenceStore prefsStore = MdwPlugin.getDefault().getPreferenceStore(); keepLockedCheckbox .setSelection(prefsStore.getBoolean(PreferenceConstants.PREFS_KEEP_RESOURCES_LOCKED_WHEN_SAVING)); return composite; }
From source file:com.centurylink.mdw.plugin.designer.dialogs.VersionableSaveDialog.java
License:Apache License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite.getShell().setText("Save " + versionable.getTitle()); Group radioGroup = new Group(composite, SWT.NONE); radioGroup.setText("Version to Save"); GridLayout gl = new GridLayout(); radioGroup.setLayout(gl);//from ww w . j av a 2 s .c om GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL); radioGroup.setLayoutData(gd); overwriteButton = new Button(radioGroup, SWT.RADIO | SWT.LEFT); overwriteButton.setText("Overwrite current version: " + versionable.getVersionString()); overwriteButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { versionButtonSelected(e); } }); newMinorButton = new Button(radioGroup, SWT.RADIO | SWT.LEFT); newMinorButton.setText( "Save as new minor version: " + versionable.formatVersion(versionable.getNextMinorVersion())); newMinorButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { versionButtonSelected(e); } }); newMajorButton = new Button(radioGroup, SWT.RADIO | SWT.LEFT); newMajorButton.setText( "Save as new major version: " + versionable.formatVersion(versionable.getNextMajorVersion())); newMajorButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { versionButtonSelected(e); } }); boolean prod = versionable.getProject().isProduction(); if (prod) overwriteButton.setEnabled(false); IPreferenceStore prefsStore = MdwPlugin.getDefault().getPreferenceStore(); String prefsIncrement = prefsStore.getString(PreferenceConstants.PREFS_ASSET_SAVE_INCREMENT); boolean rememberSelection = !prefsIncrement.isEmpty(); if (prefsIncrement.isEmpty()) prefsIncrement = Increment.Minor.toString(); versionIncrement = Increment.valueOf(prefsIncrement); if (prod && versionIncrement == Increment.Overwrite) versionIncrement = Increment.Minor; if (versionIncrement == Increment.Overwrite) overwriteButton.setSelection(true); else if (versionIncrement == Increment.Major) newMajorButton.setSelection(true); else newMinorButton.setSelection(true); rememberSelectionCheckbox = new Button(composite, SWT.CHECK); rememberSelectionCheckbox.setText("Remember this selection for future saves"); rememberSelectionCheckbox.setSelection(rememberSelection); enforceValidationCheckbox = new Button(composite, SWT.CHECK); enforceValidationCheckbox.setText("Enforce asset validation rules"); enforceValidationCheckbox .setSelection(prefsStore.getBoolean(PreferenceConstants.PREFS_ENFORCE_ASSET_VALIDATION_RULES)); if (isVcsRemote) { saveButton.setEnabled(false); } else { keepLockedCheckbox = new Button(composite, SWT.CHECK); keepLockedCheckbox.setText("Keep " + versionable.getTitle() + " locked after saving"); keepLockedCheckbox.setSelection( prefsStore.getBoolean(PreferenceConstants.PREFS_KEEP_RESOURCES_LOCKED_WHEN_SAVING)); } return composite; }
From source file:com.centurylink.mdw.plugin.designer.model.WorkflowAsset.java
License:Apache License
/** * Change listener so we'll know when the resource is changed in the * workspace.//from w w w .ja v a2 s . c om */ public void resourceChanged(IResourceChangeEvent event) { if (isForceExternalEditor()) return; if (event.getType() == IResourceChangeEvent.POST_CHANGE) { final IFile file = getAssetFile(); IResourceDelta rootDelta = event.getDelta(); IResourceDelta assetDelta = rootDelta.findMember(file.getFullPath()); if (assetDelta != null && assetDelta.getKind() == IResourceDelta.CHANGED && (assetDelta.getFlags() & IResourceDelta.CONTENT) != 0) { // the file has been changed final Display display = Display.getCurrent(); if (display != null) { display.syncExec(new Runnable() { public void run() { if (isRawEdit()) { if (getProject().isReadOnly()) MessageDialog.openWarning(display.getActiveShell(), "Not Editable", "Your changes to " + getFile().getName() + " will be overwritten the next time project '" + getProject().getLabel() + "' is refreshed."); } else { if (!isUserAuthorized(UserRoleVO.ASSET_DESIGN)) { MessageDialog.openWarning(display.getActiveShell(), "Can't Update " + getTitle(), "You're not authorized to update '" + getLabel() + "'\nin workflow project '" + getProject().getName() + "'."); return; } else if (!isLockedToUser()) { MessageDialog.openWarning(display.getActiveShell(), "Can't Update " + getTitle(), "Resource '" + getLabel() + "' is not locked by you, so updates are not allowed."); return; } } if (isBinary()) encodeAndSetContent(PluginUtil.readFile(file)); else setContent(new String(PluginUtil.readFile(file))); Increment versionIncrement = Increment.Overwrite; int previousVersion = getVersion(); String versionComment = null; if (getProject().checkRequiredVersion(5, 0)) { VersionableSaveDialog saveDialog = new VersionableSaveDialog( display.getActiveShell(), WorkflowAsset.this); int res = saveDialog.open(); if (res == VersionableSaveDialog.CANCEL) { if (isRawEdit()) { String message = "Version for '" + WorkflowAsset.this.getName() + "' remains " + WorkflowAsset.this.getVersionLabel(); MessageDialog.openInformation(display.getActiveShell(), WorkflowAsset.this.getTitle() + " Overwrite", message); return; } else { String message = "Database save for '" + WorkflowAsset.this.getName() + "' was canceled.\nTemp file changes were not persisted."; MessageDialog.openWarning(display.getActiveShell(), WorkflowAsset.this.getTitle() + " Not Saved", message); return; } } versionIncrement = saveDialog.getVersionIncrement(); if (versionIncrement != Increment.Overwrite) { setVersion(versionIncrement == Increment.Major ? getNextMajorVersion() : getNextMinorVersion()); versionComment = saveDialog.getVersionComment(); } } if (isRawEdit()) { if (versionIncrement == Increment.Overwrite) { // just fire cache refresh if (!getProject().isRemote()) getProject().getDesignerProxy().getCacheRefresh() .fireRefresh(RuleSetVO.JAVA.equals(getLanguage())); } else { setRevisionComment(versionComment); getProject().getDesignerProxy() .saveWorkflowAssetWithProgress(WorkflowAsset.this, false); fireElementChangeEvent(ChangeType.VERSION_CHANGE, getVersion()); } } else { try { IPreferenceStore prefsStore = MdwPlugin.getDefault().getPreferenceStore(); boolean keepLocked = prefsStore.getBoolean( PreferenceConstants.PREFS_KEEP_RESOURCES_LOCKED_WHEN_SAVING); if (versionIncrement != Increment.Overwrite) { RuleSetVO prevVO = new RuleSetVO(WorkflowAsset.this.getRuleSetVO()); prevVO.setId(getId()); prevVO.setVersion(previousVersion); setComment(versionComment); if (!isInDefaultPackage()) { getPackage().removeAsset(WorkflowAsset.this); getProject().getUnpackagedWorkflowAssets().add( new WorkflowAsset(prevVO, getProject().getDefaultPackage())); } RunnerResult result = getProject().getDesignerProxy() .createNewWorkflowAsset(WorkflowAsset.this, keepLocked); if (result.getStatus() == RunnerStatus.SUCCESS) { getRuleSetVO().setPrevVersion(prevVO); fireElementChangeEvent(ChangeType.VERSION_CHANGE, getVersion()); } else if (result.getStatus() == RunnerStatus.DISALLOW) { // deregister since save never // happened WorkflowAssetFactory.deRegisterAsset(WorkflowAsset.this); } } else { getProject().getDesignerProxy() .saveWorkflowAssetWithProgress(WorkflowAsset.this, keepLocked); fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, null); } if (!keepLocked) fireElementChangeEvent(ChangeType.PROPERTIES_CHANGE, null); } catch (Exception ex) { PluginMessages.uiError(ex, "Save Definition Doc", getProject()); } } } }); } } } }
From source file:com.centurylink.mdw.plugin.designer.ProcessCanvasWrapper.java
License:Apache License
/** * Creates the wrapped Swing component./*from w w w . j a va 2s . com*/ * * @param parent * the parent SWT part * @return the SWT composite with the embedded Swing component */ public EmbeddedSwingComposite createEmbeddedSwingComposite(Composite parent) { return new EmbeddedSwingComposite(parent, SWT.NONE) { @Override protected JComponent createSwingComponent() { CanvasCommon canvas = null; if (isInstance()) { getFrame().setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); canvas = getDesignerProxy().loadProcessInstance(getProcess(), getProcessInstancePage()); getProcess().setReadOnly(getProject().getPersistType() == WorkflowProject.PersistType.Database); getFrame().setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR)); } else { canvas = getDesignerProxy().loadProcess(getProcess(), getFlowchartPage()); } // initialize canvas settings from preferences IPreferenceStore prefsStore = MdwPlugin.getDefault().getPreferenceStore(); String nodeIdType = prefsStore.getString(PreferenceConstants.PREFS_DESIGNER_CANVAS_NODE_ID_TYPE); if (!isInstance() && !nodeIdType.isEmpty() && !getNodeIdType().equals(nodeIdType)) setNodeIdType(nodeIdType); FlowchartPage.showtip = !prefsStore .getBoolean(PreferenceConstants.PREFS_DESIGNER_SUPPRESS_TOOLTIPS); JScrollPane scrollPane = new JScrollPane(canvas); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); return scrollPane; } }; }