List of usage examples for org.eclipse.jface.resource JFaceResources getString
public static String getString(String key)
From source file:org.globaltester.preferences.ValidateFileFieldEditor.java
License:Open Source License
protected boolean checkState() { String msg = null;//from w w w . ja v a 2 s. co m Boolean all_okay = true; String path = getTextControl().getText(); if (path != null) { path = path.trim(); } else { all_okay = false; path = "";//$NON-NLS-1$ } if (path.length() == 0) { if (!isEmptyStringAllowed()) { msg = getErrorMessage(); all_okay = false; } } else { File file = new File(path); if (file.isFile()) { if (enforceAbsolute && !file.isAbsolute()) { msg = JFaceResources.getString("ValidateFileFieldEditor.errorMessage2");//$NON-NLS-1$ } } else { msg = getErrorMessage(); all_okay = false; } } if (msg != null) { // error showErrorMessage(msg); all_okay = false; } if (all_okay) clearErrorMessage(); return all_okay; }
From source file:org.inframesh.eclipse.jface.preference.StringFieldEditorEx.java
License:Open Source License
/** * Creates a string field editor.//from w w w . ja v a2 s. c o m * Use the method <code>setTextLimit</code> to limit the text. * * @param name the name of the preference this field editor works on * @param labelText the label text of the field editor * @param width the width of the text input field in characters, * or <code>UNLIMITED</code> for no limit * @param strategy either <code>VALIDATE_ON_KEY_STROKE</code> to perform * on the fly checking (the default), or <code>VALIDATE_ON_FOCUS_LOST</code> to * perform validation only after the text has been typed in * @param parent the parent of the field editor's control * @since 2.0 */ public StringFieldEditorEx(String name, String labelText, int width, int strategy, Composite parent) { init(name, labelText); widthInChars = width; setValidateStrategy(strategy); isValid = false; errorMessage = JFaceResources.getString("StringFieldEditor.errorMessage");//$NON-NLS-1$ createControl(parent); }
From source file:org.jboss.tools.common.model.ui.attribute.editor.JavaEclipseChoicerEditor.java
License:Open Source License
public String getChangeButtonName() { return JFaceResources.getString("openBrowse"); //$NON-NLS-1$ }
From source file:org.jboss.tools.common.model.ui.attribute.editor.JavaHyperlinkLineFieldEditor.java
License:Open Source License
public void setPropertyEditor(IPropertyEditor propertyEditor) { super.setPropertyEditor(propertyEditor); if (propertyEditor != null) { valueProvider = (IValueProvider) propertyEditor.getAdapter(IValueProvider.class); // GET Java Project Name! if (valueProvider instanceof DefaultValueAdapter) { if (((DefaultValueAdapter) valueProvider).getModel() != null) { XModelObject xmo = FileSystemsHelper .getFileSystems(((DefaultValueAdapter) valueProvider).getModel()); if (xmo != null) { IProject project = (IProject) xmo.getModel().getProperties().get("project"); //$NON-NLS-1$ if (project != null) { this.project = project; }//from w w w .java 2 s . c o m } xmo = ((DefaultValueAdapter) valueProvider).getModelObject(); if (xmo != null) { // get publicId publicId = XModelObjectUtil.getDocumentPublicID(xmo); } XAttribute attr = ((DefaultValueAdapter) valueProvider).getAttribute(); if (attr != null) { // get xPath xPath = XModelObjectUtil.getXMLLocalPath(attr); AccessibleJava.IContextPackageProvider cpp = getPackageProvider(); if (cpp != null) { setContextPackageProvider(cpp); } } } } valueProvider.addValueChangeListener(this); valueChangeListener = (IValueChangeListener) propertyEditor.getAdapter(IValueChangeListener.class); if (project != null) { setLabelAction(new OpenJavaEditorAction()); setChangeButtonText(JFaceResources.getString("openBrowse")); //$NON-NLS-1$ } } }
From source file:org.jboss.tools.common.model.ui.attribute.editor.ListStructuredFieldEditor.java
License:Open Source License
private Button createButton(Composite parent, String key) { Button b = new Button(parent, SWT.PUSH); b.setText(JFaceResources.getString(key)); b.setFont(parent.getFont());//from w w w . ja v a2 s. c o m GridData d = new GridData(GridData.FILL_HORIZONTAL); d.heightHint = convertVerticalDLUsToPixels(b, 14/*IDialogConstants.BUTTON_HEIGHT*/); int widthHint = convertHorizontalDLUsToPixels(b, IDialogConstants.BUTTON_WIDTH); d.widthHint = Math.max(widthHint, b.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); b.setLayoutData(d); b.addSelectionListener(getSelectionListener()); return b; }
From source file:org.jboss.tools.common.model.ui.attribute.editor.MutableComboBoxFieldEditor.java
License:Open Source License
protected Button getChangeControl(Composite parent) { if (changeButton == null) { int style = getSettings().getStyle("Button.Style"); //$NON-NLS-1$ if (style == SWT.DEFAULT) style = SWT.NONE;//ww w . j a va 2 s . co m if (style == 0) style = SWT.PUSH; Color bg = getSettings().getColor("Button.Background"); //$NON-NLS-1$ Color fg = getSettings().getColor("Button.Foreground"); //$NON-NLS-1$ Font font = getSettings().getFont("Button.Font"); //$NON-NLS-1$ changeButton = new Button(parent, style); changeButton.setFont(font); changeButton.setBackground(bg); changeButton.setBackground(bg); changeButton.setForeground(fg); //changeButton = new Button(parent, SWT.PUSH); if (changeButtonText == null) changeButtonText = JFaceResources.getString("openChange");//$NON-NLS-1$ changeButton.setText(changeButtonText); changeButton.setFont(parent.getFont()); changeButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent evt) { String newValue = changePressed(); setNewValue(newValue); } }); changeButton.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent event) { changeButton = null; } }); } else { checkParent(changeButton, parent); } return changeButton; }
From source file:org.jboss.tools.common.model.ui.attribute.editor.NoteFieldEditor.java
License:Open Source License
public NoteFieldEditor(String name, String labelText, int width, int strategy, Composite parent) { init(name, labelText);/*w ww . j a v a2 s. co m*/ widthInChars = width; setValidateStrategy(strategy); isValid = false; errorMessage = JFaceResources.getString("StringFieldEditor.errorMessage");//$NON-NLS-1$ createControl(parent); }
From source file:org.jboss.tools.common.model.ui.attribute.editor.StringButtonFieldEditor.java
License:Open Source License
protected Button getChangeControl(Composite parent) { if (button != null) { checkParent(button, parent);/* w w w .j a v a 2 s .co m*/ return button; } int style = getSettings().getStyle("Button.Style"); //$NON-NLS-1$ if (style == SWT.DEFAULT) style = SWT.NONE; if (style == 0) style = SWT.PUSH; /// Color bg = getSettings().getColor("Button.Background"); Color fg = getSettings().getColor("Button.Foreground"); //$NON-NLS-1$ Font font = getSettings().getFont("Button.Font"); //$NON-NLS-1$ button = new Button(parent, style); button.setFont(font); /// button.setBackground(bg); button.setForeground(fg); if (buttonName == null) buttonName = JFaceResources.getString("openChange");//$NON-NLS-1$ button.setText(buttonName); button.setFont(parent.getFont()); addListeners(); return button; }
From source file:org.jboss.tools.common.model.ui.attribute.editor.StringTwoButtonFieldEditor.java
License:Open Source License
protected Control getChange1Control(Composite parent) { button1 = this.getChangeControl(parent); // openBrowse=Browse // open=Open//from ww w . j a va 2 s .c om String buttonLabel; if ((this.buttonLabels != null) && (buttonLabels.length > 1)) { buttonLabel = buttonLabels[0]; } else { buttonLabel = JFaceResources.getString("openBrowse"); //$NON-NLS-1$ } button1.setText(buttonLabel); return button1; }
From source file:org.jboss.tools.common.model.ui.attribute.editor.StringTwoButtonFieldEditor.java
License:Open Source License
protected Control getChange2Control(Composite parent) { if (button2 == null) { int style = getSettings().getStyle("Button.Style"); //$NON-NLS-1$ if (style == SWT.DEFAULT) style = SWT.NONE;//w w w . ja v a 2 s . c om if (style == 0) style = SWT.PUSH; Color bg = getSettings().getColor("Button.Background"); //$NON-NLS-1$ Color fg = getSettings().getColor("Button.Foreground"); //$NON-NLS-1$ Font font = getSettings().getFont("Button.Font"); //$NON-NLS-1$ button2 = new Button(parent, style); button2.setFont(font); button2.setBackground(bg); button2.setBackground(bg); button2.setForeground(fg); // openBrowse=Browse // open=Open String buttonLabel; if ((this.buttonLabels != null) && (buttonLabels.length > 1)) { buttonLabel = buttonLabels[1]; } else { buttonLabel = JFaceResources.getString("open"); //$NON-NLS-1$ } button2.setText(buttonLabel); button2.setFont(parent.getFont()); button2.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent evt) { String newValue = change2Pressed(); if (newValue != null) { setStringValue(newValue); } } }); button2.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent event) { button2 = null; } }); } else { checkParent(button2, parent); } return button2; }