Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Is displaying part of GMF model possible?(How do I display only one Node of a GMF model?)
Is displaying part of GMF model possible? [message #902089] Wed, 15 August 2012 19:16 Go to next message
C. Thompson is currently offline C. ThompsonFriend
Messages: 23
Registered: May 2012
Location: Vancouver, BC
Junior Member
Is this even possible?

I am working on a project with GMF models. I have a whole Diagram object, that represents my *.ecorediag" file. But I do not want to display the whole diagram. Rather I want to display only One Node and it's persistent Children.

Currently I am doing:

	private DiagramGraphicalViewer viewer;
	protected final void displayDiagram(final Diagram diag) {

		if (diag == null) {
			return;
		}

		currentDiag = diag;
		
		// be sure the viewer will be correctly refreshed ( connections )
		viewer.getEditPartRegistry().clear();
		final DiagramRootEditPart rootEditPart = new DiagramRootEditPart(
				diag.getMeasurementUnit());
		viewer.setRootEditPart(rootEditPart);
		viewer.setContents(diag);

		enableEditMode((DiagramEditPart) viewer.getContents());
		rootEditPart.getZoomManager().setZoomAnimationStyle(
				ZoomManager.ANIMATE_NEVER);
		rootEditPart.getZoomManager().setZoom(ZOOM_FACTOR);
}


If so how can I do diag.getPersistantChildren().get(0), and view only those children?

[Updated on: Sat, 25 August 2012 02:56]

Report message to a moderator

Re: Is displaying part of GMF model possible? [message #902806 is a reply to message #902089] Mon, 20 August 2012 14:27 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

is it a solution for you to set all other views to invisible in notation model?

Ralph
Re: Is displaying part of GMF model possible? [message #903291 is a reply to message #902806] Wed, 22 August 2012 21:26 Go to previous messageGo to next message
C. Thompson is currently offline C. ThompsonFriend
Messages: 23
Registered: May 2012
Location: Vancouver, BC
Junior Member
How do I set other views to invisible?

I try to edit the
Diagram diag
object, to make some of the elements hidden. I get the error "Cannot modify resource set without a write transaction."
Re: Is displaying part of GMF model possible? [message #903665 is a reply to message #903291] Fri, 24 August 2012 19:04 Go to previous messageGo to next message
C. Thompson is currently offline C. ThompsonFriend
Messages: 23
Registered: May 2012
Location: Vancouver, BC
Junior Member
Is there a way to display a model in a view?
A minimalist way?
Re: Is displaying part of GMF model possible? [message #903908 is a reply to message #903665] Mon, 27 August 2012 08:24 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

you should try to use EMF Commands and execute them. Try SetCommand.create() http://download.eclipse.org/modeling/emf/emf/javadoc/2.4.2/org/eclipse/emf/edit/command/SetCommand.html#create(org.eclipse.emf.edit.domain.EditingDomain, java.lang.Object, java.lang.Object, java.lang.Object, int) to create an instance of the command. Execute this on the editdomain of the resource of the notation model. If you need further assistance let me know. It would be helpful to know where you want to execute the code.

Ralph
Re: Is displaying part of GMF model possible? [message #904106 is a reply to message #903908] Mon, 27 August 2012 19:12 Go to previous message
C. Thompson is currently offline C. ThompsonFriend
Messages: 23
Registered: May 2012
Location: Vancouver, BC
Junior Member
I am trying to execute the command after I run the constructor and create a tab new tab. Here is my constructor:

	public DiagramViewerTab(Composite parent, int side,
			GMFContentMergeTabFolder parentFolder) {

		contentMergeTabFolderParent = parentFolder;
		partSide = side;
		editDomain = new DiagramEditDomain(null);
		editDomain.setCommandStack(new DiagramCommandStack(editDomain));

		createDiagramGraphicalViewer(parent);

	}

	private void createDiagramGraphicalViewer(Composite composite) {
		viewer = new DiagramGraphicalViewer();
		viewer.createControl(composite);
		viewer.setEditDomain(editDomain);
		viewer.setEditPartFactory(EditPartService.getInstance());
		viewer.getControl().setBackground(ColorConstants.listBackground);
		viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.CTRL),
				MouseWheelZoomHandler.SINGLETON);
	}


Then after I load my Diagram into memory. I call displayDiagram(Diagram diag).

Thanks for the help!

[Updated on: Mon, 27 August 2012 19:12]

Report message to a moderator

Previous Topic:How do I use DiagramGraphicalViewer.setContents(Diagram)?
Next Topic:How to create a compartment (circle in a circle centered) ?
Goto Forum:
  


Current Time: Thu Apr 25 00:17:27 GMT 2024

Powered by FUDForum. Page generated in 0.03695 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top