List of usage examples for org.eclipse.jface.resource JFaceResources getString
public static String getString(String key)
From source file:io.usethesource.impulse.preferences.fields.StringFieldEditor.java
License:Open Source License
/** * Creates a string field editor./*ww w. j a va 2s . 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 StringFieldEditor(PreferencePage page, PreferencesTab tab, IPreferencesService service, String level, String name, String labelText, int width, int strategy, Composite parent) { super(page, tab, service, level, name, labelText, parent); // Relating to StrinfFieldEditor things init(name, labelText); widthInChars = width; setValidateStrategy(strategy); isValid = false; // Why set this in a local field rather than in the page? errorMessage = JFaceResources.getString("StringFieldEditor.errorMessage");//$NON-NLS-1$ createControl(parent); }
From source file:name.abuchen.portfolio.ui.preferences.ScopedPreferenceStore.java
License:Open Source License
@Override public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) { // important: create intermediate array to protect against listeners // being added/removed during the notification final Object[] list = getListeners(); if (list.length == 0) return;//w ww.j a v a2 s . c om final PropertyChangeEvent event = new PropertyChangeEvent(this, name, oldValue, newValue); for (int i = 0; i < list.length; i++) { final IPropertyChangeListener listener = (IPropertyChangeListener) list[i]; SafeRunner.run(new SafeRunnable(JFaceResources.getString("PreferenceStore.changeError")) //$NON-NLS-1$ { @Override public void run() { listener.propertyChange(event); } }); } }
From source file:net.bioclipse.core.util.ExceptionDetailsErrorDialog.java
License:Open Source License
/** * Create this dialog's drop-down list component. * /*from w w w . j av a 2 s.c o m*/ * @param parent * the parent composite * @return the drop-down list component */ protected Text createDropDownList(Composite parent) { // create the list text = new Text(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI); // fill the list populateList(text); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL); // data.heightHint = text.getItemHeight() * LIST_ITEM_COUNT; data.heightHint = 500; data.horizontalSpan = 2; text.setLayoutData(data); text.setFont(parent.getFont()); Menu copyMenu = new Menu(text); MenuItem copyItem = new MenuItem(copyMenu, SWT.NONE); copyItem.addSelectionListener(new SelectionListener() { /* * @see SelectionListener.widgetSelected (SelectionEvent) */ public void widgetSelected(SelectionEvent e) { copyToClipboard(); } /* * @see SelectionListener.widgetDefaultSelected(SelectionEvent) */ public void widgetDefaultSelected(SelectionEvent e) { copyToClipboard(); } }); copyItem.setText(JFaceResources.getString("copy")); //$NON-NLS-1$ text.setMenu(copyMenu); listCreated = true; return text; }
From source file:net.enilink.komma.common.ui.dialogs.DiagnosticDialog.java
License:Open Source License
/** * Creates an diagnostic dialog. Note that the dialog will have no visual * representation (no widgets) until it is told to open. * <p>/* www. ja v a2s .co m*/ * Normally one should use <code>open</code> to create and open one of * these. This constructor is useful only if the diagnostic object being * displayed contains child items <it>and </it> you need to specify a mask * which will be used to filter the displaying of these children. The * diagnostic dialog will only be displayed if there is at least one child * diagnostic matching the mask. * </p> * * @param parentShell * the shell under which to create this dialog * @param dialogTitle * the title to use for this dialog, or <code>null</code> to * indicate that the default title should be used * @param message * the message to show in this dialog, or <code>null</code> to * indicate that the diagnostic's message should be shown as the * primary message * @param diagnostic * the diagnostic to show to the user * @param severityMask * the mask to use to filter the displaying of child items, as * per * <code>DiagnosticComposite.severityMatches(Diagnostic, int)</code> * @see DiagnosticComposite#severityMatches(Diagnostic, int) */ public DiagnosticDialog(Shell parentShell, String dialogTitle, String message, Diagnostic diagnostic, int severityMask) { super(parentShell); this.title = dialogTitle == null ? JFaceResources.getString("Problem_Occurred") : dialogTitle; this.message = message == null ? diagnostic.getMessage() : JFaceResources.format("Reason", new Object[] { message, diagnostic.getMessage() }); this.diagnostic = diagnostic; this.severityMask = severityMask; setShellStyle(getShellStyle() | SWT.RESIZE); }
From source file:net.heartsome.license.CustomMessageDialog.java
private String getAccessibleMessageFor(Image image) { if (image.equals(getErrorImage())) { return JFaceResources.getString("error");//$NON-NLS-1$ }//from www . j av a 2 s. co m if (image.equals(getWarningImage())) { return JFaceResources.getString("warning");//$NON-NLS-1$ } if (image.equals(getInfoImage())) { return JFaceResources.getString("info");//$NON-NLS-1$ } if (image.equals(getQuestionImage())) { return JFaceResources.getString("question"); //$NON-NLS-1$ } return null; }
From source file:net.refractions.udig.style.sld.editor.internal.EditorDialog.java
License:Open Source License
@Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText(JFaceResources.getString("EditorDialog.title")); //$NON-NLS-1$ newShell.addShellListener(new ShellAdapter() { @Override/*from w w w .j av a 2 s . com*/ public void shellActivated(ShellEvent e) { if (lastShellSize == null) lastShellSize = getShell().getSize(); } }); }
From source file:net.refractions.udig.style.sld.editor.internal.EditorDialog.java
License:Open Source License
/** * The preference dialog implementation of this <code>Dialog</code> * framework method sends <code>performOk</code> to all pages of the * preference dialog, then calls <code>handleSave</code> on this dialog to * save any state, and then calls <code>close</code> to close this dialog. *///from www . j a v a2s .co m @Override protected void okPressed() { SafeRunnable.run(new SafeRunnable() { /* * (non-Javadoc) * * @see org.eclipse.core.runtime.ISafeRunnable#run() */ public void run() { getButton(IDialogConstants.OK_ID).setEnabled(false); boolean hasFailedOK = false; try { // Notify all the pages and give them a chance to abort Iterator nodes = editorPageManager.getElements(EditorPageManager.PRE_ORDER).iterator(); while (nodes.hasNext()) { IEditorNode node = (IEditorNode) nodes.next(); IEditorPage page = node.getPage(); if (page != null) { if (!page.performOk()) { hasFailedOK = true; return; } } } } catch (Exception e) { handleException(e); } finally { //Don't bother closing if the OK failed if (hasFailedOK) return; close(); } } /* * (non-Javadoc) * * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable) */ @Override public void handleException(Throwable e) { SLDPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, SLDPlugin.ID, 0, e.toString(), e)); clearSelectedNode(); String message = JFaceResources.getString("SafeRunnable.errorMessage"); //$NON-NLS-1$ MessageDialog.openError(getShell(), JFaceResources.getString("Error"), message); //$NON-NLS-1$ } }); }
From source file:net.sf.commonclipse.preferences.ComboFieldEditor.java
License:Apache License
/** * Creates a string field editor. 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 parent the parent of the field editor's control *//*from w w w .j a v a 2s.com*/ public ComboFieldEditor(String name, String labelText, int width, Composite parent) { init(name, labelText); this.widthInChars = width; this.isValid = false; this.errorMessage = JFaceResources.getString("StringFieldEditor.errorMessage"); //$NON-NLS-1$ createControl(parent); }
From source file:net.sf.eclipse.tomcat.VariableAwareDirectoryFieldEditor.java
License:Open Source License
/** * Creates a variable aware directory field editor. * * @param name the name of the preference this field editor works on * @param labelText the label text of the field editor * @param parent the parent of the field editor's control */// ww w . ja v a 2s . co m public VariableAwareDirectoryFieldEditor(String name, String labelText, Composite parent) { init(name, labelText); setErrorMessage(JFaceResources.getString("DirectoryFieldEditor.errorMessage"));//$NON-NLS-1$ setChangeButtonText(JFaceResources.getString("openBrowse"));//$NON-NLS-1$ setValidateStrategy(VALIDATE_ON_FOCUS_LOST); createControl(parent); }
From source file:net.sf.jasperreports.eclipse.ui.util.ExceptionDetailsErrorDialog.java
License:Open Source License
public String buildTitle(String dialogTitle) { return dialogTitle == null ? JFaceResources.getString("Problem_Occurred") : //$NON-NLS-1$ dialogTitle;/*from w w w. j a va 2 s .c o m*/ }