Search in sources :

Example 26 with AdapterFactoryLabelProvider

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

the class TransitionPropertiesEditionPartForm method createToFlatComboViewer.

/**
 * @param parent the parent composite
 * @param widgetFactory factory to use to instanciante widget of the form
 */
protected Composite createToFlatComboViewer(Composite parent, FormToolkit widgetFactory) {
    createDescription(parent, StatemachineViewsRepository.Transition.Properties.to, StatemachineMessages.TransitionPropertiesEditionPart_ToLabel);
    to = new EObjectFlatComboViewer(parent, !propertiesEditionComponent.isRequired(StatemachineViewsRepository.Transition.Properties.to, StatemachineViewsRepository.FORM_KIND));
    widgetFactory.adapt(to);
    to.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
    GridData toData = new GridData(GridData.FILL_HORIZONTAL);
    to.setLayoutData(toData);
    to.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(TransitionPropertiesEditionPartForm.this, StatemachineViewsRepository.Transition.Properties.to, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getTo()));
        }
    });
    to.setID(StatemachineViewsRepository.Transition.Properties.to);
    // $NON-NLS-1$
    FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(StatemachineViewsRepository.Transition.Properties.to, StatemachineViewsRepository.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 27 with AdapterFactoryLabelProvider

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

the class FinalStatePropertiesEditionPartImpl method createKeywordsMultiValuedEditor.

protected Composite createKeywordsMultiValuedEditor(Composite parent) {
    keywords = SWTUtils.createScrollableText(parent, SWT.BORDER | 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 = new Button(parent, SWT.NONE);
    editKeywords.setText(getDescription(StatemachineViewsRepository.FinalState.Properties.keywords, StatemachineMessages.FinalStatePropertiesEditionPart_KeywordsLabel));
    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(FinalStatePropertiesEditionPartImpl.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 : Button(org.eclipse.swt.widgets.Button) 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 28 with AdapterFactoryLabelProvider

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

the class StateMachineEditor method createPages.

/**
 * This is the method used by the framework to install your own controls.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
@Override
public void createPages() {
    // Creates the model from the editor input
    // 
    createModel();
    // 
    if (!getEditingDomain().getResourceSet().getResources().isEmpty()) {
        // Create a page for the selection tree view.
        // 
        Tree tree = new Tree(getContainer(), SWT.MULTI);
        selectionViewer = new TreeViewer(tree);
        setCurrentViewer(selectionViewer);
        selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
        selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
        selectionViewer.setInput(editingDomain.getResourceSet());
        selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
        selectionViewer.addDoubleClickListener(new OpenWizardOnDoubleClick(editingDomain, adapterFactory));
        new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
        createContextMenuFor(selectionViewer);
        int pageIndex = addPage(tree);
        setPageText(pageIndex, getString("_UI_SelectionPage_label"));
        getSite().getShell().getDisplay().asyncExec(new Runnable() {

            public void run() {
                setActivePage(0);
            }
        });
    }
    // Ensures that this editor will only display the page's tab
    // area if there are more than one page
    // 
    getContainer().addControlListener(new ControlAdapter() {

        boolean guard = false;

        @Override
        public void controlResized(ControlEvent event) {
            if (!guard) {
                guard = true;
                hideTabs();
                guard = false;
            }
        }
    });
    getSite().getShell().getDisplay().asyncExec(new Runnable() {

        public void run() {
            updateProblemIndication();
        }
    });
}
Also used : AdapterFactoryTreeEditor(org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor) ControlAdapter(org.eclipse.swt.events.ControlAdapter) TreeViewer(org.eclipse.jface.viewers.TreeViewer) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) AdapterFactoryContentProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider) AdapterFactoryLabelProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider) Point(org.eclipse.swt.graphics.Point) OpenWizardOnDoubleClick(org.eclipse.emf.eef.runtime.ui.notify.OpenWizardOnDoubleClick) Tree(org.eclipse.swt.widgets.Tree) ControlEvent(org.eclipse.swt.events.ControlEvent)

Example 29 with AdapterFactoryLabelProvider

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

the class StatePropertiesEditionPartImpl method createKeywordsMultiValuedEditor.

protected Composite createKeywordsMultiValuedEditor(Composite parent) {
    keywords = SWTUtils.createScrollableText(parent, SWT.BORDER | 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 = new Button(parent, SWT.NONE);
    editKeywords.setText(getDescription(StatemachineViewsRepository.State.Properties.keywords, StatemachineMessages.StatePropertiesEditionPart_KeywordsLabel));
    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(StatePropertiesEditionPartImpl.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 : Button(org.eclipse.swt.widgets.Button) 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 30 with AdapterFactoryLabelProvider

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

the class TransitionPropertiesEditionPartImpl method createFromFlatComboViewer.

/**
 * @param parent the parent composite
 */
protected Composite createFromFlatComboViewer(Composite parent) {
    createDescription(parent, StatemachineViewsRepository.Transition.Properties.from, StatemachineMessages.TransitionPropertiesEditionPart_FromLabel);
    from = new EObjectFlatComboViewer(parent, !propertiesEditionComponent.isRequired(StatemachineViewsRepository.Transition.Properties.from, StatemachineViewsRepository.SWT_KIND));
    from.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
    from.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(TransitionPropertiesEditionPartImpl.this, StatemachineViewsRepository.Transition.Properties.from, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SET, null, getFrom()));
        }
    });
    GridData fromData = new GridData(GridData.FILL_HORIZONTAL);
    from.setLayoutData(fromData);
    from.setID(StatemachineViewsRepository.Transition.Properties.from);
    // $NON-NLS-1$
    SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(StatemachineViewsRepository.Transition.Properties.from, StatemachineViewsRepository.SWT_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)

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