List of usage examples for org.eclipse.jface.resource StringConverter removeWhiteSpaces
public static String removeWhiteSpaces(String s)
From source file:au.gov.ga.earthsci.catalog.ui.handler.BrowseInputDialog.java
License:Open Source License
/** * Sets or clears the error message. If not <code>null</code>, the OK button * is disabled./*from w w w . j a v a 2 s . c o m*/ * * @param errorMessage * the error message, or <code>null</code> to clear * @since 3.0 */ public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; if (errorMessageText != null && !errorMessageText.isDisposed()) { errorMessageText.setText(errorMessage == null ? " \n " : errorMessage); //$NON-NLS-1$ // Disable the error message text control if there is no error, or // no error text (empty or whitespace only). Hide it also to avoid // color change. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=130281 boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0; errorMessageText.setEnabled(hasError); errorMessageText.setVisible(hasError); errorMessageText.getParent().update(); // Access the ok button by id, in case clients have overridden button creation. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643 Control button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(errorMessage == null); } } }
From source file:com.amalto.workbench.dialogs.ViewInputDialog.java
License:Open Source License
public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; if (errorMessageText != null && !errorMessageText.isDisposed()) { errorMessageText.setText(errorMessage == null ? " \n " : errorMessage);//$NON-NLS-1$ boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0; errorMessageText.setEnabled(hasError); errorMessageText.setVisible(hasError); errorMessageText.getParent().update(); Control button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(errorMessage == null); }//from w ww . j a va2 s .com } }
From source file:com.amalto.workbench.editors.dialog.CustomInputDialog.java
License:Open Source License
/** * Sets or clears the error message. If not <code>null</code>, the OK button is disabled. * // w w w . ja v a2 s . co m * @param errorMessage the error message, or <code>null</code> to clear * @since 3.0 */ public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; if (errorMessageText != null && !errorMessageText.isDisposed()) { errorMessageText.setText(errorMessage == null ? " \n " : errorMessage); //$NON-NLS-1$ // Disable the error message text control if there is no error, or // no error text (empty or whitespace only). Hide it also to avoid // color change. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=130281 boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0; errorMessageText.setEnabled(hasError); errorMessageText.setVisible(hasError); errorMessageText.getParent().update(); // Access the ok button by id, in case clients have overridden button creation. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643 Control button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(errorMessage == null); } } }
From source file:com.nokia.s60tools.analyzetool.internal.ui.graph.GraphSettingsThresholdComposite.java
License:Open Source License
/** * Sets or clears the error message. If not <code>null</code>, the OK button * is disabled.//w w w. ja v a 2s.com * * @param errorMessage * the error message, or <code>null</code> to clear * @since 3.0 */ public void setErrorMessage(String errorMessage) { if (errorMessageText != null && !errorMessageText.isDisposed()) { errorMessageText.setText(errorMessage == null ? "" : errorMessage); //$NON-NLS-1$ // Disable the error message text control if there is no error, or // no error text (empty or whitespace only). Hide it also to avoid // color change. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=130281 boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0; errorMessageText.setEnabled(hasError); errorMessageText.setVisible(hasError); errorMessageText.getParent().update(); Control button = parentDialog.getOkButton(); if (button != null) { button.setEnabled(errorMessage == null); } } }
From source file:com.redhat.ceylon.eclipse.code.preferences.InputDialog.java
License:Open Source License
/** * Sets or clears the error message./* w ww . j a v a 2 s . co m*/ * If not <code>null</code>, the OK button is disabled. * * @param errorMessage * the error message, or <code>null</code> to clear * @since 3.0 */ public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; if (errorMessageText != null && !errorMessageText.isDisposed()) { errorMessageText.setText(errorMessage == null ? " \n " : errorMessage); //$NON-NLS-1$ // Disable the error message text control if there is no error, or // no error text (empty or whitespace only). Hide it also to avoid // color change. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=130281 boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0; errorMessageText.setEnabled(hasError); errorMessageText.setVisible(hasError); errorImage.setVisible(hasError); errorMessageText.getParent().update(); // Access the ok button by id, in case clients have overridden button creation. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643 Control button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(errorMessage == null); } } }
From source file:com.symbian.smt.gui.smtwidgets.XmlFileSelectionDialog.java
License:Open Source License
/** * Sets or clears the error message. If not <code>null</code>, the OK button * is disabled./*w w w . j a v a2 s.c o m*/ * * @param errorMessage * the error message, or <code>null</code> to clear * @since 3.0 */ public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; if (errorMessageText != null && !errorMessageText.isDisposed()) { errorMessageText.setText(errorMessage == null ? "\n" : errorMessage); //$NON-NLS-1$ // Disable the error message text control if there is no error, or // no error text (empty or whitespace only). Hide it also to avoid // color change. boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0; errorMessageText.setEnabled(hasError); errorMessageText.setVisible(hasError); errorMessageText.getParent().update(); // Access the ok button by id, in case clients have overridden // button creation. Control button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(errorMessage == null); } } }
From source file:de.tudarmstadt.dvs.ukuflow.eventbase.utils.UkuInputDialog.java
License:Open Source License
/** * Sets or clears the error message. If not <code>null</code>, the OK button * is disabled./*from w w w. j a v a 2s . c o m*/ * * @param errorMessage * the error message, or <code>null</code> to clear * @since 3.0 */ public void setErrorMessage(String errorMessage) { log.debug("set error message: !" + errorMessage + "!"); if (errorMessageText != null && !errorMessageText.isDisposed()) { errorMessageText.setText(errorMessage == null ? "\n" : errorMessage); // Disable the error message text control if there is no error, or // no error text (empty or whitespace only). Hide it also to avoid // color change. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=130281 boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0; if (errorMessage != null) errorMessageText.setSize(errorMessageText.getSize().x, 13 * errorMessage.split("\n").length); errorMessageText.setEnabled(hasError); errorMessageText.setVisible(hasError); errorMessageText.getParent().update(); errorMessageText.setForeground(new Color(null, 255, 0, 0)); // Access the ok button by id, in case clients have overridden // button creation. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643 Control button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(errorMessage == null); } } }
From source file:edu.iastate.cs.boa.ui.dialogs.InputSelectionDialog.java
License:Open Source License
public void setErrorMessage(final String errorMessage) { this.errorMessage = errorMessage; if (errorMessageText != null && !errorMessageText.isDisposed()) { errorMessageText.setText(errorMessage == null ? " \n " : errorMessage); final boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0; errorMessageText.setEnabled(hasError); errorMessageText.setVisible(hasError); errorMessageText.getParent().update(); final Control button = getButton(IDialogConstants.OK_ID); if (button != null) button.setEnabled(errorMessage == null); }//www . j a v a2s . com }
From source file:eu.portavita.coverage.handlers.ComboInputDialog.java
License:Open Source License
/** * Sets or clears the error message. If not <code>null</code>, the OK button * is disabled./*from w ww . jav a2s . c o m*/ * * @param errorMessage * the error message, or <code>null</code> to clear * @since 3.0 */ public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; if (errorMessageText != null && !errorMessageText.isDisposed()) { errorMessageText.setText(errorMessage == null ? " \n " : errorMessage); //$NON-NLS-1$ // Disable the error message text control if there is no error, or // no error text (empty or whitespace only). Hide it also to avoid // color change. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=130281 boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0; errorMessageText.setEnabled(hasError); errorMessageText.setVisible(hasError); errorMessageText.getParent().update(); // Access the ok button by id, in case clients have overridden // button creation. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643 Control button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(errorMessage == null); } } }
From source file:gov.redhawk.ide.codegen.ui.internal.GeneratorDialog.java
License:Open Source License
/** * Sets or clears the error message. If not <code>null</code>, the OK button * is disabled./*from ww w . j a v a 2 s .c o m*/ * * @param errorMessage the error message, or <code>null</code> to clear */ public void setErrorMessage(final String errorMessage) { this.errorMessage = errorMessage; if (this.errorMessageText != null && !this.errorMessageText.isDisposed()) { this.errorMessageText.setText((errorMessage == null) ? " \n " : errorMessage); // SUPPRESS CHECKSTYLE AvoidInline //$NON-NLS-1$ // Disable the error message text control if there is no error, or // no error text (empty or whitespace only). Hide it also to avoid // color change. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=130281 final boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0; this.errorMessageText.setEnabled(hasError); this.errorMessageText.setVisible(hasError); this.errorMessageText.getParent().update(); // Access the ok button by id, in case clients have overridden // button creation. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643 final Control button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(errorMessage == null); } } }