Search in sources :

Example 1 with UserStoriesView

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;
}
Also used : UserStoriesView(org.obeonetwork.graal.design.ui.view.UserStoriesView) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) EObject(org.eclipse.emf.ecore.EObject) EditingDomain(org.eclipse.emf.edit.domain.EditingDomain) UserStoryDialog(org.obeonetwork.graal.design.ui.dialog.UserStoryDialog) Date(java.util.Date) UserStory(org.obeonetwork.graal.UserStory)

Example 2 with UserStoriesView

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;
}
Also used : UserStoriesView(org.obeonetwork.graal.design.ui.view.UserStoriesView) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart)

Example 3 with UserStoriesView

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;
}
Also used : UserStoriesView(org.obeonetwork.graal.design.ui.view.UserStoriesView) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) EditingDomain(org.eclipse.emf.edit.domain.EditingDomain) UserStory(org.obeonetwork.graal.UserStory)

Example 4 with UserStoriesView

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;
}
Also used : UserStoriesView(org.obeonetwork.graal.design.ui.view.UserStoriesView) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) EditingDomain(org.eclipse.emf.edit.domain.EditingDomain) UserStoryDialog(org.obeonetwork.graal.design.ui.dialog.UserStoryDialog) UserStory(org.obeonetwork.graal.UserStory) CompoundCommand(org.eclipse.emf.common.command.CompoundCommand)

Aggregations

IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)4 UserStoriesView (org.obeonetwork.graal.design.ui.view.UserStoriesView)4 EditingDomain (org.eclipse.emf.edit.domain.EditingDomain)3 UserStory (org.obeonetwork.graal.UserStory)3 UserStoryDialog (org.obeonetwork.graal.design.ui.dialog.UserStoryDialog)2 Date (java.util.Date)1 CompoundCommand (org.eclipse.emf.common.command.CompoundCommand)1 EObject (org.eclipse.emf.ecore.EObject)1