Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » file: / platform: differences when loading diagram
file: / platform: differences when loading diagram [message #197868] Fri, 18 July 2008 05:21 Go to next message
Eclipse UserFriend
Originally posted by: mklinchin.yahoo.com

Hi,

I have generated a diagram. It works great for diagram files located on
the file system outide of application workspace (select File / Open to
open them). I can open them in the editor, edit them and save them back.

But if I import the same diagram files (there are two of them: one for
diagram and the other one for the model) to workspace project and open
them from there (by double clicking on the file in Project Explorer) the
strange things happen. I can open the diagram, I can view it, navigate
through it but I cannot use any of the tools. When I pick any tool, I can
see a (+) sign on the editor but clicking on this sign does not do
anything. Instead I have java.lang.StackOverflowErrorerror in the log with
thousands of such records:

at
org.eclipse.emf.transaction.impl.TransactionImpl.isRollingBa ck(TransactionImpl.java:606)

I tried to dig it deeper and found that commands for tools are not formed
correctly with thousands nested commands because of some "edit policy
command" does not set to "null" for these "platform://" files but to the
same command instead.

I had custom diagram loader but I eliminated it to the following code in
my XXResourceImpl:

@Override
public void doLoad(InputStream inputStream, Map<?, ?> options)
throws IOException {
if( !this.getURI().isFile() ) {
//new ModelProvider().load(this, inputStream, options);
super.doLoad(inputStream, options);
} else {
super.doLoad(inputStream, options);
}
}

I can watch it is debug: when it goes under "if" it does not work. When it
goes under "else" - it works perfectly.

In all cases it runs as a standalone RCP application under Eclipse 3.4
Ganymede modeling edition.

Thank you,
Igor
Re: file: / platform: differences when loading diagram [message #197892 is a reply to message #197868] Fri, 18 July 2008 09:19 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Igor,

> I tried to dig it deeper and found that commands for tools are not
> formed correctly with thousands nested commands because of some "edit
> policy command" does not set to "null" for these "platform://" files
> but to the same command instead.
Looks similar to this one: https://bugs.eclipse.org/bugs/show_bug.cgi?id=234562
(recently cloased, but not a part of GMF 2.1).
Original problem was fixed, but if it appears it usually is indicating the
fact that editing domain with incorrect id was used for the diagram editor.

-----------------
Alex Shatalin
Re: file: / platform: differences when loading diagram [message #197930 is a reply to message #197892] Fri, 18 July 2008 15:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mklinchin.yahoo.com

Hi Alex,

I appreciate your prompt reply.

On Fri, 18 Jul 2008 09:19:22 +0000, Alex Shatalin wrote:

> Hello Igor,
>
>> I tried to dig it deeper and found that commands for tools are not
>> formed correctly with thousands nested commands because of some "edit
>> policy command" does not set to "null" for these "platform://" files
>> but to the same command instead.
> Looks similar to this one: https://bugs.eclipse.org/bugs/show_bug.cgi?id=234562
> (recently cloased, but not a part of GMF 2.1).
> Original problem was fixed, but if it appears it usually is indicating the
> fact that editing domain with incorrect id was used for the diagram editor.

Yes, I used the workaround suggested by Jan in the bug report (by
modifying xxxBaseEditHelper#getInsteadCommand function) and I've got my
tools woring properly.

Then I noticed that diagram never becomes "dirty" after any changes.
Following your recommendation, I checked editing domain ID and indeed it
was null while for diagrams opened directly from the file system it was
correct.

So I started debugging this situation and found that there are many places
in generated diagram code (for instance, in XXXDiagramEditor.java but not
only here) that has this check:

(input instanceof URIEditorInput)

This is correct check if you open the diagram from the file system but
when you open it by double clicking in the navigator input is instanceof
FileEditorInput.

My first encounter for this thing was in
XXXDiagramEditor.setDocumentProvider but there are more places like this -
this is why it got wrong domain. I changed this function to include my
FileEditorInput but I failed int he next place.

It seems that I am doing something wrong here. Is it possible that there
is some check box somewhere the model that will cause generation of
navigator-aware diagram? I tried to trick it by replacing my input in
XXXDiagramEditor.setDocumentProvider on new instance of FileEditorInput
but it seems that input is declared as final somewhere in the core (which
would be right thing to do).

Thanks agian,
Igor
Re: file: / platform: differences when loading diagram [message #198042 is a reply to message #197930] Mon, 21 July 2008 11:28 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Igor,

It looks like you are working with RCP version of generated code. In normal
(non-RCP) case GMF should support both inputs: FileEditorInput and URIEditorInput.
For example, code generated for ecode diagram (EcoreDiagramEditor.setDocumentProvider())
looks like:

protected void setDocumentProvider(IEditorInput input) {
if (input instanceof IFileEditorInput || input instanceof URIEditorInput) {
setDocumentProvider(EcoreDiagramEditorPlugin.getInstance().g etDocumentProvider());
} else {
super.setDocumentProvider(input);
}
}

so, check corresponding generator option and try using non-RCP mode + regenerate
whole diagram plugin (it's good idea to delete it before regeneration to
get fresh version of all the files).

-----------------
Alex Shatalin
Re: file: / platform: differences when loading diagram [message #198206 is a reply to message #198042] Tue, 22 July 2008 05:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mklinchin.yahoo.com

Hi Alex,


On Mon, 21 Jul 2008 11:28:15 +0000, Alex Shatalin wrote:

> Hello Igor,
>
> It looks like you are working with RCP version of generated code. In normal
> (non-RCP) case GMF should support both inputs: FileEditorInput and URIEditorInput.
> For example, code generated for ecode diagram (EcoreDiagramEditor.setDocumentProvider())
> looks like:
>
> protected void setDocumentProvider(IEditorInput input) {
> if (input instanceof IFileEditorInput || input instanceof URIEditorInput) {
> setDocumentProvider(EcoreDiagramEditorPlugin.getInstance().g etDocumentProvider());
> } else {
> super.setDocumentProvider(input);
> }
> }
>
> so, check corresponding generator option and try using non-RCP mode + regenerate
> whole diagram plugin (it's good idea to delete it before regeneration to
> get fresh version of all the files).

Yes, diagram was generated as an RCP application. I switched to non-RCP
like you recommended and it works perfectly now. Thank you very much,

Igor


>
> -----------------
> Alex Shatalin
Re: file: / platform: differences when loading diagram [message #199962 is a reply to message #197868] Sun, 03 August 2008 19:50 Go to previous message
Eclipse UserFriend
Originally posted by: shevliakov08.bk.ru

Hi!
Klinchin eto ty?
SGU forever!
Shevliakov
Previous Topic:can I add information to the semantic model without show them in the diagram?
Next Topic:Compartments in 2 step meta model
Goto Forum:
  


Current Time: Thu Apr 18 02:44:14 GMT 2024

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

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

Back to the top