Java Code Examples for org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#getChildren()

The following examples show how to use org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#getChildren() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StateMachineDiagramElementsGmfArranger.java    From txtUML with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Calls an {@link AbstractDiagramElementsGmfArranger#autoresizeGraphicalEditPart(GraphicalEditPart) autosize}
 * and {@link AbstractDiagramElementsGmfArranger#arrangeChildren(EditPart) arrangeChildren} 
 * on the given statemachine.
 * The method is called recursively for all children which are {@link StateEditPart}s
 * @param stateEP - The StateEditPart
 */
private void arrange_and_resize_recursively(GraphicalEditPart stateEP) {
	@SuppressWarnings("unchecked")
	List<GraphicalEditPart> stateCompartements = stateEP.getChildren();

	@SuppressWarnings("unchecked")
	List<GraphicalEditPart> regions =  ((EditPart) stateCompartements.get(1)).getChildren();
	
	for(GraphicalEditPart region: regions){		
		GraphicalEditPart regioncompartement = (GraphicalEditPart) region.getChildren().get(0);
		@SuppressWarnings("unchecked")
		List<EditPart> listEp = regioncompartement.getChildren();
		
		for(EditPart Ep : listEp){
			if(Ep instanceof StateEditPart){
				arrange_and_resize_recursively((StateEditPart) Ep);				
			}
		}
		super.autoresizeGraphicalEditPart(stateEP);
		super.arrangeChildren(regioncompartement);
	}
}
 
Example 2
Source File: StateMachineDiagramElementsGmfArranger.java    From txtUML with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Calls an {@link AbstractDiagramElementsGmfArranger#arrangeChildren(EditPart) arrangeChildren}
 *  and a hideConnectionLabels on the children of the given GraphicalEditPart
 * @param stateEP - The GraphicalEditPart
 */
private void arrange_recurively(GraphicalEditPart stateEP) {
	@SuppressWarnings("unchecked")
	List<GraphicalEditPart> stateCompartements = stateEP.getChildren();

	@SuppressWarnings("unchecked")
	List<GraphicalEditPart> regions =  ((EditPart) stateCompartements.get(1)).getChildren();
	
	for(GraphicalEditPart region: regions){		
		GraphicalEditPart regioncompartement = (GraphicalEditPart) region.getChildren().get(0);
		@SuppressWarnings("unchecked")
		List<GraphicalEditPart> listEp = regioncompartement.getChildren();
		
		for(GraphicalEditPart Ep : listEp){
			if(Ep instanceof StateEditPart){
				arrange_recurively(Ep);				
			}
		}
		super.arrangeChildren(regioncompartement);
		DiagramElementsModifier.hideConnectionLabelsForEditParts(listEp, Arrays.asList(CustomTransitionGuardEditPart.class));	
	}
}
 
Example 3
Source File: AbstractDiagramElementsTxtUmlArranger.java    From txtUML with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Arranges the children of an EditPart with the txtUML arranging algorithm 
 * @param parent - The children of this EditPart will be arranged
 * @throws ArrangeException 
 */
protected void arrangeChildren(GraphicalEditPart parent, IProgressMonitor monitor) throws ArrangeException{
	@SuppressWarnings("unchecked")
	List<GraphicalEditPart> editParts = parent.getChildren();
	if(!editParts.isEmpty()){
		DiagramExportationReport report = txtUmlRegistry.getDescriptor().getReport(this.diagep.getDiagramView().getName());
		Set<RectangleObject> objects = report.getNodes();
		Set<LineAssociation> links = report.getLinks();
		List<Statement> statements =  report.getStatements();
		
		Map<GraphicalEditPart, RectangleObject> editPartsObjectsMapping  = pairObjectsToEditParts(objects, editParts);
		setPixelsizes(editPartsObjectsMapping);
		
		LayoutVisualizerManager vm = new LayoutVisualizerManager(objects, links, statements);
		vm.addProgressMonitor(monitor);
		vm.arrange();
		
		objects = vm.getObjects();
		links = vm.getAssociations();
		
		
		List<ConnectionNodeEditPart> connections = getConnectionsOfEditParts(editParts);
		Map<ConnectionNodeEditPart, List<hu.elte.txtuml.utils.diagrams.Point>> linksTransform = pairRoutesToConnectionEditParts(links, connections);
		Map<GraphicalEditPart, hu.elte.txtuml.utils.diagrams.Rectangle> objectsTransform = createObjectRectangleMappingFromObjectsAndEditParts(objects, editParts);
		
		transformObjectsAndLinks(objectsTransform, linksTransform, 
				vm.getPixelGridRatioHorizontal(), vm.getPixelGridRatioVertical());
		
		this.modifyEditParts(objectsTransform);		
		this.modifyConnectionEditParts(linksTransform, objectsTransform);	
	}
}