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.nokia.carbide.internal.api.template.engine.TemplateEngine.java

License:Open Source License

public static List<ITemplate> readTemplates(boolean validate) {
    List<ITemplate> templates = new ArrayList<ITemplate>();

    IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
    IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(EXTENSION_ID);
    IExtension[] extensions = extensionPoint.getExtensions();

    for (int i = 0; i < extensions.length; i++) {
        IExtension extension = extensions[i];
        String pluginId = extension.getNamespaceIdentifier();
        IConfigurationElement[] elements = extension.getConfigurationElements();
        for (int j = 0; j < elements.length; j++) {
            IConfigurationElement element = elements[j];

            String templateId = element.getAttribute(TEMPLATE_ID);
            String location = element.getAttribute(LOCATION);
            String wizardId = element.getAttribute(WIZARD_ID);
            String name = element.getAttribute(DISPLAY_NAME);
            String groupLabel = element.getAttribute(GROUP_LABEL);
            String filterArgs = element.getAttribute(FILTER_ARGS);
            String imageAttribute = element.getAttribute(IMAGE);

            Bundle bundle = Platform.getBundle(pluginId);
            URL templateUrl = bundle.getEntry(location);

            Map<String, String> metadata = new LinkedHashMap<String, String>();
            IConfigurationElement[] metadatas = element.getChildren("metadata");
            for (IConfigurationElement meta : metadatas) {
                metadata.put(meta.getAttribute("name"), meta.getValue());
            }/* w ww  . j a v a  2  s  . com*/

            Template template = new Template(templateUrl, bundle, name, groupLabel, filterArgs, templateId,
                    wizardId, metadata, element);

            if (imageAttribute != null) {
                URL iconUrl = template.getBundle().getEntry(imageAttribute);
                if (iconUrl == null) {
                    Logging.log(TemplateWizardPlugin.getDefault(), Logging.newStatus(
                            TemplateWizardPlugin.getDefault(), IStatus.ERROR,
                            MessageFormat.format(Messages.getString("TemplateEngine.ImageNotFoundError"), //$NON-NLS-1$
                                    new Object[] { imageAttribute, template.getBundle().getSymbolicName() })));
                }
                ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(iconUrl);
                template.setImageDescriptor(imageDescriptor);
            }

            templates.add(template);
        }
    }

    return templates;
}

From source file:com.nokia.s60ct.cenrep.gui.editors.CRBrowser.java

License:Open Source License

private void addExpandAndCollapseButtons(Composite parent) {
    CTabFolder folder = (CTabFolder) parent;
    for (Control control : folder.getChildren()) {
        if (control instanceof ViewForm) {
            ViewForm viewForm = (ViewForm) control;
            ToolItem collapseItem = new ToolItem((ToolBar) viewForm.getTopCenter(), SWT.FLAT);
            collapseItem.setImage(ImageDescriptor.createFromURL(ICON_COLLAPSE).createImage());
            collapseItem.setToolTipText("Collapse All");
            collapseItem.addSelectionListener(new SelectionAdapter() {
                public void widgetSelected(SelectionEvent e) {
                    ((TreeViewer) currentViewer).collapseAll();
                }//from w w w.  j av a  2  s .c om
            });
            ToolItem expandItem = new ToolItem((ToolBar) viewForm.getTopRight(), SWT.FLAT);
            expandItem.setImage(ImageDescriptor.createFromURL(ICON_EXPAND).createImage());
            expandItem.setToolTipText("Expand All");
            expandItem.addSelectionListener(new SelectionAdapter() {
                public void widgetSelected(SelectionEvent e) {
                    ((TreeViewer) currentViewer).expandAll();
                }
            });
        }
    }
}

From source file:com.nokia.s60ct.gui.ApplicationActionBarAdvisor.java

License:Open Source License

protected void makeActions(IWorkbenchWindow window) {

    save = ActionFactory.SAVE.create(window);
    save.setImageDescriptor(ImageDescriptor.createFromURL(ICON_SAVE));
    save.setDisabledImageDescriptor(ImageDescriptor.createFromURL(ICON_SAVE_DISABLED));

    saveAs = ActionFactory.SAVE_AS.create(window);
    saveAs.setImageDescriptor(ImageDescriptor.createFromURL(ICON_SAVE_AS));
    saveAs.setDisabledImageDescriptor(ImageDescriptor.createFromURL(ICON_SAVE_AS_DISABLED));

    saveAll = ActionFactory.SAVE_ALL.create(window);
    saveAll.setImageDescriptor(ImageDescriptor.createFromURL(ICON_SAVE_ALL));
    saveAll.setDisabledImageDescriptor(ImageDescriptor.createFromURL(ICON_SAVE_ALL_DISABLED));

    copy = ActionFactory.COPY.create(window);
    copy.setEnabled(true);/*from   w  w w  .ja v  a2s  . c o m*/
    copy.setImageDescriptor(ImageDescriptor.createFromURL(ICON_COPY));
    copy.setDisabledImageDescriptor(ImageDescriptor.createFromURL(ICON_COPY_DISABLED));

    paste = ActionFactory.PASTE.create(window);
    paste.setEnabled(true);
    paste.setImageDescriptor(ImageDescriptor.createFromURL(ICON_PASTE));
    paste.setDisabledImageDescriptor(ImageDescriptor.createFromURL(ICON_PASTE_DISABLED));

    find = ActionFactory.FIND.create(window);
    find.setEnabled(true);
    find.setImageDescriptor(ImageDescriptor.createFromURL(ICON_FIND));
    find.setDisabledImageDescriptor(ImageDescriptor.createFromURL(ICON_FIND_DISABLED));

}

From source file:com.nokia.s60ct.gui.ApplicationWorkbenchAdvisor.java

License:Open Source License

private void declareWorkbenchImage(IWorkbenchConfigurer configurer_p, Bundle ideBundle, String symbolicName,
        String path, boolean shared) {
    URL url = ideBundle.getEntry(path);
    ImageDescriptor desc = ImageDescriptor.createFromURL(url);
    configurer_p.declareImage(symbolicName, desc, shared);
}

From source file:com.nokia.s60ct.gui.views.AboutDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {

    final Cursor hand = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
    final Cursor busy = new Cursor(parent.getDisplay(), SWT.CURSOR_WAIT);
    setHandCursor(hand);/* w w w. j av  a2  s  .com*/
    setBusyCursor(busy);
    getShell().addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            setHandCursor(null);
            hand.dispose();
            setBusyCursor(null);
            busy.dispose();
        }
    });

    Image aboutImage = null;

    if (product != null) {
        ImageDescriptor imageDescriptor = ProductProperties.getAboutImage(product);
        if (imageDescriptor != null) {
            aboutImage = imageDescriptor.createImage();
        }
    } else //no product. maybe run from Eclipse
    {
        try {
            URL url = S60CtEditorPlugin.class.getResource("/about.PNG");
            ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url);
            aboutImage = imageDescriptor.createImage();

        } catch (Exception e) {
        }
    }

    Composite workArea = new Composite(parent, SWT.NONE);
    GridLayout workLayout = new GridLayout(2, false);
    workLayout.marginHeight = 0;
    workLayout.marginWidth = 0;
    workLayout.verticalSpacing = 0;
    workLayout.horizontalSpacing = 0;
    workArea.setLayout(workLayout);
    workArea.setLayoutData(new GridData(GridData.FILL_BOTH));

    // page group
    Color background = JFaceColors.getBannerBackground(parent.getDisplay());
    Color foreground = JFaceColors.getBannerForeground(parent.getDisplay());

    workArea.setBackground(background);
    workArea.setForeground(foreground);

    //image on left side of dialog
    if (aboutImage != null) {
        Label imageLabel = new Label(workArea, SWT.NONE);
        imageLabel.setBackground(background);
        imageLabel.setForeground(foreground);

        GridData data = new GridData();
        data.horizontalAlignment = GridData.FILL;
        data.verticalAlignment = GridData.BEGINNING;
        data.grabExcessHorizontalSpace = false;
        imageLabel.setLayoutData(data);
        imageLabel.setImage(aboutImage);
    }

    // text on the right
    text = new StyledText(workArea, SWT.MULTI | SWT.READ_ONLY);
    text.setCaret(null);
    text.setFont(parent.getFont());
    GridData data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    data.verticalAlignment = GridData.BEGINNING;
    data.verticalIndent = 12;
    data.grabExcessHorizontalSpace = true;
    data.grabExcessVerticalSpace = true;

    text.setText(getAboutText());
    text.setLayoutData(data);
    text.setCursor(null);
    text.setBackground(background);
    text.setForeground(foreground);

    if (aboutImage != null) {
        // horizontal bar
        Label bar = new Label(workArea, SWT.HORIZONTAL | SWT.SEPARATOR);
        data = new GridData();
        data.horizontalAlignment = GridData.FILL;
        bar.setLayoutData(data);

        Label bar2 = new Label(workArea, SWT.HORIZONTAL | SWT.SEPARATOR);
        bar2.setLayoutData(data);
    }

    return workArea;
}

From source file:com.nokia.s60ct.gui.views.ReportDialog.java

License:Open Source License

private void createTab(TabFolder parent, String tabName, Vector vReports) {
    Object[] reports = vReports.toArray();
    Vector vErrors = new Vector(10);
    Vector vFiles = new Vector(10);

    int type = 0;

    if (tabName.equals(CENREP_TAB_NAME))
        type = GenerationReport.TYPE_CENREP;
    else if (tabName.equals(GENCONFML_TAB_NAME))
        type = GenerationReport.TYPE_GENCONFML;
    else if (tabName.equals(IBY_TAB_NAME))
        type = GenerationReport.TYPE_IBY;

    for (int i = 0; i < reports.length; i++) {
        GenerationReport report = (GenerationReport) reports[i];
        if (report == null)
            continue;
        GenerationReport.Error[] errors = report.getErrors(type);
        GenerationReport.GeneratedFile[] files = report.getGeneratedFiles(type);

        if (errors != null)
            for (int j = 0; j < errors.length; j++)
                vErrors.add(errors[j]);//from   w  ww  .  j  a  v a 2 s . c  om

        if (files != null)
            for (int j = 0; j < files.length; j++)
                vFiles.add(files[j]);

    }

    int numberOfErrors = vErrors.size();
    totalNumberOfErrors += numberOfErrors;
    int numberOfGeneratedFiles = vFiles.size();
    totalNumberOfGenerated += numberOfGeneratedFiles;

    TabItem tab = new TabItem(parent, SWT.NONE);
    tab.setText(tabName + " " + numberOfGeneratedFiles);

    GridLayout tabLayout = new GridLayout(1, true);
    GridData tabLayoutData = new GridData(SWT.FILL, SWT.NONE, true, false);
    GridData browserLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true);

    Composite tabComposite = new Composite(parent, SWT.FILL);
    tabComposite.setLayout(tabLayout);
    tabComposite.setLayoutData(tabLayoutData);
    tab.setControl(tabComposite);

    GridLayout groupLayout = new GridLayout(2, false);
    Composite groupComposite = new Composite(tabComposite, SWT.CENTER);
    groupLayout.marginTop = 0;
    groupLayout.marginBottom = -10;
    groupLayout.marginLeft = -5;
    groupLayout.marginRight = -5;
    groupComposite.setLayout(groupLayout);
    groupComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    GridLayout labelLayout = new GridLayout(1, false);
    labelLayout.marginTop = 0;
    labelLayout.marginBottom = 0;
    labelLayout.marginLeft = -5;
    labelLayout.marginRight = 0;

    Composite labelComposite = new Composite(groupComposite, SWT.FILL);
    labelComposite.setLayout(labelLayout);
    labelComposite.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, false));

    GridLayout buttonLayout = new GridLayout(1, false);
    buttonLayout.marginTop = 0;
    buttonLayout.marginBottom = 0;
    buttonLayout.marginLeft = 0;
    buttonLayout.marginRight = 12;

    Composite buttonComposite = new Composite(groupComposite, SWT.FILL);
    buttonComposite.setLayout(buttonLayout);
    buttonComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));

    Label generatedLabel = new Label(labelComposite, SWT.NONE);
    generatedLabel.setText("Generated " + tabName + " (" + numberOfGeneratedFiles + "):");
    generatedLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));

    final Object[] paths = getPaths(vFiles);

    Button openFolderButton = new Button(buttonComposite, SWT.PUSH);
    openFolderButton.setText("Open Folders...");
    openFolderButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
    openFolderButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            openFolders(paths);
        }
    });
    if (paths.length == 0)
        openFolderButton.setEnabled(false);

    Browser generatedBrowser = new Browser(tabComposite, SWT.NONE);
    generatedBrowser.setLayoutData(browserLayoutData);

    generatedBrowser.setText(getGenDataHTML(vFiles));

    if (numberOfErrors == 0)
        tab.setImage(ImageDescriptor.createFromURL(NO_ERRORS).createImage());
    else {
        tab.setImage(ImageDescriptor.createFromURL(ERRORS).createImage());

        Label empty = new Label(tabComposite, SWT.SEPARATOR | SWT.HORIZONTAL);
        empty.setLayoutData(tabLayoutData);
        empty.setText("");

        Composite groupComposite2 = new Composite(tabComposite, SWT.CENTER);
        groupComposite2.setLayout(groupLayout);
        groupComposite2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

        Composite labelComposite2 = new Composite(groupComposite2, SWT.FILL);
        labelComposite2.setLayout(labelLayout);
        labelComposite2.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, false));

        Composite buttonComposite2 = new Composite(groupComposite2, SWT.FILL);
        buttonComposite2.setLayout(buttonLayout);
        buttonComposite2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));

        Label errorsLabel = new Label(labelComposite2, SWT.NONE);
        errorsLabel.setText("Errors (" + numberOfErrors + "):");

        final String errorText = getErrorText(vErrors);

        Button copyButton = new Button(buttonComposite2, SWT.PUSH);
        copyButton.setText("Copy To Clipboard");
        copyButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
        copyButton.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                TextTransfer textTransfer = TextTransfer.getInstance();
                cb.setContents(new Object[] { errorText }, new Transfer[] { textTransfer });
            }
        });

        Browser errorsBrowser = new Browser(tabComposite, SWT.NONE);
        errorsBrowser.setLayoutData(browserLayoutData);

        errorsBrowser.setText(getErrorTextHTML(errorText));
    }
}

From source file:com.nokia.s60ct.gui.views.SequenceMenu.java

License:Open Source License

private void createControl(Composite menuComposite) {

    GridLayout buttonLayout = new GridLayout(3, true);
    GridLayout radioButtonLayout = new GridLayout(4, false);
    GridLayout layoutForGroup = new GridLayout(2, false);
    GridData buttonGridData = new GridData(SWT.FILL, SWT.NONE, false, false);
    buttonGridData.minimumWidth = 130;//ww w  .  j  ava 2s  .  c  o  m
    buttonGridData.widthHint = 150;

    GridLayout baseLayout = new GridLayout(1, false);
    baseLayout.marginLeft = -5;
    baseLayout.marginRight = -5; //this removes the extra space around SS group.
    baseLayout.marginTop = -7;
    baseLayout.marginBottom = -5;

    menuComposite.setLayout(baseLayout);
    menuComposite.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));

    Group seqSettingGroup = new Group(menuComposite, SWT.NONE);
    seqSettingGroup.setText("Sequence Settings");
    seqSettingGroup.setLayout(layoutForGroup);
    seqSettingGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    Composite composite = new Composite(seqSettingGroup, SWT.NONE);
    composite.setLayout(buttonLayout);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    buttonAdd = new Button(composite, SWT.PUSH);
    buttonAdd.setText("Add Sequence");
    buttonAdd.setLayoutData(buttonGridData);
    buttonAdd.setImage(ImageDescriptor.createFromURL(ICON_ADD_ROW).createImage());
    buttonAdd.setEnabled(false);
    buttonAdd.pack();
    buttonAdd.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(setting);
            Command command = itemProvider.createCommand(setting, domain, AddCommand.class,
                    new CommandParameter(setting, ConfigurationemfPackage.eINSTANCE.getParentSetting_Frames(),
                            null));
            domain.getCommandStack().execute(command);
            frame = null;
            updateMenu();
        }
    });
    buttonRemove = new Button(composite, SWT.PUSH);
    buttonRemove.setText("Remove Sequence");
    buttonRemove.setLayoutData(buttonGridData);
    buttonRemove.setImage(ImageDescriptor.createFromURL(ICON_REMOVE_ROW).createImage());
    buttonRemove.setEnabled(false);
    buttonRemove.pack();
    buttonRemove.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(setting);
            Command command = itemProvider.createCommand(setting, domain, RemoveCommand.class,
                    new CommandParameter(setting, ConfigurationemfPackage.eINSTANCE.getParentSetting_Frames(),
                            frame));
            domain.getCommandStack().execute(command);
            frame = null;
            updateMenu();
        }
    });

    buttonRemoveAll = new Button(composite, SWT.PUSH);
    buttonRemoveAll.setText("Remove All...");
    buttonRemoveAll.setLayoutData(buttonGridData);
    buttonRemoveAll.setImage(ImageDescriptor.createFromURL(ICON_REMOVE_ALL).createImage());
    buttonRemoveAll.setEnabled(false);
    buttonRemoveAll.pack();
    buttonRemoveAll.addSelectionListener(REMOVE_ALL_ADAPTER);

    /*
    moveUp = new Button(composite,SWT.PUSH);
    moveUp.setText("Up");
    moveUp.setLayoutData(buttonGridData);
    moveUp.setEnabled(false);
    moveUp.pack();
    moveUp.addSelectionListener(mu);
            
    moveDown = new Button(composite,SWT.PUSH);
    moveDown.setText("Down");
    moveDown.setLayoutData(buttonGridData);
    moveDown.setEnabled(false);
    moveDown.pack();
    moveDown.addSelectionListener(md);
    */
    Composite radioButtoncomposite = new Composite(seqSettingGroup, SWT.NONE);
    radioButtoncomposite.setLayout(radioButtonLayout);
    radioButtoncomposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));

    Label label2 = new Label(radioButtoncomposite, SWT.NONE);
    label2.setText("Extension Policy:");

    buttonExPolReplace = new Button(radioButtoncomposite, SWT.RADIO);
    buttonExPolReplace.setText("Replace");
    buttonExPolReplace.setEnabled(false);
    buttonExPolReplace.pack();
    buttonExPolReplace.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            setting.setCurrentExtensionPolicy(EXTENSION_POLICY.REPLACE);
            updateMenu();
        }
    });

    buttonExPolAppend = new Button(radioButtoncomposite, SWT.RADIO);
    buttonExPolAppend.setText("Append");
    buttonExPolAppend.setEnabled(false);
    buttonExPolAppend.pack();
    buttonExPolAppend.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            setting.setCurrentExtensionPolicy(EXTENSION_POLICY.APPEND);
            updateMenu();
        }
    });

    buttonExPolPrefix = new Button(radioButtoncomposite, SWT.RADIO);
    buttonExPolPrefix.setText("Prefix");
    buttonExPolPrefix.setEnabled(false);
    buttonExPolPrefix.pack();
    buttonExPolPrefix.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            setting.setCurrentExtensionPolicy(EXTENSION_POLICY.PREFIX);
            updateMenu();
        }
    });

    buttonExPolAppend.setSelection(true);

}

From source file:com.nokia.s60ct.gui.views.SequenceMenu.java

License:Open Source License

private void updateMenu() {
    if (setting == null)
        disableMenu();/*w  w w.j a va 2  s  .  com*/
    else {
        buttonAdd.setEnabled(itemProvider.isAddAllowed(setting));
        buttonRemove.setEnabled(itemProvider.isRemoveItemAllowed(setting, frame));
        if (itemProvider.isSequenceEmpty(setting)) {
            buttonRemoveAll.setText("Show Default");
            buttonRemoveAll.setImage(ImageDescriptor.createFromURL(ICON_SHOW_DEFAULT).createImage());
            buttonRemoveAll.setEnabled(true);
        } else {
            buttonRemoveAll.setText("Remove All...");
            buttonRemoveAll.setImage(ImageDescriptor.createFromURL(ICON_REMOVE_ALL).createImage());
            buttonRemoveAll.setEnabled(true);
        }

        if (isDeveloperMode()) {
            buttonExPolPrefix.setEnabled(false);
            buttonExPolReplace.setEnabled(false);
            buttonExPolAppend.setEnabled(false);
        } else {
            buttonExPolAppend.setEnabled(itemProvider.isAllowedPolicy(setting, EXTENSION_POLICY.APPEND));
            buttonExPolPrefix.setEnabled(itemProvider.isAllowedPolicy(setting, EXTENSION_POLICY.PREFIX));
            buttonExPolReplace.setEnabled(itemProvider.isAllowedPolicy(setting, EXTENSION_POLICY.REPLACE));
        }
        EXTENSION_POLICY ep = itemProvider.getExtensionPolicy(setting);
        switch (ep.getValue()) {
        case EXTENSION_POLICY.APPEND_VALUE:
            buttonExPolReplace.setSelection(false);
            buttonExPolPrefix.setSelection(false);
            buttonExPolAppend.setSelection(true);
            break;

        case EXTENSION_POLICY.PREFIX_VALUE:
            buttonExPolReplace.setSelection(false);
            buttonExPolPrefix.setSelection(true);
            buttonExPolAppend.setSelection(false);
            break;

        case EXTENSION_POLICY.REPLACE_VALUE:
            buttonExPolReplace.setSelection(true);
            buttonExPolPrefix.setSelection(false);
            buttonExPolAppend.setSelection(false);
            break;

        case EXTENSION_POLICY.NO_POLICY_VALUE:
            buttonExPolReplace.setSelection(false);
            buttonExPolPrefix.setSelection(false);
            buttonExPolAppend.setSelection(true);
            setting.setCurrentExtensionPolicy(EXTENSION_POLICY.APPEND);
            break;
        }
    }
    view.updateView();
}

From source file:com.nokia.sdt.component.symbian.designerimages.DesignerImageAdapter.java

License:Open Source License

public ImageDescriptor getLargeIconDescriptor() {
    if (largeIconKey == null) {
        return ImageDescriptor.getMissingImageDescriptor();
    }//from w  ww .j  ava  2 s. com
    try {
        return ImageDescriptor.createFromURL(new URL("file", null, largeIconKey));
    } catch (MalformedURLException e) {
        return ImageDescriptor.getMissingImageDescriptor();
    }
}

From source file:com.nokia.sdt.component.symbian.designerimages.DesignerImageAdapter.java

License:Open Source License

public ImageDescriptor getSmallIconDescriptor() {
    if (smallIconKey == null) {
        return ImageDescriptor.getMissingImageDescriptor();
    }/*from  w w w  .jav  a2s.c  om*/
    try {
        return ImageDescriptor.createFromURL(new URL("file", null, smallIconKey));
    } catch (MalformedURLException e) {
        return ImageDescriptor.getMissingImageDescriptor();
    }
}