Java Code Examples for org.eclipse.jface.viewers.ComboViewer#setLabelProvider()

The following examples show how to use org.eclipse.jface.viewers.ComboViewer#setLabelProvider() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractActorsPropertySection.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createActorComboViewer(final Composite mainComposite) {
    actorComboViewer = new ComboViewer(mainComposite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY) ;
    actorComboViewer.getCombo().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()) ;
    actorComboViewer.setContentProvider(new ArrayContentProvider()) ;
    actorComboViewer.setLabelProvider(new LabelProvider(){
        @Override
        public String getText(final Object element) {
            if(element instanceof Actor){
                String doc = ((Actor) element).getDocumentation() ;
                if(doc != null && !doc.isEmpty()){
                    doc = " -- "+ doc ;
                }else{
                    doc = "" ;
                }
                return ((Actor) element).getName() + doc ;
            }
            return super.getText(element);
        }
    });
}
 
Example 2
Source File: MapChoiceControl.java    From depan with Apache License 2.0 6 votes vote down vote up
public MapChoiceControl(Composite parent) {
  super(parent, SWT.NONE);
  setLayout(new FillLayout());

  viewer = new ComboViewer(this, SWT.READ_ONLY | SWT.FLAT);
  viewer.setContentProvider(new ControlContentProvider());
  viewer.setLabelProvider(CONTROL_LABEL_PROVIDER);
  viewer.setComparator(new AlphabeticSorter(new ViewerObjectToString() {

      @Override
      public String getString(Object object) {
        return CONTROL_LABEL_PROVIDER.getText(object);
      }
    }));

  listener = new ControlSelectionChangedListener();
  viewer.addSelectionChangedListener(listener);
}
 
Example 3
Source File: ContextValueControl.java    From depan with Apache License 2.0 6 votes vote down vote up
public ContextValueControl(Composite parent) {
  super(parent, SWT.NONE);
  setLayout(new FillLayout());

  viewer = new ComboViewer(this, SWT.READ_ONLY | SWT.FLAT);
  viewer.setContentProvider(new ArrayContentProvider());
  viewer.setLabelProvider(CONTROL_LABEL_PROVIDER);
  viewer.setComparator(new AlphabeticSorter(new ViewerObjectToString() {

      @Override
      public String getString(Object object) {
        return CONTROL_LABEL_PROVIDER.getText(object);
      }
    }));

  viewer.setInput(ContextKey.Base.values());

  listener = new ControlSelectionChangedListener();
  viewer.addSelectionChangedListener(listener);
}
 
Example 4
Source File: TaskPriorityPropertySection.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public void createControl(Composite composite, TabbedPropertySheetWidgetFactory widgetFactory,
    ExtensibleGridPropertySection extensibleGridPropertySection) {
combo = new ComboViewer(composite);
combo.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
combo.setContentProvider(new ArrayContentProvider());
combo.setLabelProvider(new PriorityLabelProvider());
Object[] input = new Object[TaskPriority.values().length];
for (int i = 0; i < TaskPriority.values().length; i++) {
    input[i] = i;
}
combo.setInput(input);
combo.setSelection(new StructuredSelection(task.getPriority()));

combo.addPostSelectionChangedListener(new ISelectionChangedListener() {
    public void selectionChanged(SelectionChangedEvent event) {
	IStructuredSelection selection = (IStructuredSelection) event.getSelection();
	if (!selection.isEmpty()) {
	    Command setCommand = new SetCommand(editDomain, task, ProcessPackage.Literals.TASK__PRIORITY,
		    selection.getFirstElement());
	    editDomain.getCommandStack().execute(setCommand);
	}
    }
});
   }
 
Example 5
Source File: AppEngineStandardWizardPage.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Override
protected void createRuntimeField(Composite composite) {
  Label runtimeLabel = new Label(composite, SWT.LEAD);
  runtimeLabel.setText(Messages.getString("app.engine.standard.project.runtimetype")); //$NON-NLS-1$
  runtimeField = new ComboViewer(composite, SWT.READ_ONLY);
  runtimeField.setLabelProvider(new LabelProvider() {
    @Override
    public String getText(Object element) {
      return ((AppEngineRuntime) element).getLabel();
    }
  });
  runtimeField.setContentProvider(ArrayContentProvider.getInstance());
  runtimeField.setInput(AppEngineRuntime.STANDARD_RUNTIMES);
  runtimeField.setSelection(new StructuredSelection(DEFAULT_RUNTIME), true);
  runtimeField.addPostSelectionChangedListener(event -> revalidate());
}
 
Example 6
Source File: MiniSelector.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
private void create(Composite parent) {
  displayExecutor = DisplayExecutor.create(parent.getDisplay());
  comboViewer = new ComboViewer(parent, SWT.READ_ONLY | SWT.DROP_DOWN);
  comboViewer.setComparator(new ViewerComparator());
  comboViewer.setLabelProvider(new LabelProvider() {
    @Override
    public String getText(Object element) {
      if (element instanceof GcpProject) {
        GcpProject project = (GcpProject) element;
        return project.getName() + " (" + project.getId() + ")";
      }
      return super.getText(element);
    }
  });
  comboViewer.setContentProvider(ArrayContentProvider.getInstance());
  comboViewer.setInput(EMPTY_PROJECTS);
  parent.addDisposeListener(new DisposeListener() {
    @Override
    public void widgetDisposed(DisposeEvent event) {
      cancelFetch();
    }
  });

  fetch();
}
 
Example 7
Source File: ExcelFileSelectionWizardPage.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Create the top composite of the page
 * 
 * @param composite
 * @param label
 */
private void createTopComposite( Composite composite, Label label )
{
	FormData data = new FormData( );
	data.left = new FormAttachment( label, 5 );
	data.right = new FormAttachment( 40, -5 );
	worksheetsCombo = new ComboViewer( composite, SWT.BORDER
			| SWT.READ_ONLY );
	worksheetsCombo.getControl( ).setLayoutData( data );
	worksheetsCombo.setContentProvider( new ArrayContentProvider( ) );
	worksheetsCombo.addSelectionChangedListener( this );
	worksheetsCombo.setLabelProvider( new LabelProvider( ) {

		public String getText( Object element )
		{
			return getFileName( element );
		}
	} );
	data = new FormData( );
	data.left = new FormAttachment( worksheetsCombo.getControl( ), 5 );
	data.top = new FormAttachment( 0, 5 );
}
 
Example 8
Source File: ActivityTypeSelectionGridPropertySectionContribution.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createActivitySelectionCombo(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
    combo = new ComboViewer(parent, SWT.READ_ONLY);
    combo.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    combo.setContentProvider(new ArrayContentProvider());
    combo.setLabelProvider(new LabelProvider());
    combo.setInput(new String[]{ACTIVITY_TYPE__TASK,ACTIVITY_TYPE__SYSTEM,ACTIVITY_TYPE__CALL_ACTVITY,ACTIVITY_TYPE__RECEIVE_TASK,ACTIVITY_TYPE__SEND_TASK,ACTIVITY_TYPE__SERVICE_TASK,ACTIVITY_TYPE__SCRIPT_TASK});
    combo.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent arg0) {
            if (toBeConverted()) {
                EClass targetEClass = getTargetEClass();
                IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor() ;
                if(editor instanceof ProcessDiagramEditor){
                    node = (GraphicalEditPart) ((IStructuredSelection)((ProcessDiagramEditor)editor).getDiagramGraphicalViewer().getSelection()).getFirstElement() ;
		GMFTools.convert(targetEClass, node, new BonitaNodesElementTypeResolver(),GMFTools.PROCESS_DIAGRAM);
		for(IViewReference vr : PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences() ){
			if(vr.getId().startsWith("org.bonitasoft.studio.views.properties")){
				IViewPart viewPart = vr.getView(false) ;
				if(viewPart != null){
					IPropertySheetPage page = (IPropertySheetPage) viewPart.getAdapter(IPropertySheetPage.class);
					if(page != null){
						page.selectionChanged(editor, ((ProcessDiagramEditor)editor).getDiagramGraphicalViewer().getSelection());
					}
				}
			}
		}
                  }
            }

        }
    });


}
 
Example 9
Source File: CompilerBlock.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
public CompilerBlock(Composite root, int style) {
  super(root, style);

  setLayout(new FillLayout(SWT.HORIZONTAL));

  Composite parent = new Composite(this, SWT.NONE);
  parent.setLayout(new GridLayout(1, false));

  groupDevMode = SWTFactory.createGroup(parent, GROUP_COMPILER_TITLE, 2, 1, GridData.FILL_HORIZONTAL);

  // Log level
  Label label = SWTFactory.createLabel(groupDevMode, "Log level:", 1);
  GridData gd_label = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
  gd_label.widthHint = 101;
  label.setLayoutData(gd_label);
  logLevelComboViewer = new ComboViewer(groupDevMode, SWT.READ_ONLY);
  new Label(groupDevMode, SWT.NONE);
  logLevelComboViewer.setContentProvider(new ArrayContentProvider());
  logLevelComboViewer.setLabelProvider(new DefaultComboLabelProvider());
  logLevelComboViewer.setInput(LogLevelArgumentProcessor.LOG_LEVELS);
  logLevelComboViewer.addPostSelectionChangedListener(new ISelectionChangedListener() {
    @Override
    public void selectionChanged(SelectionChangedEvent event) {
      updateLaunchConfigHandler.updateLaunchConfig();
    }
  });
}
 
Example 10
Source File: DataSetBasePage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create the data set type viewer
 * 
 * @param composite
 */
private void createDataSetTypeViewer( Composite composite )
{
	// create the data set type chooser combo
	new Label( composite, SWT.RIGHT ).setText( Messages.getString( "dataset.wizard.label.datasetType" ) );//$NON-NLS-1$
	dataSetTypeChooser = new ComboViewer( composite, SWT.DROP_DOWN
			| SWT.READ_ONLY );
	dataSetTypeChooser.getControl( )
			.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	DataSetTypesProvider dataSetTypes = new DataSetTypesProvider( );
	dataSetTypeChooser.setContentProvider( dataSetTypes );
	dataSetTypeChooser.setLabelProvider( dataSetTypes );
	dataSetTypeChooser.getCombo( ).setEnabled( false );
}
 
Example 11
Source File: GWTCompileDialog.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private void createOutputStyleControl(Composite parent) {
  SWTFactory.createLabel(parent, "Output style:", 1);
  outputStyleComboViewer = new ComboViewer(parent, SWT.READ_ONLY);
  outputStyleComboViewer.setContentProvider(new ArrayContentProvider());
  outputStyleComboViewer.setLabelProvider(new DefaultComboLabelProvider());
  outputStyleComboViewer.setInput(GWTLaunchAttributes.OUTPUT_STYLES);
}
 
Example 12
Source File: FindingsDetailComposite.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public void createObservationComposite(){
	Label lblType = new Label(compositeType, SWT.NONE);
	lblType.setText("Datentyp");
	lblType.setLayoutData(minGd);
	comboInputData = new ComboViewer(compositeType, SWT.BORDER | SWT.READ_ONLY);
	ObservableListContentProvider contentProvider = new ObservableListContentProvider();
	comboInputData.setContentProvider(contentProvider);
	comboInputData.setLabelProvider(new ObservableMapLabelProvider(
		EMFProperties.value(ModelPackage.Literals.INPUT_DATA_NUMERIC__DATA_TYPE)
			.observeDetail(contentProvider.getKnownElements())));
	
	comboInputData.setContentProvider(ArrayContentProvider.getInstance());
	comboInputData.setLabelProvider(new ComboInputDataTypeLabelProvider());
	comboInputData.setInput(DataType.VALUES);
	
	compositeInputData = new Composite(compositeType, SWT.NONE);
	compositeInputData.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
	GridLayout gl = new GridLayout(2, false);
	gl.marginHeight = 0;
	gl.marginWidth = 0;
	compositeInputData.setLayout(gl);
	
	comboInputData.addSelectionChangedListener(new ISelectionChangedListener() {
		@Override
		public void selectionChanged(SelectionChangedEvent event){
			updateInputData(
				(DataType) ((StructuredSelection) event.getSelection()).getFirstElement());
			updateSize();
		}
	});
}
 
Example 13
Source File: NewCheckCatalogWizardPage.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the grammars controls.
 * 
 * @param composite
 *          the composite
 */
private void createGrammarsControls(final Composite composite) {
  Label generatorConfigLabel = new Label(composite, SWT.NONE);
  generatorConfigLabel.setText(Messages.GRAMMAR_FIELD_NAME_LABEL);

  Combo generatorConfigurationField = new Combo(composite, SWT.READ_ONLY);
  GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
  data.widthHint = PAGE_WIDTH_HINT; // prevents shrinking of combo view
  generatorConfigurationField.setLayoutData(data);
  generatorConfigurationField.setFont(composite.getFont());

  ComboViewer grammars = new ComboViewer(generatorConfigurationField);
  grammars.setContentProvider(new ArrayContentProvider());
  grammars.setLabelProvider(new LabelProvider() {
    @Override
    public String getText(final Object object) {
      if (object instanceof Grammar) {
        return new GrammarHelper((Grammar) object).getLabelName();
      }
      return super.getText(object);
    }
  });
  grammars.setInput(resourceUtil.getGrammars());

  // React to the selection of the viewer
  // Note that the viewer return the real object and not just a string
  // representation
  grammars.addSelectionChangedListener(new ISelectionChangedListener() {
    public void selectionChanged(final SelectionChangedEvent event) {
      if (event.getSelection() instanceof StructuredSelection) {
        grammar = (Grammar) ((StructuredSelection) event.getSelection()).getFirstElement();
        grammarStatus = validateGrammarAccess();
        handleFieldChanged(GRAMMAR);
      }
    }
  });
  grammars.setSelection(null); // no pre-defined grammar to be used, forces the user to make a decision about which language to target
}
 
Example 14
Source File: ScriptExpressionEditor.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected void createReturnTypeComposite(final Composite parent) {
    final Composite typeComposite = new Composite(parent, SWT.NONE);
    typeComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    final GridLayout gl = new GridLayout(3, false);
    gl.marginWidth = 0;
    gl.marginHeight = 0;
    typeComposite.setLayout(gl);

    final Label typeLabel = new Label(typeComposite, SWT.NONE);
    typeLabel.setText(Messages.returnType);
    typeLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).create());

    typeCombo = new ComboViewer(typeComposite, SWT.BORDER);
    typeCombo.getCombo().setLayoutData(
            GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).indent(10, 0).create());
    typeCombo.setContentProvider(new ExpressionReturnTypeContentProvider());
    typeCombo.setLabelProvider(new LabelProvider());
    typeCombo.setSorter(new ViewerSorter() {

        @Override
        public int compare(final Viewer viewer, final Object e1, final Object e2) {
            final String t1 = (String) e1;
            final String t2 = (String) e2;
            return t1.compareTo(t2);
        }
    });
    typeCombo.getCombo().addModifyListener(e -> fireSelectionChanged());

    browseClassesButton = new Button(typeComposite, SWT.PUSH);
    browseClassesButton.setText(Messages.browse);
    browseClassesButton.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).create());
    browseClassesButton.addListener(SWT.Selection, event -> openClassSelectionDialog());
}
 
Example 15
Source File: SelectPageWidgetDialog.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private Control createScriptEditorComposite(ScriptEditor widget) {
    final Composite mainComposite = new Composite(section, SWT.NONE);
    mainComposite.setLayoutData(GridDataFactory.fillDefaults()
            .grab(true, true).create());
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2)
            .margins(15, 0).create());

    final Label interpreterLabel = new Label(mainComposite, SWT.NONE);
    interpreterLabel.setLayoutData(GridDataFactory.fillDefaults()
            .align(SWT.END, SWT.CENTER).create());
    interpreterLabel.setText(Messages.interpreter + " *");

    final ComboViewer interpreterViewer = new ComboViewer(mainComposite,
            SWT.BORDER | SWT.READ_ONLY);
    interpreterViewer.getCombo().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    interpreterViewer.setContentProvider(new ArrayContentProvider());
    interpreterViewer.setLabelProvider(new LabelProvider());
    List<String> interpreters = new ArrayList<String>();
    for (IScriptLanguageProvider provider : ScriptLanguageService.getInstance().getScriptLanguageProviders()) {
        interpreters.add(provider.getLanguageName());
    }
    interpreterViewer.setInput(interpreters);
    context.bindValue(ViewersObservables.observeSingleSelection(interpreterViewer),
            EMFObservables.observeValue(widget,
                    ConnectorDefinitionPackage.Literals.SCRIPT_EDITOR__INTERPRETER));

    return mainComposite;
}
 
Example 16
Source File: RelationFieldDetailsControl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createRelationKindCombo() {
    ComboViewer relationComboViewer = new ComboViewer(this, SWT.BORDER | SWT.READ_ONLY);
    relationComboViewer.getControl()
            .setLayoutData(GridDataFactory.fillDefaults().hint(400, SWT.DEFAULT).indent(0, -5).create());
    relationComboViewer.setContentProvider(ArrayContentProvider.getInstance());
    relationComboViewer.setLabelProvider(new LabelProviderBuilder<RelationType>()
            .withTextProvider(type -> Objects.equals(type, RelationType.AGGREGATION)
                    ? Messages.aggregation
                    : Messages.composition)
            .createLabelProvider());
    relationComboViewer.setInput(RelationType.values());

    IObservableValue<RelationType> selection = ViewersObservables.observeSingleSelection(relationComboViewer);
    IObservableValue<RelationType> relationTypeObservable = EMFObservables.observeDetailValue(Realm.getDefault(),
            selectedFieldObservable, BusinessDataModelPackage.Literals.RELATION_FIELD__TYPE);

    relationTypeObservable.addValueChangeListener(e -> {
        if (selectedFieldObservable.getValue() != null && e.diff.getOldValue() != null && e.diff.getNewValue() != null) {
            RelationField oldValue = (RelationField) EcoreUtil.copy(selectedFieldObservable.getValue());
            oldValue.setType(e.diff.getOldValue());
            DiffElement diffElement = new DiffElement(Event.UPDATE_ATTRIBUTE_TYPE, oldValue,
                    selectedFieldObservable.getValue());
            diffElement.addProperty(AttributeEditionControl.PARENT_QUALIFIED_NAME,
                    formPage.observeBusinessObjectSelected().getValue().getQualifiedName());
            formPage.refactorAccessControl(diffElement);
        }
    });
    ctx.bindValue(selection, relationTypeObservable);
}
 
Example 17
Source File: GWTJUnitSettingsTab.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
protected void createGWTJUnitSettingsComponent(Composite parent) {
  Group group = SWTFactory.createGroup(parent, "GWT JUnit Settings", 2, 1,
      GridData.FILL_HORIZONTAL);

  SWTFactory.createLabel(group, "Log level:", 1);
  logLevelComboViewer = new ComboViewer(group, SWT.READ_ONLY);
  logLevelComboViewer.setContentProvider(new ArrayContentProvider());
  logLevelComboViewer.setLabelProvider(new DefaultComboLabelProvider());
  logLevelComboViewer.setInput(LogLevelArgumentProcessor.LOG_LEVELS);
  // logLevelComboViewer.setSelection(new StructuredSelection("DEBUG"));
  logLevelComboViewer.addSelectionChangedListener(settingChangedListener);

  SWTFactory.createLabel(group, "Output style:", 1);
  outputStyleComboViewer = new ComboViewer(group, SWT.READ_ONLY);
  outputStyleComboViewer.setContentProvider(new ArrayContentProvider());
  outputStyleComboViewer.setLabelProvider(new DefaultComboLabelProvider());
  outputStyleComboViewer.setInput(GWTLaunchConstants.OUTPUT_STYLES);
  // outputStyleComboViewer.setSelection(new StructuredSelection("PRETTY"));
  outputStyleComboViewer.addSelectionChangedListener(settingChangedListener);

  notHeadlessButton = SWTFactory.createCheckButton(group,
      "Display the log window and browser windows (useful for debugging)",
      null, true, 2);
  notHeadlessButton.addSelectionListener(settingChangedListener);

  webModeButton = SWTFactory.createCheckButton(group,
      "Run tests in production mode", null, false, 2);
  webModeButton.addSelectionListener(settingChangedListener);

  standardsModeButton = SWTFactory.createCheckButton(group,
      "Use standards mode", null, false, 2);
  standardsModeButton.addSelectionListener(settingChangedListener);
  GridData standardsModeButtonData = new GridData(SWT.BEGINNING,
      SWT.BEGINNING, false, false, 2, 1);
  standardsModeButton.setLayoutData(standardsModeButtonData);

  SWTFactory.createLabel(group, "Output directory:", 1);
  outputDirectoryField = new Text(group, SWT.BORDER);
  outputDirectoryField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  outputDirectoryField.addModifyListener(settingChangedListener);
}
 
Example 18
Source File: ConditionComposite.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
public ConditionComposite(ConditionCategory category, Composite parent, int style){
	super(parent, style);
	setLayout(new GridLayout(1, false));
	
	this.category = category;
	condition = Optional.empty();
	
	statusViewer = new ComboViewer(this);
	statusViewer.setContentProvider(new ArrayContentProvider());
	statusViewer.setInput(ConditionStatus.values());
	statusViewer.setLabelProvider(new LabelProvider() {
		@Override
		public String getText(Object element){
			if (element instanceof ConditionStatus) {
				return ((ConditionStatus) element).getLocalized();
			}
			return super.getText(element);
		}
	});
	
	startTxt = new Text(this, SWT.BORDER);
	startTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	startTxt.setMessage("Beginn Datum oder Beschreibung");
	
	endTxt = new Text(this, SWT.BORDER);
	endTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	endTxt.setMessage("Ende Datum oder Beschreibung");
	
	textOrCodingFolder = new TabFolder(this, SWT.NONE);
	
	TabItem textItem = new TabItem(textOrCodingFolder, SWT.NONE, 0);
	textItem.setText("Text");
	textTxt = new Text(textOrCodingFolder, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
	textItem.setControl(textTxt);
	
	TabItem codingItem = new TabItem(textOrCodingFolder, SWT.NONE, 1);
	codingItem.setText("Kodierung");
	codingComposite = new CodingListComposite(textOrCodingFolder, SWT.NONE);
	codingComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	codingItem.setControl(codingComposite);
	
	GridData folderGd = new GridData(GridData.FILL_BOTH);
	textOrCodingFolder.setLayoutData(folderGd);

	notesComposite = new NoteListComposite(this, SWT.NONE);
	notesComposite.showTitle(true);
	notesComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
	initDataBinding();
}
 
Example 19
Source File: MessageFlowContribution.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void createControl(final Composite mainComposite, TabbedPropertySheetWidgetFactory widgetFactory,
        ExtensibleGridPropertySection extensibleGridPropertySection) {
    chooseEventCombo = new ComboViewer(mainComposite, SWT.READ_ONLY);
    chooseEventCombo.getCombo().setLayoutData(GridDataFactory.fillDefaults().hint(200, SWT.DEFAULT).grab(true, false).create());
    chooseEventCombo.setContentProvider(new EMFListFeatureTreeContentProvider(ProcessPackage.Literals.THROW_MESSAGE_EVENT__EVENTS));
    chooseEventCombo.setLabelProvider(new EMFFeatureLabelProvider(ProcessPackage.Literals.ELEMENT__NAME));
    chooseEventCombo.setInput(messageFlow.getSource());

    if(messageFlow != null && chooseEventCombo !=null && !chooseEventCombo.getCombo().isDisposed()  && messageFlow.getName() != null){
        if(!(messageFlow.getSource() == null || messageFlow.getTarget() == null)){
            chooseEventCombo.setInput(messageFlow.getSource());

            Message foundEvent = ModelHelper.findEvent(messageFlow.getSource(), messageFlow.getTarget().getEvent());
            if(foundEvent != null){
                chooseEventCombo.setSelection(new StructuredSelection(foundEvent));
            }
            previousEvent = foundEvent ;
        }
    }

    chooseEventCombo.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            Message eventObject = (Message) ((StructuredSelection)event.getSelection()).getFirstElement();
            CompoundCommand cc = new CompoundCommand() ;
            cc.append(new SetCommand(editingDomain, messageFlow, ProcessPackage.Literals.ELEMENT__NAME, eventObject.getName()));
            cc.append(new SetCommand(editingDomain, messageFlow.getTarget(), ProcessPackage.Literals.ABSTRACT_CATCH_MESSAGE_EVENT__EVENT, eventObject.getName()));
            cc.append(new SetCommand(editingDomain,eventObject, ProcessPackage.Literals.MESSAGE__TARGET_ELEMENT_EXPRESSION,ExpressionHelper.createConstantExpression(messageFlow.getTarget().getName(), String.class.getName())));
            cc.append(new SetCommand(editingDomain,eventObject, ProcessPackage.Literals.MESSAGE__TARGET_PROCESS_EXPRESSION,ExpressionHelper.createConstantExpression(ModelHelper.getParentProcess(messageFlow.getTarget()).getName(),String.class.getName())));

            if(previousEvent != null && !previousEvent.equals(eventObject)){
                cc.append(new SetCommand(editingDomain,previousEvent, ProcessPackage.Literals.MESSAGE__TARGET_ELEMENT_EXPRESSION,null));
                cc.append(new SetCommand(editingDomain,previousEvent, ProcessPackage.Literals.MESSAGE__TARGET_PROCESS_EXPRESSION,null));
            }
            editingDomain.getCommandStack().execute(cc) ;
        }
    });

}
 
Example 20
Source File: SimpleFileSetsEditor.java    From eclipse-cs with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Control createContents(Composite parent) throws CheckstylePluginException {

  mController = new Controller();

  // group composite containing the config settings
  Group configArea = new Group(parent, SWT.NULL);
  configArea.setText(Messages.SimpleFileSetsEditor_titleSimpleConfig);
  configArea.setLayout(new FormLayout());

  this.mBtnManageConfigs = new Button(configArea, SWT.PUSH);
  this.mBtnManageConfigs.setText(Messages.SimpleFileSetsEditor_btnManageConfigs);
  this.mBtnManageConfigs.addSelectionListener(mController);
  FormData fd = new FormData();
  fd.top = new FormAttachment(0, 3);
  fd.right = new FormAttachment(100, -3);
  this.mBtnManageConfigs.setLayoutData(fd);

  mComboViewer = new ComboViewer(configArea);
  mComboViewer.getCombo().setVisibleItemCount(10);
  mComboViewer.setContentProvider(new CheckConfigurationContentProvider());
  mComboViewer.setLabelProvider(new CheckConfigurationLabelProvider());
  mComboViewer.setComparator(new CheckConfigurationViewerSorter());
  mComboViewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  mComboViewer.addSelectionChangedListener(mController);
  fd = new FormData();
  fd.left = new FormAttachment(0, 3);
  fd.top = new FormAttachment(0, 3);
  fd.right = new FormAttachment(mBtnManageConfigs, -3, SWT.LEFT);
  // fd.right = new FormAttachment(100, -3);
  mComboViewer.getCombo().setLayoutData(fd);

  // Description
  Label lblConfigDesc = new Label(configArea, SWT.LEFT);
  lblConfigDesc.setText(Messages.SimpleFileSetsEditor_lblDescription);
  fd = new FormData();
  fd.left = new FormAttachment(0, 3);
  fd.top = new FormAttachment(mComboViewer.getCombo(), 3, SWT.BOTTOM);
  fd.right = new FormAttachment(100, -3);
  lblConfigDesc.setLayoutData(fd);

  this.mTxtConfigDescription = new Text(configArea,
          SWT.LEFT | SWT.WRAP | SWT.MULTI | SWT.READ_ONLY | SWT.BORDER | SWT.VERTICAL);
  fd = new FormData();
  fd.left = new FormAttachment(0, 3);
  fd.top = new FormAttachment(lblConfigDesc, 0, SWT.BOTTOM);
  fd.right = new FormAttachment(100, -3);
  fd.bottom = new FormAttachment(100, -3);
  this.mTxtConfigDescription.setLayoutData(fd);

  // init the check configuration combo
  mComboViewer.setInput(mPropertyPage.getProjectConfigurationWorkingCopy());
  if (mDefaultFileSet.getCheckConfig() != null) {
    mComboViewer.setSelection(new StructuredSelection(mDefaultFileSet.getCheckConfig()));
  }

  return configArea;
}