Search in sources :

Example 1 with TypesLibraryItemProviderAdapterFactory

use of org.obeonetwork.dsl.typeslibrary.provider.TypesLibraryItemProviderAdapterFactory in project InformationSystem by ObeoNetwork.

the class ColumnItemProvider method getText.

/**
 * This returns the label text for the adapted class.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
@Override
public String getText(Object object) {
    String label = "";
    Column column = (Column) object;
    label += column.getName();
    if (label == null || label.length() == 0) {
        label = "#NONAME#";
    }
    String typeLabel = "";
    if (column.getType() != null) {
        AdapterFactoryLabelProvider aflp = new AdapterFactoryLabelProvider(new TypesLibraryItemProviderAdapterFactory());
        typeLabel = aflp.getText(column.getType());
    }
    if (typeLabel != null && typeLabel.length() != 0) {
        label += " : " + typeLabel;
    }
    return label;
}
Also used : Column(org.obeonetwork.dsl.database.Column) TypesLibraryItemProviderAdapterFactory(org.obeonetwork.dsl.typeslibrary.provider.TypesLibraryItemProviderAdapterFactory) AdapterFactoryLabelProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider)

Example 2 with TypesLibraryItemProviderAdapterFactory

use of org.obeonetwork.dsl.typeslibrary.provider.TypesLibraryItemProviderAdapterFactory in project InformationSystem by ObeoNetwork.

the class DatabaseEditor method initializeEditingDomain.

/**
 * This sets up the editing domain for the model editor.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
protected void initializeEditingDomain() {
    // Create an adapter factory that yields item providers.
    // 
    adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
    adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new DatabaseItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new TypesLibraryItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
    // Create the command stack that will notify this editor as commands are executed.
    // 
    BasicCommandStack commandStack = new BasicCommandStack();
    // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
    // 
    commandStack.addCommandStackListener(new CommandStackListener() {

        public void commandStackChanged(final EventObject event) {
            getContainer().getDisplay().asyncExec(new Runnable() {

                public void run() {
                    firePropertyChange(IEditorPart.PROP_DIRTY);
                    // Try to select the affected objects.
                    // 
                    Command mostRecentCommand = ((CommandStack) event.getSource()).getMostRecentCommand();
                    if (mostRecentCommand != null) {
                        setSelectionToViewer(mostRecentCommand.getAffectedObjects());
                    }
                    if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed() && propertySheetPage.getCurrentTab() != null) {
                        propertySheetPage.refresh();
                    }
                }
            });
        }
    });
    // Create the editing domain with a special command stack.
    // 
    editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
}
Also used : AdapterFactoryEditingDomain(org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) BasicCommandStack(org.eclipse.emf.common.command.BasicCommandStack) CommandStack(org.eclipse.emf.common.command.CommandStack) CommandStackListener(org.eclipse.emf.common.command.CommandStackListener) ResourceItemProviderAdapterFactory(org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) ComposedAdapterFactory(org.eclipse.emf.edit.provider.ComposedAdapterFactory) DatabaseItemProviderAdapterFactory(org.obeonetwork.dsl.database.provider.DatabaseItemProviderAdapterFactory) BasicCommandStack(org.eclipse.emf.common.command.BasicCommandStack) EventObject(java.util.EventObject) ReflectiveItemProviderAdapterFactory(org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory) Command(org.eclipse.emf.common.command.Command) TypesLibraryItemProviderAdapterFactory(org.obeonetwork.dsl.typeslibrary.provider.TypesLibraryItemProviderAdapterFactory)

Example 3 with TypesLibraryItemProviderAdapterFactory

use of org.obeonetwork.dsl.typeslibrary.provider.TypesLibraryItemProviderAdapterFactory in project InformationSystem by ObeoNetwork.

the class TypesLibraryEditor method initializeEditingDomain.

/**
 * This sets up the editing domain for the model editor.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
protected void initializeEditingDomain() {
    // Create an adapter factory that yields item providers.
    // 
    adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
    adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new TypesLibraryItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
    // Create the command stack that will notify this editor as commands are executed.
    // 
    BasicCommandStack commandStack = new BasicCommandStack();
    // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
    // 
    commandStack.addCommandStackListener(new CommandStackListener() {

        public void commandStackChanged(final EventObject event) {
            getContainer().getDisplay().asyncExec(new Runnable() {

                public void run() {
                    firePropertyChange(IEditorPart.PROP_DIRTY);
                    // Try to select the affected objects.
                    // 
                    Command mostRecentCommand = ((CommandStack) event.getSource()).getMostRecentCommand();
                    if (mostRecentCommand != null) {
                        setSelectionToViewer(mostRecentCommand.getAffectedObjects());
                    }
                    if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed() && propertySheetPage.getCurrentTab() != null) {
                        propertySheetPage.refresh();
                    }
                }
            });
        }
    });
    // Create the editing domain with a special command stack.
    // 
    editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
}
Also used : AdapterFactoryEditingDomain(org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) BasicCommandStack(org.eclipse.emf.common.command.BasicCommandStack) CommandStack(org.eclipse.emf.common.command.CommandStack) ReflectiveItemProviderAdapterFactory(org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory) CommandStackListener(org.eclipse.emf.common.command.CommandStackListener) ResourceItemProviderAdapterFactory(org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory) Command(org.eclipse.emf.common.command.Command) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) TypesLibraryItemProviderAdapterFactory(org.obeonetwork.dsl.typeslibrary.provider.TypesLibraryItemProviderAdapterFactory) ComposedAdapterFactory(org.eclipse.emf.edit.provider.ComposedAdapterFactory) BasicCommandStack(org.eclipse.emf.common.command.BasicCommandStack) EventObject(java.util.EventObject)

Aggregations

TypesLibraryItemProviderAdapterFactory (org.obeonetwork.dsl.typeslibrary.provider.TypesLibraryItemProviderAdapterFactory)3 EventObject (java.util.EventObject)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 BasicCommandStack (org.eclipse.emf.common.command.BasicCommandStack)2 Command (org.eclipse.emf.common.command.Command)2 CommandStack (org.eclipse.emf.common.command.CommandStack)2 CommandStackListener (org.eclipse.emf.common.command.CommandStackListener)2 AdapterFactoryEditingDomain (org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain)2 ComposedAdapterFactory (org.eclipse.emf.edit.provider.ComposedAdapterFactory)2 ReflectiveItemProviderAdapterFactory (org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory)2 ResourceItemProviderAdapterFactory (org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory)2 AdapterFactoryLabelProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider)1 Column (org.obeonetwork.dsl.database.Column)1 DatabaseItemProviderAdapterFactory (org.obeonetwork.dsl.database.provider.DatabaseItemProviderAdapterFactory)1