Skip to content

Instantly share code, notes, and snippets.

Created December 17, 2013 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DinisCruz/8009414 to your computer and use it in GitHub Desktop.
Save DinisCruz/8009414 to your computer and use it in GitHub Desktop.
Creating a view that shows a list of images from ISharedImages
import org.eclipse.jface.dialogs.*
import org.eclipse.swt.layout.*
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;
def panel = eclipseUI.new_Panel("view images").clear()
def container = panel.composite;
container.setLayout(new FormLayout());
Label lblNewLabel = new Label(container, SWT.NONE);
FormData fd_lblNewLabel = new FormData(); = new FormAttachment(0, 10);
fd_lblNewLabel.left = new FormAttachment(0, 0);
lblNewLabel.setText("Selected Image");
Text text = new Text(container, SWT.BORDER);
FormData fd_text = new FormData();
fd_text.right = new FormAttachment(100,0); = new FormAttachment(lblNewLabel, -3, SWT.TOP);
fd_text.left = new FormAttachment(lblNewLabel, 6);
composite = new Composite(container, SWT.NONE);
FormData fd_composite = new FormData(); = new FormAttachment(text, 4);
fd_composite.left = new FormAttachment(0);
fd_composite.bottom = new FormAttachment(100, 0);
fd_composite.right = new FormAttachment(100,0);
composite.setLayout(new FillLayout());
Group grpText = new Group(composite, SWT.NONE);
grpText.setText("Images from ISharedImages (click to see name)");
grpText.setLayout(new RowLayout(SWT.HORIZONTAL));
def image = images.get(images.names().first());
for(final String name : images.names())
def label = new Label(grpText,SWT.NONE);
label.addMouseListener( new MouseAdapter() {
def pinnedName = name;
public void mouseUp(MouseEvent e)
//new Label(grpText,SWT.NONE).setImage(images.get(1));
//new Label(grpText,SWT.NONE).setImage(images.get(20));
//new Label(grpText,SWT.NONE).setImage(images.get(10));
return "done";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment