@Override public Image getImage(Object element) { if (element instanceof Fragment) { return Pics.getImage(PicsConstants.groovyScript); } return super.getImage(element); }
protected Control createResourceComposite( Section section, TabbedPropertySheetWidgetFactory widgetFactory) { final Composite client = widgetFactory.createComposite(section); client.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); client.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).create()); resourceText = widgetFactory.createText(client, ""); resourceText.setLayoutData( GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create()); final ControlDecoration cd = new ControlDecoration(resourceText, SWT.LEFT); cd.setImage(Pics.getImage(PicsConstants.hint)); cd.setDescriptionText(Messages.filewidget_resource_hint); final Button browseResourceButton = widgetFactory.createButton(client, Messages.Browse, SWT.PUSH); browseResourceButton.setLayoutData(GridDataFactory.fillDefaults().create()); browseResourceButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final SelectDocumentInBonitaStudioRepository selectDocumentInBonitaStudioRepository = new SelectDocumentInBonitaStudioRepository(Display.getDefault().getActiveShell()); if (IDialogConstants.OK_ID == selectDocumentInBonitaStudioRepository.open()) { resourceText.setText( selectDocumentInBonitaStudioRepository.getSelectedDocument().getName()); } } }); return client; }
/* (non-Javadoc) * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object) */ @Override public Image getImage(Object element) { if (element instanceof ConnectorParameter) { return Pics.getImage(PicsConstants.dot); } if (element instanceof ConnectorParameter) { return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT); } return super.getImage(element); }
private void addDecorator(final Composite composite) { checkBoxDecoration = new ControlDecoration(checkBoxControl, SWT.RIGHT, composite); checkBoxDecoration.setImage(Pics.getImage(PicsConstants.hint)); refreshDecoration(); }
protected Control createMultipleResourceComposite( Section section, TabbedPropertySheetWidgetFactory widgetFactory) { final Composite client = widgetFactory.createComposite(section); client.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); client.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).create()); resourceTableViewer = new TableViewer(client, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL); resourceTableViewer .getControl() .setLayoutData( GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 60).create()); resourceTableViewer.setContentProvider(new ArrayContentProvider()); resourceTableViewer.setLabelProvider(new LabelProvider()); final ControlDecoration cd = new ControlDecoration(resourceTableViewer.getControl(), SWT.TOP | SWT.LEFT); cd.setImage(Pics.getImage(PicsConstants.hint)); cd.setDescriptionText(Messages.filewidget_resource_hint_multiple); final Composite buttonComposite = widgetFactory.createComposite(client); buttonComposite.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).create()); buttonComposite.setLayout( GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).spacing(0, 3).create()); final Button addResourceButton = widgetFactory.createButton(buttonComposite, Messages.Add, SWT.PUSH); addResourceButton.setLayoutData( GridDataFactory.fillDefaults().grab(true, false).hint(85, SWT.DEFAULT).create()); addResourceButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final SelectDocumentInBonitaStudioRepository selectDocumentInBonitaStudioRepository = new SelectDocumentInBonitaStudioRepository(Display.getDefault().getActiveShell()); if (IDialogConstants.OK_ID == selectDocumentInBonitaStudioRepository.open()) { editingDomain .getCommandStack() .execute( AddCommand.create( editingDomain, element, FormPackage.Literals.FILE_WIDGET__INTIAL_RESOURCE_LIST, selectDocumentInBonitaStudioRepository.getSelectedDocument().getName())); resourceTableViewer.refresh(); } } }); final Button removeResourceButton = widgetFactory.createButton(buttonComposite, Messages.Remove, SWT.PUSH); removeResourceButton.setLayoutData( GridDataFactory.fillDefaults().grab(true, false).hint(85, SWT.DEFAULT).create()); removeResourceButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { editingDomain .getCommandStack() .execute( RemoveCommand.create( editingDomain, element, FormPackage.Literals.FILE_WIDGET__INTIAL_RESOURCE_LIST, ((IStructuredSelection) resourceTableViewer.getSelection()).toList())); resourceTableViewer.refresh(); } }); resourceTableViewer.setInput( EMFEditProperties.list( editingDomain, FormPackage.Literals.FILE_WIDGET__INTIAL_RESOURCE_LIST) .observe(element)); return client; }