Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 60815 Details for
Bug 177356
[Forms] Track focus between header and page folder in SharedHeaderFormEditor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed solution
177356.patch (text/plain), 4.13 KB, created by
Christof Marti
on 2007-03-14 11:45:33 EDT
(
hide
)
Description:
Proposed solution
Filename:
MIME Type:
Creator:
Christof Marti
Created:
2007-03-14 11:45:33 EDT
Size:
4.13 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.forms >Index: src/org/eclipse/ui/forms/editor/SharedHeaderFormEditor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.forms/src/org/eclipse/ui/forms/editor/SharedHeaderFormEditor.java,v >retrieving revision 1.2 >diff -u -r1.2 SharedHeaderFormEditor.java >--- src/org/eclipse/ui/forms/editor/SharedHeaderFormEditor.java 18 Jan 2007 14:35:01 -0000 1.2 >+++ src/org/eclipse/ui/forms/editor/SharedHeaderFormEditor.java 14 Mar 2007 15:42:39 -0000 >@@ -10,12 +10,19 @@ > *******************************************************************************/ > package org.eclipse.ui.forms.editor; > >+import org.eclipse.swt.SWT; > import org.eclipse.swt.layout.FillLayout; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Event; >+import org.eclipse.swt.widgets.Listener; >+import org.eclipse.ui.IEditorPart; >+import org.eclipse.ui.IKeyBindingService; >+import org.eclipse.ui.INestableKeyBindingService; > import org.eclipse.ui.forms.IFormPart; > import org.eclipse.ui.forms.IManagedForm; > import org.eclipse.ui.forms.ManagedForm; > import org.eclipse.ui.forms.widgets.ScrolledForm; >+import org.eclipse.ui.internal.services.INestable; > > /** > * A variation of {@link FormEditor}, this editor has a stable header that does >@@ -26,6 +33,9 @@ > */ > public abstract class SharedHeaderFormEditor extends FormEditor { > private HeaderForm headerForm; >+ >+ private boolean wasHeaderActive= true; >+ private Listener activationListener= null; > > private static class HeaderForm extends ManagedForm { > public HeaderForm(FormEditor editor, ScrolledForm form) { >@@ -83,7 +93,75 @@ > public IManagedForm getHeaderForm() { > return headerForm; > } >- >+ >+ protected void createPages() { >+ super.createPages(); >+ >+ // preempt MultiPageEditorPart#createPartControl(Composite) >+ if (getActivePage() == -1) { >+ // create page control and initialize page, keep focus on header by calling super implementation >+ super.setActivePage(0); >+ } >+ } >+ >+ protected void setActivePage(int pageIndex) { >+ // programmatic focus change >+ wasHeaderActive= false; >+ super.setActivePage(pageIndex); >+ } >+ >+ public void setFocus() { >+ installActivationListener(); >+ if (wasHeaderActive) >+ ((ManagedForm) getHeaderForm()).setFocus(); >+ else { >+ int index= getActivePage(); >+ if (index == -1) >+ ((ManagedForm) getHeaderForm()).setFocus(); >+ else >+ super.setFocus(); >+ } >+ } >+ >+ private void installActivationListener() { >+ if (activationListener == null) { >+ activationListener = new Listener() { >+ public void handleEvent(Event event) { >+ boolean wasHeaderActive = event.widget != getContainer(); >+ >+ // fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=177331 >+ int activePage = getActivePage(); >+ if (SharedHeaderFormEditor.this.wasHeaderActive != wasHeaderActive && activePage != -1 && pages.get(activePage) instanceof IEditorPart) { >+ IEditorPart activePart = (IEditorPart) pages.get(activePage); >+ IKeyBindingService keyBindingService = getSite().getKeyBindingService(); >+ >+ if (wasHeaderActive) { >+ >+ if (activePart.getSite() instanceof INestable) >+ ((INestable) activePart.getSite()).deactivate(); >+ >+ if (keyBindingService instanceof INestableKeyBindingService) >+ ((INestableKeyBindingService) keyBindingService).activateKeyBindingService(null); >+ >+ } else { >+ >+ if (keyBindingService instanceof INestableKeyBindingService) >+ ((INestableKeyBindingService) keyBindingService).activateKeyBindingService(activePart.getSite()); >+ >+ if (activePart.getSite() instanceof INestable) >+ ((INestable) activePart.getSite()).activate(); >+ >+ } >+ } >+ >+ SharedHeaderFormEditor.this.wasHeaderActive = wasHeaderActive; >+ } >+ }; >+ getContainer().addListener(SWT.Activate, activationListener); >+ getHeaderForm().getForm().getForm().getHead().addListener(SWT.Activate, activationListener); >+ } >+ } >+ > /* > * (non-Javadoc) > *
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 177356
: 60815