| Summary: | DiagramEditorInternal's selectionChanged() method doesn't support FormEditor-based multipage editors | ||
|---|---|---|---|
| Product: | [Modeling] Graphiti | Reporter: | Felix Velasco <felix.velasco> |
| Component: | Core | Assignee: | Project Inbox <graphiti-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | michael.wenz |
| Version: | 0.8.0 | Flags: | michael.wenz:
indigo+
michael.wenz: iplog+ michael.wenz: juno+ |
| Target Milestone: | 0.8.0 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | Juno M4 Theme_bugs Indigo SR2 | ||
| Bug Depends on: | 336488 | ||
| Bug Blocks: | |||
|
Description
Felix Velasco
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) |