Example usage for org.eclipse.jface.resource JFaceResources getImage

List of usage examples for org.eclipse.jface.resource JFaceResources getImage

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources getImage.

Prototype

public static Image getImage(String key) 

Source Link

Document

Returns the image in JFace's image registry with the given key, or null if none.

Usage

From source file:org.fusesource.ide.branding.wizards.NewCamelTestWizardPageOne.java

License:Open Source License

/**
 * Creates the controls for the JUnit 4 toggle control. Expects a
 * <code>GridLayout</code> with at least 3 columns.
 * /*from   w  w  w .j  a  v a  2  s.c  o  m*/
 * @param composite
 *            the parent composite
 * @param nColumns
 *            number of columns to span
 * 
 * @since 3.2
 */
protected void createBuildPathConfigureControls(Composite composite, int nColumns) {
    Composite inner = new Composite(composite, SWT.NONE);
    inner.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false, nColumns, 1));
    GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    inner.setLayout(layout);

    fImage = new Label(inner, SWT.NONE);
    fImage.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
    fImage.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 1, 1));

    fLink = new Link(inner, SWT.WRAP);
    fLink.setText("\n\n"); //$NON-NLS-1$
    fLink.addSelectionListener(new SelectionAdapter() {
        /*
         * (non-Javadoc)
         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        @Override
        public void widgetSelected(SelectionEvent e) {
            performBuildpathConfiguration(e.text);
        }
    });
    GridData gd = new GridData(GridData.FILL, GridData.BEGINNING, true, false, 1, 1);
    gd.widthHint = convertWidthInCharsToPixels(60);
    fLink.setLayoutData(gd);
    updateBuildPathMessage();
}

From source file:org.jboss.tools.arquillian.ui.internal.refactoring.AddArquillianSupportWizardPage.java

License:Open Source License

@Override
public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginWidth = 10;/* w  w  w .  ja v  a  2 s . c  o m*/
    gridLayout.marginHeight = 10;
    composite.setLayout(gridLayout);
    initializeDialogUnits(composite);
    Dialog.applyDialogFont(composite);

    Link link = new Link(composite, SWT.NONE);
    link.setText("<a>Arquillian Settings</a>");
    GridData gd = new GridData(SWT.FILL, GridData.FILL, true, false);
    gd.horizontalSpan = 2;
    link.setLayoutData(gd);
    link.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            PreferenceDialog preferenceDialog = PreferencesUtil.createPreferenceDialogOn(getShell(),
                    ArquillianPreferencePage.ID, null, null);
            preferenceDialog.open();
        }

    });

    Label label = new Label(composite, SWT.NONE);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    label.setLayoutData(gd);
    label.setText("Arquillian version:");
    versionCombo = new Combo(composite, SWT.READ_ONLY);
    gd = new GridData(SWT.FILL, SWT.FILL, false, false);
    versionCombo.setLayoutData(gd);
    versionCombo.setItems(ArquillianUtility.getVersions(defaultVersions));
    String value = ArquillianUtility.getPreference(ArquillianConstants.ARQUILLIAN_VERSION,
            ArquillianConstants.ARQUILLIAN_VERSION_DEFAULT);
    versionCombo.setText(value);
    refactoring.setVersion(value);
    versionCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    versionCombo.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            refactoring.setVersion(versionCombo.getText());
            validate();
        }
    });

    updatePomButton = new Button(composite, SWT.CHECK);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    gd.horizontalSpan = 2;
    updatePomButton.setText("Update the pom.xml file");
    updatePomButton.setLayoutData(gd);

    dialogSettings = ArquillianUIActivator.getDefault().getDialogSettings();
    addArquillianSupportSection = dialogSettings.getSection(ADD_ARQUILLIAN_SUPPORT_SECTION);
    if (addArquillianSupportSection == null) {
        addArquillianSupportSection = dialogSettings.addNewSection(ADD_ARQUILLIAN_SUPPORT_SECTION);
    }
    value = addArquillianSupportSection.get(UPDATE_POM);
    boolean updatePom;
    if (value == null) {
        updatePom = true;
    } else {
        updatePom = addArquillianSupportSection.getBoolean(UPDATE_POM);
    }
    updatePomButton.setSelection(updatePom);

    updateDependenciesButton = new Button(composite, SWT.CHECK);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    gd.horizontalSpan = 2;
    updateDependenciesButton.setText("Update the dependencies section");
    updateDependenciesButton.setLayoutData(gd);

    value = addArquillianSupportSection.get(UPDATE_DEPENDENCIES);
    boolean updateDependencies;
    if (value == null) {
        updateDependencies = true;
    } else {
        updateDependencies = addArquillianSupportSection.getBoolean(UPDATE_DEPENDENCIES);
    }
    updateDependenciesButton.setSelection(updateDependencies);

    updateDependenciesButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            refactoring.setUpdateDependencies(updateDependenciesButton.getSelection());
            validate();
        }

    });

    updateBuildButton = new Button(composite, SWT.CHECK);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    gd.horizontalSpan = 2;
    updateBuildButton.setText("Update the build section");
    updateBuildButton.setLayoutData(gd);

    value = addArquillianSupportSection.get(UPDATE_BUILD);
    boolean updateBuild;
    if (value == null) {
        updateBuild = true;
    } else {
        updateBuild = addArquillianSupportSection.getBoolean(UPDATE_BUILD);
    }
    updateBuildButton.setSelection(updateBuild);

    updateBuildButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            refactoring.setUpdateBuild(updateBuildButton.getSelection());
            validate();
        }

    });

    addProfilesButton = new Button(composite, SWT.CHECK);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    gd.horizontalSpan = 2;
    addProfilesButton.setText("Add Profiles");
    addProfilesButton.setLayoutData(gd);

    value = addArquillianSupportSection.get(ADD_PROFILES);
    boolean addProfiles;
    if (value == null) {
        addProfiles = true;
    } else {
        addProfiles = addArquillianSupportSection.getBoolean(ADD_PROFILES);
    }
    addProfilesButton.setSelection(addProfiles);

    addProfilesButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            refactoring.setAddProfiles(addProfilesButton.getSelection());
            validate();
        }

    });

    updatePomButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            updatePomChanged();
        }

    });
    String message = null;
    try {
        IProject project = refactoring.getProject();
        IMavenProjectFacade facade = MavenPlugin.getMavenProjectRegistry().create(project,
                new NullProgressMonitor());
        if (facade != null) {
            MavenProject mavenProject = facade.getMavenProject(new NullProgressMonitor());
            String version = ArquillianUtility.getArquillianVersion(mavenProject);
            if (version != null) {
                updatePomButton.setSelection(false);
                updatePomButton.setEnabled(false);
                message = "The project already includes Arquillian settings";
            }
        } else {
            updatePomButton.setSelection(false);
            updatePomButton.setEnabled(false);
            message = "The project is not a valid maven project";
        }
    } catch (CoreException e1) {
        updatePomButton.setSelection(false);
        updatePomButton.setEnabled(false);
        message = "Some issues encountered.\nCaused by: " + e1.getLocalizedMessage();
    }
    if (message != null) {
        Composite warningComposite = new Composite(composite, SWT.NONE);
        gd = new GridData(SWT.FILL, SWT.FILL, true, false);
        gd.horizontalSpan = 2;
        warningComposite.setLayoutData(gd);
        warningComposite.setLayout(new GridLayout(2, false));
        Label emptyLabel = new Label(warningComposite, SWT.NONE);
        gd = new GridData(SWT.FILL, SWT.FILL, true, true);
        gd.horizontalSpan = 2;
        emptyLabel.setLayoutData(gd);
        Label warningImage = new Label(warningComposite, SWT.NONE);
        gd = new GridData(SWT.FILL, SWT.LEFT, false, false);
        warningImage.setLayoutData(gd);
        warningImage.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
        Label warningText = new Label(warningComposite, SWT.NONE);
        gd = new GridData(SWT.FILL, SWT.FILL, true, false);
        warningText.setLayoutData(gd);
        warningText.setText(message);
    }

    updatePomChanged();
    setControl(composite);
    validate();
}

From source file:org.jboss.tools.central.editors.GettingStartedPage.java

License:Open Source License

private FormText createNoteText(FormToolkit toolkit, Composite parent) {
    FormText formText = toolkit.createFormText(parent, true);
    GridData gd = new GridData(GridData.FILL, GridData.FILL, false, false);
    formText.setLayoutData(gd);/*ww  w.j a va2  s  .c o  m*/
    formText.setText("<form><p>" + "<img href=\"image\"/>" + " No entries found." + "</p></form>", true, false);

    Image image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);

    formText.setImage("image", image);
    return formText;
}

From source file:org.jboss.tools.central.editors.GettingStartedPage.java

License:Open Source License

private void showException(PageBook pageBook, FormText exceptionText, Throwable e) {
    JBossCentralActivator.log(e);//from   ww w  .j  av a 2s .c o  m
    String message = StringEscapeUtils.escapeXml(e.getMessage());
    String text = JBossCentralActivator.FORM_START_TAG + "<img href=\"image\"/> " + message
            + JBossCentralActivator.FORM_END_TAG;
    exceptionText.setText(text, true, false);
    Image image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    exceptionText.setImage("image", image);
    pageBook.showPage(exceptionText);
}

From source file:org.jboss.tools.common.jdt.debug.ui.launching.JBossConnectTab.java

License:Open Source License

public void createControl(Composite parent) {
    Font font = parent.getFont();
    Composite comp = SWTFactory.createComposite(parent, font, 1, 1, GridData.FILL_BOTH);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = 0;/*from  w w  w.j a  v  a  2 s .  c o  m*/
    comp.setLayout(layout);

    createVerticalSpacer(comp, 2);
    jbossConfigurationButton = createCheckButton(comp, "JBoss Remote Configuration");
    jbossConfigurationButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setDirty(true);
            updateLaunchConfigurationDialog();
        }

    });
    createVerticalSpacer(comp, 2);
    messageGroup = new Group(comp, SWT.NONE);
    messageGroup.setText(Messages.JavaConnectTab_Warning);
    messageGroup.setLayout(new GridLayout(3, false));
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    messageGroup.setLayoutData(gd);

    Label noteLabel = new Label(messageGroup, SWT.NONE);
    gd = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
    noteLabel.setLayoutData(gd);
    Image image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    image.setBackground(noteLabel.getBackground());
    noteLabel.setImage(image);

    Text noteText = new Text(messageGroup, SWT.WRAP | SWT.READ_ONLY);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    GC gc = new GC(parent);
    gd.heightHint = Dialog.convertHeightInCharsToPixels(gc.getFontMetrics(), 3);
    gc.dispose();
    noteText.setLayoutData(gd);
    noteText.setText(Messages.JavaConnectTab_JDK_Required);

    messageGroup.setVisible(!RemoteDebugActivator.getDefault().isJdk());

    Button addJDK = new Button(messageGroup, SWT.PUSH);
    addJDK.setText(Messages.JavaConnectTab_Add_JDK);
    gd = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
    addJDK.setLayoutData(gd);
    addJDK.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            String preferenceId = "org.eclipse.jdt.debug.ui.preferences.VMPreferencePage"; //$NON-NLS-1$
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), preferenceId, null,
                    null);
            dialog.open();
            updateLaunchConfigurationDialog();
            messageGroup.setVisible(!RemoteDebugActivator.getDefault().isJdk());
        }
    });

    setControl(comp);
}

From source file:org.jboss.tools.common.jdt.debug.ui.launching.xpl.JavaConnectTab.java

License:Open Source License

public void createControl(Composite parent) {
    Font font = parent.getFont();
    Composite comp = SWTFactory.createComposite(parent, font, 1, 1, GridData.FILL_BOTH);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = 0;//from   w  ww.  j a v  a  2s. c  o  m
    comp.setLayout(layout);
    createProjectEditor(comp);
    createVerticalSpacer(comp, 1);

    //connection properties
    Group group = SWTFactory.createGroup(comp, Messages.JavaConnectTab_Connection_Properties_1, 2, 1,
            GridData.FILL_HORIZONTAL);
    Composite cgroup = SWTFactory.createComposite(group, font, 2, 1, GridData.FILL_HORIZONTAL);
    fArgumentComposite = cgroup;
    updateConnector();

    createVerticalSpacer(comp, 2);
    fAllowTerminateButton = createCheckButton(comp, Messages.JavaConnectTab__Allow_termination_of_remote_VM_6);
    fAllowTerminateButton.addSelectionListener(getDefaultListener());

    createVerticalSpacer(comp, 2);
    defaultButton = createCheckButton(comp, Messages.JavaConnectTab_SetAsDefault);
    defaultButton.addSelectionListener(getDefaultListener());

    createVerticalSpacer(comp, 2);
    messageGroup = new Group(comp, SWT.NONE);
    messageGroup.setText(Messages.JavaConnectTab_Warning);
    messageGroup.setLayout(new GridLayout(3, false));
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    messageGroup.setLayoutData(gd);

    Label noteLabel = new Label(messageGroup, SWT.NONE);
    gd = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
    noteLabel.setLayoutData(gd);
    Image image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    image.setBackground(noteLabel.getBackground());
    noteLabel.setImage(image);

    Text noteText = new Text(messageGroup, SWT.WRAP | SWT.READ_ONLY);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    GC gc = new GC(parent);
    gd.heightHint = Dialog.convertHeightInCharsToPixels(gc.getFontMetrics(), 3);
    gc.dispose();
    noteText.setLayoutData(gd);
    noteText.setText(Messages.JavaConnectTab_JDK_Required);

    messageGroup.setVisible(!RemoteDebugActivator.getDefault().isJdk());

    Button addJDK = new Button(messageGroup, SWT.PUSH);
    addJDK.setText(Messages.JavaConnectTab_Add_JDK);
    gd = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
    addJDK.setLayoutData(gd);
    addJDK.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            String preferenceId = "org.eclipse.jdt.debug.ui.preferences.VMPreferencePage"; //$NON-NLS-1$
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), preferenceId, null,
                    null);
            dialog.open();
            refresh(hostCombo.getText(), false);
            updateLaunchConfigurationDialog();
            messageGroup.setVisible(!RemoteDebugActivator.getDefault().isJdk());
        }
    });

    setControl(comp);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
            IJavaDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_CONNECT_TAB);
}

From source file:org.jboss.tools.common.jdt.ui.buildpath.dialog.MaterializeLibraryDialog.java

License:Open Source License

private void displayWarning(Composite container, String warning) {
    Composite composite = new Composite(container, SWT.NONE);
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(3, 1).applyTo(composite);
    GridLayoutFactory.fillDefaults().numColumns(2).applyTo(composite);
    warningImg = new Label(composite, SWT.CENTER);
    warningImg.setImage(JFaceResources.getImage(DLG_IMG_MESSAGE_WARNING));
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(warningImg);
    warningLabel = new Label(composite, SWT.NONE);
    warningLabel.setText(warning);/*w ww  .j  a v a2s. c  om*/
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(warningLabel);
}

From source file:org.jboss.tools.jst.css.properties.MessageCSSSection.java

License:Open Source License

@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createControls(parent, aTabbedPropertySheetPage);

    aggregateStatus = new AggregateValidationStatus(getBindingContext().getValidationStatusProviders(),
            AggregateValidationStatus.MAX_SEVERITY);
    aggregateStatus.addValueChangeListener(new IValueChangeListener() {
        public void handleValueChange(ValueChangeEvent event) {

            handleStatusChanged((IStatus) event.diff.getNewValue());
        }/* w ww .  ja  va 2 s  .c om*/
    });

    messageComposite = new Composite(parent, SWT.None);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginHeight = 0;
    gridLayout.verticalSpacing = 0;
    messageComposite.setLayout(gridLayout);
    messageImageLabel = new Label(messageComposite, SWT.CENTER);
    messageImageLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR));
    messageLabel = new Text(messageComposite, SWT.WRAP | SWT.READ_ONLY);
    messageComposite.setVisible(false);
}

From source file:org.jboss.tools.maven.conversion.ui.dialog.IdentifyMavenDependencyPage.java

License:Open Source License

private void createWarning(Composite container) {
    warningImg = new Label(container, SWT.CENTER);
    warningLink = new Link(container, SWT.NONE);
    warningLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(warningImg);
    warningImg.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
    warningLink.setText(/*from  w w  w  .j a  v a 2  s. co  m*/
            "Some selected dependencies can not be resolved. Click <a>here</a> to configure repositories in your settings.xml.");
    warningLink.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            openSettingsRepositoriesWizard();
        }

        private void openSettingsRepositoriesWizard() {
            ConfigureMavenRepositoriesWizard wizard = new ConfigureMavenRepositoriesWizard();
            WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
            dialog.create();
            dialog.open();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
}

From source file:org.jboss.tools.maven.project.examples.wizard.MissingRepositoryWarningComponent.java

License:Open Source License

public MissingRepositoryWarningComponent(Composite parent, boolean visibleInitially) {
    super(parent, SWT.NORMAL);

    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).span(3, 1).applyTo(this);
    GridLayoutFactory.fillDefaults().numColumns(2).applyTo(this);

    Label warningImg = new Label(this, SWT.CENTER | SWT.TOP);
    Image warningIcon = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(warningImg);
    warningImg.setImage(warningIcon);//ww w  . ja va 2s  .c o  m

    warninglink = new Link(this, SWT.NONE | SWT.FILL);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(warninglink);
    warninglink.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            ConfigureMavenRepositoriesWizard wizard = new ConfigureMavenRepositoriesWizard(null,
                    "redhat-techpreview-all-repository"); //$NON-NLS-1$
            WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
            dialog.create();
            dialog.open();
        }
    });

    setVisible(visibleInitially);
}