Example usage for org.eclipse.jface.resource ImageDescriptor createFromURL

List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromURL

Introduction

In this page you can find the example usage for org.eclipse.jface.resource ImageDescriptor createFromURL.

Prototype

public static ImageDescriptor createFromURL(URL url) 

Source Link

Document

Creates and returns a new image descriptor from a URL.

Usage

From source file:com.iw.plugins.spindle.ui.propertysheet.PropertySheetPage.java

License:Open Source License

/**
 * Returns the image descriptor with the given relative path.
 *///from w ww  . j a v a  2 s.  com
private ImageDescriptor getImageDescriptor(String relativePath) {
    String iconPath = "icons/full/"; //$NON-NLS-1$

    try {
        AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
        URL installURL = plugin.getDescriptor().getInstallURL();
        URL url = new URL(installURL, iconPath + relativePath);
        return ImageDescriptor.createFromURL(url);
    } catch (MalformedURLException e) {
        // Should not happen
        return null;
    }
}

From source file:com.iw.plugins.spindle.ui.wizards.NewTapComponentWizardClassPage.java

License:Mozilla Public License

/**
 * Constructor for NewTapComponetClassWizardPage.
 * /*from ww  w.j a  va 2 s . c  om*/
 * @param name
 */
public NewTapComponentWizardClassPage(IWorkspaceRoot root, String pageName,
        NewTapComponentWizardPage predecessor) {
    super(UIPlugin.getString(pageName + ".title"));

    PAGE_NAME = pageName;
    String CHOOSECLASS = PAGE_NAME + ".chooseclass";
    String SPEC_CLASS = PAGE_NAME + ".specclass";
    String NEWCLASS = PAGE_NAME + ".newclass";

    String CONTAINER = PAGE_NAME + ".container";
    String PACKAGE = PAGE_NAME + ".package";
    String CLASS = PAGE_NAME + ".class";
    String SUPER = PAGE_NAME + ".super";
    String IFACE = PAGE_NAME + ".iface";
    String MAKE_ABSTRACT = PAGE_NAME + ".makeabstract";

    this.fFullyQualifiedBaseType = UIPlugin.getString(PAGE_NAME + ".baseType");
    this.fDefaultSpecClass = UIPlugin.getString(PAGE_NAME + ".defaultSpecClass");

    this.fFirstWizardPage = predecessor;

    this.setImageDescriptor(ImageDescriptor.createFromURL(Images.getImageURL("componentDialog.gif")));

    this.setDescription(UIPlugin.getString(PAGE_NAME + ".description"));

    fChooseClass = new RadioField(UIPlugin.getString(CHOOSECLASS));
    fChooseClass.addListener(listener);

    fChooseSpecClassDialogField = createChooseSpecClassField(SPEC_CLASS);
    connect(fChooseSpecClassDialogField);
    fChooseSpecClassDialogField.addListener(listener);

    fNewClass = new RadioField(UIPlugin.getString(NEWCLASS));
    fNewClass.addListener(listener);

    fChooseContainer = new ContainerDialogField(CONTAINER, root, LABEL_WIDTH);
    connect(fChooseContainer);
    fChooseContainer.addListener(listener);

    fPackageDialogField = new PackageDialogField(PACKAGE, LABEL_WIDTH);
    fPackageDialogField.setAcceptSourcePackagesOnly(true);
    connect(fPackageDialogField);
    fPackageDialogField.addListener(listener);

    fMakeAbstractField = new CheckBoxField(UIPlugin.getString(MAKE_ABSTRACT + ".label"), LABEL_WIDTH, true);

    fSpecClassDialogField = new JavaClassnameField(CLASS, LABEL_WIDTH);
    connect(fSpecClassDialogField);
    fSpecClassDialogField.addListener(listener);

    fSuperClassDialogField = new SuperClassDialogField(SUPER, LABEL_WIDTH);
    connect(fSuperClassDialogField);
    fSuperClassDialogField.addListener(listener);

    fIFaceChooser = new InterfaceChooser(IFACE, LABEL_WIDTH);
    connect(fIFaceChooser);
    fIFaceChooser.addListener(listener);

}

From source file:com.iw.plugins.spindle.ui.wizards.NewTapComponentWizardPage.java

License:Mozilla Public License

/**
 * Constructor for NewTapAppWizardPage1//from w w  w  .java 2  s .  c  o  m
 */
public NewTapComponentWizardPage(IWorkspaceRoot root, String pageName) {
    super(UIPlugin.getString(pageName + ".title"));
    fRoot = root;
    PAGE_NAME = pageName;
    PROJECT = PAGE_NAME + ".project";
    NAMESPACE = PAGE_NAME + ".namespace";
    SPEC_CLASS = PAGE_NAME + ".specclass";
    COMPONENTNAME = PAGE_NAME + ".componentname";

    GENERATE_HTML = PAGE_NAME + ".generateHTML";
    OPEN_ALL = PAGE_NAME + ".openAll";

    LIBRARY_CONTAINER = PAGE_NAME + ".libraryContainer";
    LIBRARY_PACKAGE = PAGE_NAME + ".libraryPackage";
    APPLICATION_CONTAINER = PAGE_NAME + ".applicationContainer";
    DEFAULT_LOCATION = ".defaultLocation";

    this.setImageDescriptor(
            ImageDescriptor.createFromURL(Images.getImageURL(UIPlugin.getString(PAGE_NAME + ".image"))));

    this.setDescription(UIPlugin.getString(PAGE_NAME + ".description"));

    fListener = new FieldEventsAdapter();

    fTapestryProjectDialogField = new TapestryProjectDialogField(PROJECT, fRoot, LABEL_WIDTH);
    connect(fTapestryProjectDialogField);
    fTapestryProjectDialogField.addListener(fListener);

    fNamespaceDialogField = new NamespaceDialogField(NAMESPACE, LABEL_WIDTH + 40);
    connect(fNamespaceDialogField);
    fNamespaceDialogField.addListener(fListener);

    fComponentNameDialogField = new ComponentNameField(COMPONENTNAME,
            getClass() == NewTapComponentWizardPage.class);
    connect(fComponentNameDialogField);
    fComponentNameDialogField.addListener(fListener);

    fNextLabel = new DialogField(UIPlugin.getString(PAGE_NAME + ".nextPage"));

    fComponentTemplateSelector = createComponentTemplateSelector();

    fTapestryTemplateSelector = createTemplateSelector(XMLFileContextType.TEMPLATE_FILE_CONTEXT_TYPE,
            PreferenceConstants.TAP_TEMPLATE_TEMPLATE);

    fLibraryContainerField = new ContainerDialogField(LIBRARY_CONTAINER, fRoot, 0, true);
    fLibraryContainerField.setAcceptSourceContainers(true);
    connect(fLibraryContainerField);
    fLibraryContainerField.addListener(fListener);
    fLibraryPackageField = new PackageDialogField(LIBRARY_PACKAGE);
    fLibraryPackageField.setAcceptSourcePackagesOnly(true);
    connect(fLibraryPackageField);
    fLibraryPackageField.addListener(fListener);
    fApplicationLocationField = new ComponentLocationChooserField(APPLICATION_CONTAINER,
            getClass() != NewTapComponentWizardPage.class);
    connect(fApplicationLocationField);
    fApplicationLocationField.addListener(fListener);

    fDefaultLocation = new DialogDefaultLocation(PAGE_NAME + DEFAULT_LOCATION,
            this instanceof NewTapComponentWizardPage);

}

From source file:com.iw.plugins.spindle.ui.wizards.TypeChooseWizardPage.java

License:Mozilla Public License

/**
 * @param isClass//from   www .  ja  v a2s. co  m
 * @param pageName
 */
public TypeChooseWizardPage(String pageName, NewTapComponentWizardPage predecessor, boolean creatingPage) {
    super(true, UIPlugin.getString(pageName + ".title"));

    fCreatingPage = creatingPage;
    this.PAGE_NAME = pageName;
    String CHOOSECLASS = PAGE_NAME + ".chooseclass";
    String SPEC_CLASS = PAGE_NAME + ".specclass";
    String NEWCLASS = PAGE_NAME + ".newclass";

    fFirstWizardPage = predecessor;
    fFirstPageNameField = fFirstWizardPage.getComponentNameField();
    fFirstPageNameField.addListener(fListener);
    fFirstPageProjectField = fFirstWizardPage.getProjectField();
    fFirstPageProjectField.addListener(fListener);
    fFirstPageNamespaceField = fFirstWizardPage.getNamespaceField();
    fFirstPageContainerField = fFirstWizardPage.getContainerField();
    fFirstPagePackageField = fFirstWizardPage.getPackageField();

    fDefaultSpecClass = UIPlugin.getString(PAGE_NAME + ".defaultSpecClass");
    fBaseSpecClass = UIPlugin.getString(PAGE_NAME + ".baseClass");
    fDefaultInterface = UIPlugin.getString(PAGE_NAME + ".defaultInterface");

    fChooseClass = new RadioField(UIPlugin.getString(CHOOSECLASS));
    // fChooseClass.addListener(listener);

    fChooseSpecClassDialogField = createChooseSpecClassField(SPEC_CLASS);
    // fChooseSpecClassDialogField.addListener(listener);

    fNewClass = new RadioField(UIPlugin.getString(NEWCLASS));
    // fNewClass.addListener(listener);

    setImageDescriptor(
            ImageDescriptor.createFromURL(Images.getImageURL(UIPlugin.getString(PAGE_NAME + ".image"))));

    setDescription(UIPlugin.getString(PAGE_NAME + ".description"));

}

From source file:com.iw.plugins.spindle.wizards.migrate.DefinePagesComponentsPage.java

License:Mozilla Public License

/**
 * Constructor for DefinePagesComponentsPage.
 * @param pageName/*from   w  w w  . jav  a2s. c  o  m*/
 */
public DefinePagesComponentsPage(String pageName, MigrationContext context) {
    super(pageName);

    this.setImageDescriptor(ImageDescriptor.createFromURL(TapestryImages.getImageURL("applicationDialog.gif")));
    this.setDescription(
            "If listed, Spindle can't tell if those below are pages or components. You need to make the distinction.");

    this.context = context;

}

From source file:com.iw.plugins.spindle.wizards.migrate.MigrationActionPage.java

License:Mozilla Public License

/**
 * Constructor for ConversionWelcomePage.
 * @param name//from   w w w  .j  a v a 2 s.  c  om
 */
public MigrationActionPage(String name, MigrationContext context) {
    super(name);

    this.setImageDescriptor(ImageDescriptor.createFromURL(TapestryImages.getImageURL("applicationDialog.gif")));
    this.setDescription("Include/Exclude migration actions");

    this.context = context;

}

From source file:com.iw.plugins.spindle.wizards.migrate.MigrationScopePage.java

License:Mozilla Public License

/**
 * Constructor for ConversionWelcomePage.
 * @param name// w w w .ja va2s.  c  o  m
 */
public MigrationScopePage(String name, MigrationContext context) {
    super(name);

    this.setImageDescriptor(ImageDescriptor.createFromURL(TapestryImages.getImageURL("applicationDialog.gif")));
    this.setDescription("Tune Migration Scope");

    this.context = context;

}

From source file:com.iw.plugins.spindle.wizards.migrate.MigrationWelcomePage.java

License:Mozilla Public License

/**
 * Constructor for ConversionWelcomePage.
 * @param name/*  w  w  w.j a v a2 s .  c o m*/
 */
public MigrationWelcomePage(String name, MigrationContext context) {
    super(name);

    this.setImageDescriptor(ImageDescriptor.createFromURL(TapestryImages.getImageURL("applicationDialog.gif")));
    this.setDescription("Migrate a Tapestry Project");

    this.context = context;

}

From source file:com.iw.plugins.spindle.wizards.NewTapComponentWizardClassPage.java

License:Mozilla Public License

/**
 * Constructor for NewTapComponetClassWizardPage.
 * @param name//from   w  w w .j a v a  2  s  .  co m
 */
public NewTapComponentWizardClassPage(IWorkspaceRoot root, String pageName,
        NewTapComponentWizardPage predecessor) {
    super(MessageUtil.getString(pageName + ".title"));

    PAGE_NAME = pageName;
    String CHOOSECLASS = PAGE_NAME + ".chooseclass";
    String SPEC_CLASS = PAGE_NAME + ".specclass";
    String NEWCLASS = PAGE_NAME + ".newclass";

    String CONTAINER = PAGE_NAME + ".container";
    String PACKAGE = PAGE_NAME + ".package";
    String CLASS = PAGE_NAME + ".class";
    String SUPER = PAGE_NAME + ".super";
    String IFACE = PAGE_NAME + ".iface";

    this.fullyQualifiedBaseType = MessageUtil.getString(PAGE_NAME + ".baseType");
    this.defaultSpecClass = MessageUtil.getString(PAGE_NAME + ".defaultSpecClass");

    this.predecessor = predecessor;

    this.setImageDescriptor(ImageDescriptor.createFromURL(TapestryImages.getImageURL("componentDialog.gif")));

    this.setDescription(MessageUtil.getString(PAGE_NAME + ".description"));

    fChooseClass = new CheckBoxField(MessageUtil.getString(CHOOSECLASS));
    fChooseClass.addListener(listener);

    fChooseSpecClassDialogField = createChooseSpecClassField(SPEC_CLASS);
    connect(fChooseSpecClassDialogField);
    fChooseSpecClassDialogField.addListener(listener);

    fNewClass = new CheckBoxField(MessageUtil.getString(NEWCLASS));
    fNewClass.addListener(listener);

    fChooseContainer = new ContainerDialogField(CONTAINER, root, LABEL_WIDTH);
    connect(fChooseContainer);
    fChooseContainer.addListener(listener);

    fPackageDialogField = new PackageDialogField(PACKAGE, LABEL_WIDTH);
    connect(fPackageDialogField);
    fPackageDialogField.addListener(listener);

    fSpecClassDialogField = new JavaClassnameField(CLASS, LABEL_WIDTH);
    connect(fSpecClassDialogField);
    fSpecClassDialogField.addListener(listener);

    fSuperClassDialogField = new SuperClassDialogField(SUPER, LABEL_WIDTH);
    connect(fSuperClassDialogField);
    fSuperClassDialogField.addListener(listener);

    fIFaceChooser = new InterfaceChooser(IFACE, LABEL_WIDTH);
    connect(fIFaceChooser);
    fIFaceChooser.addListener(listener);

}

From source file:com.iw.plugins.spindle.wizards.NewTapComponentWizardPage.java

License:Mozilla Public License

/**
 * Constructor for NewTapAppWizardPage1/*from  ww  w. j a va2s .c  o m*/
 */
public NewTapComponentWizardPage(IWorkspaceRoot root, String pageName) {
    super(MessageUtil.getString(pageName + ".title"));
    PAGE_NAME = pageName;
    CONTAINER = PAGE_NAME + ".container";
    PACKAGE = PAGE_NAME + ".package";
    SPEC_CLASS = PAGE_NAME + ".specclass";
    COMPONENTNAME = PAGE_NAME + ".componentname";
    AUTO_ADD = PAGE_NAME + ".autoadd";

    GENERATE_HTML = PAGE_NAME + ".generateHTML";

    this.setImageDescriptor(ImageDescriptor.createFromURL(TapestryImages.getImageURL("componentDialog.gif")));

    this.setDescription(MessageUtil.getString(PAGE_NAME + ".description"));

    IDialogFieldChangedListener listener = new FieldEventsAdapter();

    fContainerDialogField = new ContainerDialogField(CONTAINER, root, LABEL_WIDTH);
    connect(fContainerDialogField);
    fContainerDialogField.addListener(listener);
    fPackageDialogField = new PackageDialogField(PACKAGE, LABEL_WIDTH);
    connect(fPackageDialogField);
    fPackageDialogField.addListener(listener);
    fComponentNameDialog = new ComponentNameField(COMPONENTNAME);
    connect(fComponentNameDialog);
    fComponentNameDialog.addListener(listener);
    fAutoAddField = new TapestryContainerDialogField(AUTO_ADD, LABEL_WIDTH + 40);
    connect(fAutoAddField);
    fAutoAddField.addListener(listener);
    fGenerateHTML = new CheckBoxField(MessageUtil.getString(GENERATE_HTML + ".label"));
    fNextLabel = new DialogField("Choose a class for the specification on the next page...");

}