Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [graphiti-dev] DiagramComposite example

With still (literally) hundreds of errors in the error log, this is going in the right direction...


2013/3/6 Wenz, Michael <michael.wenz@xxxxxxx>

+1

 

Michael

 

From: graphiti-dev-bounces@xxxxxxxxxxx [mailto:graphiti-dev-bounces@xxxxxxxxxxx] On Behalf Of Felix Velasco
Sent: Mittwoch, 6. März 2013 09:15
To: Patrick Paulin; Discuss development topics on Graphiti
Subject: Re: [graphiti-dev] DiagramComposite example

 

Hi Patrick,

 

Thanks, I was missing the setLayout part. With that, I have a diagram in a view, and will now work in the diagram in a dialog example.

I believe setting the layout is something that should be done within the composite, not left to its caller. I will change it once I'm able to show a nice popup with a diagram.

 

Regards, and thanks,

Félix

 

2013/3/5 Patrick Paulin <patrick@xxxxxxxxxxxx>

Hi Felix,

 

You're probably doing this already, but I just wanted to check that you're calling setLayout(FillLayout()) on the diagram composite. This is probably something we should place inside the DiagramComposite itself. BTW, does the diagram composite example work for you?

 

As for the IWorkbenchPart dependency, I think it would be a great idea to make it optional as you suggest. Ideally we would support a self-contained diagram composite that could be used in a wide variety of situations. In the long term, though, I'd like Graphiti to become e4 compatible and in that case the IWP reference would need to go. Could we wrap the IWP reference in our own type (e.g. IGraphitiPart) so that we would have more flexibility in the future?

 

--- Patrick

 

On Mar 5, 2013, at 12:46 PM, Felix Velasco <felix.velasco@xxxxxxxxx> wrote:



Hi,

 

I'm working in a couple examples, based on the chess one, and I've run into some issues. First of all, I'm totally unable to show anything in the view. I'm sure I'm missing something obvious, since I just get an empty composite. The relevant code I'm using within the ViewPart is this:

 

URI diagramURI = URI.createPlatformResourceURI(resource.getFullPath().toString(), true);

IDiagramEditorInput input = new DiagramEditorInput(diagramURI,

"org.eclipse.graphiti.examples.chess.ChessDiagramTypeProvider");

 

DiagramComposite diagramComposite = new DiagramComposite(this, parent, SWT.BORDER);

diagramComposite.setInput(input);

 

Please tell me if I have to call some method in DiagramComposite, or I'm just doing something terribly wrong. I've tried createControl, initializeGraphicalViewer, createGraphicalViewer, configureGraphicalViewer, layout, update and anything else I could thought of.

 

On the other hand, I've also tried putting the composite inside a Dialog. There I've had more troubles, since DiagramComposite expects an IWorkbenchPart, and there's none available. Since it's there only for behavioral concerns, I've successfully passed null to the constructor and checked its use within the architecture, to prevent NPEs. Successfully, that's it, up to the point where I'm presented with an empty composite, just as in the ViewPart. Once somebody (Patrick, Michael) points me the mistake I'm making, I think I'd be able to show a diagram in both a view and a dialog.

 

Then we should think if we must pass the IWorkbenchPart to the constructor. By doing so, the behavior of the view is pretty much tied to the diagram. This works well if this is a view with just a diagram, but wouldn't play nice with other Controls or the possibility of using it in a Dialog. If we provide two constructors, with and without IWP, or even just a setter (setWorkbenchPart), we could have two possible behaviors: if setted, graphiti is the "owner" of the IWorkbenchPart. We could set the title, the selection provider, the actions... everything. Otherwise, we should suppose that we are not in control, and not even try to do this things, thus playing nice with any other Controls that lay around us. This would also allow for two different diagrams in the same view, since none of them would try to own it.

 

What do you think?

 

Regards,

Félix

 

 

 


_______________________________________________
graphiti-dev mailing list
graphiti-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/graphiti-dev


Attachment: ChessDialog.png
Description: PNG image


Back to the top