@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);
 }
 public ExportBarWizard() {
   setDefaultPageImageDescriptor(Pics.getWizban());
   setNeedsProgressMonitor(true);
   IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
   IDialogSettings wizardSettings = workbenchSettings.getSection("ExportBarWizard"); // $NON-NLS-1$
   if (wizardSettings == null) {
     wizardSettings = workbenchSettings.addNewSection("ExportBarWizard"); // $NON-NLS-1$
   }
   setDialogSettings(wizardSettings);
   setWindowTitle(Messages.buildTitle);
 }
  /**
   * @param element
   * @param container
   * @param simulationData
   */
  public AddSimulationDataWizardPage(
      SimulationDataContainer element, SimulationData simulationData) {
    super("add simulation data");
    this.element = element;
    data = simulationData;
    setTitle(Messages.AddSimulationDataWizardPage_title);
    this.setMessage(Messages.AddSimulationDataWizardPage_msg);
    setImageDescriptor(Pics.getWizban());
    if (data != null) {
      dataClass = data.eClass();
      dataDescription = data.getDescription();
      dataName = data.getName();
      if (data.getExpression() == null) {
        dataExpression = ExpressionFactory.eINSTANCE.createExpression();
      } else {
        dataExpression = EcoreUtil.copy(data.getExpression());
      }

      setExpressionBased(data.isExpressionBased());

      if (data instanceof SimulationBoolean) {
        probabilityOfTrue = ((SimulationBoolean) data).getProbabilityOfTrue();
      }
      if (data instanceof SimulationNumberData) {
        for (SimulationNumberRange range : ((SimulationNumberData) data).getRanges()) {
          ranges.add(EcoreUtil.copy(range));
        }
      }
      if (data instanceof SimulationLiteralData) {
        for (SimulationLiteral literal : ((SimulationLiteralData) data).getLiterals()) {
          literals.add(EcoreUtil.copy(literal));
        }
      }
    } else {
      dataExpression = ExpressionFactory.eINSTANCE.createExpression();
      dataName = generateDataName();
    }
  }
 private void addDecorator(final Composite composite) {
   checkBoxDecoration = new ControlDecoration(checkBoxControl, SWT.RIGHT, composite);
   checkBoxDecoration.setImage(Pics.getImage(PicsConstants.hint));
   refreshDecoration();
 }
 public ImportParametersAction() {
   setText(Messages.parameters);
   setImageDescriptor(Pics.getImageDescriptor(PicsConstants.parameter));
 }
Esempio n. 8
0
 private void initDataWizard(
     EStructuralFeature dataContainmentFeature, boolean showAutogenerateForm) {
   setDefaultPageImageDescriptor(Pics.getWizban());
   this.dataContainmentFeature = dataContainmentFeature; // the default add data on this feature
   this.showAutogenerateForm = showAutogenerateForm;
 }
  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;
  }