Search in sources :

Example 66 with ViewerFilter

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

the class TaskTaskPropertiesEditionComponent 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 Task task = (Task) elt;
        final TaskPropertiesEditionPart taskPart = (TaskPropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(GraalViewsRepository.Task.Properties.description))
            taskPart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, task.getDescription()));
        if (isAccessible(GraalViewsRepository.Task.Properties.subActivities)) {
            subActivitiesSettings = new ReferencesTableSettings(task, GraalPackage.eINSTANCE.getActivity_SubActivities());
            taskPart.initSubActivities(subActivitiesSettings);
        }
        if (isAccessible(GraalViewsRepository.Task.Properties.actors)) {
            actorsSettings = new ReferencesTableSettings(task, GraalPackage.eINSTANCE.getTask_Actors());
            taskPart.initActors(actorsSettings);
        }
        if (isAccessible(GraalViewsRepository.Task.Properties.id))
            taskPart.setId(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, task.getId()));
        if (isAccessible(GraalViewsRepository.Task.Properties.name))
            taskPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, task.getName()));
        if (isAccessible(GraalViewsRepository.Task.Properties.uses)) {
            usesSettings = new ReferencesTableSettings(task, GraalPackage.eINSTANCE.getTask_Uses());
            taskPart.initUses(usesSettings);
        }
        if (isAccessible(GraalViewsRepository.Task.Properties.preconditions))
            taskPart.setPreconditions(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, task.getPreconditions()));
        if (isAccessible(GraalViewsRepository.Task.Properties.postconditions))
            taskPart.setPostconditions(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, task.getPostconditions()));
        if (isAccessible(GraalViewsRepository.Task.Properties.subActivities)) {
            taskPart.addFilterToSubActivities(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 Loop);
                }
            });
        // Start of user code for additional businessfilters for subActivities
        // End of user code
        }
        if (isAccessible(GraalViewsRepository.Task.Properties.actors)) {
            taskPart.addFilterToActors(new EObjectFilter(GraalPackage.Literals.ACTOR));
        // Start of user code for additional businessfilters for actors
        // End of user code
        }
        if (isAccessible(GraalViewsRepository.Task.Properties.uses)) {
            taskPart.addFilterToUses(new EObjectFilter(GraalPackage.Literals.TASK));
        // Start of user code for additional businessfilters for uses
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : Loop(org.obeonetwork.graal.Loop) EObjectFilter(org.eclipse.emf.eef.runtime.impl.filters.EObjectFilter) Task(org.obeonetwork.graal.Task) ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) TaskPropertiesEditionPart(org.obeonetwork.graal.parts.TaskPropertiesEditionPart)

Example 67 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(GraalViewsRepository.Transition.Properties.description))
            transitionPart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, transition.getDescription()));
        if (isAccessible(GraalViewsRepository.Transition.Properties.guard))
            transitionPart.setGuard(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, transition.getGuard()));
        if (isAccessible(GraalViewsRepository.Transition.Properties.source)) {
            // init part
            sourceSettings = new EObjectFlatComboSettings(transition, GraalPackage.eINSTANCE.getTransition_Source());
            transitionPart.initSource(sourceSettings);
            // set the button mode
            transitionPart.setSourceButtonMode(ButtonsModeEnum.BROWSE);
        }
        if (isAccessible(GraalViewsRepository.Transition.Properties.target)) {
            // init part
            targetSettings = new EObjectFlatComboSettings(transition, GraalPackage.eINSTANCE.getTransition_Target());
            transitionPart.initTarget(targetSettings);
            // set the button mode
            transitionPart.setTargetButtonMode(ButtonsModeEnum.BROWSE);
        }
        if (isAccessible(GraalViewsRepository.Transition.Properties.kind)) {
            transitionPart.initKind(EEFUtils.choiceOfValues(transition, GraalPackage.eINSTANCE.getTransition_Kind()), transition.getKind());
        }
        if (isAccessible(GraalViewsRepository.Transition.Properties.source)) {
            transitionPart.addFilterToSource(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) {
                    return (element instanceof Node);
                }
            });
        // Start of user code for additional businessfilters for source
        // End of user code
        }
        if (isAccessible(GraalViewsRepository.Transition.Properties.target)) {
            transitionPart.addFilterToTarget(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) {
                    return (element instanceof Node);
                }
            });
        // Start of user code for additional businessfilters for target
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) Node(org.obeonetwork.graal.Node) Transition(org.obeonetwork.graal.Transition) TransitionPropertiesEditionPart(org.obeonetwork.graal.parts.TransitionPropertiesEditionPart) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) EObjectFlatComboSettings(org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings)

Example 68 with ViewerFilter

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

the class LoopLoopPropertiesEditionComponent 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 Loop loop = (Loop) elt;
        final LoopPropertiesEditionPart loopPart = (LoopPropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(GraalViewsRepository.Loop.Properties.description))
            loopPart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, loop.getDescription()));
        if (isAccessible(GraalViewsRepository.Loop.Properties.subActivities)) {
            subActivitiesSettings = new ReferencesTableSettings(loop, GraalPackage.eINSTANCE.getActivity_SubActivities());
            loopPart.initSubActivities(subActivitiesSettings);
        }
        if (isAccessible(GraalViewsRepository.Loop.Properties.lowerBound)) {
            loopPart.setLowerBound(EEFConverterUtil.convertToString(EcorePackage.Literals.EINT, loop.getLowerBound()));
        }
        if (isAccessible(GraalViewsRepository.Loop.Properties.upperBound)) {
            loopPart.setUpperBound(EEFConverterUtil.convertToString(EcorePackage.Literals.EINT, loop.getUpperBound()));
        }
        if (isAccessible(GraalViewsRepository.Loop.Properties.subActivities)) {
            loopPart.addFilterToSubActivities(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 Loop);
                }
            });
        // Start of user code for additional businessfilters for subActivities
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : Loop(org.obeonetwork.graal.Loop) ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) LoopPropertiesEditionPart(org.obeonetwork.graal.parts.LoopPropertiesEditionPart) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject)

Example 69 with ViewerFilter

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

the class TaskReferenceTaskReferencePropertiesEditionComponent 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 TaskReference taskReference = (TaskReference) elt;
        final TaskReferencePropertiesEditionPart taskReferencePart = (TaskReferencePropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(GraalViewsRepository.TaskReference.Properties.description))
            taskReferencePart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, taskReference.getDescription()));
        if (isAccessible(GraalViewsRepository.TaskReference.Properties.outgoingTransitions)) {
            outgoingTransitionsSettings = new ReferencesTableSettings(taskReference, GraalPackage.eINSTANCE.getNode_OutgoingTransitions());
            taskReferencePart.initOutgoingTransitions(outgoingTransitionsSettings);
        }
        if (isAccessible(GraalViewsRepository.TaskReference.Properties.incomingTransitions)) {
            incomingTransitionsSettings = new ReferencesTableSettings(taskReference, GraalPackage.eINSTANCE.getNode_IncomingTransitions());
            taskReferencePart.initIncomingTransitions(incomingTransitionsSettings);
        }
        if (isAccessible(GraalViewsRepository.TaskReference.Properties.task)) {
            // init part
            taskSettings = new EObjectFlatComboSettings(taskReference, GraalPackage.eINSTANCE.getTaskReference_Task());
            taskReferencePart.initTask(taskSettings);
            // set the button mode
            taskReferencePart.setTaskButtonMode(ButtonsModeEnum.BROWSE);
        }
        if (isAccessible(GraalViewsRepository.TaskReference.Properties.outgoingTransitions)) {
            taskReferencePart.addFilterToOutgoingTransitions(new EObjectFilter(GraalPackage.Literals.TRANSITION));
        // Start of user code for additional businessfilters for outgoingTransitions
        // End of user code
        }
        if (isAccessible(GraalViewsRepository.TaskReference.Properties.incomingTransitions)) {
            taskReferencePart.addFilterToIncomingTransitions(new EObjectFilter(GraalPackage.Literals.TRANSITION));
        // Start of user code for additional businessfilters for incomingTransitions
        // End of user code
        }
        if (isAccessible(GraalViewsRepository.TaskReference.Properties.task)) {
            taskReferencePart.addFilterToTask(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) {
                    return (element instanceof Task);
                }
            });
        // Start of user code for additional businessfilters for task
        // 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) Task(org.obeonetwork.graal.Task) ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) EObjectFlatComboSettings(org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings) TaskReferencePropertiesEditionPart(org.obeonetwork.graal.parts.TaskReferencePropertiesEditionPart) TaskReference(org.obeonetwork.graal.TaskReference)

Example 70 with ViewerFilter

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

the class CategoryPropertiesEditionPartImpl method createRequirementsAdvancedTableComposition.

/**
 * @param container
 */
protected Composite createRequirementsAdvancedTableComposition(Composite parent) {
    this.requirements = new ReferencesTable(getDescription(RequirementViewsRepository.Category.Category_.requirements, RequirementMessages.CategoryPropertiesEditionPart_RequirementsLabel), new ReferencesTableListener() {

        public void handleAdd() {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(CategoryPropertiesEditionPartImpl.this, RequirementViewsRepository.Category.Category_.requirements, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, null));
            requirements.refresh();
        }

        public void handleEdit(EObject element) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(CategoryPropertiesEditionPartImpl.this, RequirementViewsRepository.Category.Category_.requirements, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.EDIT, null, element));
            requirements.refresh();
        }

        public void handleMove(EObject element, int oldIndex, int newIndex) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(CategoryPropertiesEditionPartImpl.this, RequirementViewsRepository.Category.Category_.requirements, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.MOVE, element, newIndex));
            requirements.refresh();
        }

        public void handleRemove(EObject element) {
            propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(CategoryPropertiesEditionPartImpl.this, RequirementViewsRepository.Category.Category_.requirements, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.REMOVE, null, element));
            requirements.refresh();
        }

        public void navigateTo(EObject element) {
        }
    });
    for (ViewerFilter filter : this.requirementsFilters) {
        this.requirements.addFilter(filter);
    }
    this.requirements.setHelpText(propertiesEditionComponent.getHelpContent(RequirementViewsRepository.Category.Category_.requirements, RequirementViewsRepository.SWT_KIND));
    this.requirements.createControls(parent);
    this.requirements.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (e.item != null && e.item.getData() instanceof EObject) {
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(CategoryPropertiesEditionPartImpl.this, RequirementViewsRepository.Category.Category_.requirements, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SELECTION_CHANGED, null, e.item.getData()));
            }
        }
    });
    GridData requirementsData = new GridData(GridData.FILL_HORIZONTAL);
    requirementsData.horizontalSpan = 3;
    this.requirements.setLayoutData(requirementsData);
    this.requirements.setLowerBound(0);
    this.requirements.setUpperBound(-1);
    requirements.setID(RequirementViewsRepository.Category.Category_.requirements);
    // $NON-NLS-1$
    requirements.setEEFType("eef::AdvancedTableComposition");
    // End of user code
    return parent;
}
Also used : ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) FlatReferencesTable(org.eclipse.emf.eef.runtime.ui.widgets.FlatReferencesTable) 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)

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