/** * {@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( final Object key, final int kind, final EObject elt, final ResourceSet allResource) { this.setInitializing(true); if ((this.editingPart != null) && (key == this.partKey)) { this.editingPart.setContext(elt, allResource); final Task task = (Task) elt; final TaskPropertiesEditionPart taskPart = (TaskPropertiesEditionPart) this.editingPart; // init values if (this.isAccessible(GraalViewsRepository.Task.Properties.description)) { taskPart.setDescription( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, task.getDescription())); } if (this.isAccessible(GraalViewsRepository.Task.Properties.subActivities)) { this.subActivitiesSettings = new ReferencesTableSettings(task, GraalPackage.eINSTANCE.getActivity_SubActivities()); taskPart.initSubActivities(this.subActivitiesSettings); } if (this.isAccessible(GraalViewsRepository.Task.Properties.actors)) { this.actorsSettings = new ReferencesTableSettings(task, GraalPackage.eINSTANCE.getTask_Actors()); taskPart.initActors(this.actorsSettings); } if (this.isAccessible(GraalViewsRepository.Task.Properties.id)) { taskPart.setId( EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, task.getId())); } if (this.isAccessible(GraalViewsRepository.Task.Properties.name)) { taskPart.setName( EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, task.getName())); } if (this.isAccessible(GraalViewsRepository.Task.Properties.uses)) { this.usesSettings = new ReferencesTableSettings(task, GraalPackage.eINSTANCE.getTask_Uses()); taskPart.initUses(this.usesSettings); } if (this.isAccessible(GraalViewsRepository.Task.Properties.preconditions)) { taskPart.setPreconditions( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, task.getPreconditions())); } if (this.isAccessible(GraalViewsRepository.Task.Properties.postconditions)) { taskPart.setPostconditions( EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, task.getPostconditions())); // init filters } if (this.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) */ @Override public boolean select( final Viewer viewer, final Object parentElement, final Object element) { return ((element instanceof String) && element.equals("")) || (element instanceof Activity); // $NON-NLS-1$ } }); // Start of user code for additional businessfilters for // subActivities // End of user code } if (this.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 (this.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 } this.setInitializing(false); }
/** * {@inheritDoc} * * @see * org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updateSemanticModel(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent) */ @Override public void updateSemanticModel(final IPropertiesEditionEvent event) { final Task task = (Task) this.semanticObject; if (GraalViewsRepository.Task.Properties.description == event.getAffectedEditor()) { task.setDescription( (java.lang.String) EEFConverterUtil.createFromString( EcorePackage.Literals.ESTRING, (String) event.getNewValue())); } if (GraalViewsRepository.Task.Properties.subActivities == event.getAffectedEditor()) { if (event.getKind() == PropertiesEditionEvent.ADD) { final EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext( this.editingContext, this, this.subActivitiesSettings, this.editingContext.getAdapterFactory()); final PropertiesEditingProvider provider = (PropertiesEditingProvider) this.editingContext .getAdapterFactory() .adapt(this.semanticObject, PropertiesEditingProvider.class); if (provider != null) { final PropertiesEditingPolicy policy = provider.getPolicy(context); if (policy instanceof CreateEditingPolicy) { policy.execute(); } } } else if (event.getKind() == PropertiesEditionEvent.EDIT) { final EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext( this.editingContext, this, (EObject) event.getNewValue(), this.editingContext.getAdapterFactory()); final PropertiesEditingProvider provider = (PropertiesEditingProvider) this.editingContext .getAdapterFactory() .adapt((EObject) event.getNewValue(), PropertiesEditingProvider.class); if (provider != null) { final PropertiesEditingPolicy editionPolicy = provider.getPolicy(context); if (editionPolicy != null) { editionPolicy.execute(); } } } else if (event.getKind() == PropertiesEditionEvent.REMOVE) { this.subActivitiesSettings.removeFromReference((EObject) event.getNewValue()); } else if (event.getKind() == PropertiesEditionEvent.MOVE) { this.subActivitiesSettings.move(event.getNewIndex(), (Activity) event.getNewValue()); } } if (GraalViewsRepository.Task.Properties.actors == event.getAffectedEditor()) { if (event.getKind() == PropertiesEditionEvent.ADD) { if (event.getNewValue() instanceof Actor) { this.actorsSettings.addToReference((EObject) event.getNewValue()); } } else if (event.getKind() == PropertiesEditionEvent.REMOVE) { this.actorsSettings.removeFromReference((EObject) event.getNewValue()); } else if (event.getKind() == PropertiesEditionEvent.MOVE) { this.actorsSettings.move(event.getNewIndex(), (Actor) event.getNewValue()); } } if (GraalViewsRepository.Task.Properties.id == event.getAffectedEditor()) { task.setId( (java.lang.String) EEFConverterUtil.createFromString( EcorePackage.Literals.ESTRING, (String) event.getNewValue())); } if (GraalViewsRepository.Task.Properties.name == event.getAffectedEditor()) { task.setName( (java.lang.String) EEFConverterUtil.createFromString( EcorePackage.Literals.ESTRING, (String) event.getNewValue())); } if (GraalViewsRepository.Task.Properties.uses == event.getAffectedEditor()) { if (event.getKind() == PropertiesEditionEvent.ADD) { if (event.getNewValue() instanceof Task) { this.usesSettings.addToReference((EObject) event.getNewValue()); } } else if (event.getKind() == PropertiesEditionEvent.REMOVE) { this.usesSettings.removeFromReference((EObject) event.getNewValue()); } else if (event.getKind() == PropertiesEditionEvent.MOVE) { this.usesSettings.move(event.getNewIndex(), (Task) event.getNewValue()); } } if (GraalViewsRepository.Task.Properties.preconditions == event.getAffectedEditor()) { task.setPreconditions( (java.lang.String) EEFConverterUtil.createFromString( EcorePackage.Literals.ESTRING, (String) event.getNewValue())); } if (GraalViewsRepository.Task.Properties.postconditions == event.getAffectedEditor()) { task.setPostconditions( (java.lang.String) EEFConverterUtil.createFromString( EcorePackage.Literals.ESTRING, (String) event.getNewValue())); } }