Search in sources :

Example 1 with UserStory

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);
}
Also used : UserStoryPropertiesEditionPart(org.obeonetwork.graal.parts.UserStoryPropertiesEditionPart) UserStory(org.obeonetwork.graal.UserStory)

Example 2 with UserStory

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;
}
Also used : EObject(org.eclipse.emf.ecore.EObject) ArrayList(java.util.ArrayList) EObject(org.eclipse.emf.ecore.EObject) System(org.obeonetwork.graal.System) UserStory(org.obeonetwork.graal.UserStory)

Example 3 with UserStory

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);
    }
}
Also used : AdapterImpl(org.eclipse.emf.common.notify.impl.AdapterImpl) Adapter(org.eclipse.emf.common.notify.Adapter) Notification(org.eclipse.emf.common.notify.Notification) UserStory(org.obeonetwork.graal.UserStory)

Example 4 with UserStory

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);
    }
}
Also used : Figure(org.eclipse.draw2d.Figure) IFigure(org.eclipse.draw2d.IFigure) UserStory(org.obeonetwork.graal.UserStory)

Example 5 with UserStory

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;
}
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)

Aggregations

UserStory (org.obeonetwork.graal.UserStory)10 EObject (org.eclipse.emf.ecore.EObject)3 EditingDomain (org.eclipse.emf.edit.domain.EditingDomain)3 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)3 UserStoriesView (org.obeonetwork.graal.design.ui.view.UserStoriesView)3 ArrayList (java.util.ArrayList)2 UserStoryDialog (org.obeonetwork.graal.design.ui.dialog.UserStoryDialog)2 Collection (java.util.Collection)1 Date (java.util.Date)1 State (org.eclipse.core.commands.State)1 Figure (org.eclipse.draw2d.Figure)1 IFigure (org.eclipse.draw2d.IFigure)1 CompoundCommand (org.eclipse.emf.common.command.CompoundCommand)1 Adapter (org.eclipse.emf.common.notify.Adapter)1 Notification (org.eclipse.emf.common.notify.Notification)1 AdapterImpl (org.eclipse.emf.common.notify.impl.AdapterImpl)1 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)1 CheckStateChangedEvent (org.eclipse.jface.viewers.CheckStateChangedEvent)1 CheckboxTreeViewer (org.eclipse.jface.viewers.CheckboxTreeViewer)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1