List of usage examples for org.eclipse.jface.resource JFaceResources getString
public static String getString(String key)
From source file:org.org.eclipse.core.utils.platform.dialogs.selection.ProgressMonitorDialog.java
License:Open Source License
protected void configureShell(Shell shell) { super.configureShell(shell); shell.setText(JFaceResources.getString("ProgressMonitorDialog.title")); //$NON-NLS-1$ if (waitCursor == null) waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT); shell.setCursor(waitCursor);/* w ww . ja v a 2s .c om*/ }
From source file:org.python.pydev.ui.pythonpathconf.AbstractInterpreterEditor.java
License:Open Source License
/** * Helper method to create a push button. * * @param parent the parent control/*from w w w . j a v a2 s . c om*/ * @param key the resource name used to supply the button's label text * @param listenerToAdd * @return Button */ /*default*/Button createBt(Composite parent, String key, SelectionListener listenerToAdd) { Button button = new Button(parent, SWT.PUSH); button.setText(JFaceResources.getString(key)); button.setFont(parent.getFont()); GridData data = new GridData(GridData.FILL_HORIZONTAL); // data.heightHint = convertVerticalDLUsToPixels(button, IDialogConstants.BUTTON_HEIGHT); int widthHint = convertHorizontalDLUsToPixels(button, IDialogConstants.BUTTON_WIDTH); data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); button.setLayoutData(data); button.addSelectionListener(listenerToAdd); return button; }
From source file:org.python.pydev.utils.CustomizableFieldEditor.java
License:Open Source License
/** * Creates a string field editor. Use the method <code>setTextLimit</code> to limit the text. * //w w w .j av a 2 s . c om * @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 CustomizableFieldEditor(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.rubypeople.rdt.internal.ui.text.ruby.ContentAssistProcessor.java
License:Open Source License
/** * Informs the user about the fact that there are no enabled categories in the default content * assist set and shows a link to the preferences. * /*from w w w . ja va2 s .c o m*/ * @since 3.3 */ private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = RubyPlugin.getActiveWorkbenchShell(); String title = RubyTextMessages.ContentAssistProcessor_all_disabled_title; String message = RubyTextMessages.ContentAssistProcessor_all_disabled_message; // see PreferencePage#createControl for the 'defaults' label final String restoreButtonLabel = JFaceResources.getString("defaults"); //$NON-NLS-1$ final String linkMessage = Messages.format( RubyTextMessages.ContentAssistProcessor_all_disabled_preference_link, LegacyActionTools.removeMnemonics(restoreButtonLabel)); final int restoreId = IDialogConstants.CLIENT_ID + 10; final OptionalMessageDialog dialog = new OptionalMessageDialog(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY, shell, title, null /* default image */, message, MessageDialog.WARNING, new String[] { restoreButtonLabel, IDialogConstants.CLOSE_LABEL }, 1) { /* * @see org.eclipse.jdt.internal.ui.dialogs.OptionalMessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite) */ protected Control createCustomArea(Composite composite) { // wrap link and checkbox in one composite without space Composite parent = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = 0; parent.setLayout(layout); Composite linkComposite = new Composite(parent, SWT.NONE); layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); linkComposite.setLayout(layout); Link link = new Link(linkComposite, SWT.NONE); link.setText(linkMessage); link.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { close(); PreferencesUtil.createPreferenceDialogOn(shell, "org.eclipse.jdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$ .open(); } }); GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint = this.getMinimumMessageWidth(); link.setLayoutData(gridData); // create checkbox and "don't show this message" prompt super.createCustomArea(parent); return parent; } /* * @see org.eclipse.jface.dialogs.MessageDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) */ protected void createButtonsForButtonBar(Composite parent) { Button[] buttons = new Button[2]; buttons[0] = createButton(parent, restoreId, restoreButtonLabel, false); buttons[1] = createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true); setButtons(buttons); } }; if (restoreId == dialog.open()) { IPreferenceStore store = RubyPlugin.getDefault().getPreferenceStore(); store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER); store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault(); registry.reload(); return true; } } return false; }
From source file:org.salever.rcp.dbSystem.client.db.preferences.PwdStringFieldEditor.java
License:Open Source License
/** * Creates a string field editor. Use the method <code>setTextLimit</code> * to limit the text./*from www . j a v a2 s. c o m*/ * * @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 PwdStringFieldEditor(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.salever.rcp.demo.wizard.preferences.StringPasswordField.java
License:Open Source License
/** * Creates a string field editor. Use the method <code>setTextLimit</code> * to limit the text.//from ww w .jav a2 s. com * * @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 StringPasswordField(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.spearce.egit.ui.internal.preferences.StorageSizeFieldEditor.java
License:Open Source License
StorageSizeFieldEditor(String name, String labelText, Composite parent, int min, int max) { init(name, labelText);/*from w ww . j a v a 2 s . c o m*/ setTextLimit(10); setEmptyStringAllowed(false); setErrorMessage(JFaceResources.getString("IntegerFieldEditor.errorMessage")); createControl(parent); minValidValue = min; maxValidValue = max; }
From source file:org.summer.sdt.internal.ui.text.java.ContentAssistProcessor.java
License:Open Source License
/** * Informs the user about the fact that there are no enabled categories in the default content * assist set and shows a link to the preferences. * * @return <code>true</code> if the default should be restored * @since 3.3/*from www . j a va 2 s. co m*/ */ private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = JavaPlugin.getActiveWorkbenchShell(); String title = JavaTextMessages.ContentAssistProcessor_all_disabled_title; String message = JavaTextMessages.ContentAssistProcessor_all_disabled_message; // see PreferencePage#createControl for the 'defaults' label final String restoreButtonLabel = JFaceResources.getString("defaults"); //$NON-NLS-1$ final String linkMessage = Messages.format( JavaTextMessages.ContentAssistProcessor_all_disabled_preference_link, LegacyActionTools.removeMnemonics(restoreButtonLabel)); final int restoreId = IDialogConstants.CLIENT_ID + 10; final int settingsId = IDialogConstants.CLIENT_ID + 11; final OptionalMessageDialog dialog = new OptionalMessageDialog(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY, shell, title, null /* default image */, message, MessageDialog.WARNING, new String[] { restoreButtonLabel, IDialogConstants.CLOSE_LABEL }, 1) { /* * @see org.summer.sdt.internal.ui.dialogs.OptionalMessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite) */ @Override protected Control createCustomArea(Composite composite) { // wrap link and checkbox in one composite without space Composite parent = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = 0; parent.setLayout(layout); Composite linkComposite = new Composite(parent, SWT.NONE); layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); linkComposite.setLayout(layout); Link link = new Link(linkComposite, SWT.NONE); link.setText(linkMessage); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setReturnCode(settingsId); close(); } }); GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint = this.getMinimumMessageWidth(); link.setLayoutData(gridData); // create checkbox and "don't show this message" prompt super.createCustomArea(parent); return parent; } /* * @see org.eclipse.jface.dialogs.MessageDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) */ @Override protected void createButtonsForButtonBar(Composite parent) { Button[] buttons = new Button[2]; buttons[0] = createButton(parent, restoreId, restoreButtonLabel, false); buttons[1] = createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true); setButtons(buttons); } }; int returnValue = dialog.open(); if (restoreId == returnValue || settingsId == returnValue) { if (restoreId == returnValue) { IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore(); store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER); store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); } if (settingsId == returnValue) PreferencesUtil .createPreferenceDialogOn(shell, "org.summer.sdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$ .open(); fComputerRegistry.reload(); return true; } } return false; }
From source file:org.talend.commons.ui.swt.preferences.TableEditor.java
License:Open Source License
/** * Helper method to create a push button. * //from w w w. j a v a 2s. c o m * @param parent the parent control * @param key the resource name used to supply the button's label text * @return Button */ protected Button createPushButton(Composite parent, String key) { Button button = new Button(parent, SWT.PUSH); button.setText(JFaceResources.getString(key)); button.setFont(parent.getFont()); GridData data = new GridData(GridData.FILL_HORIZONTAL); int widthHint = convertHorizontalDLUsToPixels(button, IDialogConstants.BUTTON_WIDTH); data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); button.setLayoutData(data); button.addSelectionListener(getSelectionListener()); return button; }
From source file:org.talend.designer.core.ui.preferences.MetadataTalendTypeEditor.java
License:Open Source License
protected void createButtons(Composite box) { addButton = createPushButton(box, Messages.getString("MetadataTalendTypeEditor.button.import")); //$NON-NLS-1$ addButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { importItem();//from www .jav a 2 s .c o m } }); exportButton = createPushButton(box, Messages.getString("MetadataTalendTypeEditor.button.export")); //$NON-NLS-1$ exportButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { exportItem(); } }); editButton = createPushButton(box, Messages.getString("MetadataTalendTypeEditor.button.edit")); //$NON-NLS-1$ editButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { editItem(); } }); removeButton = createPushButton(box, JFaceResources.getString("ListEditor.remove")); //$NON-NLS-1$ removeButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { removeItem(); } }); }