Search in sources :

Example 81 with ViewerFilter

use of org.eclipse.jface.viewers.ViewerFilter in project InformationSystem by ObeoNetwork.

the class CinematicRootPropertiesEditionPartForm method createViewContainersTableComposition.

/**
 * @param container
 */
protected Composite createViewContainersTableComposition(FormToolkit widgetFactory, Composite parent) {
    this.viewContainers = new ReferencesTable(getDescription(CinematicViewsRepository.CinematicRoot.Properties.viewContainers, CinematicMessages.CinematicRootPropertiesEditionPart_ViewContainersLabel), new ReferencesTableListener() {

        public void handleAdd() {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(CinematicRootPropertiesEditionPartForm.this, CinematicViewsRepository.CinematicRoot.Properties.viewContainers, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, null));
            viewContainers.refresh();
        }

        public void handleEdit(EObject element) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(CinematicRootPropertiesEditionPartForm.this, CinematicViewsRepository.CinematicRoot.Properties.viewContainers, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.EDIT, null, element));
            viewContainers.refresh();
        }

        public void handleMove(EObject element, int oldIndex, int newIndex) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(CinematicRootPropertiesEditionPartForm.this, CinematicViewsRepository.CinematicRoot.Properties.viewContainers, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.MOVE, element, newIndex));
            viewContainers.refresh();
        }

        public void handleRemove(EObject element) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(CinematicRootPropertiesEditionPartForm.this, CinematicViewsRepository.CinematicRoot.Properties.viewContainers, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.REMOVE, null, element));
            viewContainers.refresh();
        }

        public void navigateTo(EObject element) {
        }
    });
    for (ViewerFilter filter : this.viewContainersFilters) {
        this.viewContainers.addFilter(filter);
    }
    this.viewContainers.setHelpText(propertiesEditionComponent.getHelpContent(CinematicViewsRepository.CinematicRoot.Properties.viewContainers, CinematicViewsRepository.FORM_KIND));
    this.viewContainers.createControls(parent, widgetFactory);
    this.viewContainers.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (e.item != null && e.item.getData() instanceof EObject) {
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(CinematicRootPropertiesEditionPartForm.this, CinematicViewsRepository.CinematicRoot.Properties.viewContainers, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SELECTION_CHANGED, null, e.item.getData()));
            }
        }
    });
    GridData viewContainersData = new GridData(GridData.FILL_HORIZONTAL);
    viewContainersData.horizontalSpan = 3;
    this.viewContainers.setLayoutData(viewContainersData);
    this.viewContainers.setLowerBound(0);
    this.viewContainers.setUpperBound(-1);
    viewContainers.setID(CinematicViewsRepository.CinematicRoot.Properties.viewContainers);
    // $NON-NLS-1$
    viewContainers.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 82 with ViewerFilter

use of org.eclipse.jface.viewers.ViewerFilter in project InformationSystem by ObeoNetwork.

the class CinematicRootPropertiesEditionPartForm method createSubPackagesTableComposition.

/**
 * @param container
 */
protected Composite createSubPackagesTableComposition(FormToolkit widgetFactory, Composite parent) {
    this.subPackages = new ReferencesTable(getDescription(CinematicViewsRepository.CinematicRoot.Properties.subPackages, CinematicMessages.CinematicRootPropertiesEditionPart_SubPackagesLabel), new ReferencesTableListener() {

        public void handleAdd() {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(CinematicRootPropertiesEditionPartForm.this, CinematicViewsRepository.CinematicRoot.Properties.subPackages, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, null));
            subPackages.refresh();
        }

        public void handleEdit(EObject element) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(CinematicRootPropertiesEditionPartForm.this, CinematicViewsRepository.CinematicRoot.Properties.subPackages, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.EDIT, null, element));
            subPackages.refresh();
        }

        public void handleMove(EObject element, int oldIndex, int newIndex) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(CinematicRootPropertiesEditionPartForm.this, CinematicViewsRepository.CinematicRoot.Properties.subPackages, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.MOVE, element, newIndex));
            subPackages.refresh();
        }

        public void handleRemove(EObject element) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(CinematicRootPropertiesEditionPartForm.this, CinematicViewsRepository.CinematicRoot.Properties.subPackages, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.REMOVE, null, element));
            subPackages.refresh();
        }

        public void navigateTo(EObject element) {
        }
    });
    for (ViewerFilter filter : this.subPackagesFilters) {
        this.subPackages.addFilter(filter);
    }
    this.subPackages.setHelpText(propertiesEditionComponent.getHelpContent(CinematicViewsRepository.CinematicRoot.Properties.subPackages, CinematicViewsRepository.FORM_KIND));
    this.subPackages.createControls(parent, widgetFactory);
    this.subPackages.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (e.item != null && e.item.getData() instanceof EObject) {
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(CinematicRootPropertiesEditionPartForm.this, CinematicViewsRepository.CinematicRoot.Properties.subPackages, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SELECTION_CHANGED, null, e.item.getData()));
            }
        }
    });
    GridData subPackagesData = new GridData(GridData.FILL_HORIZONTAL);
    subPackagesData.horizontalSpan = 3;
    this.subPackages.setLayoutData(subPackagesData);
    this.subPackages.setLowerBound(0);
    this.subPackages.setUpperBound(-1);
    subPackages.setID(CinematicViewsRepository.CinematicRoot.Properties.subPackages);
    // $NON-NLS-1$
    subPackages.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 83 with ViewerFilter

use of org.eclipse.jface.viewers.ViewerFilter in project InformationSystem by ObeoNetwork.

the class Package_PropertiesEditionPartForm method createFlowsTableComposition.

/**
 * @param container
 */
protected Composite createFlowsTableComposition(FormToolkit widgetFactory, Composite parent) {
    this.flows = new ReferencesTable(getDescription(CinematicViewsRepository.Package_.Properties.flows, CinematicMessages.Package_PropertiesEditionPart_FlowsLabel), new ReferencesTableListener() {

        public void handleAdd() {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(Package_PropertiesEditionPartForm.this, CinematicViewsRepository.Package_.Properties.flows, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, null));
            flows.refresh();
        }

        public void handleEdit(EObject element) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(Package_PropertiesEditionPartForm.this, CinematicViewsRepository.Package_.Properties.flows, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.EDIT, null, element));
            flows.refresh();
        }

        public void handleMove(EObject element, int oldIndex, int newIndex) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(Package_PropertiesEditionPartForm.this, CinematicViewsRepository.Package_.Properties.flows, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.MOVE, element, newIndex));
            flows.refresh();
        }

        public void handleRemove(EObject element) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(Package_PropertiesEditionPartForm.this, CinematicViewsRepository.Package_.Properties.flows, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.REMOVE, null, element));
            flows.refresh();
        }

        public void navigateTo(EObject element) {
        }
    });
    for (ViewerFilter filter : this.flowsFilters) {
        this.flows.addFilter(filter);
    }
    this.flows.setHelpText(propertiesEditionComponent.getHelpContent(CinematicViewsRepository.Package_.Properties.flows, CinematicViewsRepository.FORM_KIND));
    this.flows.createControls(parent, widgetFactory);
    this.flows.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (e.item != null && e.item.getData() instanceof EObject) {
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(Package_PropertiesEditionPartForm.this, CinematicViewsRepository.Package_.Properties.flows, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SELECTION_CHANGED, null, e.item.getData()));
            }
        }
    });
    GridData flowsData = new GridData(GridData.FILL_HORIZONTAL);
    flowsData.horizontalSpan = 3;
    this.flows.setLayoutData(flowsData);
    this.flows.setLowerBound(0);
    this.flows.setUpperBound(-1);
    flows.setID(CinematicViewsRepository.Package_.Properties.flows);
    // $NON-NLS-1$
    flows.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 84 with ViewerFilter

use of org.eclipse.jface.viewers.ViewerFilter in project InformationSystem by ObeoNetwork.

the class Package_PropertiesEditionPartForm method createSubPackagesTableComposition.

/**
 * @param container
 */
protected Composite createSubPackagesTableComposition(FormToolkit widgetFactory, Composite parent) {
    this.subPackages = new ReferencesTable(getDescription(CinematicViewsRepository.Package_.Properties.subPackages, CinematicMessages.Package_PropertiesEditionPart_SubPackagesLabel), new ReferencesTableListener() {

        public void handleAdd() {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(Package_PropertiesEditionPartForm.this, CinematicViewsRepository.Package_.Properties.subPackages, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, null));
            subPackages.refresh();
        }

        public void handleEdit(EObject element) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(Package_PropertiesEditionPartForm.this, CinematicViewsRepository.Package_.Properties.subPackages, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.EDIT, null, element));
            subPackages.refresh();
        }

        public void handleMove(EObject element, int oldIndex, int newIndex) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(Package_PropertiesEditionPartForm.this, CinematicViewsRepository.Package_.Properties.subPackages, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.MOVE, element, newIndex));
            subPackages.refresh();
        }

        public void handleRemove(EObject element) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(Package_PropertiesEditionPartForm.this, CinematicViewsRepository.Package_.Properties.subPackages, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.REMOVE, null, element));
            subPackages.refresh();
        }

        public void navigateTo(EObject element) {
        }
    });
    for (ViewerFilter filter : this.subPackagesFilters) {
        this.subPackages.addFilter(filter);
    }
    this.subPackages.setHelpText(propertiesEditionComponent.getHelpContent(CinematicViewsRepository.Package_.Properties.subPackages, CinematicViewsRepository.FORM_KIND));
    this.subPackages.createControls(parent, widgetFactory);
    this.subPackages.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (e.item != null && e.item.getData() instanceof EObject) {
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(Package_PropertiesEditionPartForm.this, CinematicViewsRepository.Package_.Properties.subPackages, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SELECTION_CHANGED, null, e.item.getData()));
            }
        }
    });
    GridData subPackagesData = new GridData(GridData.FILL_HORIZONTAL);
    subPackagesData.horizontalSpan = 3;
    this.subPackages.setLayoutData(subPackagesData);
    this.subPackages.setLowerBound(0);
    this.subPackages.setUpperBound(-1);
    subPackages.setID(CinematicViewsRepository.Package_.Properties.subPackages);
    // $NON-NLS-1$
    subPackages.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 85 with ViewerFilter

use of org.eclipse.jface.viewers.ViewerFilter in project InformationSystem by ObeoNetwork.

the class TransitionTransitionPropertiesEditionComponent method initPart.

/**
 * {@inheritDoc}
 *
 * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
 *      org.eclipse.emf.ecore.resource.ResourceSet)
 */
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
    setInitializing(true);
    if (editingPart != null && key == partKey) {
        editingPart.setContext(elt, allResource);
        final Transition transition = (Transition) elt;
        final TransitionPropertiesEditionPart transitionPart = (TransitionPropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(FlowViewsRepository.Transition.Properties.description))
            transitionPart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, transition.getDescription()));
        if (isAccessible(FlowViewsRepository.Transition.Properties.name))
            transitionPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, transition.getName()));
        if (isAccessible(FlowViewsRepository.Transition.Properties.guard))
            transitionPart.setGuard(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, transition.getGuard()));
        if (isAccessible(FlowViewsRepository.Transition.Properties.modal)) {
            transitionPart.setModal(transition.isModal());
        }
        if (isAccessible(FlowViewsRepository.Transition.Properties.from)) {
            // init part
            fromSettings = new EObjectFlatComboSettings(transition, FlowPackage.eINSTANCE.getTransition_From());
            transitionPart.initFrom(fromSettings);
            // set the button mode
            transitionPart.setFromButtonMode(ButtonsModeEnum.BROWSE);
        }
        if (isAccessible(FlowViewsRepository.Transition.Properties.to)) {
            // init part
            toSettings = new EObjectFlatComboSettings(transition, FlowPackage.eINSTANCE.getTransition_To());
            transitionPart.initTo(toSettings);
            // set the button mode
            transitionPart.setToButtonMode(ButtonsModeEnum.BROWSE);
        }
        if (isAccessible(FlowViewsRepository.Transition.Properties.on)) {
            onSettings = new ReferencesTableSettings(transition, FlowPackage.eINSTANCE.getTransition_On());
            transitionPart.initOn(onSettings);
        }
        if (isAccessible(FlowViewsRepository.Transition.Properties.from)) {
            transitionPart.addFilterToFrom(new ViewerFilter() {

                /**
                 * {@inheritDoc}
                 *
                 * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
                 */
                public boolean select(Viewer viewer, Object parentElement, Object element) {
                    // $NON-NLS-1$
                    return (element instanceof String && element.equals("")) || (element instanceof FlowState);
                }
            });
        // Start of user code for additional businessfilters for from
        // End of user code
        }
        if (isAccessible(FlowViewsRepository.Transition.Properties.to)) {
            transitionPart.addFilterToTo(new ViewerFilter() {

                /**
                 * {@inheritDoc}
                 *
                 * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
                 */
                public boolean select(Viewer viewer, Object parentElement, Object element) {
                    // $NON-NLS-1$
                    return (element instanceof String && element.equals("")) || (element instanceof FlowState);
                }
            });
        // Start of user code for additional businessfilters for to
        // End of user code
        }
        if (isAccessible(FlowViewsRepository.Transition.Properties.on)) {
            transitionPart.addFilterToOn(new EObjectFilter(CinematicPackage.Literals.EVENT));
        // Start of user code for additional businessfilters for on
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : EObjectFilter(org.eclipse.emf.eef.runtime.impl.filters.EObjectFilter) FlowState(org.obeonetwork.dsl.cinematic.flow.FlowState) ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) Transition(org.obeonetwork.dsl.cinematic.flow.Transition) TransitionPropertiesEditionPart(org.obeonetwork.dsl.cinematic.flow.parts.TransitionPropertiesEditionPart) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) EObjectFlatComboSettings(org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings)

Aggregations

ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)266 EObject (org.eclipse.emf.ecore.EObject)144 Viewer (org.eclipse.jface.viewers.Viewer)130 GridData (org.eclipse.swt.layout.GridData)124 SelectionEvent (org.eclipse.swt.events.SelectionEvent)107 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)101 IPropertiesEditionEvent (org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)86 PropertiesEditionEvent (org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent)86 ReferencesTable (org.eclipse.emf.eef.runtime.ui.widgets.ReferencesTable)84 ReferencesTableListener (org.eclipse.emf.eef.runtime.ui.widgets.ReferencesTable.ReferencesTableListener)84 ReferencesTableSettings (org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings)38 Composite (org.eclipse.swt.widgets.Composite)38 GridLayout (org.eclipse.swt.layout.GridLayout)33 TreeViewer (org.eclipse.jface.viewers.TreeViewer)28 IFile (org.eclipse.core.resources.IFile)24 EObjectFlatComboSettings (org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings)22 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)21 Label (org.eclipse.swt.widgets.Label)21 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)20 TableViewer (org.eclipse.jface.viewers.TableViewer)20