List of usage examples for org.eclipse.jface.dialogs MessageDialog WARNING
int WARNING
To view the source code for org.eclipse.jface.dialogs MessageDialog WARNING.
Click Source Link
From source file:org.talend.dataprofiler.core.ui.dialog.message.DeleteModelElementConfirmDialog.java
License:Open Source License
/** * //w ww . j a v a 2 s .co m * MOD mzhao 2009-03-26, Impact existing analyses when copy remote structure from remote to local on comparison * editor. * * @param parentShell * @param modelElements * @param dialogMessage * @return */ public static int showElementImpactDialog(Shell parentShell, ModelElement[] modelElements, String dialogTitle, String dialogMessage) { addDenpendencyElements(modelElements); ImpactNode[] impactElements = getImpactNodes(); if (impactElements.length > 0) { TreeMessageInfoDialog dialog = new TreeMessageInfoDialog(parentShell, dialogTitle, null, dialogMessage, MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.setContentProvider(new DialogContentProvider(impactElements)); dialog.setInput(new Object()); clear(); int result = dialog.open(); return result; } else { return Window.OK; } }
From source file:org.talend.dataprofiler.core.ui.dialog.message.DeleteModelElementConfirmDialog.java
License:Open Source License
public static int showElementImpactConfirmDialog(Shell parentShell, ModelElement[] modelElements, String dialogTitle, String dialogMessage) { addDenpendencyElements(modelElements); ImpactNode[] impactElements = getImpactNodes(); if (impactElements.length > 0) { TreeMessageInfoDialog dialog = new TreeMessageInfoDialog(parentShell, dialogTitle, null, dialogMessage, MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0); dialog.setContentProvider(new DialogContentProvider(impactElements)); dialog.setInput(new Object()); clear();/*ww w . j a v a 2 s .com*/ int result = dialog.open(); return result; } else { return Window.OK; } }
From source file:org.talend.dataprofiler.core.ui.dialog.message.DeleteModelElementConfirmDialog.java
License:Open Source License
private static int popConfirmDialog(ModelElement[] modelElements) { MessageDialog messageDialog;//from www.j a va 2 s . c om if (modelElements.length > 1) { messageDialog = new MessageDialog(null, DefaultMessagesImpl.getString("DeleteModelElementConfirmDialog.confirmResourceDelete"), null, //$NON-NLS-1$ DefaultMessagesImpl.getString("DeleteModelElementConfirmDialog.deleleTheseResources"), //$NON-NLS-1$ MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0); } else { messageDialog = new MessageDialog(null, DefaultMessagesImpl.getString("DeleteModelElementConfirmDialog.confirmResourcesDelete"), null, //$NON-NLS-1$ DefaultMessagesImpl.getString("DeleteModelElementConfirmDialog.areYouDelele", //$NON-NLS-1$ modelElements[0].getName()), MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0); } return messageDialog.open(); }
From source file:org.talend.dataprofiler.core.ui.dialog.message.DeleteModelElementConfirmDialog.java
License:Open Source License
/** * show all nodes with its dependencies (in nodeWithDependsMap) in one dialog. if the dependency has its own * depends, also show them under this dependsency * // www .j a va 2 s.c o m * @param nodeWithDependsMap key is the repostiory node and value is the dependencies of this node. * @param dialogMessage the message shown in dialog * @param needCheckBox show the check box or not * @return true if the user choose force delete, false if the user did not choose force delete */ public static boolean showDialog(Map<IRepositoryNode, List<ModelElement>> nodeWithDependsMap, String dialogMessage, boolean needCheckBox) { // for each node in the map, add the node as a ImpactNode, and its children are its depends. Iterator iter = nodeWithDependsMap.entrySet().iterator(); List<ModelElement> lockedByOthersList = new ArrayList<ModelElement>(); while (iter.hasNext()) { Map.Entry<IRepositoryNode, List<ModelElement>> entry = (Map.Entry<IRepositoryNode, List<ModelElement>>) iter .next(); IRepositoryNode node = entry.getKey(); List<ModelElement> dependencies = entry.getValue(); addDenpendencyElements(node, dependencies); findLockedByOthersModelElement(lockedByOthersList, dependencies); } ImpactNode[] impactElements = getImpactNodes(); boolean isChecked = false; // show the dialog if (impactElements.length > 0) { boolean lockedByOthersFlag = !lockedByOthersList.isEmpty(); String message = lockedByOthersFlag ? DefaultMessagesImpl.getString("DQDeleteAction.lockedByOthers") //$NON-NLS-1$ : dialogMessage; String[] buttonLabels = lockedByOthersFlag ? new String[] {} : new String[] { IDialogConstants.OK_LABEL }; TreeMessageInfoDialog dialog = new TreeMessageInfoDialog(null, DefaultMessagesImpl.getString("DeleteModelElementConfirmDialog.confirmResourceDelete"), null, //$NON-NLS-1$ message, MessageDialog.WARNING, buttonLabels, 1); dialog.setNeedCheckbox(lockedByOthersFlag ? false : needCheckBox); dialog.setContentProvider(new DialogContentProvider(impactElements)); dialog.setInput(new Object()); clear(); // MOD qiongli 2012-1-6 if don't click OK button,should return false; int result = dialog.open(); isChecked = dialog.isChecked() && (result == Window.OK); } return isChecked; }
From source file:org.talend.dataprofiler.core.ui.views.PatternTestView.java
License:Open Source License
/** * If the pattern is not null, will save it and update the corresponding pattern editor content. *//*from w w w . j a v a2 s . c om*/ private void savePattern() { // If the pattern is not null, will update the pattern editor content. if (pattern != null) { String expressionLanguage = this.regularExpression.getExpression().getLanguage(); DbmsLanguage dbmsLanguage = this.getDbmsLanguage(); // MOD gdbu 2011-5-31 bug : 19119 // MOD gdbu 2011-6-13 bug : 21695 if (null != dbmsLanguage) { dbmsLanguage.setRegularExpressionFunction(getFunctionName()); } // ~21695 // ~19119 // MOD qiongli 2011-1-7 featrue 16799. boolean isLanguageMatched = false; if (isJavaEngine && expressionLanguage.equals(ExecutionLanguage.JAVA.getLiteral()) || dbmsLanguage != null && (dbmsLanguage.getDbmsName().equalsIgnoreCase(expressionLanguage))) { isLanguageMatched = true; } if (!isLanguageMatched) { String messageInfo = DefaultMessagesImpl.getString("PatternTestView.modifiedTheRegularExpression", //$NON-NLS-1$ expressionLanguage, dbmsLanguage.getDbmsName(), expressionLanguage, expressionLanguage, dbmsLanguage.getDbmsName()); MessageDialog messageDialog = new MessageDialog(new Shell(), DefaultMessagesImpl.getString("PatternTestView.warning"), null, messageInfo, //$NON-NLS-1$ MessageDialog.WARNING, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); int result = messageDialog.open(); if (result == MessageDialog.OK) { regularExpression.getExpression().setBody(regularText.getText()); } else { EList<PatternComponent> components = this.pattern.getComponents(); boolean isContainLanguage = false; for (int i = 0; i < components.size(); i++) { RegularExpressionImpl regularExpress = (RegularExpressionImpl) components.get(i); // set the regular text to the corresponding regular // expression if (dbmsLanguage.getDbmsName() .equalsIgnoreCase(regularExpress.getExpression().getLanguage())) { regularExpress.getExpression().setBody(regularText.getText()); isContainLanguage = true; break; } } // Not find the corresponding regular expression, will new a // expression. if (!isContainLanguage) { RegularExpression newRegularExpress = BooleanExpressionHelper .createRegularExpression(dbmsLanguage.getDbmsName(), regularText.getText()); this.pattern.getComponents().add(newRegularExpress); } } } else { regularExpression.getExpression().setBody(regularText.getText()); } EMFUtil.saveSingleResource(pattern.eResource()); editorPage.updatePatternDefinitonSection(); // MessageDialog.openInformation(new Shell(), "Success", // "Success to save the pattern '" + // pattern.getName() // + "'"); saveButton.setEnabled(false); } }
From source file:org.talend.designer.codegen.components.ui.ComponentsPreferencePage.java
License:Open Source License
public void propertyChangeForComponents(PropertyChangeEvent event) { MessageDialog warningMessageDialog = new MessageDialog(getFieldEditorParent().getShell(), Messages.getString("ComponentsPreferencePage.WarningTitle"), null, //$NON-NLS-1$ Messages.getString("ComponentsPreferencePage.WarningMsg"), MessageDialog.WARNING, //$NON-NLS-1$ new String[] { Messages.getString("ComponentsPreferencePage.ButtonLabel0") }, 0); //$NON-NLS-1$ warningMessageDialog.open();//from www.java 2 s . co m }
From source file:org.talend.designer.core.ui.action.GEFDeleteAction.java
License:Open Source License
@Override public Command createDeleteCommand(List objects) { objects = filterSameObject(objects); if (objects.isEmpty()) { return null; }//from w ww. j a va 2 s . c o m if (!(objects.get(0) instanceof EditPart)) { return null; } EditPart object = (EditPart) objects.get(0); // for TUP-1015 boolean isConnAttachedJLTriggerComp = false; ConnectionPart connectionPart = null; if (object instanceof ConnectionPart) { connectionPart = (ConnectionPart) object; } else if (object instanceof ConnLabelEditPart) { connectionPart = (ConnectionPart) object.getParent(); } if (connectionPart != null) { Node srcNode = null; Object srcModel = connectionPart.getSource().getModel(); if (srcModel instanceof Node) { srcNode = (Node) srcModel; } Node tarNode = null; Object tarModel = connectionPart.getTarget().getModel(); if (tarModel instanceof Node) { tarNode = (Node) tarModel; } if (srcNode == null || tarNode == null) { return null; } IProcess process = srcNode.getProcess(); if (AbstractProcessProvider.isExtensionProcessForJoblet(process)) { IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault() .getService(IJobletProviderService.class); if (service != null && (service.isTriggerNode(srcNode) || service.isTriggerNode(tarNode))) { isConnAttachedJLTriggerComp = true; } } } IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore(); String preKey = TalendDesignerPrefConstants.NOT_SHOW_WARNING_WHEN_DELETE_LINK_WITH_JOBLETTRIGGERLINKCOMPONENT; if (isConnAttachedJLTriggerComp && !preferenceStore.getBoolean(preKey)) { MessageDialogWithToggle jlTriggerConfirmDialog = new MessageDialogWithToggle(null, Messages.getString("GEFDeleteAction.deleteConnectionDialog.title"), //$NON-NLS-1$ null, // accept the default window icon Messages.getString("GEFDeleteAction.deleteConnectionDialog.msg"), MessageDialog.WARNING, //$NON-NLS-1$ new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0, Messages.getString("GEFDeleteAction.deleteConnectionDialog.toggleMsg"), //$NON-NLS-1$ preferenceStore.getDefaultBoolean(preKey)); jlTriggerConfirmDialog.setPrefStore(preferenceStore); jlTriggerConfirmDialog.setPrefKey(preKey); if (jlTriggerConfirmDialog.open() != IDialogConstants.YES_ID) { return null; } preferenceStore.setValue(preKey, jlTriggerConfirmDialog.getToggleState()); } List nodeParts = new ArrayList(); List noteParts = new ArrayList(); List others = new ArrayList(objects); for (Object o : objects) { if (o instanceof NodePart) { others.remove(o); Node model = (Node) ((NodePart) o).getModel(); if (model.getJobletNode() != null) { continue; } nodeParts.add(o); } else if (o instanceof NoteEditPart) { noteParts.add(o); others.remove(o); } else if (o instanceof SubjobContainerPart) { others.remove(o); SubjobContainerPart subjob = (SubjobContainerPart) o; for (Iterator iterator = subjob.getChildren().iterator(); iterator.hasNext();) { NodeContainerPart nodeContainerPart = (NodeContainerPart) iterator.next(); if (nodeContainerPart instanceof JobletContainerPart) { JobletContainer jobletCon = (JobletContainer) ((JobletContainerPart) nodeContainerPart) .getModel(); JobletContainerFigure jobletFigure = (JobletContainerFigure) ((JobletContainerPart) nodeContainerPart) .getFigure(); if (!jobletCon.isCollapsed()) { jobletFigure.doCollapse(); } } NodePart nodePart = nodeContainerPart.getNodePart(); if (nodePart != null) { nodeParts.add(nodePart); } } } } if (others.size() == 0) { // so notes & nodes only CompoundCommand cpdCmd = new CompoundCommand(); cpdCmd.setLabel(Messages.getString("GEFDeleteAction.DeleteItems")); //$NON-NLS-1$ if (nodeParts.size() != 0) { GroupRequest deleteReq = new GroupRequest(RequestConstants.REQ_DELETE); deleteReq.setEditParts(nodeParts); cpdCmd.add(((NodePart) nodeParts.get(0)).getCommand(deleteReq)); } if (noteParts.size() != 0) { GroupRequest deleteReq = new GroupRequest(RequestConstants.REQ_DELETE); deleteReq.setEditParts(noteParts); cpdCmd.add(((NoteEditPart) noteParts.get(0)).getCommand(deleteReq)); } return cpdCmd; } else { GroupRequest deleteReq = new GroupRequest(RequestConstants.REQ_DELETE); deleteReq.setEditParts(objects); Command cmd = object.getCommand(deleteReq); return cmd; } }
From source file:org.talend.rcp.intro.Application.java
License:Open Source License
public boolean checkUnSupportJavaVersion(Shell shell) { IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault() .getService(IBrandingService.class); String javaVersion = System.getProperty("java.version"); if (javaVersion != null) { org.talend.commons.utils.Version v = new org.talend.commons.utils.Version(javaVersion); if (v.getMajor() == 1 && v.getMinor() > 7) { // more than JDK 1.7 if (brandingService.isPoweredbyTalend()) { OpenLinkMessageDialog dialog = new OpenLinkMessageDialog(shell, "", shell.getBackgroundImage(), Messages.getString("Application.doNotSupportJavaVersionYetPoweredbyTalend"), MessageDialog.WARNING, new String[] { "Quit" }, 0); dialog.open();//from w ww . j ava 2s. c o m return true; } else { MessageDialog dialog = new MessageDialog(shell, "", shell.getBackgroundImage(), Messages.getString("Application.doNotSupportJavaVersionYetNoPoweredbyTalend"), MessageDialog.WARNING, new String[] { "Quit" }, 0); dialog.open(); return true; } } } return false; }
From source file:org.talend.repository.ui.login.LoginComposite.java
License:Open Source License
private void addListeners() { if (connectionsViewer != null) { connectionsViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override//w ww . jav a 2 s .c o m public void selectionChanged(SelectionChangedEvent event) { try { final ConnectionBean connection = getConnection(); if (connection == null) { return; } if (beforeConnBean != null && connection.equals(beforeConnBean)) { return; } beforeConnBean = connection; user.setText(connection.getUser() == null ? "" : connection.getUser()); //$NON-NLS-1$ passwordText.setText(connection.getPassword() == null ? "" : connection.getPassword()); //$NON-NLS-1$ updateServerFields(); // updateButtons(); updateVisible(); // Validate data if (validateFields()) { populateProjectList(); validateProject(); } setStatusArea(); validateUpdate(); } catch (PersistenceException e) { ExceptionHandler.process(e); } catch (JSONException e) { ExceptionHandler.process(e); } displayPasswordComposite(); } }); } if (PluginChecker.isSVNProviderPluginLoaded()) { ModifyListener modifyListener = new ModifyListener() { @Override public void modifyText(ModifyEvent e) { unpopulateProjectList(); dialog.updateButtons(); setRepositoryContextInContext(); } }; passwordText.addModifyListener(modifyListener); fillProjectsBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // Validate data if (validateFields()) { populateProjectList(); validateProject(); } try { setStatusArea(); } catch (PersistenceException e1) { ExceptionHandler.process(e1); } setRepositoryContextInContext(); } }); branchesViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { PreferenceManipulator prefManipulator = new PreferenceManipulator( CorePlugin.getDefault().getPreferenceStore()); String branch = getBranch(); if (branch == null) { branch = SVNConstant.EMPTY; } prefManipulator.setLastSVNBranch(branch); } }); } if (projectViewer != null) { projectViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { PreferenceManipulator prefManipulator = new PreferenceManipulator( CorePlugin.getDefault().getPreferenceStore()); Project project = getProject(); prefManipulator.setLastProject(project.getLabel()); setBranchesSetting(project, false); dialog.updateButtons(); setRepositoryContextInContext(); } }); } manageConnectionsButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { try { ConnectionsDialog connectionsDialog = new ConnectionsDialog(getShell()); int open = connectionsDialog.open(); if (open == Window.OK) { LoginComposite.this.storedConnections = connectionsDialog.getConnections(); perReader.saveConnections(LoginComposite.this.storedConnections); fillContents(); // updateVisible(); // validateUpdate(); final ConnectionBean connection = getConnection(); if (connection == null) { return; } beforeConnBean = connection; user.setText(connection.getUser() == null ? "" : connection.getUser()); //$NON-NLS-1$ passwordText.setText(connection.getPassword() == null ? "" : connection.getPassword()); //$NON-NLS-1$ updateServerFields(); // updateButtons(); updateVisible(); // Validate data if (validateFields()) { populateProjectList(); validateProject(); } setStatusArea(); validateUpdate(); displayPasswordComposite(); } // setStatusArea(); } catch (PersistenceException e1) { ExceptionHandler.process(e1); } catch (JSONException e2) { ExceptionHandler.process(e2); } } }); manageProjectsButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ManageItem item = null; if (!manageViewer.getSelection().isEmpty()) { IStructuredSelection sel = (IStructuredSelection) manageViewer.getSelection(); item = (ManageItem) sel.getFirstElement(); } item.run(); try { setStatusArea(); } catch (PersistenceException e1) { ExceptionHandler.process(e1); } } }); openProjectBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setRepositoryContextInContext(); dialog.okPressed(); } }); restartBut.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { isRestart = true; perReader.saveLastConnectionBean(getConnection()); // update the restart command line to specify the workspace to launch // if relaunch, should delete the "disableLoginDialog" argument in eclipse data for bug TDI-19214 EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand("-data", //$NON-NLS-1$ getConnection().getWorkSpace(), false); // store the workspace in the eclipse history so that it is rememebered on next studio launch ChooseWorkspaceData workspaceData = new ChooseWorkspaceData(""); //$NON-NLS-1$ workspaceData.workspaceSelected(getConnection().getWorkSpace()); workspaceData.writePersistedData(); dialog.okPressed(); } }); updateBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // install and update all patches; try { if (updateBtn.getText().equals("update")) { ICoreTisService tisService = (ICoreTisService) GlobalServiceRegister.getDefault() .getService(ICoreTisService.class); afterUpdate = false; if (tisService != null) { tisService.downLoadAndInstallUpdates(getConnection().getUser(), getConnection().getPassword(), getAdminURL()); afterUpdate = true; tisService.setNeedResartAfterUpdate(afterUpdate); } // need to relauch the studio automaticlly after updating isRestart = true; perReader.saveLastConnectionBean(getConnection()); dialog.okPressed(); } else { String[] buttons = new String[] { IDialogConstants.OK_LABEL }; String message = Messages.getString("LoginComposite.archivaJarLost"); ArchivaErrorDialog archivaDialog = new ArchivaErrorDialog(getShell(), "Warning", null, message, MessageDialog.WARNING, buttons, 0); archivaDialog.open(); } } catch (Exception e1) { ExceptionHandler.process(e1); } } }); }
From source file:org.talend.repository.ui.login.LoginProjectPage.java
License:Open Source License
protected void updateStudio() { // install and update all patches; try {//from w w w . j a v a 2 s .c om if (FINISH_ACTION_UPDATE.equals(finishButtonAction)) { ICoreTisService tisService = (ICoreTisService) GlobalServiceRegister.getDefault() .getService(ICoreTisService.class); afterUpdate = false; if (tisService != null) { tisService.downLoadAndInstallUpdates(getConnection().getUser(), getConnection().getPassword(), getAdminURL()); afterUpdate = true; tisService.setNeedResartAfterUpdate(afterUpdate); } // need to relauch the studio automaticlly after updating LoginHelper.isRestart = true; loginHelper.saveLastConnectionBean(getConnection()); finishPressed(); } else { String[] buttons = new String[] { IDialogConstants.OK_LABEL }; String message = Messages.getString("LoginComposite.archivaJarLost"); //$NON-NLS-1$ ArchivaErrorDialog archivaDialog = new ArchivaErrorDialog(getShell(), "Warning", null, message, MessageDialog.WARNING, buttons, 0); archivaDialog.open(); } } catch (Throwable e1) { CommonExceptionHandler.process(e1); ExceptionMessageDialog.openError(getShell(), Messages.getString("LoginProjectPage.update.error.title"), //$NON-NLS-1$ Messages.getString("LoginProjectPage.update.error.message"), e1); //$NON-NLS-1$ } }