Search in sources :

Example 41 with PropertiesEditionEvent

use of org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent in project InformationSystem by ObeoNetwork.

the class ColumnPropertiesEditionPartForm method createLiteralsMultiValuedEditor.

/**
 */
protected Composite createLiteralsMultiValuedEditor(FormToolkit widgetFactory, Composite parent) {
    // $NON-NLS-1$
    literals = widgetFactory.createText(parent, "", SWT.READ_ONLY);
    GridData literalsData = new GridData(GridData.FILL_HORIZONTAL);
    literalsData.horizontalSpan = 2;
    literals.setLayoutData(literalsData);
    EditingUtils.setID(literals, DatabaseViewsRepository.Column.Properties.literals);
    // $NON-NLS-1$
    EditingUtils.setEEFtype(literals, "eef::MultiValuedEditor::field");
    editLiterals = widgetFactory.createButton(parent, getDescription(DatabaseViewsRepository.Column.Properties.literals, DatabaseMessages.ColumnPropertiesEditionPart_LiteralsLabel), SWT.NONE);
    GridData editLiteralsData = new GridData();
    editLiterals.setLayoutData(editLiteralsData);
    editLiterals.addSelectionListener(new SelectionAdapter() {

        /**
         * {@inheritDoc}
         *
         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        public void widgetSelected(SelectionEvent e) {
            EEFFeatureEditorDialog dialog = new EEFFeatureEditorDialog(// $NON-NLS-1$
            literals.getShell(), // $NON-NLS-1$
            "Column", // $NON-NLS-1$
            new AdapterFactoryLabelProvider(adapterFactory), literalsList, TypesLibraryPackage.eINSTANCE.getTypeInstance_Literals().getEType(), null, false, true, null, null);
            if (dialog.open() == Window.OK) {
                literalsList = dialog.getResult();
                if (literalsList == null) {
                    literalsList = new BasicEList();
                }
                literals.setText(literalsList.toString());
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ColumnPropertiesEditionPartForm.this, DatabaseViewsRepository.Column.Properties.literals, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, new BasicEList(literalsList)));
                setHasChanged(true);
            }
        }
    });
    EditingUtils.setID(editLiterals, DatabaseViewsRepository.Column.Properties.literals);
    // $NON-NLS-1$
    EditingUtils.setEEFtype(editLiterals, "eef::MultiValuedEditor::browsebutton");
    // End of user code
    return parent;
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) BasicEList(org.eclipse.emf.common.util.BasicEList) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) AdapterFactoryLabelProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider) IPropertiesEditionEvent(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent) PropertiesEditionEvent(org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent) EEFFeatureEditorDialog(org.eclipse.emf.eef.runtime.ui.widgets.EEFFeatureEditorDialog)

Example 42 with PropertiesEditionEvent

use of org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent in project InformationSystem by ObeoNetwork.

the class ColumnPropertiesEditionPartForm method createUniqueCheckbox.

protected Composite createUniqueCheckbox(FormToolkit widgetFactory, Composite parent) {
    unique = widgetFactory.createButton(parent, getDescription(DatabaseViewsRepository.Column.Properties.NullablePkAndUnique.unique, DatabaseMessages.ColumnPropertiesEditionPart_UniqueLabel), SWT.CHECK);
    unique.addSelectionListener(new SelectionAdapter() {

        /**
         * {@inheritDoc}
         *
         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        public void widgetSelected(SelectionEvent e) {
            if (propertiesEditionComponent != null)
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ColumnPropertiesEditionPartForm.this, DatabaseViewsRepository.Column.Properties.NullablePkAndUnique.unique, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, new Boolean(unique.getSelection())));
        }
    });
    GridData uniqueData = new GridData(GridData.FILL_HORIZONTAL);
    uniqueData.horizontalSpan = 2;
    unique.setLayoutData(uniqueData);
    EditingUtils.setID(unique, DatabaseViewsRepository.Column.Properties.NullablePkAndUnique.unique);
    // $NON-NLS-1$
    EditingUtils.setEEFtype(unique, "eef::Checkbox");
    // $NON-NLS-1$
    FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(DatabaseViewsRepository.Column.Properties.NullablePkAndUnique.unique, DatabaseViewsRepository.FORM_KIND), null);
    // End of user code
    return parent;
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) IPropertiesEditionEvent(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent) PropertiesEditionEvent(org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent)

Example 43 with PropertiesEditionEvent

use of org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent in project InformationSystem by ObeoNetwork.

the class ConstraintPropertiesEditionPartForm method createCommentsTextarea.

protected Composite createCommentsTextarea(FormToolkit widgetFactory, Composite parent) {
    Label commentsLabel = createDescription(parent, DatabaseViewsRepository.Constraint.Properties.comments, DatabaseMessages.ConstraintPropertiesEditionPart_CommentsLabel);
    GridData commentsLabelData = new GridData(GridData.FILL_HORIZONTAL);
    commentsLabelData.horizontalSpan = 3;
    commentsLabel.setLayoutData(commentsLabelData);
    // $NON-NLS-1$
    comments = widgetFactory.createText(parent, "", SWT.BORDER | SWT.WRAP | SWT.MULTI | SWT.V_SCROLL);
    GridData commentsData = new GridData(GridData.FILL_HORIZONTAL);
    commentsData.horizontalSpan = 2;
    commentsData.heightHint = 80;
    commentsData.widthHint = 200;
    comments.setLayoutData(commentsData);
    comments.addFocusListener(new FocusAdapter() {

        /**
         * {@inheritDoc}
         *
         * @see org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt.events.FocusEvent)
         */
        public void focusLost(FocusEvent e) {
            if (propertiesEditionComponent != null) {
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ConstraintPropertiesEditionPartForm.this, DatabaseViewsRepository.Constraint.Properties.comments, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, comments.getText()));
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ConstraintPropertiesEditionPartForm.this, DatabaseViewsRepository.Constraint.Properties.comments, PropertiesEditionEvent.FOCUS_CHANGED, PropertiesEditionEvent.FOCUS_LOST, null, comments.getText()));
            }
        }

        /**
         * @see org.eclipse.swt.events.FocusAdapter#focusGained(org.eclipse.swt.events.FocusEvent)
         */
        @Override
        public void focusGained(FocusEvent e) {
            if (propertiesEditionComponent != null) {
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ConstraintPropertiesEditionPartForm.this, null, PropertiesEditionEvent.FOCUS_CHANGED, PropertiesEditionEvent.FOCUS_GAINED, null, null));
            }
        }
    });
    EditingUtils.setID(comments, DatabaseViewsRepository.Constraint.Properties.comments);
    // $NON-NLS-1$
    EditingUtils.setEEFtype(comments, "eef::Textarea");
    // $NON-NLS-1$
    FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(DatabaseViewsRepository.Constraint.Properties.comments, DatabaseViewsRepository.FORM_KIND), null);
    // End of user code
    return parent;
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) IPropertiesEditionEvent(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent) PropertiesEditionEvent(org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent) FocusEvent(org.eclipse.swt.events.FocusEvent)

Example 44 with PropertiesEditionEvent

use of org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent in project InformationSystem by ObeoNetwork.

the class ConstraintsPropertiesEditionPartForm method createConstraintsTableComposition.

/**
 * @param container
 */
protected Composite createConstraintsTableComposition(FormToolkit widgetFactory, Composite parent) {
    this.constraints = new ReferencesTable(getDescription(DatabaseViewsRepository.Constraints.Properties.constraints_, DatabaseMessages.ConstraintsPropertiesEditionPart_ConstraintsLabel), new ReferencesTableListener() {

        public void handleAdd() {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ConstraintsPropertiesEditionPartForm.this, DatabaseViewsRepository.Constraints.Properties.constraints_, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, null));
            constraints.refresh();
        }

        public void handleEdit(EObject element) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ConstraintsPropertiesEditionPartForm.this, DatabaseViewsRepository.Constraints.Properties.constraints_, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.EDIT, null, element));
            constraints.refresh();
        }

        public void handleMove(EObject element, int oldIndex, int newIndex) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ConstraintsPropertiesEditionPartForm.this, DatabaseViewsRepository.Constraints.Properties.constraints_, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.MOVE, element, newIndex));
            constraints.refresh();
        }

        public void handleRemove(EObject element) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ConstraintsPropertiesEditionPartForm.this, DatabaseViewsRepository.Constraints.Properties.constraints_, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.REMOVE, null, element));
            constraints.refresh();
        }

        public void navigateTo(EObject element) {
        }
    });
    for (ViewerFilter filter : this.constraintsFilters) {
        this.constraints.addFilter(filter);
    }
    this.constraints.setHelpText(propertiesEditionComponent.getHelpContent(DatabaseViewsRepository.Constraints.Properties.constraints_, DatabaseViewsRepository.FORM_KIND));
    this.constraints.createControls(parent, widgetFactory);
    this.constraints.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (e.item != null && e.item.getData() instanceof EObject) {
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ConstraintsPropertiesEditionPartForm.this, DatabaseViewsRepository.Constraints.Properties.constraints_, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SELECTION_CHANGED, null, e.item.getData()));
            }
        }
    });
    GridData constraintsData = new GridData(GridData.FILL_HORIZONTAL);
    constraintsData.horizontalSpan = 3;
    this.constraints.setLayoutData(constraintsData);
    this.constraints.setLowerBound(0);
    this.constraints.setUpperBound(-1);
    constraints.setID(DatabaseViewsRepository.Constraints.Properties.constraints_);
    // $NON-NLS-1$
    constraints.setEEFType("eef::AdvancedTableComposition");
    // End of user code
    return parent;
}
Also used : ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) ReferencesTable(org.eclipse.emf.eef.runtime.ui.widgets.ReferencesTable) EObject(org.eclipse.emf.ecore.EObject) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) IPropertiesEditionEvent(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent) PropertiesEditionEvent(org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent) ReferencesTableListener(org.eclipse.emf.eef.runtime.ui.widgets.ReferencesTable.ReferencesTableListener)

Example 45 with PropertiesEditionEvent

use of org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent in project InformationSystem by ObeoNetwork.

the class DataBasePropertiesEditionPartForm method createNameText.

protected Composite createNameText(FormToolkit widgetFactory, Composite parent) {
    createDescription(parent, DatabaseViewsRepository.DataBase_.Properties.name, DatabaseMessages.DataBasePropertiesEditionPart_NameLabel);
    // $NON-NLS-1$
    name = widgetFactory.createText(parent, "");
    name.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
    widgetFactory.paintBordersFor(parent);
    GridData nameData = new GridData(GridData.FILL_HORIZONTAL);
    name.setLayoutData(nameData);
    name.addFocusListener(new FocusAdapter() {

        /**
         * @see org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt.events.FocusEvent)
         */
        @Override
        @SuppressWarnings("synthetic-access")
        public void focusLost(FocusEvent e) {
            if (propertiesEditionComponent != null) {
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(DataBasePropertiesEditionPartForm.this, DatabaseViewsRepository.DataBase_.Properties.name, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, name.getText()));
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(DataBasePropertiesEditionPartForm.this, DatabaseViewsRepository.DataBase_.Properties.name, PropertiesEditionEvent.FOCUS_CHANGED, PropertiesEditionEvent.FOCUS_LOST, null, name.getText()));
            }
        }

        /**
         * @see org.eclipse.swt.events.FocusAdapter#focusGained(org.eclipse.swt.events.FocusEvent)
         */
        @Override
        public void focusGained(FocusEvent e) {
            if (propertiesEditionComponent != null) {
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(DataBasePropertiesEditionPartForm.this, null, PropertiesEditionEvent.FOCUS_CHANGED, PropertiesEditionEvent.FOCUS_GAINED, null, null));
            }
        }
    });
    name.addKeyListener(new KeyAdapter() {

        /**
         * @see org.eclipse.swt.events.KeyAdapter#keyPressed(org.eclipse.swt.events.KeyEvent)
         */
        @Override
        @SuppressWarnings("synthetic-access")
        public void keyPressed(KeyEvent e) {
            if (e.character == SWT.CR) {
                if (propertiesEditionComponent != null)
                    propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(DataBasePropertiesEditionPartForm.this, DatabaseViewsRepository.DataBase_.Properties.name, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, name.getText()));
            }
        }
    });
    EditingUtils.setID(name, DatabaseViewsRepository.DataBase_.Properties.name);
    // $NON-NLS-1$
    EditingUtils.setEEFtype(name, "eef::Text");
    // $NON-NLS-1$
    FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(DatabaseViewsRepository.DataBase_.Properties.name, DatabaseViewsRepository.FORM_KIND), null);
    // End of user code
    return parent;
}
Also used : KeyEvent(org.eclipse.swt.events.KeyEvent) FocusAdapter(org.eclipse.swt.events.FocusAdapter) KeyAdapter(org.eclipse.swt.events.KeyAdapter) GridData(org.eclipse.swt.layout.GridData) IPropertiesEditionEvent(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent) PropertiesEditionEvent(org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent) FocusEvent(org.eclipse.swt.events.FocusEvent)

Aggregations

PropertiesEditionEvent (org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent)1056 IPropertiesEditionEvent (org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)1052 GridData (org.eclipse.swt.layout.GridData)818 FocusAdapter (org.eclipse.swt.events.FocusAdapter)458 FocusEvent (org.eclipse.swt.events.FocusEvent)458 KeyAdapter (org.eclipse.swt.events.KeyAdapter)283 KeyEvent (org.eclipse.swt.events.KeyEvent)283 EObject (org.eclipse.emf.ecore.EObject)262 SelectionEvent (org.eclipse.swt.events.SelectionEvent)230 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)228 Label (org.eclipse.swt.widgets.Label)174 ReferencesTable (org.eclipse.emf.eef.runtime.ui.widgets.ReferencesTable)162 ReferencesTableListener (org.eclipse.emf.eef.runtime.ui.widgets.ReferencesTable.ReferencesTableListener)162 AdapterFactoryLabelProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider)134 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)116 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)116 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)86 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)84 TabElementTreeSelectionDialog (org.eclipse.emf.eef.runtime.ui.widgets.TabElementTreeSelectionDialog)78 EObjectFlatComboViewer (org.eclipse.emf.eef.runtime.ui.widgets.EObjectFlatComboViewer)60