List of usage examples for org.eclipse.jface.dialogs MessageDialog openWarning
public static void openWarning(Shell parent, String title, String message)
From source file:com.centurylink.mdw.plugin.designer.DesignerProxy.java
License:Apache License
public boolean saveOverrideAttributes(String prefix, String ownerType, Long ownerId, String subType, String subId, Map<String, String> attributes) { try {/* w w w. j a va2 s .co m*/ try { dataAccess.getDesignerDataAccess().setOverrideAttributes(prefix, ownerType, ownerId, subType, subId, attributes); } catch (DataAccessOfflineException ex) { PluginMessages.log(ex); MessageDialog.openWarning(MdwPlugin.getShell(), "Save Attributes", "Server appears to be offline: " + ex.getMessage()); return false; } cacheRefresh.fireRefresh(false); return true; } catch (Exception ex) { PluginMessages.uiError(ex, "Save Attributes", project); return false; } }
From source file:com.centurylink.mdw.plugin.designer.DesignerProxy.java
License:Apache License
public boolean saveAllOverrideAttributes(WorkflowProcess process) { try {//w ww . j a v a 2 s.com try { dataAccess.getDesignerDataAccess().setOverrideAttributes(process.getProcessVO()); } catch (DataAccessOfflineException ex) { PluginMessages.log(ex); MessageDialog.openWarning(MdwPlugin.getShell(), "Save Attributes", "Server appears to be offline: " + ex.getMessage()); return false; } cacheRefresh.fireRefresh(false); return false; } catch (Exception ex) { PluginMessages.uiError(ex, "Save Attributes", project); return false; } }
From source file:com.centurylink.mdw.plugin.designer.DesignerProxy.java
License:Apache License
public ProcessList getProcessInstanceList(WorkflowProcess processVersion, Map<String, String> criteria, Map<String, String> variables, int pageIndex, int pageSize, String orderBy) { CodeTimer timer = new CodeTimer("getProcessInstanceList()"); try {// w w w . j a v a 2 s .co m Long id = processVersion.getId(); if (id == 0) { // cross-version query by name String name; if (project.isFilePersist()) name = processVersion.getPackage().getName() + "/" + processVersion.getName(); // qualified // name else name = processVersion.getName(); return dataAccess.getDesignerDataAccess().getProcessInstanceList(name, criteria, variables, pageIndex, pageSize, orderBy); } else { return dataAccess.getDesignerDataAccess().getProcessInstanceList(id, criteria, variables, pageIndex, pageSize, orderBy); } } catch (DataAccessOfflineException ex) { PluginMessages.log(ex); String msg = "Server appears to be offline: " + ex.getMessage(); MessageDialog.openWarning(MdwPlugin.getShell(), "Retrieve Process Instances", msg); return new ProcessList(ProcessList.PROCESS_INSTANCES, new ArrayList<ProcessInstanceVO>()); } catch (Exception ex) { PluginMessages.uiError(ex, "Retrieve Process Instances", project); return new ProcessList(ProcessList.PROCESS_INSTANCES, new ArrayList<ProcessInstanceVO>()); } finally { timer.stopAndLog(); } }
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 . j av a 2 s . co m */ 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.properties.PackageConfigurationSection.java
License:Apache License
public void aboutToBeHidden() { if (dirty)// w w w. j a v a2 s .c o m MessageDialog.openWarning(getShell(), "Package Configuration", "Remember to save any changes."); }
From source file:com.centurylink.mdw.plugin.designer.properties.PropertySection.java
License:Apache License
protected void warnDirty() { String tabLabel = null;//from w w w. j a v a 2 s . c om if (selectedTab instanceof PageletTab) tabLabel = ((PageletTab) selectedTab).getLabel(); else if (selectedTab instanceof PropertyTab) tabLabel = ((PropertyTab) selectedTab).getLabel(); String msg = "Remember to save " + (tabLabel == null ? "attributes." : tabLabel + " attributes."); MessageDialog.openWarning(getShell(), "Attributes", msg); warnedDirty = true; }
From source file:com.centurylink.mdw.plugin.designer.views.AutomatedTestActionGroup.java
License:Apache License
private IAction createCompareResultsAction() { IAction action = new Action() { @SuppressWarnings("restriction") public void run() { if (compareResultsApplies(view.getSelectedItem())) { WorkflowProject project = ((WorkflowElement) view.getSelectedItem()).getProject(); try { project.getProjectFolder(project.getTestResultsPath(AutomatedTestCase.FUNCTION_TEST)) .refreshLocal(IResource.DEPTH_INFINITE, null); Object[] items = new Object[2]; if (view.getSelectedItem() instanceof AutomatedTestResults) { AutomatedTestResults expectedResults = (AutomatedTestResults) view.getSelectedItem(); if (project.isFilePersist()) { items[0] = project.getProjectFile(expectedResults.getVcsAssetPath()); } else { expectedResults.openTempFile(new NullProgressMonitor()); items[0] = expectedResults.getTempFile(expectedResults.getTempFolder()); }//from w w w. j a v a 2 s . c o m String actualResultsPath = expectedResults.getPackage().getName() + "/" + expectedResults.getName(); items[1] = project .getProjectFile(project.getTestResultsPath(AutomatedTestCase.FUNCTION_TEST) + "/" + actualResultsPath); } else if (view.getSelectedItem() instanceof LegacyExpectedResults) { LegacyExpectedResults expectedResult = (LegacyExpectedResults) view.getSelectedItem(); items[0] = expectedResult.getExpectedResult(); items[1] = expectedResult.getActualResult(); } if (items[1] == null || !((IFile) items[1]).exists()) { MessageDialog.openWarning(view.getSite().getShell(), "No Results", "Unable to locate results file: " + ((IFile) items[1]).getLocation().toString()); return; } StructuredSelection compareSelection = new StructuredSelection(items); ResultsCompareAction compareAction = new ResultsCompareAction(compareSelection); compareAction.run(compareSelection); } catch (Exception ex) { PluginMessages.uiError(ex, "Compare Test Results", project); } } } }; action.setId(MdwMenuManager.MDW_MENU_PREFIX + "compare.results"); action.setText("Compare Results"); ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/compare.gif"); action.setImageDescriptor(imageDesc); return action; }
From source file:com.centurylink.mdw.plugin.designer.views.AutomatedTestActionGroup.java
License:Apache License
private IAction createOpenProcessInstanceAction() { IAction action = new Action() { public void run() { if (openProcessInstanceApplies(view.getSelectedItem())) { WorkflowProject project = ((WorkflowElement) view.getSelectedItem()).getProject(); try { Long procInstId = null; if (view.getSelectedItem() instanceof AutomatedTestResults) { AutomatedTestResults expectedResults = (AutomatedTestResults) view.getSelectedItem(); procInstId = expectedResults.getActualProcessInstanceId(); } else if (view.getSelectedItem() instanceof LegacyExpectedResults) { LegacyExpectedResults expectedResult = (LegacyExpectedResults) view.getSelectedItem(); File resultsFile = expectedResult.getActualResultFile(); TestFile testFile = new TestFile(null, resultsFile.getPath()); testFile.load(); TestFileLine line1 = testFile.getLines().get(0); procInstId = new Long(line1.getWord(3)); }/*from www .jav a 2 s.c om*/ if (procInstId == null) { MessageDialog.openWarning(view.getSite().getShell(), "No Results", "Unable to locate results file."); return; } ProcessInstanceVO procInst = project.getDataAccess().getProcessInstance(procInstId); Long processId = procInst.getProcessId(); ProcessVO procVO = project.getProcess(processId).getProcessVO(); if (procVO == null) PluginMessages.uiError("Unable to locate process: " + processId, "Open Process Instance", project); WorkflowProcess instance = new WorkflowProcess(project, procVO); instance.setProcessInstance(procInst); actionHandler.open(instance); } catch (Exception ex) { PluginMessages.uiError(ex, "Open Process Instance", project); } } } }; action.setId(MdwMenuManager.MDW_MENU_PREFIX + "open.process.instance"); action.setText("Open Process Instance"); ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/process.gif"); action.setImageDescriptor(imageDesc); return action; }
From source file:com.centurylink.mdw.plugin.designer.views.ProcessExplorerActionGroup.java
License:Apache License
private IAction createCompareResultsAction() { IAction action = new Action() { @SuppressWarnings("restriction") public void run() { if (compareResultsApplies(getSelection())) { WorkflowProject project = ((WorkflowElement) getSelection().getFirstElement()).getProject(); try { project.getProjectFolder(project.getTestResultsPath(AutomatedTestCase.FUNCTION_TEST)) .refreshLocal(IResource.DEPTH_INFINITE, null); Object[] items = new Object[2]; if (getSelection().getFirstElement() instanceof AutomatedTestResults) { AutomatedTestResults expectedResults = (AutomatedTestResults) getSelection() .getFirstElement(); if (project.isFilePersist()) { items[0] = project.getProjectFile(expectedResults.getVcsAssetPath()); } else { expectedResults.openTempFile(new NullProgressMonitor()); items[0] = expectedResults.getTempFile(expectedResults.getTempFolder()); }//from w w w . j a v a 2 s . c om String actualResultsPath = expectedResults.getPackage().getName() + "/" + expectedResults.getName(); items[1] = project .getProjectFile(project.getTestResultsPath(AutomatedTestCase.FUNCTION_TEST) + "/" + actualResultsPath); } else if (getSelection().getFirstElement() instanceof LegacyExpectedResults) { LegacyExpectedResults expectedResult = (LegacyExpectedResults) getSelection() .getFirstElement(); items[0] = expectedResult.getExpectedResult(); items[1] = expectedResult.getActualResult(); } if (items[1] == null || !((IFile) items[1]).exists()) { MessageDialog.openWarning(view.getSite().getShell(), "No Results", "Unable to locate results file: " + ((IFile) items[1]).getLocation().toString()); return; } StructuredSelection compareSelection = new StructuredSelection(items); ResultsCompareAction compareAction = new ResultsCompareAction(compareSelection); compareAction.run(compareSelection); } catch (Exception ex) { PluginMessages.uiError(ex, "Compare Test Results", project); } } } }; action.setId(MdwMenuManager.MDW_MENU_PREFIX + "compare.results"); action.setText("Compare Results"); ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/compare.gif"); action.setImageDescriptor(imageDesc); return action; }
From source file:com.centurylink.mdw.plugin.designer.views.ProcessExplorerActionGroup.java
License:Apache License
private IAction createOpenInstanceAction() { IAction action = new Action() { public void run() { if (openInstanceApplies(getSelection())) { WorkflowProject project = ((WorkflowElement) getSelection().getFirstElement()).getProject(); try { Long procInstId = null; if (getSelection().getFirstElement() instanceof AutomatedTestResults) { AutomatedTestResults expectedResults = (AutomatedTestResults) getSelection() .getFirstElement(); procInstId = expectedResults.getActualProcessInstanceId(); } else if (getSelection().getFirstElement() instanceof LegacyExpectedResults) { LegacyExpectedResults expectedResult = (LegacyExpectedResults) getSelection() .getFirstElement(); java.io.File resultsFile = expectedResult.getActualResultFile(); TestFile testFile = new TestFile(null, resultsFile.getPath()); testFile.load(); TestFileLine line1 = testFile.getLines().get(0); procInstId = new Long(line1.getWord(3)); }//from w ww .ja v a 2s . co m if (procInstId == null) { MessageDialog.openWarning(view.getSite().getShell(), "No Results", "Unable to locate results file."); return; } ProcessInstanceVO procInst = project.getDataAccess().getProcessInstance(procInstId); Long processId = procInst.getProcessId(); ProcessVO procVO = project.getProcess(processId).getProcessVO(); if (procVO == null) PluginMessages.uiError("Unable to locate process: " + processId, "Open Process Instance", project); WorkflowProcess instance = new WorkflowProcess(project, procVO); instance.setProcessInstance(procInst); actionHandler.open(instance); } catch (Exception ex) { PluginMessages.uiError(ex, "Open Process Instance", project); } } } }; action.setText("Open Process Instance"); action.setId(MdwMenuManager.MDW_MENU_PREFIX + "open.process.instance"); ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/process.gif"); action.setImageDescriptor(imageDesc); return action; }