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

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

Introduction

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

Prototype

public Image createImage() 

Source Link

Document

Creates and returns a new SWT image for this image descriptor.

Usage

From source file:com.googlecode.osde.internal.editors.pref.UserPrefsListLabelProvider.java

License:Apache License

public Image getColumnImage(Object element, int columnIndex) {
    switch (columnIndex) {
    case 0:/*from w  w  w .j  a  v  a  2  s . co m*/
        ImageDescriptor descriptor = Activator.getDefault().getImageRegistry()
                .getDescriptor("icons/icon_settings.gif");
        return descriptor.createImage();
    default:
        return null;
    }
}

From source file:com.googlecode.osde.internal.runtime.ShowKeysAction.java

License:Apache License

public void run(IAction action) {
    try {/*from   w  w w.ja  v a  2 s  . c  o  m*/
        ApplicationInformation appInfo = OpenSocialUtil.createApplicationInformation(file);
        ApplicationService service = Activator.getDefault().getApplicationService();
        final ApplicationImpl application = service.getApplication(appInfo.getAppId());
        if (application != null) {
            ImageDescriptor imageDescriptor = Activator.getDefault().getImageRegistry()
                    .getDescriptor("icons/icon_key.gif");
            MessageDialog dialog = new MessageDialog(shell, "Application information",
                    imageDescriptor.createImage(), "This is keys for accessing from external service.",
                    MessageDialog.INFORMATION, new String[] { "OK" }, 0) {
                @Override
                protected Control createCustomArea(Composite parent) {
                    Composite composite = new Composite(parent, SWT.NONE);
                    GridLayout gridLayout = new GridLayout();
                    gridLayout.numColumns = 2;
                    composite.setLayout(gridLayout);
                    GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
                    composite.setLayoutData(layoutData);
                    Label label = new Label(composite, SWT.NONE);
                    label.setText("Title:");
                    label = new Label(composite, SWT.NONE);
                    label.setText(application.getTitle());
                    label = new Label(composite, SWT.NONE);
                    label.setText("Path:");
                    label = new Label(composite, SWT.NONE);
                    label.setText(application.getPath());
                    label = new Label(composite, SWT.NONE);
                    label.setText("Consumer Key:");
                    Text text = new Text(composite, SWT.BORDER | SWT.MULTI);
                    text.setText(application.getConsumerKey());
                    text.setEditable(false);
                    text.setSelection(0);
                    layoutData = new GridData(GridData.FILL_HORIZONTAL);
                    layoutData.heightHint = 20;
                    text.setLayoutData(layoutData);
                    label = new Label(composite, SWT.NONE);
                    label.setText("Consumer Secret:");
                    text = new Text(composite, SWT.BORDER | SWT.MULTI);
                    text.setText(application.getConsumerSecret());
                    text.setEditable(false);
                    text.setSelection(0);
                    layoutData = new GridData(GridData.FILL_HORIZONTAL);
                    layoutData.heightHint = 20;
                    text.setLayoutData(layoutData);
                    return parent;
                }
            };
            dialog.open();
        } else {
            MessageDialog.openWarning(shell, "Warning", "This application does not run yet.");
        }
    } catch (CoreException e) {
        MessageDialog.openError(shell, "Error", "Invalid gadget file. " + e.getMessage());
    } catch (ConnectionException e) {
        MessageDialog.openError(shell, "Error", "Shindig database not started yet.");
    } catch (ParserException e) {
        MessageDialog.openError(shell, "Error", "Invalid gadget file. " + e.getMessage());
    }
}

From source file:com.googlecode.osde.internal.shindig.ShowPublicCertificateAction.java

License:Apache License

public void run(IAction action) {
    ImageDescriptor imageDescriptor = Activator.getDefault().getImageRegistry()
            .getDescriptor("icons/icon_key.gif");
    MessageDialog dialog = new MessageDialog(shell, "Public Certificate", imageDescriptor.createImage(),
            "This is Public Certificate for OAuth.", MessageDialog.INFORMATION, new String[] { "OK" }, 0) {
        @Override/*from  w  w  w . ja v  a  2s . c  o m*/
        protected Control createCustomArea(Composite parent) {
            Composite composite = new Composite(parent, SWT.NONE);
            composite.setLayout(new GridLayout());
            GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
            composite.setLayoutData(layoutData);
            Text text = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
            text.setText(PUBLIC_CER);
            text.setSelection(0, PUBLIC_CER.length());
            text.setEditable(false);
            layoutData = new GridData(GridData.FILL_HORIZONTAL);
            layoutData.heightHint = 250;
            text.setLayoutData(layoutData);
            return parent;
        }
    };
    dialog.open();
}

From source file:com.googlecode.osde.internal.ui.views.activities.ActivityListLabelProvider.java

License:Apache License

public Image getColumnImage(Object element, int columnIndex) {
    switch (columnIndex) {
    case 0://from  w  ww . j av  a  2  s  .  c o m
        ImageDescriptor descriptor = Activator.getDefault().getImageRegistry()
                .getDescriptor("icons/comment_yellow.gif");
        return descriptor.createImage();
    default:
        return null;
    }
}

From source file:com.googlecode.osde.internal.ui.views.apps.ApplicationListLabelProvider.java

License:Apache License

public Image getColumnImage(Object element, int columnIndex) {
    switch (columnIndex) {
    case 0:// ww  w .  ja  va 2  s  .c  o  m
        ImageDescriptor descriptor = Activator.getDefault().getImageRegistry()
                .getDescriptor("icons/opensocial.gif");
        return descriptor.createImage();
    default:
        return null;
    }
}

From source file:com.googlecode.osde.internal.ui.views.apps.PersonListLabelProvider.java

License:Apache License

public Image getColumnImage(Object element, int columnIndex) {
    switch (columnIndex) {
    case 0://  w w  w  . j av  a  2s.  c om
        ImageDescriptor descriptor = Activator.getDefault().getImageRegistry()
                .getDescriptor("icons/icon_user.gif");
        return descriptor.createImage();
    default:
        return null;
    }
}

From source file:com.googlecode.osde.internal.ui.wizards.export.ProjectListLabelProvider.java

License:Apache License

public Image getColumnImage(Object element, int columnIndex) {
    switch (columnIndex) {
    case 0:/*from w ww.j av  a 2  s .  co m*/
        ImageDescriptor descriptor = Activator.getDefault().getImageRegistry()
                .getDescriptor("icons/project.gif");
        return descriptor.createImage();
    default:
        return null;
    }
}

From source file:com.gorillalogic.monkeyconsole.plugin.FoneMonkeyPlugin.java

License:Open Source License

public static Image getImage(String imagePath) {

    ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, imagePath);
    Image image = imageDescriptor.createImage();

    return image;

}

From source file:com.hangum.tadpole.rdb.core.viewers.connections.DBIconsUtils.java

License:Open Source License

/**
 * get plugin image/*from   w  ww .j a  va 2s. com*/
 * 
 * @param pluginId
 * @param imgURL
 * @return
 */
public static Image getPluginImage(String pluginId, String imgURL) {
    ImageDescriptor descriptor = getPluginImageDescriptor(pluginId, imgURL);
    if (descriptor != null)
        return descriptor.createImage();
    else
        return null;
}

From source file:com.hudren.woodpile.ImageCache.java

License:Open Source License

public Image getImage(final ImageDescriptor descriptor) {
    if (descriptor == null)
        return null;

    Image image = images.get(descriptor);
    if (image == null) {
        image = descriptor.createImage();
        images.put(descriptor, image);// w  w  w . j  a  v a  2s. c o m
    }

    return image;
}