/** * check for transitions from initstate * * @param initState * @return */ private boolean isLoneTransition(EObject initState) { Pageflow pageflow = (Pageflow) initState.eContainer(); EList transitions = pageflow.getTransitions(); for (Iterator iter = transitions.iterator(); iter.hasNext(); ) { Transition transition = (Transition) iter.next(); if (transition.getFromState().equals(initState)) { return false; } } return true; }
/** @param input */ private void setInput(Object input) { Diagram diagram = null; if (input instanceof Pageflow) { Pageflow pageflow = (Pageflow) input; diagram = fetchDiagram(pageflow.eResource()); } else if (input instanceof Diagram) { diagram = (Diagram) input; } else if (input instanceof Resource) { Resource res = (Resource) input; diagram = fetchDiagram(res); } else if (input instanceof ResourceSet) { Resource res = ((ResourceSet) input).getResources().get(0); diagram = fetchDiagram(res); } else if (input instanceof List) { Resource res = (Resource) ((List<?>) input).get(0); diagram = fetchDiagram(res); } if (diagram != null) { TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain( diagram.eResource().getResourceSet()); RootEditPart rootEP = EditPartService.getInstance().createRootEditPart(diagram); if (rootEP instanceof DiagramRootEditPart) { ((DiagramRootEditPart) rootEP) .setPreferencesHint(PageflowDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT); } viewer.setRootEditPart(rootEP); viewer.setEditPartFactory(new PageflowEditPartFactory()); viewer.setContents(diagram); viewer.flush(); if (viewer.getContents() instanceof DiagramEditPart) { DiagramEditPart dp = (DiagramEditPart) viewer.getContents(); dp.disableEditMode(); } } return; }