Search in sources :

Example 21 with AdapterFactoryLabelProvider

use of org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider in project InformationSystem by ObeoNetwork.

the class ForeignKeyElementPropertiesEditionPartForm method createPKColumnFlatComboViewer.

/**
 * @param parent the parent composite
 * @param widgetFactory factory to use to instanciante widget of the form
 */
protected Composite createPKColumnFlatComboViewer(Composite parent, FormToolkit widgetFactory) {
    createDescription(parent, DatabaseViewsRepository.ForeignKeyElement.Properties.pKColumn, DatabaseMessages.ForeignKeyElementPropertiesEditionPart_PKColumnLabel);
    pKColumn = new EObjectFlatComboViewer(parent, !propertiesEditionComponent.isRequired(DatabaseViewsRepository.ForeignKeyElement.Properties.pKColumn, DatabaseViewsRepository.FORM_KIND));
    widgetFactory.adapt(pKColumn);
    pKColumn.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
    GridData pKColumnData = new GridData(GridData.FILL_HORIZONTAL);
    pKColumn.setLayoutData(pKColumnData);
    pKColumn.addSelectionChangedListener(new ISelectionChangedListener() {

        /**
         * {@inheritDoc}
         *
         * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
         */
        public void selectionChanged(SelectionChangedEvent event) {
            if (propertiesEditionComponent != null)
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ForeignKeyElementPropertiesEditionPartForm.this, DatabaseViewsRepository.ForeignKeyElement.Properties.pKColumn, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getPKColumn()));
        }
    });
    pKColumn.setID(DatabaseViewsRepository.ForeignKeyElement.Properties.pKColumn);
    // $NON-NLS-1$
    FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(DatabaseViewsRepository.ForeignKeyElement.Properties.pKColumn, DatabaseViewsRepository.FORM_KIND), null);
    // End of user code
    return parent;
}
Also used : EObjectFlatComboViewer(org.eclipse.emf.eef.runtime.ui.widgets.EObjectFlatComboViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) GridData(org.eclipse.swt.layout.GridData) AdapterFactoryLabelProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IPropertiesEditionEvent(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent) PropertiesEditionEvent(org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent)

Example 22 with AdapterFactoryLabelProvider

use of org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider in project InformationSystem by ObeoNetwork.

the class ForeignKeyPropertiesEditionPartForm method createTargetFlatComboViewer.

/**
 * @param parent the parent composite
 * @param widgetFactory factory to use to instanciante widget of the form
 */
protected Composite createTargetFlatComboViewer(Composite parent, FormToolkit widgetFactory) {
    createDescription(parent, DatabaseViewsRepository.ForeignKey.Properties.target, DatabaseMessages.ForeignKeyPropertiesEditionPart_TargetLabel);
    target = new EObjectFlatComboViewer(parent, !propertiesEditionComponent.isRequired(DatabaseViewsRepository.ForeignKey.Properties.target, DatabaseViewsRepository.FORM_KIND));
    widgetFactory.adapt(target);
    target.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
    GridData targetData = new GridData(GridData.FILL_HORIZONTAL);
    target.setLayoutData(targetData);
    target.addSelectionChangedListener(new ISelectionChangedListener() {

        /**
         * {@inheritDoc}
         *
         * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
         */
        public void selectionChanged(SelectionChangedEvent event) {
            if (propertiesEditionComponent != null)
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ForeignKeyPropertiesEditionPartForm.this, DatabaseViewsRepository.ForeignKey.Properties.target, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getTarget()));
        }
    });
    target.setID(DatabaseViewsRepository.ForeignKey.Properties.target);
    // $NON-NLS-1$
    FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(DatabaseViewsRepository.ForeignKey.Properties.target, DatabaseViewsRepository.FORM_KIND), null);
    // End of user code
    return parent;
}
Also used : EObjectFlatComboViewer(org.eclipse.emf.eef.runtime.ui.widgets.EObjectFlatComboViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) GridData(org.eclipse.swt.layout.GridData) AdapterFactoryLabelProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IPropertiesEditionEvent(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent) PropertiesEditionEvent(org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent)

Example 23 with AdapterFactoryLabelProvider

use of org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider in project InformationSystem by ObeoNetwork.

the class FinalStatePropertiesEditionPartForm method createKeywordsMultiValuedEditor.

/**
 */
protected Composite createKeywordsMultiValuedEditor(FormToolkit widgetFactory, Composite parent) {
    // $NON-NLS-1$
    keywords = widgetFactory.createText(parent, "", SWT.READ_ONLY);
    GridData keywordsData = new GridData(GridData.FILL_HORIZONTAL);
    keywordsData.horizontalSpan = 2;
    keywords.setLayoutData(keywordsData);
    EditingUtils.setID(keywords, StatemachineViewsRepository.FinalState.Properties.keywords);
    // $NON-NLS-1$
    EditingUtils.setEEFtype(keywords, "eef::MultiValuedEditor::field");
    editKeywords = widgetFactory.createButton(parent, getDescription(StatemachineViewsRepository.FinalState.Properties.keywords, StatemachineMessages.FinalStatePropertiesEditionPart_KeywordsLabel), SWT.NONE);
    GridData editKeywordsData = new GridData();
    editKeywords.setLayoutData(editKeywordsData);
    editKeywords.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$
            keywords.getShell(), // $NON-NLS-1$
            "FinalState", // $NON-NLS-1$
            new AdapterFactoryLabelProvider(adapterFactory), keywordsList, EnvironmentPackage.eINSTANCE.getObeoDSMObject_Keywords().getEType(), null, false, true, null, null);
            if (dialog.open() == Window.OK) {
                keywordsList = dialog.getResult();
                if (keywordsList == null) {
                    keywordsList = new BasicEList();
                }
                keywords.setText(keywordsList.toString());
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(FinalStatePropertiesEditionPartForm.this, StatemachineViewsRepository.FinalState.Properties.keywords, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, new BasicEList(keywordsList)));
                setHasChanged(true);
            }
        }
    });
    EditingUtils.setID(editKeywords, StatemachineViewsRepository.FinalState.Properties.keywords);
    // $NON-NLS-1$
    EditingUtils.setEEFtype(editKeywords, "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 24 with AdapterFactoryLabelProvider

use of org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider in project InformationSystem by ObeoNetwork.

the class StatePropertiesEditionPartForm method createKeywordsMultiValuedEditor.

/**
 */
protected Composite createKeywordsMultiValuedEditor(FormToolkit widgetFactory, Composite parent) {
    // $NON-NLS-1$
    keywords = widgetFactory.createText(parent, "", SWT.READ_ONLY);
    GridData keywordsData = new GridData(GridData.FILL_HORIZONTAL);
    keywordsData.horizontalSpan = 2;
    keywords.setLayoutData(keywordsData);
    EditingUtils.setID(keywords, StatemachineViewsRepository.State.Properties.keywords);
    // $NON-NLS-1$
    EditingUtils.setEEFtype(keywords, "eef::MultiValuedEditor::field");
    editKeywords = widgetFactory.createButton(parent, getDescription(StatemachineViewsRepository.State.Properties.keywords, StatemachineMessages.StatePropertiesEditionPart_KeywordsLabel), SWT.NONE);
    GridData editKeywordsData = new GridData();
    editKeywords.setLayoutData(editKeywordsData);
    editKeywords.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$
            keywords.getShell(), // $NON-NLS-1$
            "State", // $NON-NLS-1$
            new AdapterFactoryLabelProvider(adapterFactory), keywordsList, EnvironmentPackage.eINSTANCE.getObeoDSMObject_Keywords().getEType(), null, false, true, null, null);
            if (dialog.open() == Window.OK) {
                keywordsList = dialog.getResult();
                if (keywordsList == null) {
                    keywordsList = new BasicEList();
                }
                keywords.setText(keywordsList.toString());
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(StatePropertiesEditionPartForm.this, StatemachineViewsRepository.State.Properties.keywords, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, new BasicEList(keywordsList)));
                setHasChanged(true);
            }
        }
    });
    EditingUtils.setID(editKeywords, StatemachineViewsRepository.State.Properties.keywords);
    // $NON-NLS-1$
    EditingUtils.setEEFtype(editKeywords, "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 25 with AdapterFactoryLabelProvider

use of org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider in project InformationSystem by ObeoNetwork.

the class TransitionPropertiesEditionPartForm method createKeywordsMultiValuedEditor.

/**
 */
protected Composite createKeywordsMultiValuedEditor(FormToolkit widgetFactory, Composite parent) {
    // $NON-NLS-1$
    keywords = widgetFactory.createText(parent, "", SWT.READ_ONLY);
    GridData keywordsData = new GridData(GridData.FILL_HORIZONTAL);
    keywordsData.horizontalSpan = 2;
    keywords.setLayoutData(keywordsData);
    EditingUtils.setID(keywords, StatemachineViewsRepository.Transition.Properties.keywords);
    // $NON-NLS-1$
    EditingUtils.setEEFtype(keywords, "eef::MultiValuedEditor::field");
    editKeywords = widgetFactory.createButton(parent, getDescription(StatemachineViewsRepository.Transition.Properties.keywords, StatemachineMessages.TransitionPropertiesEditionPart_KeywordsLabel), SWT.NONE);
    GridData editKeywordsData = new GridData();
    editKeywords.setLayoutData(editKeywordsData);
    editKeywords.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$
            keywords.getShell(), // $NON-NLS-1$
            "Transition", // $NON-NLS-1$
            new AdapterFactoryLabelProvider(adapterFactory), keywordsList, EnvironmentPackage.eINSTANCE.getObeoDSMObject_Keywords().getEType(), null, false, true, null, null);
            if (dialog.open() == Window.OK) {
                keywordsList = dialog.getResult();
                if (keywordsList == null) {
                    keywordsList = new BasicEList();
                }
                keywords.setText(keywordsList.toString());
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(TransitionPropertiesEditionPartForm.this, StatemachineViewsRepository.Transition.Properties.keywords, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, new BasicEList(keywordsList)));
                setHasChanged(true);
            }
        }
    });
    EditingUtils.setID(editKeywords, StatemachineViewsRepository.Transition.Properties.keywords);
    // $NON-NLS-1$
    EditingUtils.setEEFtype(editKeywords, "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)

Aggregations

AdapterFactoryLabelProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider)208 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)147 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)147 GridData (org.eclipse.swt.layout.GridData)136 IPropertiesEditionEvent (org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)134 PropertiesEditionEvent (org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent)134 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)66 AdapterFactoryContentProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider)65 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)62 EObjectFlatComboViewer (org.eclipse.emf.eef.runtime.ui.widgets.EObjectFlatComboViewer)60 Composite (org.eclipse.swt.widgets.Composite)52 EMFComboViewer (org.eclipse.emf.eef.runtime.ui.widgets.EMFComboViewer)50 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)35 TreeViewer (org.eclipse.jface.viewers.TreeViewer)32 Tree (org.eclipse.swt.widgets.Tree)32 AdapterFactoryTreeEditor (org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor)31 IMenuManager (org.eclipse.jface.action.IMenuManager)30 IStatusLineManager (org.eclipse.jface.action.IStatusLineManager)30 IToolBarManager (org.eclipse.jface.action.IToolBarManager)30 ControlAdapter (org.eclipse.swt.events.ControlAdapter)30