Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Editor shows api generated import twice
Editor shows api generated import twice [message #477398] Mon, 19 May 2008 09:35 Go to next message
Felix Dorner is currently offline Felix Dorner
Messages: 676
Registered: July 2009
Senior Member
Hey,

When a model is opened in the tree editor, and I call
model.createPackageImport(...) for an already imported package (yes I am lazy
and don't want to check that case) the editor shows the import twice, while the
uml model file remains unchanged.

Felix
Re: Editor shows api generated import twice [message #477408 is a reply to message #477398] Tue, 20 May 2008 15:51 Go to previous messageGo to next message
Kenn Hussey is currently offline Kenn Hussey
Messages: 1618
Registered: July 2009
Senior Member
Felix,

What do you mean the file remains unchanged? I assume it changes once you
save the model? Note that there is a version of that method that takes a
second parameter (the visibility) and throws an exception if the package is
already in the model's namespace; perhaps you could use that version and
wrap the call in a try/catch block?

Kenn

"Felix Dorner" <felix_do@web.de> wrote in message
news:g0rhlq$81s$1@build.eclipse.org...
> Hey,
>
> When a model is opened in the tree editor, and I call
> model.createPackageImport(...) for an already imported package (yes I am
> lazy and don't want to check that case) the editor shows the import
> twice, while the uml model file remains unchanged.
>
> Felix
Re: Editor shows api generated import twice [message #477410 is a reply to message #477408] Tue, 20 May 2008 17:34 Go to previous messageGo to next message
Felix Dorner is currently offline Felix Dorner
Messages: 676
Registered: July 2009
Senior Member
Kenn Hussey wrote:
> Felix,
>
> What do you mean the file remains unchanged? I assume it changes once you
> save the model? Note that there is a version of that method that takes a
> second parameter (the visibility) and throws an exception if the package is
> already in the model's namespace; perhaps you could use that version and
> wrap the call in a try/catch block?

Yeah, I can also check if it's already imported. But I think the problem is
somewhere else.

The file is open in the tree editor while this import is added (Caused by a
running WorkspaceJob. The tree changes, and shows two identical import elements,
however the editor itself doesn't indicate that its contents have changed. This
however also happens if the package wasn't imported before.

Felix
Re: Editor shows api generated import twice [message #477411 is a reply to message #477410] Tue, 20 May 2008 18:10 Go to previous message
Felix Dorner is currently offline Felix Dorner
Messages: 676
Registered: July 2009
Senior Member
Felix Dorner wrote:

> The file is open in the tree editor while this import is added (Caused
> by a running WorkspaceJob. The tree changes, and shows two identical
> import elements, however the editor itself doesn't indicate that its
> contents have changed. This however also happens if the package wasn't
> imported before.

I think I should look at the examples again, where all those model changing
actions inherit from GenerateModelAction. My use case is different: I offer
some primitive class types that should be resolved automatically in a
code-generation process for operation bodies. So for the generation I
"temporarily" import my package into the model root to make those elements be
resolvable by only using API calls from every operation in the user model.".
After the generation is done, I destroy the import. Apart from being kind of a
hack and probably a slow resolver, it works fine.

Felix
Re: Editor shows api generated import twice [message #626590 is a reply to message #477398] Tue, 20 May 2008 15:51 Go to previous message
Kenn Hussey is currently offline Kenn Hussey
Messages: 1618
Registered: July 2009
Senior Member
Felix,

What do you mean the file remains unchanged? I assume it changes once you
save the model? Note that there is a version of that method that takes a
second parameter (the visibility) and throws an exception if the package is
already in the model's namespace; perhaps you could use that version and
wrap the call in a try/catch block?

Kenn

"Felix Dorner" <felix_do@web.de> wrote in message
news:g0rhlq$81s$1@build.eclipse.org...
> Hey,
>
> When a model is opened in the tree editor, and I call
> model.createPackageImport(...) for an already imported package (yes I am
> lazy and don't want to check that case) the editor shows the import
> twice, while the uml model file remains unchanged.
>
> Felix
Re: Editor shows api generated import twice [message #626592 is a reply to message #477408] Tue, 20 May 2008 17:34 Go to previous message
Felix Dorner is currently offline Felix Dorner
Messages: 676
Registered: July 2009
Senior Member
Kenn Hussey wrote:
> Felix,
>
> What do you mean the file remains unchanged? I assume it changes once you
> save the model? Note that there is a version of that method that takes a
> second parameter (the visibility) and throws an exception if the package is
> already in the model's namespace; perhaps you could use that version and
> wrap the call in a try/catch block?

Yeah, I can also check if it's already imported. But I think the problem is
somewhere else.

The file is open in the tree editor while this import is added (Caused by a
running WorkspaceJob. The tree changes, and shows two identical import elements,
however the editor itself doesn't indicate that its contents have changed. This
however also happens if the package wasn't imported before.

Felix
Re: Editor shows api generated import twice [message #626593 is a reply to message #477410] Tue, 20 May 2008 18:10 Go to previous message
Felix Dorner is currently offline Felix Dorner
Messages: 676
Registered: July 2009
Senior Member
Felix Dorner wrote:

> The file is open in the tree editor while this import is added (Caused
> by a running WorkspaceJob. The tree changes, and shows two identical
> import elements, however the editor itself doesn't indicate that its
> contents have changed. This however also happens if the package wasn't
> imported before.

I think I should look at the examples again, where all those model changing
actions inherit from GenerateModelAction. My use case is different: I offer
some primitive class types that should be resolved automatically in a
code-generation process for operation bodies. So for the generation I
"temporarily" import my package into the model root to make those elements be
resolvable by only using API calls from every operation in the user model.".
After the generation is done, I destroy the import. Apart from being kind of a
hack and probably a slow resolver, it works fine.

Felix
Previous Topic:Copy-paste Association as a side-effect when pasting a Class
Next Topic:Copy Element With Applied Stereotypes
Goto Forum:
  


Current Time: Sun Oct 26 07:19:22 GMT 2014

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

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