Dynamically created links created on collapced compartment is not visible [message #104197] |
Thu, 15 February 2007 06:15  |
Eclipse User |
|
|
|
Originally posted by: andrey_medvedev.epam.com
I have Node ("WithSearchData") with compartment. Compartment of
"WithSearchData" created in collapsed state (i made this by his
ViewFactory).
I'v created dynamically on compartment two other nodes and link between
them like this:
in WithSearchDataEditHelper.java:
protected void doElementCreation(EObject element, IProgressMonitor
monitor) {
WithSearchData b = (WithSearchData) element;
SpecifySearchDataScreen spin =
ScreenpatternFactory.eINSTANCE.createSpecifySearchDataScreen ();
SpecifySearchDataScreen spinObj = (SpecifySearchDataScreen)
EMFCoreUtil.create(b,BbpatternPackage.eINSTANCE.getBBPattern _Screens(),spin.eClass());
DisplaySearchResultsScreen spout =
ScreenpatternFactory.eINSTANCE.createDisplaySearchResultsScr een();
DisplaySearchResultsScreen spoutObj = (DisplaySearchResultsScreen)
EMFCoreUtil.create(b,BbpatternPackage.eINSTANCE.getBBPattern _Screens(),spout.eClass());
PatternLink link3 = MftappFactory.eINSTANCE.createPatternLink();
PatternLink lnk = (PatternLink)
EMFCoreUtil.create(b,BbpatternPackage.eINSTANCE.getBBPattern _Links(),link3.eClass());
lnk.setInConnectable(spinObj);
lnk.setOutConnectable(spoutObj);
}
After creation this node - i see - in emf model my elements created
correctly. But, when i expand the compartment link between my custom
created nodes is not shown. Is shown only after reopen diagram. Could
anyone help me with this?
|
|
|
Re: Dynamically created links created on collapced compartment is not visible [message #104640 is a reply to message #104197] |
Fri, 16 February 2007 10:21  |
Eclipse User |
|
|
|
Originally posted by: vcciubot.uwaterloo.ca
There might be some race conditions involving your canonical edit
policies. To create an Edge the policy tries to get the end edit parts. If
these haven't been activated yet, because some other canonical policy
didn't refresh, then you have this problem.
Also note, that the compartment canonical policy is not active if the
compartment is collapsed.
In the corresponding canonical connection edit policy that should create
a connection breakpoint this method:
private EditPart getEditPartFor(EObject element, EObject context)
to see whether it returns null.
It's hard to make this policy refresh by using the tools directly on the
diagram, that's why you have to close/reopen. That's because the policies
are turned off when you create both the view and the model element with a
tool.
vlad
On Thu, 15 Feb 2007 11:15:00 +0000, Andrey Medvedev wrote:
> I have Node ("WithSearchData") with compartment. Compartment of
> "WithSearchData" created in collapsed state (i made this by his
> ViewFactory).
>
> I'v created dynamically on compartment two other nodes and link between
> them like this:
> in WithSearchDataEditHelper.java:
>
> protected void doElementCreation(EObject element, IProgressMonitor
> monitor) {
> WithSearchData b = (WithSearchData) element;
> SpecifySearchDataScreen spin =
> ScreenpatternFactory.eINSTANCE.createSpecifySearchDataScreen ();
> SpecifySearchDataScreen spinObj = (SpecifySearchDataScreen)
> EMFCoreUtil.create(b,BbpatternPackage.eINSTANCE.getBBPattern _Screens(),spin.eClass());
>
> DisplaySearchResultsScreen spout =
> ScreenpatternFactory.eINSTANCE.createDisplaySearchResultsScr een();
> DisplaySearchResultsScreen spoutObj = (DisplaySearchResultsScreen)
> EMFCoreUtil.create(b,BbpatternPackage.eINSTANCE.getBBPattern _Screens(),spout.eClass());
>
> PatternLink link3 = MftappFactory.eINSTANCE.createPatternLink();
> PatternLink lnk = (PatternLink)
> EMFCoreUtil.create(b,BbpatternPackage.eINSTANCE.getBBPattern _Links(),link3.eClass());
> lnk.setInConnectable(spinObj);
> lnk.setOutConnectable(spoutObj);
> }
>
> After creation this node - i see - in emf model my elements created
> correctly. But, when i expand the compartment link between my custom
> created nodes is not shown. Is shown only after reopen diagram. Could
> anyone help me with this?
|
|
|
Powered by
FUDForum. Page generated in 0.02985 seconds