List of usage examples for org.eclipse.jface.dialogs IDialogConstants NO_LABEL
String NO_LABEL
To view the source code for org.eclipse.jface.dialogs IDialogConstants NO_LABEL.
Click Source Link
From source file:org.salever.common.swtjface.extend.widget.util.MessageDialogEx.java
License:Open Source License
/** * @param kind/*ww w.j av a2 s . c om*/ * @return */ static String[] getButtonLabels(int kind) { String[] dialogButtonLabels; switch (kind) { case ERROR: case INFORMATION: case WARNING: { dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL }; break; } case CONFIRM: { dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }; break; } case QUESTION: { dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }; break; } case QUESTION_WITH_CANCEL: { dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; break; } case QUESTION_WITH_SAVE: { dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, QUESTION_WITH_SAVE_LABEL }; break; } default: { throw new IllegalArgumentException("Illegal value for kind in MessageDialog.open()"); //$NON-NLS-1$ } } return dialogButtonLabels; }
From source file:org.search.niem.uml.qvt.ui.handlers.TransformDelegate.java
License:Open Source License
private boolean shouldContinue(final Shell shell, final IStatus status) { final ErrorDialog dialog = new ErrorDialog(shell, Activator.INSTANCE.getString("_UI_NIEM_TransformDelegate_validation_dialog_title"), getValidationMessage(status), status, IStatus.ERROR | IStatus.WARNING | IStatus.INFO) { @Override/*from w w w . j a v a 2 s.co m*/ protected Control createContents(final Composite parent) { final Control contents = super.createContents(parent); shell.getDisplay().asyncExec(new Runnable() { @Override public void run() { buttonPressed(IDialogConstants.DETAILS_ID); } }); return contents; } @Override protected void createButtonsForButtonBar(final Composite parent) { createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, false); createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, true); createDetailsButton(parent); } @Override protected void buttonPressed(final int id) { if (id == IDialogConstants.YES_ID) { super.buttonPressed(IDialogConstants.OK_ID); } else if (id == IDialogConstants.NO_ID) { super.buttonPressed(IDialogConstants.CANCEL_ID); } super.buttonPressed(id); } @Override protected int getShellStyle() { return super.getShellStyle() | SWT.SHEET; } }; final AtomicBoolean result = new AtomicBoolean(); shell.getDisplay().syncExec(new Runnable() { @Override public void run() { result.set(dialog.open() == IDialogConstants.OK_ID); } }); return result.get(); }
From source file:org.springframework.ide.eclipse.maven.internal.legacyconversion.ListMessageDialog.java
License:Open Source License
public ListMessageDialog(Shell shell, IProject[] legacyProjects) { super(shell, TITLE, null, DIALOG_TEXT, QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0, PREFERENCE_QUESTION, MavenCorePlugin.getDefault().getPreferenceStore().getBoolean(DONT_AUTO_CHECK)); this.legacyProjects = legacyProjects; }
From source file:org.springsource.ide.eclipse.commons.frameworks.ui.internal.legacyconversion.ListMessageDialog.java
License:Open Source License
public ListMessageDialog(Shell shell, IProject[] legacyProjects) { super(shell, TITLE, null, createMessage(legacyProjects), QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0, PREFERENCE_QUESTION, PREFERENCE_STORE.getBoolean(AUTO_CHECK_FOR_LEGACY_STS_PROJECTS)); this.legacyProjects = legacyProjects; }
From source file:org.summer.dsl.builder.nature.NatureAddingEditorCallback.java
License:Open Source License
@Override public void afterCreatePartControl(XtextEditor editor) { super.afterCreatePartControl(editor); IResource resource = editor.getResource(); if (resource != null && !toggleNature.hasNature(resource.getProject()) && resource.getProject().isAccessible() && !resource.getProject().isHidden()) { String title = Messages.NatureAddingEditorCallback_MessageDialog_Title; String message = Messages.NatureAddingEditorCallback_MessageDialog_Msg0 + resource.getProject().getName() + Messages.NatureAddingEditorCallback_MessageDialog_Msg1; Image image = null;/*from www .j av a 2 s.c o m*/ MessageDialog dialog = new MessageDialog( editor.getEditorSite().getShell(), title, image, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0); int open = dialog.open(); if (open == 0) { toggleNature.toggleNature(resource.getProject()); } } }
From source file:org.symbian.tools.wrttools.wizards.projectimport.WrtProjectLocationWizardPage.java
License:Open Source License
/** * The <code>WizardDataTransfer</code> implementation of this * <code>IOverwriteQuery</code> method asks the user whether the existing * resource at the given path should be overwritten. * * @param pathString//from w w w .j a v a 2 s . c om * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>, * <code>"ALL"</code>, or <code>"CANCEL"</code> */ public String queryOverwrite(String pathString) { Path path = new Path(pathString); if (path.segmentCount() > 1 && ".settings".equals(path.segment(1))) { return NO; } String messageString; // Break the message up if there is a file name and a directory // and there are at least 2 segments. if (path.getFileExtension() == null || path.segmentCount() < 2) { messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_existsQuestion, pathString); } else { messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_overwriteNameAndPathQuestion, path.lastSegment(), path.removeLastSegments(1).toOSString()); } final MessageDialog dialog = new MessageDialog(getContainer().getShell(), IDEWorkbenchMessages.Question, null, messageString, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL, IDialogConstants.CANCEL_LABEL }, 0) { protected int getShellStyle() { return super.getShellStyle() | SWT.SHEET; } }; String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL }; // run in syncExec because callback is from an operation, // which is probably not running in the UI thread. getControl().getDisplay().syncExec(new Runnable() { public void run() { dialog.open(); } }); return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()]; }
From source file:org.talend.core.model.metadata.builder.database.ExtractMetaDataFromDataBase.java
License:Open Source License
public static boolean checkSchemaConnection(final String schema, Connection connection, boolean notCaseSensitive, String dbType, final StringBuffer retPropsedSchema) throws SQLException { ExtractMetaDataUtils extractMeta = ExtractMetaDataUtils.getInstance(); DatabaseMetaData dbMetaData = extractMeta.getDatabaseMetaData(connection, dbType); final StringBuffer proposeSchema = new StringBuffer(); if (dbMetaData != null) { ResultSet rs = dbMetaData.getSchemas(); while (rs.next()) { if (notCaseSensitive) { if (rs.getString(1).toLowerCase().compareTo(schema.toLowerCase()) == 0) { extractMeta.setSchema(rs.getString(1)); rs.close();//from w w w . j a v a2s. c om return (true); } } else { String schemaFromDB = rs.getString(1); if (schemaFromDB.toLowerCase().compareTo(schema.toLowerCase()) == 0) { if (schemaFromDB.compareTo(schema) == 0) { extractMeta.setSchema(schema); rs.close(); return (true); } else { proposeSchema.append(schemaFromDB); } } } } rs.close(); } if (retPropsedSchema != null && 0 < proposeSchema.length()) { final StringBuffer userSelectResult = new StringBuffer(); Display.getDefault().syncExec(new Runnable() { @Override public void run() { String title = Messages.getString("CheckConnection.CheckSchema.ProposeSchema.title"); //$NON-NLS-1$ String proposeMessage = Messages.getString("CheckConnection.CheckSchema.ProposeSchema.message", //$NON-NLS-1$ new Object[] { schema, proposeSchema }); MessageDialog messageDialog = new MessageDialog(new Shell(), title, null, proposeMessage, MessageDialog.CONFIRM, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); if (messageDialog.open() == 0) { retPropsedSchema.append(proposeSchema); userSelectResult.append("true"); //$NON-NLS-1$ } } }); if (0 < userSelectResult.length()) { return true; } } return false; }
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 ww w. ja va2 s. c o m 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.core.ui.action.GEFDeleteAction.java
License:Open Source License
@Override public Command createDeleteCommand(List objects) { objects = filterSameObject(objects); if (objects.isEmpty()) { return null; }/* w w w .j a va 2s.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.mdm.repository.ui.dialogs.SwitchPerspectiveDialog.java
License:Open Source License
/** * DOC HHB SwitchPerspectiveDialog constructor comment. * /* w w w.jav a2 s . c o m*/ * @param parentShell * @param dialogTitle * @param dialogTitleImage * @param dialogMessage * @param dialogImageType * @param dialogButtonLabels * @param defaultIndex */ public SwitchPerspectiveDialog(Shell parentShell, String perspectiveName, String perspectiveId, String prefSwitchId, String prefWarnUserSwitchId) { super(parentShell, Messages.SwitchPerspectiveDialog_title, null, getDialogMessage(perspectiveName), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); this.perspectiveId = perspectiveId; this.prefSwitchId = prefSwitchId; this.prefWarnUserSwitchId = prefWarnUserSwitchId; }