Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Sharing an EditDomain among multiple editors?
Sharing an EditDomain among multiple editors? [message #168412] Tue, 15 February 2005 21:18 Go to next message
Youval Bronicki is currently offline Youval BronickiFriend
Messages: 14
Registered: July 2009
Junior Member
Hi,

In my product, the CommandStack should be shared between all editors (of a
certain type) that belong to the same project.

I have tried to implement this by having all editors share a custom
EditDomain. This works partially, with the disastrous side effect of
editors stopping to respond in some situations that involve multiple
editors. The problem seems to be related to the palette management - If I
reopen the palette view the active editor returns to the normal behavior.

It looks as though EditDomains where not designed to be shared, and that
sharing of the command stack should be handled otherwise (one EditDomain
per editor but multiple EditDomains share the same command stack). Is
statement correct?

What about the palette? The palettes of all editors of the same project
are the same. Is there a good reason (and a recommended way) to share the
palette objects between editors?

Thanks for your attention!

b.t.w

Youval
Re: Sharing the CommandStack among multiple editors - an issue with EditDomain (was: Sharing an Edit [message #168609 is a reply to message #168412] Thu, 17 February 2005 08:06 Go to previous messageGo to next message
Youval Bronicki is currently offline Youval BronickiFriend
Messages: 14
Registered: July 2009
Junior Member
Hi again,

I've made the change outlined in my prior post (see below), and it seems
to work fine. In the process I have encountered a difficulty with
sub-classing EditDomain that led me to an awkward solution:

In my custom EditDomain, I have overriden getCommandStack() to return
the project's command stack instead of the specific editor's.

This initially caused a NullPointer exception because the constructor of
EditDomain calls
EidtDomaon.loadDefaultTool()->EditDomain.setActiveTool()->AbstractTool.activate(),
the latter assumein the prior existence a non-null the command stack.


My solution was to override loadDefaultTool() so that it does nothing
during initialization, and call it explicitly after initialization:

public class MyEditDomain extends DefaultEditDomain
{
private initialized = false;
public MyEditDomain(IProject project, MyEditor editorPart)
{

super(editorPart);
initCommandStack(project);
initialized = true;
loadDefaultTool();
}
public void loadDefaultTool()
{
if ( initialized)
super.loadDefaultTool();
}
...
...

Any better ideas?

Youval Bronicki

Youval Bronicki wrote:
> Hi,
>
> In my product, the CommandStack should be shared between all editors (of
> a certain type) that belong to the same project.
>
> I have tried to implement this by having all editors share a custom
> EditDomain. This works partially, with the disastrous side effect of
> editors stopping to respond in some situations that involve multiple
> editors. The problem seems to be related to the palette management - If
> I reopen the palette view the active editor returns to the normal behavior.
>
> It looks as though EditDomains where not designed to be shared, and that
> sharing of the command stack should be handled otherwise (one EditDomain
> per editor but multiple EditDomains share the same command stack). Is
> statement correct?
>
> What about the palette? The palettes of all editors of the same project
> are the same. Is there a good reason (and a recommended way) to share
> the palette objects between editors?
>
> Thanks for your attention!
>
> b.t.w
>
> Youval
>
Re: Sharing the CommandStack among multiple editors - an issue with EditDomain (was: Sharing an Edit [message #168650 is a reply to message #168609] Thu, 17 February 2005 16:00 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

This is a funny but real problem. What do you suggest as a fix? We could
avoid loading the default tool until the first EditPartViewer has been
added. Open a bugzilla if your workaround is bothering you too much.

"Youval" <youval_b@yahoo.com> escreveu na mensagem
news:cv1jb1$p4t$1@www.eclipse.org...
> Hi again,
>
> I've made the change outlined in my prior post (see below), and it seems
> to work fine. In the process I have encountered a difficulty with
> sub-classing EditDomain that led me to an awkward solution:
>
> In my custom EditDomain, I have overriden getCommandStack() to return the
> project's command stack instead of the specific editor's.
>
> This initially caused a NullPointer exception because the constructor of
> EditDomain calls
> EidtDomaon.loadDefaultTool()->EditDomain.setActiveTool()->AbstractTool.activate(),
> the latter assumein the prior existence a non-null the command stack.
>
> My solution was to override loadDefaultTool() so that it does nothing
> during initialization, and call it explicitly after initialization:
>
> public class MyEditDomain extends DefaultEditDomain
> {
> private initialized = false;
> public MyEditDomain(IProject project, MyEditor editorPart)
> {
>
> super(editorPart);
> initCommandStack(project);
> initialized = true;
> loadDefaultTool();
> }
> public void loadDefaultTool()
> {
> if ( initialized)
> super.loadDefaultTool();
> }
> ..
> ..
>
> Any better ideas?
>
> Youval Bronicki
>
> Youval Bronicki wrote:
>> Hi,
>>
>> In my product, the CommandStack should be shared between all editors (of
>> a certain type) that belong to the same project.
>>
>> I have tried to implement this by having all editors share a custom
>> EditDomain. This works partially, with the disastrous side effect of
>> editors stopping to respond in some situations that involve multiple
>> editors. The problem seems to be related to the palette management - If
>> I reopen the palette view the active editor returns to the normal
>> behavior.
>>
>> It looks as though EditDomains where not designed to be shared, and that
>> sharing of the command stack should be handled otherwise (one EditDomain
>> per editor but multiple EditDomains share the same command stack). Is
>> statement correct?
>>
>> What about the palette? The palettes of all editors of the same project
>> are the same. Is there a good reason (and a recommended way) to share
>> the palette objects between editors?
>>
>> Thanks for your attention!
>>
>> b.t.w
>>
>> Youval
>>
Previous Topic:Need help in PolylineConnection
Next Topic:permanent cursor
Goto Forum:
  


Current Time: Tue Apr 16 15:28:18 GMT 2024

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

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

Back to the top