Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Delete Feature does not work in MPE
Delete Feature does not work in MPE [message #697819] Mon, 18 July 2011 02:39 Go to next message
Murthy Bhat is currently offline Murthy Bhat
Messages: 159
Registered: July 2009
Senior Member
Hello,

I have a graphical editor within a multipage editor. Some features like the 'DeleteFeature''AlignFeature'etc do not work in multipage environment. However it all works alone when the editor is run alone. my assumption is that the selection event is not being fired correctly. Am I in the right direction ? Any kind of help would be great.

Thanks.

Best Regards,
Murthy
Re: Delete Feature does not work in MPE [message #697872 is a reply to message #697819] Mon, 18 July 2011 04:56 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1577
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Murthy,

for the alignment I could imagine that the selection is not fired, but not
for the delete. Do you have an appropriate ActionBarContributor set for you
multipage editor? It needs to activate the alignment actions just as
DiagramEditorActionBarContributor does.

Does that help?
Michael


"Murthybhat" schrieb im Newsbeitrag news:j00jt3$i7d$1@news.eclipse.org...

Hello,

I have a graphical editor within a multipage editor. Some features like the
'DeleteFeature''AlignFeature'etc do not work in multipage environment.
However it all works alone when the editor is run alone. my assumption is
that the selection event is not being fired correctly. Am I in the right
direction ? Any kind of help would be great.

Thanks.

Best Regards,
Murthy
Re: Delete Feature does not work in MPE [message #697878 is a reply to message #697872] Mon, 18 July 2011 05:19 Go to previous messageGo to next message
Murthy Bhat is currently offline Murthy Bhat
Messages: 159
Registered: July 2009
Senior Member
Hi Michael,

I have made DiagramEditorActionBarContributor itself as the contributor to my multipage editor. Could that be the problem ?

Regards,
Murthy
Re: Delete Feature does not work in MPE [message #698341 is a reply to message #697878] Tue, 19 July 2011 05:50 Go to previous messageGo to next message
Murthy Bhat is currently offline Murthy Bhat
Messages: 159
Registered: July 2009
Senior Member
I also tried creating a new "MultiPageEditorActionBarContributor". But no success. The menus/toolbar actions and context menu all appear but are disabled. Is there something extra that I need to override in my MPE to listen to selection and key events ?

Regards,
Murthy
Re: Delete Feature does not work in MPE [message #698849 is a reply to message #698341] Wed, 20 July 2011 07:22 Go to previous messageGo to next message
Murthy Bhat is currently offline Murthy Bhat
Messages: 159
Registered: July 2009
Senior Member
Hello,

I was able to figure out the solution. My problem was in "DiagramEditorInternal.java" and specifically the "selectionChanged" method.

The "selectionChanged(IWorkbenchPart part, ISelection selection)" method called its "super.selectionChanged(...)" method. That method checked if the active editor was current editor(graphical editor) and only then the actions would get updated(enabled).

But the ".getPage().getActiveEditor()" always returned my multipageEditor instance.
	public void selectionChanged(IWorkbenchPart part, ISelection selection) {
		// If not the active editor, ignore selection changed.
		if (this.equals(getSite().getPage().getActiveEditor()))
			updateActions(selectionActions);
	}


I had to hence make a change in "DiagramEditorInternal.java" selectionChanged method. Instead of calling super.selectionChanged, i check when multipageeditor, if selectedPage is same as the current(graphicalEditor), then call update actions.

Hope I am not violating any intended behavior of graphiti.

Best Regards,
Murthy
Re: Delete Feature does not work in MPE [message #698858 is a reply to message #698849] Wed, 20 July 2011 07:33 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1577
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Great, thanks for posting the solution as well :-)

What you are doing sounds fine, at least there are no immediate issues I can
see.

Michael


"Murthybhat" schrieb im Newsbeitrag news:j06d77$9hu$1@news.eclipse.org...

Hello,

I was able to figure out the solution. My problem was in
"DiagramEditorInternal.java" and specifically the "selectionChanged" method.

The "selectionChanged(IWorkbenchPart part, ISelection selection)" method
called its "super.selectionChanged(...)" method. That method checked if the
active editor was current editor(graphical editor) and only then the actions
would get updated(enabled).

But the ".getPage().getActiveEditor()" always returned my multipageEditor
instance.
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
// If not the active editor, ignore selection changed.
if (this.equals(getSite().getPage().getActiveEditor()))
updateActions(selectionActions);
}

I had to hence make a change in "DiagramEditorInternal.java"
selectionChanged method. Instead of calling super.selectionChanged, i check
when multipageeditor, if selectedPage is same as the
current(graphicalEditor), then call update actions.

Hope I am not violating any intended behavior of graphiti.

Best Regards,
Murthy
Re: Delete Feature does not work in MPE [message #903869 is a reply to message #697819] Sun, 26 August 2012 19:42 Go to previous message
Emerson Simbolon is currently offline Emerson Simbolon
Messages: 12
Registered: April 2012
Junior Member
Hi, I have a same problem as well, I want to try your solution, but I don't know what I should put into the variable "selectedActions". Can you elaborate more, thanks.

Emerson.
Previous Topic:Associate diagram extension
Next Topic:One CreateFeature for many palette entries
Goto Forum:
  


Current Time: Thu Aug 21 04:27:45 EDT 2014

Powered by FUDForum. Page generated in 0.10841 seconds