use of org.obeonetwork.graal.UserStory in project InformationSystem by ObeoNetwork.
the class UserStoryUserStoryPropertiesEditionComponent 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 UserStory userStory = (UserStory) elt;
final UserStoryPropertiesEditionPart userStoryPart = (UserStoryPropertiesEditionPart) editingPart;
// init values
if (isAccessible(GraalViewsRepository.UserStory.Properties.description))
userStoryPart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, userStory.getDescription()));
if (isAccessible(GraalViewsRepository.UserStory.Properties.name))
userStoryPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, userStory.getName()));
// init filters
// init values for referenced views
// init filters for referenced views
}
setInitializing(false);
}
use of org.obeonetwork.graal.UserStory in project InformationSystem by ObeoNetwork.
the class UserStoriesContentProvider method availableStories.
/**
* @param eObject
* @return
*/
private List<UserStory> availableStories(Collection<?> eObjects) {
List<EObject> treatedRoots = new ArrayList<EObject>();
List<UserStory> result = new ArrayList<UserStory>();
for (Object next : eObjects) {
if (next instanceof EObject) {
EObject eObject = (EObject) next;
EObject rootContainer = EcoreUtil.getRootContainer(eObject);
if (!treatedRoots.contains(rootContainer)) {
if (rootContainer instanceof System) {
result.addAll(((System) rootContainer).getUserStories());
}
treatedRoots.add(rootContainer);
}
}
}
return result;
}
use of org.obeonetwork.graal.UserStory in project InformationSystem by ObeoNetwork.
the class AbstractUserStoryDecorator method attachUserStoriesAdapters.
/**
* Attaches adapters on the active user stories to refresh the decorator when an user story changes
*/
private void attachUserStoriesAdapters() {
for (UserStory activeUserStory : activeUserStories) {
Adapter adapter = new AdapterImpl() {
public void notifyChanged(Notification msg) {
if (GraalPackage.Literals.USER_STORY__ELEMENTS.equals(msg.getFeature())) {
doRefresh();
}
}
};
activeUserStory.eAdapters().add(adapter);
activeUserStoriesAdapters.add(adapter);
}
}
use of org.obeonetwork.graal.UserStory in project InformationSystem by ObeoNetwork.
the class UserStoryEdgeDecorator method doRefresh.
/**
* Refresh the decorator
* this method is called from the parent's refresh() method
*/
@Override
public void doRefresh() {
removeDecoration();
if (isConcernedByActiveUserStory()) {
setDecoration(getDecoratorTarget().addDecoration(new Figure(), new UserStoryEdgeLocator(), false));
UserStory userStory = getActiveUserStories().get(0);
getTargetEditPart().getFigure().setForegroundColor(pickColor(userStory));
} else {
getTargetEditPart().getFigure().setForegroundColor(normalColor);
}
}
use of org.obeonetwork.graal.UserStory in project InformationSystem by ObeoNetwork.
the class AddUserStoryHandler method execute.
/**
* {@inheritDoc}
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
if (activePart instanceof UserStoriesView) {
UserStoriesView view = (UserStoriesView) activePart;
EditingDomain editingDomain = view.getEditingDomain();
if (editingDomain != null) {
UserStoryDialog dialog = new UserStoryDialog(HandlerUtil.getActiveShell(event));
int open = dialog.open();
if (open == Window.OK) {
UserStory story = GraalFactory.eINSTANCE.createUserStory();
story.setName(dialog.getName());
story.setDescription(dialog.getDescription());
Date createdOn = new Date();
story.setCreatedOn(createdOn);
story.setModifiedOn(createdOn);
EObject eObject = EcoreUtil.getRootContainer(view.getInput().get(0));
if (eObject instanceof org.obeonetwork.graal.System) {
editingDomain.getCommandStack().execute(AddCommand.create(editingDomain, eObject, GraalPackage.eINSTANCE.getSystem_UserStories(), story));
view.refresh();
}
}
}
}
return null;
}
Aggregations