use of org.obeonetwork.graal.design.ui.view.UserStoriesView 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;
}
use of org.obeonetwork.graal.design.ui.view.UserStoriesView in project InformationSystem by ObeoNetwork.
the class HighlightUserStoryHandler 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;
view.updateUserStoryHighlightment();
}
return null;
}
use of org.obeonetwork.graal.design.ui.view.UserStoriesView in project InformationSystem by ObeoNetwork.
the class DeleteUserStoriesHandler 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;
boolean openConfirm = MessageDialog.openConfirm(view.getSite().getShell(), "Delete User Stories", "Delete the selected user stories ?");
if (openConfirm == true) {
EditingDomain editingDomain = view.getEditingDomain();
if (editingDomain != null) {
List<UserStory> selectedStories = view.getSelectedStories();
editingDomain.getCommandStack().execute(DeleteCommand.create(editingDomain, selectedStories));
view.refresh();
}
}
}
return null;
}
use of org.obeonetwork.graal.design.ui.view.UserStoriesView in project InformationSystem by ObeoNetwork.
the class EditUserStoryHandler 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) {
UserStory userStory = view.getSelectedStories().get(0);
UserStoryDialog dialog = new UserStoryDialog(HandlerUtil.getActiveShell(event), userStory);
int open = dialog.open();
if (open == Window.OK) {
CompoundCommand cc = new CompoundCommand();
cc.append(SetCommand.create(editingDomain, userStory, GraalPackage.eINSTANCE.getNamedElement_Name(), dialog.getName()));
cc.append(SetCommand.create(editingDomain, userStory, EnvironmentPackage.eINSTANCE.getObeoDSMObject_Description(), dialog.getDescription()));
editingDomain.getCommandStack().execute(cc);
view.refresh();
}
}
}
return null;
}
Aggregations