Community
Participate
Working Groups
Build Identifier: FormEditor (from package org.eclipse.ui.forms.editor) extends MultiPageEditorPart, overriding the getSelectedPage() so it only returns the current page if it's an instance of IFormPage. In order to retrieve the current page, FormEditor changes the visibility of getActiveEditor to public. In selectionChanged(), as recommended in bug#332964, getSelectedPage() is used to support Multipage editors. However, it the editor is based in FormEditor, this method returns null for the graphiti editor. A more general approach would be using getAdapter(DiagramEditorInternal.class), since MultiPageEditorPart's implementation first checks the currently active editor, and this behavior is respected by subclasses. Reproducible: Always
Should be postponed until https://bugs.eclipse.org/bugs/show_bug.cgi?id=336488 is resolved
For the change in HEAD, I understand it goes after the bug#336488 revolution :) However, could this be done independently in the 0.8 branch? I understand #336488 won't be ported back to 0.8.2, will it?
(In reply to comment #2) > However, could this be done independently in the 0.8 branch? I understand > #336488 won't be ported back to 0.8.2, will it? That's correct. And surely we can do this change independently in 0.8. Availability would be with the Graphiti 0.8.2 release as part of Indigo SR2 end or February 2012. Ok?
Sure, great!
Planned for Indigo SR2
Looking deeper in the code, I think the original logic is flawed. Currently, the code is: boolean editorIsActive = getSite().getPage().isPartVisible(this); --> If we are the current editor, go ahead if (!editorIsActive) { // Check if we are a page of the active multipage editor --> However, if we are not.... IEditorPart activeEditor = getSite().getPage().getActiveEditor(); if (activeEditor != null) { --> Almost certainly there's an active editor (i.e. a java editor), so we enter here // Check if the top level editor if it is active editorIsActive = getSite().getPage().isPartVisible(activeEditor); --> And here editorIsActive becomes true, because we just find activeEditor as the visible editor if (activeEditor instanceof MultiPageEditorPart) { --> If it's NOT a MultiPageEditorPart, editorIsActive remains true, so the graphiti diagram (or the 20 different opened diagrams) updates if selection (once again, think java editor) Object selectedPage = ((MultiPageEditorPart) activeEditor).getSelectedPage(); if (!(selectedPage instanceof DiagramEditorInternal)) { --> Only if the active editor is a multipart, and its active page is not a graphiti diagram (any graphiti editor, not only this one) do editorIsActive become false // Editor is active but the diagram sub editor is not // its active page editorIsActive = false; } } } } Proposed solution: boolean editorIsActive = getSite().getPage().isPartVisible(this); if (!editorIsActive) { // Check if we are a page of the active multipage editor IEditorPart activeEditor = getSite().getPage().getActiveEditor(); if (activeEditor != null) { // Check if the top level editor is a multipage editor, and its active page is this if (activeEditor instanceof MultiPageEditorPart) { Object selectedPage = activeEditor.getAdapter(DiagramEditorInternal.class); if (selectedPage == this) { // Editor is active but the diagram sub editor is not // its active page editorIsActive = true; } } } }
solved in master and b0_8_x branch
Bookkeeping, marked coding cotribution as IP log relevant
Bookkeeping: Set target release: 0.8.2
Part of Graphiti 0.9.0 (Eclipse Juno)