List of usage examples for org.eclipse.jface.dialogs Dialog DLG_IMG_MESSAGE_ERROR
String DLG_IMG_MESSAGE_ERROR
To view the source code for org.eclipse.jface.dialogs Dialog DLG_IMG_MESSAGE_ERROR.
Click Source Link
"dialog_message_error_image"
). From source file:org.bonitasoft.studio.common.jface.CellEditorValidationStatusListener.java
License:Open Source License
@Override public void editorValueChanged(boolean oldValidState, boolean newValidState) { if (!newValidState) { statusControl.setText(editor.getErrorMessage()); statusControl.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR)); } else {//ww w. j a v a 2 s. c om statusControl.setText(""); statusControl.setImage(null); } }
From source file:org.bonitasoft.studio.engine.ui.dialog.ProcessEnablementProblemsDialog.java
License:Open Source License
@Override protected Control createCustomArea(Composite parent) { if (processResolutionProblems.isEmpty()) { return super.createCustomArea(parent); }/*from w w w . j a va 2s . c om*/ TableViewer problemsViewer = new TableViewer(parent, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); problemsViewer.getControl().setLayoutData( GridDataFactory.fillDefaults().grab(true, true).hint(300, 100).indent(0, 10).create()); problemsViewer.setContentProvider(new ArrayContentProvider()); problemsViewer.setLabelProvider(new LabelProvider() { /* * (non-Javadoc) * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object) */ @Override public String getText(Object element) { return ((Problem) element).getDescription(); } /* * (non-Javadoc) * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object) */ @Override public Image getImage(Object element) { return ((Problem) element).getLevel() == Level.ERROR ? JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR) : JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); } }); problemsViewer.setInput(processResolutionProblems); return problemsViewer.getControl(); }
From source file:org.caleydo.core.io.gui.dataimport.widget.IDParsingRulesWidget.java
License:Open Source License
/** * @param parent/*from w ww. j a v a 2 s. c om*/ * @param templateIdTypeParsingRules * Template that is used to fill the widgets. May be null. * @param showEnableButton * Determines, whether a checkbox is displayed that enables/disables all widgets. * @param idSample * Sample id that shall be used to preview effects of regular expressions. * @param validRegExCallback * Called when the inserted regular expression is valid or not valid. This can be used to disable buttons * external to this widget when the inserted regex is not valid. */ public IDParsingRulesWidget(Composite parent, IDTypeParsingRules templateIdTypeParsingRules, boolean showEnableButton, String idSample, ICallback<Boolean> validRegExCallback) { this.idSample = idSample; this.validRegExCallback = validRegExCallback; if (showEnableButton) { useRegExButton = new Button(parent, SWT.CHECK); useRegExButton.setText("Convert IDs"); useRegExButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setEnabled(useRegExButton.getSelection()); } }); } Label conversionLabel = new Label(parent, SWT.WRAP); conversionLabel.setText( "You can convert IDs using the follwing methods. They are applied in the order shown here."); conversionLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); caseGroup = new Group(parent, SWT.SHADOW_ETCHED_IN); caseGroup.setText("Change Case"); caseGroup.setLayout(new GridLayout(1, false)); caseGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); caseExplanationLabel = new Label(caseGroup, SWT.WRAP); caseExplanationLabel.setText( "Choose whether to keep the case of the IDs, convert all to lower, or convert all to upper case."); caseExplanationLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); keepCaseButton = new Button(caseGroup, SWT.RADIO); keepCaseButton.setText("Keep case unchanged"); keepCaseButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); keepCaseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { updatePreview(); } }); toUpperCaseButton = new Button(caseGroup, SWT.RADIO); toUpperCaseButton.setText("Make upper case"); toUpperCaseButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); toUpperCaseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { updatePreview(); } }); toLowerCaseButton = new Button(caseGroup, SWT.RADIO); toLowerCaseButton.setText("Make lower case"); toLowerCaseButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); toUpperCaseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { updatePreview(); } }); replaceGroup = new Group(parent, SWT.SHADOW_ETCHED_IN); replaceGroup.setText("Replace parts of IDs"); replaceGroup.setLayout(new GridLayout(4, false)); replaceGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); Composite useRegExComposite = new Composite(replaceGroup, SWT.NONE); useRegExComposite.setLayout(new RowLayout(SWT.HORIZONTAL)); useRegExComposite.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, false, 4, 1)); ModifyListener regexModifyListener = new ModifyListener() { @Override public void modifyText(ModifyEvent e) { updatePreview(); } }; replacementExplanationLabel = new Label(replaceGroup, SWT.WRAP); replacementExplanationLabel.setText("Replace certain expressions within an ID by a specified " + "string. For example, applying the regular expression '\\.' and the replacement string '-' on the ID " + "'abc.000.yz' results in 'abc-000-yz'."); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1); gridData.widthHint = 500; replacementExplanationLabel.setLayoutData(gridData); replacementRegExLabel = new Label(replaceGroup, SWT.NONE); replacementRegExLabel.setText("Replace"); replacementRegExLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, true)); replacementRegExTextField = new Text(replaceGroup, SWT.BORDER); GridData replacementTextFieldsGridData = new GridData(SWT.FILL, SWT.FILL, true, true); replacementTextFieldsGridData.widthHint = 150; replacementRegExTextField.setLayoutData(replacementTextFieldsGridData); replacementRegExTextField.addModifyListener(regexModifyListener); replacementStringLabel = new Label(replaceGroup, SWT.NONE); replacementStringLabel.setText("with"); replacementStringTextField = new Text(replaceGroup, SWT.BORDER); replacementStringTextField.setLayoutData(replacementTextFieldsGridData); replacementStringTextField.addModifyListener(regexModifyListener); substringGroup = new Group(parent, SWT.SHADOW_ETCHED_IN); substringGroup.setText("Split IDs"); substringGroup.setLayout(new GridLayout(4, false)); substringGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); substringExplanationLabel = new Label(substringGroup, SWT.WRAP); substringExplanationLabel .setText("Splits an ID into substrings around matches of the specified regular expression. " + "The first non-empty substring of this operation will be the resulting ID. For example, a leading string " + "'abc' can be removed from an ID 'abc-001' using the expression 'abc-'. In this case the split operation " + "results in ['','001']. Using, for example, '\\-' as expression would result in ['abc','001'] and 'abc' " + "would be used as the result."); gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1); gridData.widthHint = 500; substringExplanationLabel.setLayoutData(gridData); substringRegExLabel = new Label(substringGroup, SWT.NONE); substringRegExLabel.setText("Substring specification"); substringRegExTextField = new Text(substringGroup, SWT.BORDER); substringRegExTextField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); substringRegExTextField.addModifyListener(regexModifyListener); if (idSample != null) { gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1); previewLabel = new Label(substringGroup, SWT.NONE); previewLabel.setText("Preview: "); previewLabel.setLayoutData(gridData); FontData fontData = previewLabel.getFont().getFontData()[0]; Font font = new Font(previewLabel.getDisplay(), new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD)); previewLabel.setFont(font); gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1); originalIDLabel = new Label(substringGroup, SWT.NONE); originalIDLabel.setText("Original ID: " + idSample); originalIDLabel.setLayoutData(gridData); gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1); convertedIDLabel = new Label(substringGroup, SWT.NONE); convertedIDLabel.setLayoutData(gridData); } errorImage = new Label(parent, SWT.NONE); errorImage.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR)); errorImage.setVisible(false); errorLabel = new Label(parent, SWT.NONE); errorLabel.setText("Invalid regular expression."); errorLabel.setVisible(false); regexLink = new Link(parent, SWT.WRAP); regexLink.setText( " <a href=\"http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html\">Regular Expression Reference</a>"); regexLink.addSelectionListener(BrowserUtils.LINK_LISTENER); fillWidgets(templateIdTypeParsingRules); }
From source file:org.eclipse.cdt.internal.ui.newui.StatusMessageLine.java
License:Open Source License
/** * Find an image associated with the status. *///from w w w .j av a2 s. c om private Image findImage(IStatus status) { if (status.isOK()) { return null; } else if (status.matches(IStatus.ERROR)) { return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR); } else if (status.matches(IStatus.WARNING)) { return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); } else if (status.matches(IStatus.INFO)) { return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO); } return null; }
From source file:org.eclipse.cdt.internal.ui.refactoring.dialogs.ValidatingLabeledTextField.java
License:Open Source License
public void addElement(String description, String initialText, boolean readOnly, final Validator validator) { Label label = new Label(this, SWT.NONE); label.setText(description);/*from w w w . j a v a 2s. c o m*/ label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); final Text textField = new Text(this, SWT.BORDER | SWT.SINGLE); textField.setText(initialText); textField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); if (readOnly) { //readOnly inputs are always valid: validationStatus.put(textField, Boolean.TRUE); textField.setEnabled(false); return; } validationStatus.put(textField, Boolean.FALSE); final Label errorImageLabel = new Label(this, SWT.NONE); errorImageLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR)); errorImageLabel.setLayoutData(new GridData()); errorImageLabel.setVisible(false); final Label errorLabel = new Label(this, SWT.NONE); errorLabel.setLayoutData(new GridData()); final Color defaultColor = textField.getBackground(); Listener listener = new Listener() { @SuppressWarnings("unchecked") public void checkField() { String newName = textField.getText(); boolean isEmpty = (newName.length() == 0); boolean isNameAlreadyInUse = nameAlreadyInUse(textField, newName); boolean isValid = validator.isValidInput(newName); boolean isKeyword = NameHelper.isKeyword(newName); boolean isValidName = NameHelper.isValidLocalVariableName(newName); boolean isOk = isValid && !isNameAlreadyInUse && !isEmpty && !isKeyword && isValidName; if (isOk) { setErrorStatus(EMPTY_STRING); } else if (isEmpty) { setErrorStatus(validator.errorMessageForEmptyField()); } else if (!isValid || !isValidName) { setErrorStatus(validator.errorMessageForInvalidInput()); } else if (isKeyword) { setErrorStatus(validator.errorIsKeywordMessage()); } else if (isNameAlreadyInUse) { setErrorStatus(validator.errorMessageForDuplicateValues()); } validationStatus.put(textField, isOk); if (validationStatus.values().contains(Boolean.FALSE) || isEmpty || isNameAlreadyInUse || isKeyword || !isValidName) { validator.hasErrors(); } else { validator.hasNoErrors(); } layout(); // recheck all other listeners in case duplicate names have been resolved, // but remove this first to avoid an infinite loop inputTextListeners.remove(this); for (Listener listener : (ArrayList<Listener>) inputTextListeners.clone()) { listener.handleEvent(null); } inputTextListeners.add(this); } private boolean nameAlreadyInUse(final Text textField, String newName) { for (Text text : validationStatus.keySet()) { if (text != textField && text.getText().equals(newName)) { return true; } } return false; } private void setErrorStatus(String errorMessage) { if (EMPTY_STRING.equals(errorMessage)) { textField.setBackground(defaultColor); errorLabel.setText(EMPTY_STRING); errorImageLabel.setVisible(false); } else { textField.setBackground(errorColor); errorLabel.setText(errorMessage); errorImageLabel.setVisible(true); } } @Override public void handleEvent(Event event) { checkField(); } }; //we need to keep a list of all listeners so we get access from other textfields to resolve duplicate names inputTextListeners.add(listener); listener.handleEvent(null); textField.addListener(SWT.Modify, listener); }
From source file:org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.java
License:Open Source License
/** * Shows the link for either multiple launch delegates or bad launch mode combinations * // w ww .j av a2 s . c o m * @since 3.3 */ private void showLink() { String text = null; if (!canLaunchWithModes()) { text = LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_13; } else if (hasMultipleDelegates()) { ILaunchDelegate delegate = getPreferredDelegate(); if (delegate != null) { String name = delegate.getName(); if (name == null) { text = LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_15; } else { text = MessageFormat.format(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_16, new String[] { name }); } } else { text = LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_17; } } if (text != null) { fOptionsLink.setText(text); } fOptionsLink.setVisible(!canLaunchWithModes() || hasMultipleDelegates()); if (hasDuplicateDelegates()) { fOptionsErrorLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR)); } else { fOptionsErrorLabel.setImage(null); } fViewform.layout(true, true); }
From source file:org.eclipse.dirigible.ide.common.status.StatusLineManagerUtil.java
License:Open Source License
public static void setErrorMessage(String message) { getDefaultStatusLineManager().removeAll(); getDefaultStatusLineManager().setErrorMessage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR), message);/*from w w w.jav a 2s.c o m*/ clearMessages(); }
From source file:org.eclipse.dltk.ruby.testing.internal.RubyTestingMainLaunchConfigurationTab.java
License:Open Source License
/** * @param status//from ww w . jav a 2 s. c o m */ private void updateEngineStatus(IStatus status) { Image newImage = null; String newMessage = status.getMessage(); switch (status.getSeverity()) { case IStatus.OK: newMessage = EMPTY_STRING; break; case IStatus.INFO: newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO); break; case IStatus.WARNING: newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); break; case IStatus.ERROR: newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR); break; } showMessage(newMessage, newImage); }
From source file:org.eclipse.e4.tools.ui.designer.properties.AppearanceSection.java
License:Open Source License
protected void setMessage(IStatus status) { if (imageLabel == null || imageLabel.isDisposed() || messageLabel == null || messageLabel.isDisposed()) { return;// w w w .j av a2 s . c o m } Image image = null; String message = null; if (status != null && !status.isOK()) { int severity = status.getSeverity(); switch (severity) { case IStatus.ERROR: image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR); break; case IStatus.WARNING: image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); break; case IStatus.INFO: image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO); break; } message = status.getMessage(); } boolean visible = image != null; imageLabel.setImage(image); imageLabelData.exclude = messageLableData.exclude = !visible; imageLabel.setVisible(visible); messageLabel.setVisible(visible); messageLabel.setText(message == null ? "" : message); imageLabel.getParent().layout(new Control[] { imageLabel, messageLabel }); }
From source file:org.eclipse.equinox.internal.p2.ui.model.EmptyElementExplanation.java
License:Open Source License
protected String getImageId(Object obj) { if (severity == IStatus.ERROR) return Dialog.DLG_IMG_MESSAGE_ERROR; if (severity == IStatus.WARNING) return Dialog.DLG_IMG_MESSAGE_WARNING; return Dialog.DLG_IMG_MESSAGE_INFO; }