List of usage examples for org.eclipse.jface.resource JFaceResources getImage
public static Image getImage(String key)
null
if none. From source file:com.nokia.tools.variant.editor.dialogs.SaveAsDialog.java
License:Open Source License
/** * Creates the dialog's contents/*from w ww . j ava2 s . c om*/ * * @param shell * the dialog window */ protected Control createDialogArea(Composite parent) { GridLayout childLayout = new GridLayout(1, true); childLayout.marginHeight = 0; childLayout.marginWidth = 0; childLayout.verticalSpacing = 0; Composite workArea = new Composite(parent, SWT.NONE | SWT.NO_REDRAW_RESIZE); childLayout = new GridLayout(1, true); childLayout.marginHeight = 0; childLayout.marginWidth = 0; childLayout.verticalSpacing = 0; workArea.setLayout(childLayout); workArea.setLayoutData(new GridData(GridData.FILL_BOTH)); // --- Composite titleComposite = new Composite(workArea, SWT.NO_REDRAW_RESIZE); titleComposite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); childLayout = new GridLayout(3, false); childLayout.marginHeight = 0; childLayout.marginWidth = 0; childLayout.verticalSpacing = 0; titleComposite.setLayout(childLayout); Label imgLabel = new Label(titleComposite, SWT.NO); imgLabel.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING; gridData.widthHint = 20; gridData.heightHint = 20; gridData.horizontalIndent = 10; imgLabel.setLayoutData(gridData); imgLabel.setImage(JFaceResources.getImage(DLG_IMG_MESSAGE_INFO)); Label leftLabel = new Label(titleComposite, SWT.NO); leftLabel.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); gridData = new GridData(); gridData.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING; gridData.widthHint = 450; gridData.heightHint = 55; leftLabel.setLayoutData(gridData); leftLabel.setText("\n Save your changes as a new CPF.\n" + " You may want to do this for creating " + "a new variant or revision of your current CPF."); Label rightLabel = new Label(titleComposite, SWT.NO); rightLabel.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); gridData = new GridData(); gridData.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END; gridData.widthHint = 60; gridData.heightHint = 60; rightLabel.setLayoutData(gridData); ImageDescriptor imageDescriptor = Activator.getImageDescriptor("icons/saveas_wiz.png"); Image image = imageDescriptor.createImage(); rightLabel.setImage(image); // --- createControls(workArea); // --- Composite btnComposite = new Composite(workArea, SWT.NO_REDRAW_RESIZE); childLayout = new GridLayout(2, true); childLayout.marginHeight = 0; childLayout.marginWidth = 0; childLayout.verticalSpacing = 0; btnComposite.setLayout(childLayout); leftLabel = new Label(btnComposite, SWT.NO); gridData = new GridData(); gridData.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING; gridData.widthHint = 330; gridData.heightHint = 30; leftLabel.setLayoutData(gridData); Composite btnGroupComposite = new Composite(btnComposite, SWT.NO_REDRAW_RESIZE); childLayout = new GridLayout(2, true); childLayout.marginHeight = 0; childLayout.marginWidth = 0; childLayout.verticalSpacing = 0; btnGroupComposite.setLayout(childLayout); gridData = new GridData(); gridData.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END; gridData.widthHint = 150; gridData.heightHint = 22; btnGroupComposite.setLayoutData(gridData); // Set the OK button as the default, so // user can type input and press Enter // to dismiss // shell.setDefaultButton(okBtn); // shell.layout(true, true); return workArea; }
From source file:com.sap.dirigible.ide.common.status.DefaultProgressMonitor.java
License:Open Source License
/** * Sets the message, along with a image corresponding to error/warning/info * severity. If another argument is provided in severity, the method * returns./*from ww w .j av a 2s .com*/ */ public void setMessage(final String message, final int severity) { String imageCode = null; switch (severity) { case (IStatus.INFO): imageCode = Dialog.DLG_IMG_MESSAGE_INFO; break; case (IStatus.WARNING): imageCode = Dialog.DLG_IMG_MESSAGE_WARNING; break; case (IStatus.ERROR): imageCode = Dialog.DLG_IMG_MESSAGE_ERROR; break; } if (imageCode == null) { return; } else { this.statusLineManager.setMessage(JFaceResources.getImage(imageCode), message); } }
From source file:com.sap.dirigible.ide.common.status.StatusLineManagerUtil.java
License:Open Source License
public static void setInfoMessage(String message) { getDefaultStatusLineManager().removeAll(); getDefaultStatusLineManager().setMessage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO), message); }
From source file:com.sap.dirigible.ide.common.status.StatusLineManagerUtil.java
License:Open Source License
public static void setErrorMessage(String message) { getDefaultStatusLineManager().removeAll(); getDefaultStatusLineManager().setErrorMessage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR), message);//from w w w. j a v a2s. c om }
From source file:com.sap.dirigible.ide.common.status.StatusLineManagerUtil.java
License:Open Source License
public static void setWarningMessage(String message) { getDefaultStatusLineManager().removeAll(); getDefaultStatusLineManager().setMessage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING), message); }
From source file:com.sap.dirigible.ide.workspace.ui.commands.UploadDataWizardPage.java
License:Open Source License
private void createInfoMsgArea(Composite composite) { // create the info image GridData gridDataInfoImage = new GridData(); gridDataInfoImage.horizontalAlignment = GridData.END; gridDataInfoImage.verticalAlignment = GridData.FILL; Label infoImage = new Label(composite, SWT.NONE); infoImage.setImage(JFaceResources.getImage(TitleAreaDialog.DLG_IMG_MESSAGE_INFO)); infoImage.setLayoutData(gridDataInfoImage); // create the info text Text infoMsg = new Text(composite, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); GridData gridDataInfoMsg = new GridData(GridData.FILL_HORIZONTAL); gridDataInfoMsg.horizontalSpan = 2;//from w w w.j ava2s.co m gridDataInfoMsg.widthHint = 400; infoMsg.setText(INFO_MSG); infoMsg.setLayoutData(gridDataInfoMsg); }
From source file:com.siteview.mde.internal.ui.editor.MDEFormPage.java
License:Open Source License
protected void createFormErrorContent(IManagedForm managedForm, String errorTitle, String errorMessage, Exception e) {/*ww w . ja v a 2 s . co m*/ ScrolledForm form = managedForm.getForm(); FormToolkit toolkit = managedForm.getToolkit(); toolkit.decorateFormHeading(form.getForm()); Composite parent = form.getBody(); GridLayout layout = new GridLayout(); GridData data2 = new GridData(GridData.FILL_BOTH); layout.marginWidth = 7; layout.marginHeight = 7; parent.setLayout(layout); parent.setLayoutData(data2); // Set the title and image of the form form.setText(errorTitle); form.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR)); int sectionStyle = Section.DESCRIPTION | ExpandableComposite.TITLE_BAR; // Create the message section Section messageSection = createUISection(parent, MDEUIMessages.PDEFormPage_titleMessage, errorMessage, sectionStyle); Composite messageClient = createUISectionContainer(messageSection, 1); // Bind the widgets toolkit.paintBordersFor(messageClient); messageSection.setClient(messageClient); // Ensure the exception was defined if (e == null) { return; } // Create the details section Section detailsSection = createUISection(parent, MDEUIMessages.PDEFormPage_titleDetails, e.getMessage(), sectionStyle); Composite detailsClient = createUISectionContainer(detailsSection, 1); // Create text widget holding the exception trace int style = SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY; Text text = toolkit.createText(detailsClient, getStackTrace(e), style); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = 160; data.widthHint = 200; text.setLayoutData(data); // Bind the widgets toolkit.paintBordersFor(detailsClient); detailsSection.setClient(detailsClient); // Note: The veritical scrollbar fails to appear when text widget is // not entirely shown }
From source file:com.xored.glance.ui.panels.SearchPanel.java
License:Open Source License
protected ToolItem createSettingsMenu(final ToolBar bar) { final ToolItem settings = new ToolItem(bar, SWT.PUSH); settings.setImage(JFaceResources.getImage(PopupDialog.POPUP_IMG_MENU)); settings.setDisabledImage(JFaceResources.getImage(PopupDialog.POPUP_IMG_MENU_DISABLED)); settings.setToolTipText("Settings"); //$NON-NLS-1$ settings.addSelectionListener(new SelectionAdapter() { @Override/*from w w w . java 2 s. c o m*/ public void selected(final SelectionEvent e) { showSettings(); } }); return settings; }
From source file:custom.swt.widgets.PopupDialog.java
License:Open Source License
/** * Create the dialog's menu for the move and resize actions. * //from w ww .j a va 2 s. c om * @param parent * The parent composite. */ private void createDialogMenu(Composite parent) { toolBar = new ToolBar(parent, SWT.FLAT); ToolItem viewMenuButton = new ToolItem(toolBar, SWT.PUSH, 0); GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(toolBar); viewMenuButton.setImage(JFaceResources.getImage(POPUP_IMG_MENU)); viewMenuButton.setDisabledImage(JFaceResources.getImage(POPUP_IMG_MENU_DISABLED)); viewMenuButton.setToolTipText(JFaceResources.getString("PopupDialog.menuTooltip")); //$NON-NLS-1$ viewMenuButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { showDialogMenu(); } }); // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=177183 toolBar.addMouseListener(new MouseAdapter() { public void mouseDown(MouseEvent e) { showDialogMenu(); } }); }
From source file:de.femodeling.e4.ui.progress.internal.ErrorInfo.java
License:Open Source License
/** * Return the image for the receiver. * * @return Image */ Image getImage() { return JFaceResources.getImage(ProgressManager.ERROR_JOB_KEY); }