Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsEditor shows api generated import twice
https://www.eclipse.org/forums/index.php/mv/msg/151699/477398/#msg_477398
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]]>Felix Dorner2008-05-19T09:35:58-00:00Re: Editor shows api generated import twice
https://www.eclipse.org/forums/index.php/mv/msg/151699/626590/#msg_626590
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]]>Kenn Hussey2008-05-20T15:51:19-00:00Re: Editor shows api generated import twice
https://www.eclipse.org/forums/index.php/mv/msg/151699/477408/#msg_477408
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]]>Kenn Hussey2008-05-20T15:51:19-00:00Re: Editor shows api generated import twice
https://www.eclipse.org/forums/index.php/mv/msg/151699/626592/#msg_626592
> 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]]>Felix Dorner2008-05-20T17:34:00-00:00Re: Editor shows api generated import twice
https://www.eclipse.org/forums/index.php/mv/msg/151699/477410/#msg_477410
> 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]]>Felix Dorner2008-05-20T17:34:00-00:00Re: Editor shows api generated import twice
https://www.eclipse.org/forums/index.php/mv/msg/151699/626593/#msg_626593
> 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]]>Felix Dorner2008-05-20T18:10:28-00:00Re: Editor shows api generated import twice
https://www.eclipse.org/forums/index.php/mv/msg/151699/477411/#msg_477411
> 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.