/** * Sets or clears the error message. * 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); 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); } } }
public List<SyntaxStyle> get() { ArrayList<SyntaxStyle> result = new ArrayList<SyntaxStyle>(); setDefaults(store); for (SyntaxStyle s : defaultStyles) { boolean enable = store.getBoolean(getStyleKey(StyleAspect.enable, s.displayName)); RGB color = StringConverter.asRGB(store.getString(getStyleKey(StyleAspect.color, s.displayName))); boolean bold = store.getBoolean(getStyleKey(StyleAspect.bold, s.displayName)); ; boolean italic = store.getBoolean(getStyleKey(StyleAspect.italic, s.displayName)); ; boolean strikethrough = store.getBoolean(getStyleKey(StyleAspect.strikethrough, s.displayName)); ; boolean underline = store.getBoolean(getStyleKey(StyleAspect.underline, s.displayName)); ; result.add(new SyntaxStyle(s.displayName, s.type, enable, color, bold, italic, strikethrough, underline)); } return result; }
private void adaptToColorChange(Token token, PropertyChangeEvent event) { RGB rgb = null; Object value = event.getNewValue(); if (value instanceof RGB) { rgb = (RGB) value; } else if (value instanceof String) { rgb = StringConverter.asRGB((String) value); } if (rgb != null) { String property = event.getProperty(); Color color = colorMgr.getColor(property); if (!rgb.equals(color.getRGB())) { colorMgr.setValue(property, rgb); color = colorMgr.getColor(property); } Object data = token.getData(); if (data instanceof TextAttribute) { TextAttribute oldAttr = (TextAttribute) data; token.setData(new TextAttribute(color, oldAttr.getBackground(), oldAttr.getStyle())); } } }
public void setErrorMessage(String 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); } } }
public static Color colorFromString(String rgbString) { if (rgbString != null && rgbString.trim().length() > 0) { Color col = JFaceResources.getColorRegistry().get(rgbString); try { if (col == null) { RGB rgb = StringConverter.asRGB(rgbString); JFaceResources.getColorRegistry().put(rgbString, rgb); col = JFaceResources.getColorRegistry().get(rgbString); } } catch (DataFormatException e) { log.error("Corrupt color value: " + rgbString, e); } return col; } return null; }
protected Color getColorForKeyWithoutDefault(String key) { Color result = null; try { if (!Raptor.getInstance().getColorRegistry().hasValueFor(key)) { // We don't want the default color if not found we want to // return null, so use // StringConverter instead of PreferenceConverter. String value = getString(key); if (StringUtils.isNotBlank(value)) { RGB rgb = StringConverter.asRGB(value, null); if (rgb != null) { Raptor.getInstance().getColorRegistry().put(key, rgb); } else { return null; } } else { return null; } } result = Raptor.getInstance().getColorRegistry().get(key); } catch (Throwable t) { result = null; } return result; }
private Color getColor(final String configurationKey, final String defaultColorKey) { String colorKey = configuration.getString(configurationKey, defaultColorKey); RGB rgbColorData; try { rgbColorData = StringConverter.asRGB(colorKey); } catch (final RuntimeException e) { logger.log(Level.FINER, e.toString(), e); logger.log(Level.INFO, Messages.get("err.invalid.color"), colorKey); colorKey = defaultColorKey; rgbColorData = StringConverter.asRGB(colorKey); } final ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); if (!colorRegistry.hasValueFor(colorKey)) { colorRegistry.put(colorKey, rgbColorData); } return colorRegistry.get(colorKey); }
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); } }
public void createColorProperty(Composite cmp, final String prop, String name, final IPreferenceStore store) { new Label(cmp, SWT.NONE).setText(name); final ColorSelector colorSelector = new ColorSelector(cmp); colorSelector.addListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { properties.put(prop, StringConverter.asString(colorSelector.getColorValue())); save(store); } }); try { colorSelector.setColorValue(StringConverter.asRGB(properties.get(prop))); } catch (DataFormatException e) { e.printStackTrace(); } }
/** * Updates the {@link GridLayer grid} based on properties set on the {@link #getViewer() graphical viewer}: * {@link SnapToGrid#PROPERTY_GRID_VISIBLE}, {@link SnapToGrid#PROPERTY_GRID_SPACING}, and * {@link SnapToGrid#PROPERTY_GRID_ORIGIN}. * <p> * This method is invoked initially when the GridLayer is created, and when any of the above-mentioned properties are * changed on the viewer. */ protected void refreshGridLayer() { if (jConfig != null) { boolean visible = jConfig.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SHOWGRID, true); GridLayer grid = ((APageFigure) getFigure()).getGrid(); grid.setOrigin((Point) getViewer().getProperty(SnapToGrid.PROPERTY_GRID_ORIGIN)); int x = jConfig.getPropertyInteger(RulersGridPreferencePage.P_PAGE_RULERGRID_GRIDSPACEX, 10); int y = jConfig.getPropertyInteger(RulersGridPreferencePage.P_PAGE_RULERGRID_GRIDSPACEY, 10); grid.setSpacing(new Dimension(x, y)); grid.setVisible(visible); getViewer().setProperty(SnapToGrid.PROPERTY_GRID_SPACING, new Dimension(x, y)); String mcolor = jConfig.getProperty(RulersGridPreferencePage.P_PAGE_GRID_COLOR, RulersGridPreferencePage.DEFAULT_GRIDCOLOR); Color fg = SWTResourceManager.getColor(StringConverter.asRGB(mcolor)); grid.setForegroundColor(fg); } }
protected void setToken(IEclipsePreferences prefs, Theme theme, String ourTokenType, String jdtToken, boolean revertToDefaults) { if (revertToDefaults) { prefs.remove(jdtToken); prefs.remove(jdtToken + "_bold"); //$NON-NLS-1$ prefs.remove(jdtToken + "_italic"); //$NON-NLS-1$ prefs.remove(jdtToken + "_underline"); //$NON-NLS-1$ prefs.remove(jdtToken + "_strikethrough"); //$NON-NLS-1$ } else { TextAttribute attr = theme.getTextAttribute(ourTokenType); prefs.put(jdtToken, StringConverter.asString(attr.getForeground().getRGB())); prefs.putBoolean(jdtToken + "_bold", (attr.getStyle() & SWT.BOLD) != 0); //$NON-NLS-1$ prefs.putBoolean(jdtToken + "_italic", (attr.getStyle() & SWT.ITALIC) != 0); //$NON-NLS-1$ prefs.putBoolean(jdtToken + "_underline", (attr.getStyle() & TextAttribute.UNDERLINE) != 0); //$NON-NLS-1$ prefs.putBoolean(jdtToken + "_strikethrough", (attr.getStyle() & TextAttribute.STRIKETHROUGH) != 0); //$NON-NLS-1$ } }
protected void setSemanticToken(IEclipsePreferences prefs, Theme theme, String ourTokenType, String jdtToken, boolean revertToDefaults) { String prefix = "semanticHighlighting."; //$NON-NLS-1$ jdtToken = prefix + jdtToken; if (revertToDefaults) { prefs.remove(jdtToken + ".color"); //$NON-NLS-1$ prefs.remove(jdtToken + ".bold"); //$NON-NLS-1$ prefs.remove(jdtToken + ".italic"); //$NON-NLS-1$ prefs.remove(jdtToken + ".underline"); //$NON-NLS-1$ prefs.remove(jdtToken + ".strikethrough"); //$NON-NLS-1$ prefs.remove(jdtToken + ".enabled"); //$NON-NLS-1$ } else { TextAttribute attr = theme.getTextAttribute(ourTokenType); prefs.put(jdtToken + ".color", StringConverter.asString(attr.getForeground().getRGB())); //$NON-NLS-1$ prefs.putBoolean(jdtToken + ".bold", (attr.getStyle() & SWT.BOLD) != 0); //$NON-NLS-1$ prefs.putBoolean(jdtToken + ".italic", (attr.getStyle() & SWT.ITALIC) != 0); //$NON-NLS-1$ prefs.putBoolean(jdtToken + ".underline", (attr.getStyle() & TextAttribute.UNDERLINE) != 0); //$NON-NLS-1$ prefs.putBoolean(jdtToken + ".strikethrough", (attr.getStyle() & TextAttribute.STRIKETHROUGH) != 0); //$NON-NLS-1$ prefs.putBoolean(jdtToken + ".enabled", true); //$NON-NLS-1$ } }
/** * Validates the input. * * /** Sets or clears the error message. 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); 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); } } }
/** * Updates the change font button and the previewer to reflect the newly selected font. * * @param font * The FontData[] to update with. */ private void updateFont(final FontData font[]) { FontData[] bestFont = JFaceResources.getFontRegistry().filterData(font, _lblSelectedFont.getDisplay()); //if we have nothing valid do as best we can if (bestFont == null) { bestFont = getDefaultFontData(); } //Now cache this value in the receiver this.chosenFont = bestFont; if (_lblSelectedFont != null) { _lblSelectedFont.setText(StringConverter.asString(chosenFont[0])); } if (_fontPreviewer != null) { _fontPreviewer.setFont(bestFont); } // update font size widget final int fontHeight = bestFont[0].getHeight(); _spinFontSize.setSelection(fontHeight); }
/** * Converts a String to RGB, could be of several formats * * @see {@link StringUtils} */ public static RGB parseRGB(String valueString) { try { if (valueString != null && valueString.startsWith("#")) { valueString = valueString.substring(1); } Integer hexcode = Integer.parseInt(valueString, 16); if (hexcode != null) { return new RGB((hexcode/256/256)%256, (hexcode/256)%256, hexcode%256); } } catch (NumberFormatException e) { try { return StringConverter.asRGB(valueString); } catch (Exception x) { // ignore it } } return null; }
private void adaptToTextForegroundChange(Highlighting highlighting, PropertyChangeEvent event) { RGB rgb= null; Object value= event.getNewValue(); if (value instanceof RGB) rgb= (RGB) value; else if (value instanceof String) rgb= StringConverter.asRGB((String) value); if (rgb != null) { String property= event.getProperty(); Color color= fColorManager.getColor(property); if ((color == null || !rgb.equals(color.getRGB())) && fColorManager instanceof IColorManagerExtension) { IColorManagerExtension ext= (IColorManagerExtension) fColorManager; ext.unbindColor(property); ext.bindColor(property, rgb); color= fColorManager.getColor(property); } TextAttribute oldAttr= highlighting.getTextAttribute(); highlighting.setTextAttribute(new TextAttribute(color, oldAttr.getBackground(), oldAttr.getStyle())); } }
@Override public boolean close() { if (fAllowedVisibilities != null && fAllowedVisibilities.size() > 0 && fAllowedVisibilities.contains(new Integer(fVisibilityModifier))) fSettings.put(SETTINGS_VISIBILITY_MODIFIER, StringConverter.asString(fVisibilityModifier)); fSettings.put(SETTINGS_FINAL_MODIFIER, StringConverter.asString(fFinal)); fSettings.put(SETTINGS_SYNCHRONIZED_MODIFIER, StringConverter.asString(fSynchronized)); fSettings.put(SETTINGS_COMMENTS, fGenerateComment); if (fHasUserChangedPositionIndex) { if (fCurrentPositionIndex == INSERT_FIRST_INDEX || fCurrentPositionIndex == INSERT_LAST_INDEX) fSettings.put(SETTINGS_INSERT_POSITION, StringConverter.asString(fCurrentPositionIndex)); else if (fEditor != null) fSettings.put(SETTINGS_INSERT_POSITION, StringConverter.asString(INSERT_POSITION_FROM_EDITOR)); } return super.close(); }
/** * Updates the change font button and the previewer to reflect the * newly selected font. * @param font The FontData[] to update with. */ private void updateFont(FontData font[]) { FontData[] bestFont = JFaceResources.getFontRegistry().filterData( font, valueControl.getDisplay()); //if we have nothing valid do as best we can if (bestFont == null) { bestFont = getDefaultFontData(); } //Now cache this value in the receiver this.chosenFont = bestFont; if (valueControl != null) { valueControl.setText(StringConverter.asString(chosenFont[0])); } if (previewer != null) { previewer.setFont(bestFont); } }
@Override public boolean close() { fSettings.put(SETTINGS_VISIBILITY_MODIFIER, StringConverter.asString(fVisibilityModifier)); fSettings.put(SETTINGS_FINAL_MODIFIER, StringConverter.asString(fFinal)); fSettings.put(SETTINGS_SYNCHRONIZED_MODIFIER, StringConverter.asString(fSynchronized)); fSettings.put(SETTINGS_COMMENTS, fGenerateComment); if (fHasUserChangedPositionIndex) { if (fCurrentPositionIndex == INSERT_FIRST_INDEX || fCurrentPositionIndex == INSERT_LAST_INDEX) fSettings.put(SETTINGS_INSERT_POSITION, StringConverter.asString(fCurrentPositionIndex)); else if (fEditor != null) fSettings.put(SETTINGS_INSERT_POSITION, StringConverter.asString(INSERT_POSITION_FROM_EDITOR)); } return super.close(); }
@Override public String toString() { StringBuffer buf = new StringBuffer(""); //$NON-NLS-1$ RGB rgb = mForeground; if(rgb != null) { buf.append(StringConverter.asString(rgb)); } buf.append("|"); //$NON-NLS-1$ rgb = mBackground; if(rgb != null) { buf.append(StringConverter.asString(rgb)); } buf.append("|"); //$NON-NLS-1$ buf.append(StringConverter.asString(mBold)); buf.append("|"); //$NON-NLS-1$ buf.append(StringConverter.asString(mItalic)); buf.append("|"); //$NON-NLS-1$ buf.append(StringConverter.asString(mUnderline)); buf.append("|"); //$NON-NLS-1$ buf.append(StringConverter.asString(mStrikethrough)); return buf.toString(); }
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 ); } } }
public void setErrorMessage( String 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 ); } } }
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 ); } } }
private PyCodeScanner createCodeScanner() { PreferenceStore store = new PreferenceStore(); store.putValue(PydevEditorPrefs.KEYWORD_COLOR, StringConverter.asString(new RGB(1, 0, 0))); store.putValue(PydevEditorPrefs.SELF_COLOR, StringConverter.asString(new RGB(2, 0, 0))); store.putValue(PydevEditorPrefs.CODE_COLOR, StringConverter.asString(new RGB(3, 0, 0))); store.putValue(PydevEditorPrefs.DECORATOR_COLOR, StringConverter.asString(new RGB(4, 0, 0))); store.putValue(PydevEditorPrefs.NUMBER_COLOR, StringConverter.asString(new RGB(5, 0, 0))); store.putValue(PydevEditorPrefs.FUNC_NAME_COLOR, StringConverter.asString(new RGB(6, 0, 0))); store.putValue(PydevEditorPrefs.CLASS_NAME_COLOR, StringConverter.asString(new RGB(7, 0, 0))); store.putValue(PydevEditorPrefs.OPERATORS_COLOR, StringConverter.asString(new RGB(8, 0, 0))); store.putValue(PydevEditorPrefs.PARENS_COLOR, StringConverter.asString(new RGB(9, 0, 0))); this.colorCache = new ColorAndStyleCache(store); PyCodeScanner scanner = new PyCodeScanner(colorCache); return scanner; }
/** * @param feature * @param result * @return value */ protected Object returnPropertyValue(EStructuralFeature feature, Object result) { if (result instanceof Integer) { result = ((Integer) result).toString(); } else if (result instanceof Double) { result = ((Double) result).toString(); } else if (result instanceof Boolean) { // result = ((Boolean) result).booleanValue() ? new Integer(1) : new // Integer(0); // result = result; } else if (feature.getName().toLowerCase().indexOf("color") >= 0) { //$NON-NLS-1$ if (result == null || ((String) result).length() == 0) result = new RGB(0, 0, 0); else result = StringConverter.asRGB((String) result); } return result; }
/** * The user has changed a property in the interface; change the model to reflect the user's action. * * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object) */ public void setPropertyValue(Object id, Object value) { // int propertyid = Integer.parseInt((String) id); // EStructuralFeature feature = // object.eClass().getEStructuralFeature(propertyid); // EStructuralFeature feature = (EStructuralFeature) id; PropertyID propertyid = (PropertyID) id; EStructuralFeature feature = propertyid.getFeature(); Object result = getPropertyValue(id); if (feature.getEType().getInstanceClass() == int.class) { result = new Integer(Integer.parseInt((String) value)); } else if (feature.getEType().getInstanceClass() == double.class) { result = new Double(Double.parseDouble(value.toString())); } else if (feature.getEType().getInstanceClass() == boolean.class) { result = value; } else if (result instanceof RGB) { result = StringConverter.asString((RGB) value); } else result = value; if (feature.getName().equals("name") && result instanceof String) result = result.toString().trim(); setReferencedObject(propertyid, feature, result); }
/** * Sets the figure's colors. The default line color is black, the default fill color is white. * * @param lineColor * outline color * @param fillColor * inside color * @param filled * should it be filled? */ public void setColors(String lineColor, String fillColor, boolean filled) { setFill(filled); if (fillColor == null || fillColor.length() == 0) { setBackgroundColor(ColorManager.FILL); } else { // if( JUCMNavPlugin.isInDebug() ) System.out.println( "fillColor: " + fillColor ); setBackgroundColor(new Color(Display.getCurrent(), StringConverter.asRGB(fillColor))); } if (lineColor == null || lineColor.length() == 0) { setForegroundColor(ColorManager.LINE); } else setForegroundColor(new Color(Display.getCurrent(), StringConverter.asRGB(lineColor))); }
@Override public void initializeDefaultPreferences() { IPreferenceStore store = BytemanEditorPlugin.getDefault().getPreferenceStore(); store.setDefault(BytemanEditorPlugin.PREF_VALIDATION_CLASS_CHECK, false); store.setDefault(BytemanEditorPlugin.PREF_VALIDATION_JAVA_LANG_CHECK, true); store.setDefault(BytemanEditorPlugin.PREF_VALIDATION_METHOD_CHECK, true); store.setDefault(BytemanEditorPlugin.PREF_DEFAULT_COLOR, StringConverter.asString(new RGB(0, 0, 0))); store.setDefault(BytemanEditorPlugin.PREF_DEFAULT_BOLD, false); store.setDefault(BytemanEditorPlugin.PREF_DEFAULT_ITALIC, false); store.setDefault(BytemanEditorPlugin.PREF_DEFAULT_STRIKE, false); store.setDefault(BytemanEditorPlugin.PREF_DEFAULT_UNDERLINE, false); store.setDefault(BytemanEditorPlugin.PREF_KEYWORD_COLOR, StringConverter.asString(new RGB(255, 0, 0))); store.setDefault(BytemanEditorPlugin.PREF_KEYWORD_BOLD, false); store.setDefault(BytemanEditorPlugin.PREF_KEYWORD_ITALIC, false); store.setDefault(BytemanEditorPlugin.PREF_KEYWORD_STRIKE, false); store.setDefault(BytemanEditorPlugin.PREF_KEYWORD_UNDERLINE, false); store.setDefault(BytemanEditorPlugin.PREF_ASSIST_JAVA_LANG_PACKAGE, false); }
/** * Sets or clears the error message. 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); 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); } } }
public SQLEditorSyntaxModel load() { color = StringConverter.asRGB(prefStore.getString( type.getPrefName() + PREF_COLOR)); bold = prefStore.getBoolean(type.getPrefName() + PREF_BOLD); italic = prefStore.getBoolean(type.getPrefName() + PREF_ITALIC); strikethrough = prefStore.getBoolean(type.getPrefName() + PREF_STRIKETHROUGH); underline = prefStore.getBoolean(type.getPrefName() + PREF_UNDERLINE); return this; }
public void setDefault() { prefStore.setDefault(type.getPrefName() + PREF_COLOR, StringConverter.asString(color)); prefStore.setDefault(type.getPrefName() + PREF_BOLD, bold); prefStore.setDefault(type.getPrefName() + PREF_ITALIC, italic); prefStore.setDefault(type.getPrefName() + PREF_STRIKETHROUGH, strikethrough); prefStore.setDefault(type.getPrefName() + PREF_UNDERLINE, underline); }
public SQLEditorSyntaxModel loadDefault() { color = StringConverter.asRGB(prefStore.getDefaultString( type.getPrefName()+ PREF_COLOR)); bold = prefStore.getDefaultBoolean(type.getPrefName() + PREF_BOLD); italic = prefStore.getDefaultBoolean(type.getPrefName() + PREF_ITALIC); strikethrough = prefStore.getDefaultBoolean(type.getPrefName() + PREF_STRIKETHROUGH); underline = prefStore.getDefaultBoolean(type.getPrefName() + PREF_UNDERLINE); return this; }
public void store() { prefStore.setValue(type.getPrefName() + PREF_COLOR, StringConverter.asString(color)); prefStore.setValue(type.getPrefName() + PREF_BOLD, bold); prefStore.setValue(type.getPrefName() + PREF_ITALIC, italic); prefStore.setValue(type.getPrefName() + PREF_STRIKETHROUGH, strikethrough); prefStore.setValue(type.getPrefName() + PREF_UNDERLINE, underline); }