Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » refresh all subCannonicalEditPolicies
refresh all subCannonicalEditPolicies [message #104857] Sat, 17 February 2007 18:08 Go to next message
Wiktor is currently offline WiktorFriend
Messages: 55
Registered: July 2009
Member
Hi,

My each operation executes my MainCanonicalEditPolicy.refresh() in order
to refresh all diagram elements.

But some main diagram elements can have another one inside them.
So there is also SubCanonicalEditPolicy for them.

Unfortunatelly refreshing MainCEP does not refresh all SubCEPs.
How should I do that?

Thanks
Wiktor
Re: refresh all subCannonicalEditPolicies [message #104940 is a reply to message #104857] Mon, 19 February 2007 15:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vcciubot.uwaterloo.ca

CanonicalEditPolicy has some static methods to reach all policies for a
given semantic element. To see how it's done take a look in
ToggleCanonical...Command (I don't remember the exact name).

vlad


On Sat, 17 Feb 2007 19:08:20 +0100, Wiktor wrote:

> Hi,
>
> My each operation executes my MainCanonicalEditPolicy.refresh() in order
> to refresh all diagram elements.
>
> But some main diagram elements can have another one inside them.
> So there is also SubCanonicalEditPolicy for them.
>
> Unfortunatelly refreshing MainCEP does not refresh all SubCEPs.
> How should I do that?
>
> Thanks
> Wiktor
Re: refresh all subCannonicalEditPolicies [message #105639 is a reply to message #104940] Tue, 20 February 2007 21:41 Go to previous messageGo to next message
Wiktor is currently offline WiktorFriend
Messages: 55
Registered: July 2009
Member
My diagram looks like this:

--MYTOP---------------------
|
| -MYCONTAINER-----
| | |
| | A |
| |_______________|
|
| MYNONCONTAINER
|
| -MYCONTAINER-----
| | |
| | B |
| |_______________|
|
----------------------------------


There can be arrows betwean containers/noncontainers
and betwean containers and their elements.


After each EMF operation on diagram command stack (i do not use GMF
operations) and/or after each change of my layer (level of visible
diagram details) i execute sth. like this:

MYTOPCanonicalEditPolicy editPolicy = (MYTOPCanonicalEditPolicy)
MYTOPCanonicalEditPolicy.getRegisteredEditPolicies(getDiagra m().getElement()).get(0);


editPolicy.refreshActiveElements();
- prepares list of visible elements and its connection (calculations
are rather complex)

editPolicy.refreshComplexEditPolicies();
- executes editPolicy1.refresh() for every MYCONTAINERS canonical edit
policy

editPolicy.refresh();
- refresh elements in MYTOP

editPolicy.refreshComplexEditPolicies();
- executes editPolicy1.refresh() for every MYCONTAINERS canonical edit
policy


but it does not work well. very often (but not always), after this whole
refresh there are less arrows on diagram than should be (but they are in
semantic model).

I suppose, that when some elements are created, another (necessary for
connections) or have been ot created yet.

I think that there should be one mechanism for refreshing all elements
on diagram - but where? maybe should I modify generated
MYTOPCannonicalEditPolicy?


I am fighting with this problem for days, with no result:(


Vlad Ciubotariu napisał(a):
> CanonicalEditPolicy has some static methods to reach all policies for a
> given semantic element. To see how it's done take a look in
> ToggleCanonical...Command (I don't remember the exact name).
>
> vlad
>
>
> On Sat, 17 Feb 2007 19:08:20 +0100, Wiktor wrote:
>
>> Hi,
>>
>> My each operation executes my MainCanonicalEditPolicy.refresh() in order
>> to refresh all diagram elements.
>>
>> But some main diagram elements can have another one inside them.
>> So there is also SubCanonicalEditPolicy for them.
>>
>> Unfortunatelly refreshing MainCEP does not refresh all SubCEPs.
>> How should I do that?
>>
>> Thanks
>> Wiktor
>
Re: refresh all subCannonicalEditPolicies [message #105856 is a reply to message #105639] Wed, 21 February 2007 13:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vcciubot.uwaterloo.ca

You need to refresh when the edit part ends activate, so override these
two methods in you editparts, substituting your canonical refresh
accordingly.

vlad

public void activate() {
super.activate();
B2CanonicalConnectionEditPolicy.refresh(this);
}

public void refresh() {
if (isRefresh == false) {
isRefresh = true;
try {
super.refresh();
} finally {
isRefresh = false;
}
}

}
Re: refresh all subCannonicalEditPolicies [message #106603 is a reply to message #105856] Sat, 24 February 2007 16:47 Go to previous messageGo to next message
Wiktor is currently offline WiktorFriend
Messages: 55
Registered: July 2009
Member
Many thanks for your help, but I still do not understand what should I do.


1. which editParts should I extend (all, or only few of them)?

I have such a structure:(EP=EditPart, CEP=CannonicalEditPolicy)

myNetEP - (with corresponding myNetCEP)
|
|-myNodePlaceEP
|
|-myNodeTransitionEP (with corresponding myTransitionCEP)
| |-mySubNodePlaceEP
|
|-myConnectionArrowEP


2. what should B2CanonicalConnectionEditPolicy.refresh(this); do?
I suppose that B2CCEP is myNetCEP - also extends CCEP.

3. To be sure - isRefresh should be a private variable of my EP's (not
global from for e.g. NetCEP)?


Wiktor

Vlad Ciubotariu:
> You need to refresh when the edit part ends activate, so override these
> two methods in you editparts, substituting your canonical refresh
> accordingly.
>
> vlad
>
> public void activate() {
> super.activate();
> B2CanonicalConnectionEditPolicy.refresh(this);
> }
>
> public void refresh() {
> if (isRefresh == false) {
> isRefresh = true;
> try {
> super.refresh();
> } finally {
> isRefresh = false;
> }
> }
>
> }
>
>
>
Re: refresh all subCannonicalEditPolicies [message #106620 is a reply to message #106603] Sat, 24 February 2007 18:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vcciubot.uwaterloo.ca

I'll attach the files for you in an email.

You should extend the editparts that can be created programmatically,
together with the connection.

vlad

On Sat, 24 Feb 2007 17:47:06 +0100, Wiktor
wrote:

> Many thanks for your help, but I still do not understand what should I do.
>
>
> 1. which editParts should I extend (all, or only few of them)?
>
> I have such a structure:(EP=EditPart, CEP=CannonicalEditPolicy)
>
> myNetEP - (with corresponding myNetCEP)
> |
> |-myNodePlaceEP
> |
> |-myNodeTransitionEP (with corresponding myTransitionCEP)
> | |-mySubNodePlaceEP
> |
> |-myConnectionArrowEP
>
>
> 2. what should B2CanonicalConnectionEditPolicy.refresh(this); do?
> I suppose that B2CCEP is myNetCEP - also extends CCEP.
>
> 3. To be sure - isRefresh should be a private variable of my EP's (not
> global from for e.g. NetCEP)?
>
>
> Wiktor
>
> Vlad Ciubotariu:
>> You need to refresh when the edit part ends activate, so override these
>> two methods in you editparts, substituting your canonical refresh
>> accordingly.
>>
>> vlad
>>
>> public void activate() {
>> super.activate();
>> B2CanonicalConnectionEditPolicy.refresh(this);
>> }
>>
>> public void refresh() {
>> if (isRefresh == false) {
>> isRefresh = true;
>> try {
>> super.refresh();
>> } finally {
>> isRefresh = false;
>> }
>> }
>>
>> }
>>
>>
>>
Re: refresh all subCannonicalEditPolicies [message #107385 is a reply to message #106620] Tue, 27 February 2007 22:00 Go to previous message
Wiktor is currently offline WiktorFriend
Messages: 55
Registered: July 2009
Member
Thanks, but my problem seems to be more global . for a moment I forgot
even about my 'parts in parts', and I try to solve my bug on 'flat
structure'. I do not know why

standard CanonicalConnectionEditPolicy cannot find in

protected final Edge createConnectionView(EObject connection, int index) {
EditPart sep = getSourceEditPartFor(connection);
EditPart tep = getTargetEditPartFor(connection);

sep or tep (usually for elements which should exists). Sometimes I have
here null, so new/old connections are not created.

any ideas?
Wiktor



Vlad Ciubotariu napisał(a):
> I'll attach the files for you in an email.
>
> You should extend the editparts that can be created programmatically,
> together with the connection.
>
> vlad
>
> On Sat, 24 Feb 2007 17:47:06 +0100, Wiktor
> wrote:
>
>> Many thanks for your help, but I still do not understand what should I do.
>>
>>
>> 1. which editParts should I extend (all, or only few of them)?
>>
>> I have such a structure:(EP=EditPart, CEP=CannonicalEditPolicy)
>>
>> myNetEP - (with corresponding myNetCEP)
>> |
>> |-myNodePlaceEP
>> |
>> |-myNodeTransitionEP (with corresponding myTransitionCEP)
>> | |-mySubNodePlaceEP
>> |
>> |-myConnectionArrowEP
>>
>>
>> 2. what should B2CanonicalConnectionEditPolicy.refresh(this); do?
>> I suppose that B2CCEP is myNetCEP - also extends CCEP.
>>
>> 3. To be sure - isRefresh should be a private variable of my EP's (not
>> global from for e.g. NetCEP)?
>>
>>
>> Wiktor
>>
>> Vlad Ciubotariu:
>>> You need to refresh when the edit part ends activate, so override these
>>> two methods in you editparts, substituting your canonical refresh
>>> accordingly.
>>>
>>> vlad
>>>
>>> public void activate() {
>>> super.activate();
>>> B2CanonicalConnectionEditPolicy.refresh(this);
>>> }
>>>
>>> public void refresh() {
>>> if (isRefresh == false) {
>>> isRefresh = true;
>>> try {
>>> super.refresh();
>>> } finally {
>>> isRefresh = false;
>>> }
>>> }
>>>
>>> }
>>>
>>>
>>>
>
Previous Topic:Problems with Tutorial Part1
Next Topic:Creating a node using CreateViewRequest
Goto Forum:
  


Current Time: Sun Dec 22 05:59:10 GMT 2024

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

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

Back to the top