List of usage examples for org.eclipse.jface.resource JFaceResources getString
public static String getString(String key)
From source file:org.eclipse.ui.preferences.ViewSettingsDialog.java
License:Open Source License
protected void createButtonsForButtonBar(Composite parent) { parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); createButton(parent, DEFAULTS_BUTTON_ID, JFaceResources.getString("defaults"), false); //$NON-NLS-1$ Label l = new Label(parent, SWT.NONE); l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); l = new Label(parent, SWT.NONE); l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout layout = (GridLayout) parent.getLayout(); layout.numColumns += 2;//from w ww . j a v a 2 s . c om layout.makeColumnsEqualWidth = false; super.createButtonsForButtonBar(parent); }
From source file:org.eclipse.ui.tests.datatransfer.SmartImportTests.java
License:Open Source License
private static ToolItem getStopButton(ProgressMonitorPart part) { for (Control control : part.getChildren()) { if (control instanceof ToolBar) { for (ToolItem item : ((ToolBar) control).getItems()) { if (item.getToolTipText() .equals(JFaceResources.getString("ProgressMonitorPart.cancelToolTip"))) { //$NON-NLS-1$ )) return item; }/*from w w w . j a va 2 s . c o m*/ } } } return null; }
From source file:org.eclipse.ui.tests.dialogs.UIMessageDialogs.java
License:Open Source License
public void testAbortPageFlipping() { Dialog dialog = getWarningDialog(JFaceResources.getString("AbortPageFlippingDialog.title"), JFaceResources.getString("AbortPageFlippingDialog.message")); DialogCheck.assertDialog(dialog, this); }
From source file:org.eclipse.ui.tests.dialogs.UIMessageDialogs.java
License:Open Source License
public void testWizardClosing() { Dialog dialog = new MessageDialog(getShell(), JFaceResources.getString("WizardClosingDialog.title"), null, JFaceResources.getString("WizardClosingDialog.message"), MessageDialog.QUESTION, new String[] { IDialogConstants.OK_LABEL }, 0); DialogCheck.assertDialog(dialog, this); }
From source file:org.eclipse.ui.tests.dialogs.UIMessageDialogsAuto.java
License:Open Source License
public void testAbortPageFlipping() { Dialog dialog = getWarningDialog(JFaceResources.getString("AbortPageFlippingDialog.title"), JFaceResources.getString("AbortPageFlippingDialog.message")); DialogCheck.assertDialogTexts(dialog, this); }
From source file:org.eclipse.ui.tests.dialogs.UIMessageDialogsAuto.java
License:Open Source License
public void testWizardClosing() { Dialog dialog = new MessageDialog(getShell(), JFaceResources.getString("WizardClosingDialog_title"), null, JFaceResources.getString("WizardClosingDialog_message"), MessageDialog.QUESTION, new String[] { IDialogConstants.OK_LABEL }, 0); DialogCheck.assertDialogTexts(dialog, this); }
From source file:org.eclipse.ui.tests.statushandlers.WorkbenchStatusDialogManagerImplTest.java
License:Open Source License
public void testDefaultTitle() { assertEquals(JFaceResources.getString("Problem_Occurred"), mgr.getProperty(IStatusDialogConstants.TITLE)); }
From source file:org.eclipse.wst.command.internal.env.ui.dialog.MessageDialog.java
License:Open Source License
/** * Creates an error dialog. Note that the dialog will have no visual * representation (no widgets) until it is told to open. * <p>// ww w . ja v a 2s. co m * Normally one should use <code>openError</code> to create and open one of * these. This constructor is useful only if the error 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. * </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 error's message should be shown as the * primary message * @param status * the error to show to the user * @param displayMask * the mask to use to filter the displaying of child items, as per * <code>Status.matches</code> */ public MessageDialog(Shell parentShell, String dialogTitle, String message, IStatus status, int displayMask) { super(parentShell); this.title = dialogTitle == null ? JFaceResources.getString("Problem_Occurred") : //$NON-NLS-1$ dialogTitle; this.message = message == null ? status.getMessage() : JFaceResources.format("Reason", new Object[] { message, status.getMessage() }); //$NON-NLS-1$ this.status = status; statusList = Arrays.asList(status.getChildren()); this.displayMask = displayMask; setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL); }
From source file:org.eclipse.wst.jsdt.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. * /*from w ww . j a v a 2s. co m*/ * */ private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = JavaScriptPlugin.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.eclipse.wst.jsdt.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) { 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) */ 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 = JavaScriptPlugin.getDefault().getPreferenceStore(); store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER); store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); } if (settingsId == returnValue) PreferencesUtil .createPreferenceDialogOn(shell, "org.eclipse.wst.jsdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$ .open(); CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault(); registry.reload(); return true; } } return false; }
From source file:org.eclipse.wst.server.discovery.internal.wizard.ErrorWizardPage.java
License:Open Source License
/** * Create this dialog's drop-down list component. * /*from www. j av a 2 s . c om*/ * @param parent * the parent composite * @return the drop-down list component */ protected List createDropDownList(Composite parent) { list = new List(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI); populateList(list); GridData data = new GridData(SWT.FILL, SWT.FILL, false, false); data.widthHint = 225; list.setLayoutData(data); list.setFont(parent.getFont()); Menu copyMenu = new Menu(list); MenuItem copyItem = new MenuItem(copyMenu, SWT.NONE); copyItem.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { copyToClipboard(); } public void widgetDefaultSelected(SelectionEvent e) { copyToClipboard(); } }); copyItem.setText(JFaceResources.getString("copy")); //$NON-NLS-1$ list.setMenu(copyMenu); //listCreated = true; return list; }