Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Why are my adapters being removed when I'm using diagram partitioning? ...and how to listen to the c
Why are my adapters being removed when I'm using diagram partitioning? ...and how to listen to the c [message #236238] Wed, 15 July 2009 18:45 Go to next message
Eclipse UserFriend
Originally posted by: rene.boettge.gmx.net

Hi,

I'm still new on GMF :-)

I'm working with galileo...

I have a GMF editor and I'm using diagram partitioning(one model for
both editors).
After a double-click opens a new editor but all my adapters I added
before to the elements in der first editor are being removed (I get a
notification "REMOVING_ADAPTERS") ... but why are they being removed? I
need them to be adapted because I have a view which listens to them...

when I accepted that they obviously have to be removed I decided to
listen to the change of the active editor. So I can add my adapter again
when certain editor (the first one) is active again... but how can
listen to this change?

I need this because my next step is to avoid a dirty editor so I want to
save the content of an editor if another is getting active.

Thanks in advance for some hints to solve my problems.

René
Re: Why are my adapters being removed when I'm using diagram partitioning? ...and how to listen to t [message #236246 is a reply to message #236238] Wed, 15 July 2009 18:56 Go to previous messageGo to next message
Martin Fluegge is currently offline Martin FlueggeFriend
Messages: 141
Registered: July 2009
Senior Member
Hi René,

concerning your change problem an implementation of IPartListener could
be what you are searching for. Write a class which implements this
interface. Something like this.

public class MyPartListener implements IPartListener
{
@Override
public void partActivated(IWorkbenchPart part)
{
System.out.println("do something");
}

@Override
public void partBroughtToTop(IWorkbenchPart part)
{
System.out.println("do something");
}

@Override
public void partClosed(IWorkbenchPart part)
{
System.out.println("do something");
}

@Override
public void partDeactivated(IWorkbenchPart part)
{
System.out.println("do something");
}

@Override
public void partOpened(IWorkbenchPart part)
{
System.out.println("do something");
}
}

Than just add this implementation to the page which holds your editor.
This could be done in your editor's init method.

public void init(IEditorSite site, IEditorInput input) throws
PartInitException
{
...
IPartListener partListener = new MyPartListener();
site.getPage().addPartListener(partListener);
...
}

Now you can react on the event when you switch between the tabs of you
opened editors. Hope that helps.

Cheers,

Martin


René Böttge schrieb:
> Hi,
>
> I'm still new on GMF :-)
>
> I'm working with galileo...
>
> I have a GMF editor and I'm using diagram partitioning(one model for
> both editors).
> After a double-click opens a new editor but all my adapters I added
> before to the elements in der first editor are being removed (I get a
> notification "REMOVING_ADAPTERS") ... but why are they being removed? I
> need them to be adapted because I have a view which listens to them...
>
> when I accepted that they obviously have to be removed I decided to
> listen to the change of the active editor. So I can add my adapter again
> when certain editor (the first one) is active again... but how can
> listen to this change?
>
> I need this because my next step is to avoid a dirty editor so I want to
> save the content of an editor if another is getting active.
>
> Thanks in advance for some hints to solve my problems.
>
> René
Re: Why are my adapters being removed when I'm using diagram partitioning? ...and how to listen to t [message #236260 is a reply to message #236238] Thu, 16 July 2009 09:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: janapureddy.gmail.com

Hi,

I have the same problem. This link could help you further...
https://bugs.eclipse.org/bugs/show_bug.cgi?id=249717

Ravi


René Böttge schrieb:
> Hi,
>
> I'm still new on GMF :-)
>
> I'm working with galileo...
>
> I have a GMF editor and I'm using diagram partitioning(one model for
> both editors).
> After a double-click opens a new editor but all my adapters I added
> before to the elements in der first editor are being removed (I get a
> notification "REMOVING_ADAPTERS") ... but why are they being removed? I
> need them to be adapted because I have a view which listens to them...
>
> when I accepted that they obviously have to be removed I decided to
> listen to the change of the active editor. So I can add my adapter again
> when certain editor (the first one) is active again... but how can
> listen to this change?
>
> I need this because my next step is to avoid a dirty editor so I want to
> save the content of an editor if another is getting active.
>
> Thanks in advance for some hints to solve my problems.
>
> René
Re: Why are my adapters being removed when I'm using diagram partitioning? ...and how to listen to t [message #236438 is a reply to message #236260] Sun, 19 July 2009 19:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rene.boettge.gmx.net

Thanks for the replies,

but this bug doesn't really cover my problem(or question) because I
don't have any problem with graphical elements...my added adapters are
being removed during opening my second editor

René

Ravi Jan schrieb:
> Hi,
>
> I have the same problem. This link could help you further...
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=249717
>
> Ravi
>
>
> René Böttge schrieb:
>> Hi,
>>
>> I'm still new on GMF :-)
>>
>> I'm working with galileo...
>>
>> I have a GMF editor and I'm using diagram partitioning(one model for
>> both editors).
>> After a double-click opens a new editor but all my adapters I added
>> before to the elements in der first editor are being removed (I get a
>> notification "REMOVING_ADAPTERS") ... but why are they being removed?
>> I need them to be adapted because I have a view which listens to them...
>>
>> when I accepted that they obviously have to be removed I decided to
>> listen to the change of the active editor. So I can add my adapter
>> again when certain editor (the first one) is active again... but how
>> can listen to this change?
>>
>> I need this because my next step is to avoid a dirty editor so I want
>> to save the content of an editor if another is getting active.
>>
>> Thanks in advance for some hints to solve my problems.
>>
>> René
Re: Why are my adapters being removed when I'm using diagram partitioning?...and how to listen to th [message #236512 is a reply to message #236238] Mon, 20 July 2009 12:41 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello René,

I think adapters were removed because of resetting editor input (model elements
were reloaded from file again.. Where do you attach adapters to model elements?

-----------------
Alex Shatalin
Re: Why are my adapters being removed when I'm using diagram partitioning?...and how to listen to th [message #237154 is a reply to message #236512] Tue, 21 July 2009 18:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rene.boettge.gmx.net

Hi Alex,

I'm not sure if it is the best way to solve but I add the adapter in
handleEventNotification() of my ***CanonicalEditPolicy because this is
one possibility to notice when a new element was added... or is there a
better way?

Thanks in advance.
René

Alex Shatalin schrieb:
> Hello René,
>
> I think adapters were removed because of resetting editor input (model
> elements were reloaded from file again.. Where do you attach adapters to
> model elements?
>
> -----------------
> Alex Shatalin
>
>
Re: Why are my adapters being removed when I'm using diagram partitioning?...andhow to listen to the [message #237190 is a reply to message #237154] Wed, 22 July 2009 09:28 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello René,

I doubt this method will be called on starting the editor for each diagram
element..
I think you have to initially traverse the model attaching corresponding
adapters in one of ???DocumentProvider + handle appropriate notifications.

-----------------
Alex Shatalin
Previous Topic:Show Preferences window in RCP
Next Topic:Created a tutorial on using Xpand and QVT to transform model to text file.
Goto Forum:
  


Current Time: Fri Feb 26 07:43:07 GMT 2021

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

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

Back to the top