List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromFile
public static ImageDescriptor createFromFile(Class<?> location, String filename)
From source file:it.scoppelletti.sdk.ide.ui.IDEConsoleImpl.java
License:Apache License
/** * Costruttore./*from ww w. j a v a2 s.co m*/ */ IDEConsoleImpl() { super(IDEConsoleImpl.NAME, IDEConsoleImpl.TYPE, ImageDescriptor.createFromFile(IDEConsoleImpl.class, IDEConsoleImpl.IMAGE_RES), true); myPartitioner = new IDEConsolePartitioner(this); myPartitioner.connect(getDocument()); }
From source file:it.scoppelletti.sdk.ide.ui.NewProjectWizard.java
License:Apache License
/** * Costruttore./* www.j a v a 2 s. c om*/ */ public NewProjectWizard() { ImageDescriptor image; image = ImageDescriptor.createFromFile(getClass(), NewProjectWizard.IMAGE_RES); setDefaultPageImageDescriptor(image); setDialogSettings(IDEPlugin.getInstance().getDialogSettings()); setWindowTitle("New Programmer Power Project"); setNeedsProgressMonitor(true); }
From source file:it.uniba.di.cdg.econference.planningpoker.ui.CardButton.java
License:Open Source License
public CardButton(Composite parent, final String value) { super(parent, SWT.NONE); this.value = value; this.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { if (!selected) { // Dotted rectangle containing the card e.gc.setLineWidth(2);/*from ww w .ja v a 2 s . c o m*/ e.gc.setLineStyle(SWT.LINE_DASH); e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_GRAY)); e.gc.drawRoundRectangle(3, 3, e.width - 6, e.height - 6, 10, 10); // Card background pattern Image image = ImageDescriptor.createFromFile(getClass(), CARD_BACKGROUND_IMAGE).createImage(); Pattern pattern = new Pattern(e.display, image); e.gc.setBackgroundPattern(pattern); e.gc.fillRectangle(8, 8, e.width - 16, e.height - 16); // Card border e.gc.setLineWidth(2); e.gc.setLineStyle(SWT.LINE_SOLID); e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_WHITE)); e.gc.drawRoundRectangle(7, 7, e.width - 14, e.height - 14, 5, 5); // Card value Font font = new Font(e.display, "Arial", 12, SWT.BOLD); e.gc.setFont(font); Point textSize = e.gc.textExtent(value); e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_BLACK)); e.gc.drawText(value, (e.width - textSize.x) / 2, (e.height - textSize.y) / 2, true); /* * Switch * * 0: Default state * 1: Mouse over * 2: Mouse down * */ switch (mouse) { case 0: case 1: case 2: break; } image.dispose(); pattern.dispose(); font.dispose(); } else { // Dotted rectangle containing the card e.gc.setLineWidth(2); e.gc.setLineStyle(SWT.LINE_DASH); e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_GRAY)); e.gc.drawRoundRectangle(3, 3, e.width - 6, e.height - 6, 10, 10); } } }); this.addMouseTrackListener(new MouseTrackListener() { @Override public void mouseHover(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseExit(MouseEvent e) { mouse = 0; redraw(); } @Override public void mouseEnter(MouseEvent e) { mouse = 1; redraw(); } }); this.addMouseListener(new MouseListener() { @Override public void mouseUp(MouseEvent e) { mouse = 1; if (e.x < 0 || e.y < 0 || e.x > getBounds().width || e.y > getBounds().height) { mouse = 0; } redraw(); if (mouse == 1) notifyListeners(SWT.Selection, new Event()); } @Override public void mouseDown(MouseEvent e) { mouse = 2; redraw(); } @Override public void mouseDoubleClick(MouseEvent e) { // TODO Auto-generated method stub } }); }
From source file:it.uniba.di.cdg.econference.planningpoker.ui.CardTarget.java
License:Open Source License
public CardTarget(Composite parent) { super(parent, SWT.NONE); this.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { if (isEnabled()) { if (estimate.isEmpty()) { Font font = new Font(e.display, "Arial", 10, SWT.NONE); e.gc.setFont(font);/*from w w w .j av a 2 s.c om*/ e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_DARK_GRAY)); String text = "Drag"; Point textSize = e.gc.textExtent(text); e.gc.drawText(text, (e.width - textSize.x) / 2, (e.height - textSize.y) / 2 - 20, true); text = "your card"; textSize = e.gc.textExtent(text); e.gc.drawText(text, (e.width - textSize.x) / 2, (e.height - textSize.y) / 2, true); text = "here"; textSize = e.gc.textExtent(text); e.gc.drawText(text, (e.width - textSize.x) / 2, (e.height - textSize.y) / 2 + 20, true); // Dotted rectangle containing the card e.gc.setLineWidth(2); e.gc.setLineStyle(SWT.LINE_DASH); e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_RED)); e.gc.drawRoundRectangle(3, 3, e.width - 6, e.height - 6, 10, 10); font.dispose(); } else { // Dotted rectangle containing the card e.gc.setLineWidth(2); e.gc.setLineStyle(SWT.LINE_DASH); e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_RED)); e.gc.drawRoundRectangle(3, 3, e.width - 6, e.height - 6, 10, 10); // Card background pattern Image image = ImageDescriptor.createFromFile(getClass(), CardButton.CARD_BACKGROUND_IMAGE) .createImage(); Pattern pattern = new Pattern(e.display, image); e.gc.setBackgroundPattern(pattern); e.gc.fillRectangle(8, 8, e.width - 16, e.height - 16); // Card border e.gc.setLineWidth(2); e.gc.setLineStyle(SWT.LINE_SOLID); e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_WHITE)); e.gc.drawRoundRectangle(7, 7, e.width - 14, e.height - 14, 5, 5); // Card value Font font = new Font(e.display, "Arial", 12, SWT.BOLD); e.gc.setFont(font); Point textSize = e.gc.textExtent(estimate); e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_BLACK)); e.gc.drawText(estimate, (e.width - textSize.x) / 2, (e.height - textSize.y) / 2, true); font.dispose(); image.dispose(); pattern.dispose(); } } else { Font font = new Font(e.display, "Arial", 10, SWT.NONE); e.gc.setFont(font); e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_DARK_GRAY)); String text = "You"; Point textSize = e.gc.textExtent(text); e.gc.drawText(text, (e.width - textSize.x) / 2, (e.height - textSize.y) / 2 - 20, true); text = "can't"; textSize = e.gc.textExtent(text); e.gc.drawText(text, (e.width - textSize.x) / 2, (e.height - textSize.y) / 2, true); text = "vote"; textSize = e.gc.textExtent(text); e.gc.drawText(text, (e.width - textSize.x) / 2, (e.height - textSize.y) / 2 + 20, true); // Dotted rectangle containing the card e.gc.setLineWidth(2); e.gc.setLineStyle(SWT.LINE_DASH); e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_RED)); e.gc.drawRoundRectangle(3, 3, e.width - 6, e.height - 6, 10, 10); font.dispose(); } } }); }
From source file:jasima_gui.editors.FactorsEditor.java
License:Open Source License
public FactorsEditor(Composite parent) { super(parent); factorImage = ImageDescriptor.createFromFile(getClass(), "/icons/factor.png").createImage(true); }
From source file:lost.tok.DiscussionViewer.GemsWizardPage.java
License:Open Source License
public GemsWizardPage(IWorkbench aWorkbench, IStructuredSelection selection) { super("DiscussionViewer DSML", selection); //$NON-NLS-1$ this.setTitle("DiscussionViewer DSML"); this.setDescription("Create a DiscussionViewer DSML instance"); this.setImageDescriptor(ImageDescriptor.createFromFile(getClass(), "icons/logicbanner.gif")); //$NON-NLS-1$ this.workbench = aWorkbench; }
From source file:net.bhl.cdt.ui.decorators.IsStartableDecorator.java
License:Open Source License
@Override public void decorate(Object resource, IDecoration decoration) { try {//w ww . j a v a 2s. c o m if (resource instanceof ProcessElement) { ProcessElement processElement = (ProcessElement) resource; if (processElement.isStartable()) { decoration.addOverlay( ImageDescriptor.createFromFile(IsStartableDecorator.class, "/icons/ready.gif"), IDecoration.TOP_RIGHT); } else decoration.addOverlay( ImageDescriptor.createFromFile(IsStartableDecorator.class, "/icons/nogo.gif"), IDecoration.TOP_RIGHT); /** * Dummy Notification to get the Containment (the parent) refreshed so that decorate is called. The * containment sets a notification that itself has changed. */ processElement.eContainer() .eNotify(new ENotificationImpl((InternalEObject) processElement.eContainer(), Notification.UNSET, ProcessPackage.DESIGN_OPERATION___IS_STARTABLE, null, null)); } } catch (NullPointerException e) { e.printStackTrace(); } }
From source file:net.bioclipse.reaction.editor.ReactionEditor.java
License:Open Source License
protected PaletteRoot getPaletteRoot() { PaletteRoot root = new PaletteRoot(); PaletteGroup toolGroup = new PaletteGroup("c["); ToolEntry tool = new SelectionToolEntry(); toolGroup.add(tool);//from w w w . j av a 2s . c o m root.setDefaultEntry(tool); toolGroup.add(new MarqueeToolEntry()); toolGroup.add(new FileMoveToolEntry()); PaletteDrawer drawer = new PaletteDrawer("i"); ImageDescriptor descriptor = ImageDescriptor.createFromFile(ReactionEditor.class, "/icons/reactionFigure.gif"); CreationToolEntry creationEntry = new CreationToolEntry("Reaction", "Reaction Figure", new SimpleFactory(ReactionObjectModel.class), descriptor, descriptor); drawer.add(creationEntry); descriptor = ImageDescriptor.createFromFile(ReactionEditor.class, "/icons/compoundFigure.gif"); creationEntry = new CreationToolEntry("Compound", "Compound Figure", new SimpleFactory(CompoundObjectModel.class), descriptor, descriptor); drawer.add(creationEntry); descriptor = ImageDescriptor.createFromFile(ReactionEditor.class, "/icons/newConnection.gif"); ConnectionCreationToolEntry connxCreationEntry = new ConnectionCreationToolEntry("reversible", "reversible Connection", new SimpleFactory(LineConnectionModel.class), descriptor, descriptor); drawer.add(connxCreationEntry); descriptor = ImageDescriptor.createFromFile(ReactionEditor.class, "/icons/arrowConnection.gif"); ConnectionCreationToolEntry arrowConnxCreationEntry = new ConnectionCreationToolEntry("arrow", "arrow Connection", new SimpleFactory(ArrowConnectionModel.class), descriptor, descriptor); drawer.add(arrowConnxCreationEntry); root.add(toolGroup); root.add(drawer); return root; }
From source file:net.bioclipse.usermanager.dialogs.DialogArea.java
License:Open Source License
/** * This method is used when ever a dialog for login in Bioclipse is wanted. * //from ww w .j a v a 2 s. c o m * @param parent The component where it will live * @return A composite with the different SWT-components that are needed. */ public Composite getLoginArea(Composite parent) { Composite container = new Composite(parent, SWT.NONE); container.setLayout(new FormLayout()); container.setLayoutData(new GridData(GridData.FILL_BOTH)); usernameLabel = new Label(container, SWT.NONE); final FormData formData = new FormData(); usernameLabel.setLayoutData(formData); usernameLabel.setText("Username:"); passwordLabel = new Label(container, SWT.NONE); final FormData formData_1 = new FormData(); passwordLabel.setLayoutData(formData_1); passwordLabel.setText("Password:"); usernameText = new Text(container, SWT.BORDER); formData.bottom = new FormAttachment(usernameText, 0, SWT.BOTTOM); formData.right = new FormAttachment(usernameText, -5, SWT.LEFT); final FormData formData_2 = new FormData(); formData_2.right = new FormAttachment(usernameText, 0, SWT.RIGHT); formData_2.left = new FormAttachment(usernameText, 0, SWT.LEFT); final FormData formData_3 = new FormData(); formData_3.left = new FormAttachment(0, 140); formData_3.right = new FormAttachment(100, -34); formData_3.top = new FormAttachment(0, 53); usernameText.setLayoutData(formData_3); usernameText.addListener(SWT.CHANGED, this); passwordText = new Text(container, SWT.BORDER | SWT.PASSWORD); formData_1.bottom = new FormAttachment(passwordText, 0, SWT.BOTTOM); formData_1.right = new FormAttachment(passwordText, -5, SWT.LEFT); formData_2.top = new FormAttachment(0, 93); passwordText.setLayoutData(formData_2); passwordText.addListener(SWT.CHANGED, this); if (createNewAccountButton) { Button createNewKeyringButton = new Button(container, SWT.NONE); createNewKeyringButton.addSelectionListener(new SelectionAdapter() { /* * CREATE NEW USER */ public void widgetSelected(SelectionEvent e) { CreateUserDialog createDialog = new CreateUserDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), userContainer); createDialog.open(); if (createDialog.getReturnCode() == Window.OK) { createDialog.close(); EditUserDialog dialog = new EditUserDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), userContainer); dialog.open(); if (dialog.getReturnCode() == Window.OK) { userContainerEdited = true; } } } }); final FormData formData_4 = new FormData(); formData_4.right = new FormAttachment(100, -34); formData_4.top = new FormAttachment(0, 136); createNewKeyringButton.setLayoutData(formData_4); createNewKeyringButton.setText("Create new Account..."); container.setTabList(new Control[] { usernameText, passwordText, passwordLabel, usernameLabel, createNewKeyringButton }); } else { repeatPasswordLabel = new Label(container, SWT.NONE); final FormData formData_4 = new FormData(); repeatPasswordLabel.setLayoutData(formData_2); repeatPasswordLabel.setText("Repeat password:"); repeatPasswordText = new Text(container, SWT.BORDER | SWT.PASSWORD); formData_2.bottom = new FormAttachment(repeatPasswordText, 0, SWT.BOTTOM); formData_2.right = new FormAttachment(repeatPasswordText, -5, SWT.LEFT); formData_4.left = new FormAttachment(repeatPasswordText, -316, SWT.RIGHT); formData_4.right = new FormAttachment(repeatPasswordText, 0, SWT.RIGHT); final FormData formData_5 = new FormData(); formData_5.top = new FormAttachment(0, 107); formData_5.left = new FormAttachment(0, 154); formData_5.right = new FormAttachment(0, 470); repeatPasswordText.setLayoutData(formData_5); repeatPasswordText.addListener(SWT.CHANGED, this); container.setTabList(new Control[] { usernameText, passwordText, repeatPasswordText, usernameLabel, passwordLabel, repeatPasswordLabel }); } Label icon = new Label(container, SWT.NONE); ImageDescriptor imgDesc = ImageDescriptor.createFromFile(this.getClass(), "../../../../../icons/login_16.png"); Image img = imgDesc.createImage(); icon.setImage(img); final FormData formData_6 = new FormData(); formData_6.bottom = new FormAttachment(usernameText, 0, SWT.RIGHT); formData_6.left = new FormAttachment(usernameText, 0, SWT.RIGHT); icon.setLayoutData(formData_6); usernameText.setFocus(); return container; }
From source file:net.bioclipse.usermanager.NewAccountWizard.java
License:Open Source License
public void addPages() { super.addPages(); if (usermanager != null && usermanager.getUserNames().size() == 0) { createUserPage = new CreateUserWizardPage("Create user", sandbox); createUserPage.setTitle("Create Bioclipse Account"); createUserPage.setDescription("Bioclipse wants to create an account " + "for storing all your different passwords in one password " + "encrypted file."); addPage(createUserPage);//from w w w . ja v a2s .co m } else if (!sandbox.isLoggedIn()) { loginPage = new LoginWizardPage("loginPage", sandbox); loginPage.setTitle("Log In To Your Bioclipse Account"); loginPage.setDescription("Before adding an acount you have to " + "loggin or create a new acount."); addPage(loginPage); } addAccountPage = new NewAccountWizardPage("addAccountPage", sandbox); addAccountPage.setTitle("New Account"); addAccountPage.setDescription("Add a third-part account to " + "Bioclipse.\nAll fields denoted with an asterisk (*) are " + "required."); addPage(addAccountPage); setDefaultPageImageDescriptor( ImageDescriptor.createFromFile(this.getClass(), "BioclipseAccountLogo3_medium.png")); }