List of usage examples for org.eclipse.jface.resource JFaceResources getString
public static String getString(String key)
From source file:com.jaspersoft.studio.jface.dialogs.DataAdapterErrorDialog.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>//from ww w.ja va 2 s .c o 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. The error * dialog will only be displayed if there is at least one child status * 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 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>IStatus.matches</code> * @see org.eclipse.core.runtime.IStatus#matches(int) */ public DataAdapterErrorDialog(Shell parentShell, String dialogTitle, String message, IStatus status) { 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; }
From source file:com.jaspersoft.studio.jface.dialogs.DataAdapterErrorDialog.java
License:Open Source License
/** * Create this dialog's drop-down list component. * // w w w. j a v 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 | SWT.READ_ONLY); // fill the list text.setText(getStackTrace()); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL); data.heightHint = 100; //list.getItemHeight() * LIST_ITEM_COUNT; 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); textCreated = true; return text; }
From source file:com.mindquarry.desktop.preferences.dialog.FilteredPreferenceDialog.java
License:Open Source License
@Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText(JFaceResources.getString("PreferenceDialog.title")); //$NON-NLS-1$ newShell.addShellListener(new ShellAdapter() { @Override//from w w w . java 2s. c om public void shellActivated(ShellEvent e) { if (lastShellSize == null) { lastShellSize = getShell().getSize(); } } }); }
From source file:com.mindquarry.desktop.preferences.dialog.FilteredPreferenceDialog.java
License:Open Source License
/** * Save the values specified in the pages. * <p>//from ww w . j a v a2 s. c o m * The default implementation of this framework method saves all pages of * type <code>PreferencePage</code> (if their store needs saving and is a * <code>PreferenceStore</code>). * </p> * <p> * Subclasses may override. * </p> */ protected void handleSave() { Iterator nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER).iterator(); while (nodes.hasNext()) { IPreferenceNode node = (IPreferenceNode) nodes.next(); IPreferencePage page = node.getPage(); if (page instanceof PreferencePage) { // Save now in case tbe workbench does not shutdown cleanly IPreferenceStore store = ((PreferencePage) page).getPreferenceStore(); if (store != null && store.needsSaving() && store instanceof IPersistentPreferenceStore) { try { ((IPersistentPreferenceStore) store).save(); } catch (IOException e) { MessageDialog.openError(getShell(), JFaceResources.getString("PreferenceDialog.saveErrorTitle"), //$NON-NLS-1$ JFaceResources.format("PreferenceDialog.saveErrorMessage", //$NON-NLS-1$ new Object[] { page.getTitle(), e.getMessage() })); } } } } }
From source file:com.mindquarry.desktop.preferences.dialog.FilteredPreferenceDialog.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 va 2 s. co m @Override protected void okPressed() { SafeRunnable.run(new SafeRunnable() { private boolean errorOccurred; /* * (non-Javadoc) * * @see org.eclipse.core.runtime.ISafeRunnable#run() */ public void run() { getButton(IDialogConstants.OK_ID).setEnabled(false); errorOccurred = false; boolean hasFailedOK = false; try { // Notify all the pages and give them a chance to abort Iterator nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER).iterator(); while (nodes.hasNext()) { IPreferenceNode node = (IPreferenceNode) nodes.next(); IPreferencePage 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) { setReturnCode(FAILED); getButton(IDialogConstants.OK_ID).setEnabled(true); return; } if (!errorOccurred) { // Give subclasses the choice to save the state of the // preference pages. handleSave(); } setReturnCode(OK); close(); } } /** * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable) */ @Override public void handleException(Throwable e) { errorOccurred = true; log.error(e.toString(), e); //Policy.getLog().log( // new Status(IStatus.ERROR, Policy.JFACE, 0, // e.toString(), e)); clearSelectedNode(); String message = JFaceResources.getString("SafeRunnable.errorMessage"); //$NON-NLS-1$ MessageDialog.openError(getShell(), JFaceResources.getString("Error"), //$NON-NLS-1$ message + ": " + e.toString()); //$NON-NLS-1$ } }); }
From source file:com.mindquarry.desktop.preferences.dialog.FilteredPreferenceDialog.java
License:Open Source License
/** * Shows the "Page Flipping abort" dialog. */// www . jav a 2 s . c om void showPageFlippingAbortDialog() { MessageDialog.openError(getShell(), JFaceResources.getString("AbortPageFlippingDialog.title"), //$NON-NLS-1$ JFaceResources.getString("AbortPageFlippingDialog.message")); //$NON-NLS-1$ }
From source file:com.mulgasoft.emacsplus.preferences.MListEditor.java
License:Open Source License
/** * Helper method to create a push button. * /* w w w. ja va 2s . co m*/ * @param parent the parent control * @param key the resource name used to supply the button's label text * @return Button */ private Button createPushButton(Composite parent, String key) { Button button = new Button(parent, SWT.PUSH); String buttonText = JFaceResources.getString(key); button.setText(buttonText); 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:com.nokia.s60tools.analyzetool.global.Util.java
License:Open Source License
public static ToolBar createHelpControl(Composite parent) { ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); ((GridLayout) parent.getLayout()).numColumns++; toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); toolBar.setCursor(cursor);// w w w . j av a2s . com toolBar.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { cursor.dispose(); } }); ToolItem item = new ToolItem(toolBar, SWT.NONE); item.setImage(JFaceResources.getImage(Dialog.DLG_IMG_HELP)); item.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ item.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { PlatformUI.getWorkbench().getHelpSystem() .displayHelp(AnalyzeToolHelpContextIDs.ANALYZE_TROUBLESHOOTING); } }); return toolBar; }
From source file:com.nokia.tools.carbidect.cone.ui.internal.preferences.ConeFieldEditor.java
License:Open Source License
/** * Helper method to create a push button. * //from w w w. jav a 2s. c om * @param parent the parent control * @param key the resource name used to supply the button's label text * @return Button */ private 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); // 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(getSelectionListener()); return button; }
From source file:com.nokia.tools.screen.ui.dialogs.MessageDialogWithCheckBox.java
License:Open Source License
private ToolBar createHelpImageButton(Composite parent, Image image) { ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); ((GridLayout) parent.getLayout()).numColumns++; GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); toolBar.setLayoutData(gd);// w w w. jav a 2 s. co m final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); toolBar.setCursor(cursor); toolBar.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { cursor.dispose(); } }); ToolItem item = new ToolItem(toolBar, SWT.NONE); item.setImage(image); item.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ item.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { PlatformUI.getWorkbench().getHelpSystem().displayHelp(helpID); } }); return toolBar; }