org.eclipse.core.databinding.observable.Realm Java Examples

The following examples show how to use org.eclipse.core.databinding.observable.Realm. 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: FactoryImpl.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void init ( final Realm realm )
{
    this.realm = realm;
    this.list = new WritableList ();

    for ( final String name : this.names )
    {
        try
        {
            this.list.add ( new SunMSCAPIProvider ( this.realm, name ) );
        }
        catch ( final Exception e )
        {
            StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ) );
        }
    }
}
 
Example #2
Source File: FieldDetailsControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public FieldDetailsControl(Composite parent, BusinessDataModelFormPage formPage,
        IObservableValue<Field> selectedFieldObservable, DataBindingContext ctx) {
    super(parent, SWT.None);
    this.formPage = formPage;
    this.ctx = ctx;
    this.selectedFieldObservable = selectedFieldObservable;
    this.descriptionObservable = EMFObservables.observeDetailValue(Realm.getDefault(),
            selectedFieldObservable, BusinessDataModelPackage.Literals.FIELD__DESCRIPTION);
    formPage.getToolkit().adapt(this);

    stackLayout = new CustomStackLayout(this);
    setLayout(stackLayout);
    setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    createStringFieldDetailsComposite(ctx);
    createDateDeprecatedDetailsComposite();
    createDateOnlyDetailsComposite();
    createDateTimeComposite();
    createDateTimeInTimeZoneComposite();
    createTextFieldComposite();
    createRelationFieldComposite(ctx);
    createNoDetailsComposite();

    selectedFieldObservable.addValueChangeListener(e -> updateTopControl());
}
 
Example #3
Source File: UsersWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createGeneralLastNameField(final Composite detailsInfoComposite) {
    final Label lastName = new Label(detailsInfoComposite, SWT.NONE);
    lastName.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).create());
    lastName.setText(Messages.lastName);

    final Text lastNameText = new Text(detailsInfoComposite, SWT.BORDER);
    lastNameText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    lastNameText.setMessage(Messages.lastNameHint);

    final IObservableValue lastNameUserValue = EMFObservables.observeDetailValue(Realm.getDefault(),
            userSingleSelectionObservable,
            OrganizationPackage.Literals.USER__LAST_NAME);
    context.bindValue(SWTObservables.observeText(lastNameText, SWT.Modify), lastNameUserValue);

    lastNameUserValue.addValueChangeListener(new IValueChangeListener() {

        @Override
        public void handleValueChange(final ValueChangeEvent event) {
            handleLastNameChange(event);
        }
    });
}
 
Example #4
Source File: QueryContentProvider.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
    if (newInput instanceof IObservableValue) {
        input = (IObservableValue<BusinessObject>) newInput;
        customQueries = EMFObservables.observeDetailList(Realm.getDefault(), input,
                BusinessDataModelPackage.Literals.BUSINESS_OBJECT__QUERIES);
        defaultQueries = EMFObservables.observeDetailList(Realm.getDefault(), input,
                BusinessDataModelPackage.Literals.BUSINESS_OBJECT__DEFAULT_QUERIES);
        input.addValueChangeListener(e -> {
            viewer.setSelection(new StructuredSelection());
            viewer.refresh();
        });
        viewer.refresh();
    } else if (newInput != null) {
        throw new IllegalArgumentException("Expecting an input of type IobservableValue<BusinessObject>");
    }
}
 
Example #5
Source File: ContractPropertySection.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createConstraintTabContent(final Composite parent, final IObservableValue observeContractValue) {
    final Composite buttonsComposite = createButtonContainer(parent);
    final Button addButton = createButton(buttonsComposite, Messages.add);
    final Button upButton = createButton(buttonsComposite, Messages.up);
    final Button downButton = createButton(buttonsComposite, Messages.down);
    final Button removeButton = createButton(buttonsComposite, Messages.remove);

    final ContractConstraintsTableViewer constraintsTableViewer = new ContractConstraintsTableViewer(parent,
            getWidgetFactory());
    constraintsTableViewer.getControl()
            .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(500, SWT.DEFAULT).create());
    constraintsTableViewer.initialize(constraintController, getMessageManager(), context);
    constraintsTableViewer.setInput(CustomEMFEditObservables.observeDetailList(Realm.getDefault(), observeContractValue,
            ProcessPackage.Literals.CONTRACT__CONSTRAINTS));

    constraintsTableViewer.createAddListener(addButton);
    constraintsTableViewer.createMoveUpListener(upButton);
    constraintsTableViewer.createMoveDownListener(downButton);
    constraintsTableViewer.createRemoveListener(removeButton);

    bindAddConstraintButtonEnablement(addButton, observeContractValue);
    bindRemoveButtonEnablement(removeButton, constraintsTableViewer);
    bindUpButtonEnablement(upButton, constraintsTableViewer);
    bindDownButtonEnablement(downButton, constraintsTableViewer);
}
 
Example #6
Source File: RolesWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createDescriptionField(final Group group) {
    final Label descriptionLabel = new Label(group, SWT.NONE);
    descriptionLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).create());
    descriptionLabel.setText(Messages.description);

    final Text roleDescriptionText = new Text(group, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
    roleDescriptionText
            .setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 80).create());
    roleDescriptionText.setMessage(Messages.descriptionHint);
    roleDescriptionText.setTextLimit(255);

    final IObservableValue roleDescriptionValue = EMFObservables.observeDetailValue(Realm.getDefault(),
            roleSingleSelectionObservable, OrganizationPackage.Literals.ROLE__DESCRIPTION);
    context.bindValue(SWTObservables.observeText(roleDescriptionText, SWT.Modify), roleDescriptionValue);
    roleDescriptionValue.addValueChangeListener(new IValueChangeListener() {

        @Override
        public void handleValueChange(final ValueChangeEvent event) {
            handleRoleDescriptionChange(event);
        }
    });
}
 
Example #7
Source File: IndexControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public IndexControl(Composite parent,
        AbstractBdmFormPage formPage,
        DataBindingContext ctx) {

    this.indexableFieldFilter = new IndexableFieldFilter();
    this.formPage = formPage;
    this.selectedBoObservable = formPage.observeBusinessObjectSelected();

    this.indexObservable = EMFObservables.observeDetailList(Realm.getDefault(), selectedBoObservable,
            BusinessDataModelPackage.Literals.BUSINESS_OBJECT__INDEXES);
    this.actualsFieldsObservable = EMFObservables.observeDetailList(Realm.getDefault(), selectedBoObservable,
            BusinessDataModelPackage.Literals.BUSINESS_OBJECT__FIELDS);

    this.mainComposite = formPage.getToolkit().createComposite(parent);
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create());
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    createIndexDefinitionSection();
    createIndexEditionComposite(ctx);
    enableButtons(ctx);

    EMFObservables.observeDetailList(Realm.getDefault(), selectedIndexObservable,
            BusinessDataModelPackage.Literals.INDEX__FIELD_NAMES).addChangeListener(e -> indexViewer.refresh());
}
 
Example #8
Source File: CreateContractInputFromBusinessObjectWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public void setTitle() {
    if (selectedDataObservable.getValue() != null) {
        setTitle(Messages.bind(Messages.selectFieldToGenerateTitle,
                ((Element) selectedDataObservable.getValue()).getName()));
        EMFObservables
                .observeDetailValue(Realm.getDefault(), selectedDataObservable,
                        ProcessPackage.Literals.ELEMENT__NAME)
                .addValueChangeListener(
                        new IValueChangeListener() {

                            @Override
                            public void handleValueChange(final ValueChangeEvent event) {
                                setTitle(Messages.bind(Messages.selectFieldToGenerateTitle,
                                        event.diff.getNewValue()));
                            }
                        });
    }
}
 
Example #9
Source File: QueryExpressionEditor.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createQueryTextContent(final Composite composite, final EMFDataBindingContext ctx) {
    final Composite queryContentComposite = new Composite(composite, SWT.NONE);
    queryContentComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).create());
    queryContentComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).spacing(0, 2).create());

    final Label queryContentLabel = new Label(queryContentComposite, SWT.NONE);
    queryContentLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(2, 1).create());
    queryContentLabel.setText(Messages.queryContent);

    final Text queryContentText = new Text(queryContentComposite,
            SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL | SWT.WRAP | SWT.MULTI);
    queryContentText.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 80).create());
    ctx.bindValue(SWTObservables.observeText(queryContentText),
            EMFObservables.observeDetailValue(Realm.getDefault(), observeQuerySingleSelection,
                    ExpressionPackage.Literals.EXPRESSION__CONTENT));
}
 
Example #10
Source File: ContractConstraintsTableViewerTest.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @throws java.lang.Exception
 */
@Before
public void setUp() throws Exception {
    parent = realm.createComposite();
    FileActionDialog.setDisablePopup(true);
    viewer = new ContractConstraintsTableViewer(parent, new FormToolkit(parent.getDisplay()));
    final ContractConstraintController inputController = new ContractConstraintController(new WritableValue(aContract()
            .build(), Contract.class));
    viewer.initialize(inputController, messageManager, new EMFDataBindingContext());
    final Contract contract = ProcessFactory.eINSTANCE.createContract();
    final ContractInput input = ProcessFactory.eINSTANCE.createContractInput();
    input.setName("name");
    input.setType(ContractInputType.TEXT);
    contract.getInputs().add(input);
    constraint = ProcessFactory.eINSTANCE.createContractConstraint();
    constraint.setName("c1");
    constraint2 = ProcessFactory.eINSTANCE.createContractConstraint();
    constraint2.setName("c2");
    contract.getConstraints().add(constraint);
    contract.getConstraints().add(constraint2);
    viewer.setInput(EMFObservables.observeList(Realm.getDefault(), contract, ProcessPackage.Literals.CONTRACT__CONSTRAINTS));
}
 
Example #11
Source File: FormattedTextObservableValue.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public FormattedTextObservableValue(final Realm realm, final FormattedText formattedText, int updateEventType) {
	super(realm);

	boolean eventValid = false;
	for (int i = 0; !eventValid && i < validUpdateEventTypes.length; i++) {
		eventValid = (updateEventType == validUpdateEventTypes[i]);
	}
	if ( ! eventValid ) {
		throw new IllegalArgumentException(
				"UpdateEventType [" + updateEventType + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
	}

	this.formattedText = formattedText;
	this.updateEventType = updateEventType;
	if ( updateEventType != SWT.None ) {
		formattedText.getControl().addListener(updateEventType, updateListener);
	}

	formattedText.getControl().addDisposeListener(disposeListener);
}
 
Example #12
Source File: DateChooserObservableValue.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public DateChooserObservableValue(final Realm realm, final DateChooser dateChooser, int updateEventType) {
	super(realm);

	boolean eventValid = false;
	for (int i = 0; !eventValid && i < validUpdateEventTypes.length; i++) {
		eventValid = (updateEventType == validUpdateEventTypes[i]);
	}
	if ( ! eventValid ) {
		throw new IllegalArgumentException(
				"UpdateEventType [" + updateEventType + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
	}

	this.dateChooser = dateChooser;
	this.updateEventType = updateEventType;
	if ( updateEventType != SWT.None ) {
		dateChooser.addListener(updateEventType, updateListener);
	}

	dateChooser.addDisposeListener(disposeListener);
}
 
Example #13
Source File: DateChooserComboObservableValue.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public DateChooserComboObservableValue(final Realm realm, final DateChooserCombo combo, int updateEventType) {
	super(realm);

	boolean eventValid = false;
	for (int i = 0; !eventValid && i < validUpdateEventTypes.length; i++) {
		eventValid = (updateEventType == validUpdateEventTypes[i]);
	}
	if ( ! eventValid ) {
		throw new IllegalArgumentException(
				"UpdateEventType [" + updateEventType + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$
	}

	this.combo = combo;
	this.updateEventType = updateEventType;
	if ( updateEventType != SWT.None ) {
		combo.addListener(updateEventType, updateListener);
	}

	combo.addDisposeListener(disposeListener);
}
 
Example #14
Source File: RadioGroupViewerSnippet01.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public static void main(String[] arrrrgs) {
	final Display display = new Display();

	Realm.runWithDefault(SWTObservables.getRealm(display), new Runnable() {
		public void run() {
			Shell shell = createShell();

			shell.open();
			while (!shell.isDisposed())
				if (!display.readAndDispatch())
					display.sleep();

			display.dispose();
		}
	});
}
 
Example #15
Source File: DataItemObservableValue.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
public DataItemObservableValue ( final BundleContext context, final String connectionId, final String itemId, final InvalidValuePolicy invalidValuePolicy, Realm realm )
{
	super ( realm );
    this.invalidValuePolicy = invalidValuePolicy;
    this.itemId = itemId;
    final Listener listener = new Listener () {

        @Override
        public void setConnection ( final ConnectionService connectionService )
        {
            bind ( connectionService );
        }
    };
    this.tracker = new ConnectionIdTracker ( context, connectionId, listener, org.eclipse.scada.da.connection.provider.ConnectionService.class );
    this.tracker.open ();
}
 
Example #16
Source File: ConstraintEditionControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createConstraintDescriptionSection(Composite parent, DataBindingContext ctx) {
    Section section = formPage.getToolkit().createSection(parent, Section.EXPANDED);
    section.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    section.setLayout(GridLayoutFactory.fillDefaults().create());
    section.setText(Messages.description);

    Composite client = formPage.getToolkit().createComposite(section);
    client.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    client.setLayout(GridLayoutFactory.fillDefaults().margins(10, 10).create());

    IObservableValue descriptionObservable = EMFObservables.observeDetailValue(Realm.getDefault(),
            selectedConstraintObservable, BusinessDataModelPackage.Literals.UNIQUE_CONSTRAINT__DESCRIPTION);

    new TextAreaWidget.Builder()
            .widthHint(500)
            .heightHint(70)
            .bindTo(descriptionObservable)
            .inContext(ctx)
            .adapt(formPage.getToolkit())
            .createIn(client);

    section.setClient(client);
}
 
Example #17
Source File: DataViewer.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public void bindControl(final DataBindingContext context, final IObservableValue dataContainerObservable) {
    this.dataContainerObservable = dataContainerObservable;
    IObservableSet knownElements = ((ObservableListContentProvider) tableViewer.getContentProvider())
            .getKnownElements();
    IObservableMap[] labelMaps = EMFObservables.observeMaps(knownElements,
            new EStructuralFeature[] { ProcessPackage.Literals.ELEMENT__NAME,
                    ProcessPackage.Literals.DATA__MULTIPLE,
                    ProcessPackage.Literals.JAVA_OBJECT_DATA__CLASS_NAME, ProcessPackage.Literals.DATA__DATA_TYPE });
    tableViewer.setLabelProvider(createLabelProvider(labelMaps));
    tableViewer.setInput(CustomEMFEditObservables.observeDetailList(Realm.getDefault(), dataContainerObservable,
            dataFeature));

    IViewerObservableValue<Object> selectionObservable = ViewerProperties.singleSelection().observe(tableViewer);
    UpdateValueStrategy selectionNotNullUpdateValueStrategy = updateValueStrategy().withConverter(selectionNotNull())
            .create();

    context.bindValue(WidgetProperties.enabled().observe(editButton),
            selectionObservable,
            neverUpdateValueStrategy().create(),
            selectionNotNullUpdateValueStrategy);

    context.bindValue(WidgetProperties.enabled().observe(removeButton),
            selectionObservable,
            neverUpdateValueStrategy().create(),
            selectionNotNullUpdateValueStrategy);
}
 
Example #18
Source File: ExpressionViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected IObservableValue getExpressionContentObservable() {
    IObservableValue returnContentObservable;
    final EditingDomain editingDomain = getEditingDomain();
    if (editingDomain != null) {
        returnContentObservable = CustomEMFEditObservables.observeDetailValue(Realm.getDefault(),
                getSelectedExpressionObservable(),
                ExpressionPackage.Literals.EXPRESSION__CONTENT);
    } else {
        returnContentObservable = EMFObservables.observeDetailValue(Realm.getDefault(),
                getSelectedExpressionObservable(),
                ExpressionPackage.Literals.EXPRESSION__CONTENT);
    }
    return returnContentObservable;
}
 
Example #19
Source File: ExpressionViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected IObservableValue getExpressionReturnTypeObservable() {
    IObservableValue returnTypeObservable;
    final EditingDomain editingDomain = getEditingDomain();
    if (editingDomain != null) {
        returnTypeObservable = CustomEMFEditObservables.observeDetailValue(Realm.getDefault(),
                getSelectedExpressionObservable(),
                ExpressionPackage.Literals.EXPRESSION__RETURN_TYPE);
    } else {
        returnTypeObservable = EMFObservables.observeDetailValue(Realm.getDefault(), getSelectedExpressionObservable(),
                ExpressionPackage.Literals.EXPRESSION__RETURN_TYPE);
    }
    return returnTypeObservable;
}
 
Example #20
Source File: ExpressionViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected IObservableValue getExpressionTypeObservable() {
    IObservableValue nameObservable;
    final EditingDomain editingDomain = getEditingDomain();
    if (editingDomain != null) {
        nameObservable = CustomEMFEditObservables.observeDetailValue(Realm.getDefault(),
                getSelectedExpressionObservable(),
                ExpressionPackage.Literals.EXPRESSION__TYPE);
    } else {
        nameObservable = EMFObservables.observeDetailValue(Realm.getDefault(), getSelectedExpressionObservable(),
                ExpressionPackage.Literals.EXPRESSION__TYPE);
    }
    return nameObservable;
}
 
Example #21
Source File: ConfigurationEditorInput.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
protected void handleSetResult ( final ConfigurationInformation configurationInformation )
{
    final Realm realm = this.dataMap.getRealm ();
    realm.asyncExec ( new Runnable () {
        @Override
        public void run ()
        {
            if ( !ConfigurationEditorInput.this.dataMap.isDisposed () )
            {
                setResult ( configurationInformation );
            }
        }
    } );
}
 
Example #22
Source File: QueryDetailsControl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected void createParametersTable(Composite parent) {
    parametersTableViewer = new TableViewer(parent,
            SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI);
    parametersTableViewer.getControl()
            .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).create());
    parametersTableViewer.getTable().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, QUERY_PARAMETERS_VIEWER_ID);
    ColumnViewerToolTipSupport.enableFor(parametersTableViewer);
    parametersTableViewer.getTable().setHeaderVisible(true);
    parametersTableViewer.setContentProvider(new ObservableListContentProvider());
    parametersTableViewer.addFilter(createSearchFilter());

    TableLayout tableLayout = new TableLayout();
    tableLayout.addColumnData(new ColumnWeightData(1));
    tableLayout.addColumnData(new ColumnWeightData(1));
    tableLayout.addColumnData(new ColumnWeightData(2));
    parametersTableViewer.getTable().setLayout(tableLayout);

    createNameColumn(parametersTableViewer);
    createTypeColumn(parametersTableViewer);
    createDescriptionColumn(parametersTableViewer);

    selectedQueryParameterObservableList = EMFObservables.observeDetailList(Realm.getDefault(),
            querySelectedObservable,
            BusinessDataModelPackage.Literals.QUERY__QUERY_PARAMETERS);
    parametersMultipleSelectionObservable = ViewerProperties.multipleSelection(QueryParameter.class)
            .observe(parametersTableViewer);
    parametersTableViewer.setInput(selectedQueryParameterObservableList);
}
 
Example #23
Source File: ContractInputObservableFactoryTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void should_createObservable_return_contract_input_observable_list() throws Exception {
    final WritableValue contractObservable = new WritableValue(Realm.getDefault());
    contractObservable.setValue(ProcessFactory.eINSTANCE.createContract());
    final IObservable observable = contractInputObservableFactory.createObservable(contractObservable);
    assertThat(observable).isInstanceOf(IObservableList.class);
    assertThat(((IObservableList) observable).getElementType()).isEqualTo(ProcessPackage.Literals.CONTRACT__INPUTS);
}
 
Example #24
Source File: ExpressionViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected IObservableValue getExpressionNameObservable() {
    IObservableValue nameObservable;
    final EditingDomain editingDomain = getEditingDomain();
    if (editingDomain != null) {
        nameObservable = CustomEMFEditObservables.observeDetailValue(Realm.getDefault(),
                getSelectedExpressionObservable(),
                ExpressionPackage.Literals.EXPRESSION__NAME);
    } else {
        nameObservable = EMFObservables.observeDetailValue(Realm.getDefault(), getSelectedExpressionObservable(),
                ExpressionPackage.Literals.EXPRESSION__NAME);
    }
    return nameObservable;
}
 
Example #25
Source File: ContractPropertySection.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void createContent(final Composite parent) {
    final IObservableValue observeContractValue = CustomEMFEditObservables.observeDetailValue(Realm.getDefault(),
            ViewersObservables.observeSingleSelection(selectionProvider),
            ProcessPackage.Literals.CONTRACT_CONTAINER__CONTRACT);
    init(observeContractValue);

    final CTabFolder tabFolder = getWidgetFactory().createTabFolder(parent, SWT.TOP);
    tabFolder.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    getWidgetFactory().adapt(tabFolder);

    final CTabItem inputTabItem = getWidgetFactory().createTabItem(tabFolder, SWT.NULL);
    inputTabItem.setText(Messages.inputTabLabel);
    final Composite inputComposite = getWidgetFactory().createComposite(tabFolder);
    inputComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    inputComposite.setLayout(GridLayoutFactory.fillDefaults().margins(15, 10).numColumns(2).extendedMargins(5, 0, 0, 5)
                    .spacing(LayoutConstants.getSpacing().x, 15).create());

    createInputTabContent(inputComposite, observeContractValue);

    inputTabItem.setControl(inputComposite);

    final Composite constraintComposite = getWidgetFactory().createComposite(tabFolder);
    constraintComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    constraintComposite.setLayout(GridLayoutFactory.fillDefaults().margins(15, 10).numColumns(2).extendedMargins(5, 0, 0, 5)
            .spacing(LayoutConstants.getSpacing().x, 15).create());

    createConstraintTabContent(constraintComposite, observeContractValue);

    final CTabItem constraintTabItem = getWidgetFactory().createTabItem(tabFolder, SWT.NULL);
    constraintTabItem.setText(Messages.constraintsTabLabel);
    constraintTabItem.setControl(constraintComposite);
    tabFolder.setSelection(0);
}
 
Example #26
Source File: Helper.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public Master ( final Realm realm, final MasterServer master, final Component component )
{
    this.master = master;
    this.entries = new WritableSet ( realm );

    fillWithEntries ( component, this.entries );
}
 
Example #27
Source File: EMFEditWithRefactorObservables.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public static IObservableFactory valueWithRefactorFactory(final Realm realm, final EStructuralFeature eStructuralFeature, IRefactorOperationFactory refactorOperationFactory,
        IProgressService progressService) {
    return new IObservableFactory()
    {

        @Override
        public IObservable createObservable(final Object target)
        {
            final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(target);
            return new ObservableValueWithRefactor(editingDomain, (EObject) target, eStructuralFeature, refactorOperationFactory, progressService);
        }
    };
}
 
Example #28
Source File: ContractInputObservableFactory.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public IObservable createObservable(final Object target) {
    if (target instanceof IObservableValue) {
        return CustomEMFEditObservables.observeDetailList(Realm.getDefault(), (IObservableValue) target, ProcessPackage.Literals.CONTRACT__INPUTS);
    } else if (target instanceof ContractInput) {
        return CustomEMFEditObservables.observeList(Realm.getDefault(), (ContractInput) target, ProcessPackage.Literals.CONTRACT_INPUT__INPUTS);
    }
    return null;
}
 
Example #29
Source File: ContextCreator.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public ContextCreator ( final Realm realm, final LoginContext loginContext, final ContextCreatorListener listener, final ContextCreatorResultListener resultListener )
{
    this.realm = realm;
    this.context = loginContext;
    this.listener = listener;
    this.resultListener = resultListener;
}
 
Example #30
Source File: ContractPropertySection.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected void bindAddChildButtonEnablement(final Button button, final Viewer viewer) {
    context.bindValue(WidgetProperties.enabled().observe(button),
            ViewersObservables.observeSingleSelection(viewer),
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
            emptySelectionAndComplexTypeToBooleanStrategy());

    context.bindValue(
            WidgetProperties.enabled().observe(button),
            EMFObservables.observeDetailValue(Realm.getDefault(), ViewersObservables.observeSingleSelection(viewer),
                    ProcessPackage.Literals.CONTRACT_INPUT__TYPE),
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
            complexTypeToBooleanStrategy());
}