[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform] Re: Focus Problems

What is meant by "properly?" All my views (dont have editors) implement setFocus() by calling an appropriate composites setFocus() method. I assume this is the proper thing to do.

I started trying to figure this out again today... what I'm seeing is that if I run the debugger, and put breakpoints WorkBenchPage.setActivePart(), WorkBenchPage.deactivePart(), WorkBenchPage.activePart(), etc, the view shows up with the CatalogExplorerDetailView being focused, instead of the ExplorerTreeView (which appears as the focused view if I run without the debugger). I stepped thru the debugger and have seen the ExplorerTreeView being activated first, then being deactivated as a result of the CatalogExplorerDetailView being activated. So it seems that a refresh is missing between these events... The focus has really switched to the CatalogExplorerDetailView, but not quite refreshed properly... I dont have the eclipse code, nor do I I know enough about it to go fix this... but some one who has worked on this and know more about it will know better.

Thanks
Mahesh

Boris Bokowski wrote:
Do all of your views and editors implement setFocus() properly?

"Mahesh Soori" <msoori@xxxxxxxx> wrote in message news:f3jvl9$i7c$1@xxxxxxxxxxxxxxxxxxxx
Also,

The details View consists of a PageBook and several TableViewers. The Explorer view is a SelectionProvider and the DetailsView is a Listener to the selection events. I thougth this might be a place where focus might get switched, and debugged it. I only call PageBook.showPage() and I've suspected this might be switching focus. So, after digging thru, I found this comment in Control.setVisible() method

/*
* Feature in Windows.  If the receiver has focus, hiding
* the receiver causes no window to have focus.  The fix is
* to assign focus to the first ancestor window that takes
* focus.  If no window will take focus, set focus to the
* desktop.
*/

and this line at the end
if (fixFocus) fixFocus (control);

Could this be the culprit? Since PageBook would hide one control and show another? But this dosent explain why it happens only on the first click. Also I've noticed that If I switch to a different application by pressing Alt+Tab or swithc to a different perspective and back to the Catalog Perspective, everything workls as expected.

Thanks
Mahesh

Mahesh Soori wrote:
Tom,

I've attached an image of the perspective. The explorer view has focus when switched to this perspective. But if you click anywhere on the window (including the Explorer view, the Menubar, or any other views), Details views gets selected. This is only with the first click of the mouse. If I use the arrow keys, the tree navigation works fine, but the first click always switches focus to the Details View.


Here is the plugin.xml

Integrated changes from old branch to mainline








<?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.0"?> <plugin>

   <extension
         point="org.eclipse.ui.perspectives">
      <perspective
            class="com.lggi.esp.client.app.catalog.Perspective"
            icon="icons/catalog.png"
            id="com.lggi.esp.client.app.catalog.perspective"
            name="Catalog">
      </perspective>
   </extension>

   <extension
         point="org.eclipse.ui.views">
      <view
              name="Map"
            allowMultiple="true"
            class="com.lggi.esp.rcp.catalog.map.MapView"
            icon="icons/catalog.png"
            id="com.lggi.esp.rcp.catalog.map.MapView"/>

      <view
              name="Explorer"
            allowMultiple="true"

class="com.lggi.esp.rcp.catalog.explorer.tree.ExplorerTreeView"
            icon="icons/catalog.png"

id="com.lggi.esp.rcp.catalog.explorer.tree.ExplorerTreeView"/>

      <view
              name="Details"
            allowMultiple="true"

class="com.lggi.esp.rcp.catalog.explorer.detail.CatalogExplorerDetailView"
            icon="icons/catalog.png"

id="com.lggi.esp.rcp.catalog.explorer.detail.CatalogExplorerDetailView"/>

   </extension>

</plugin>



and the createInitialLayout() method from the Perspective class, which implements IPerspectiveFactory


/** * Create the initial views for the perspective. */ public void createInitialLayout(IPageLayout layout) { final float fractionalPosition35 = 0.35f; final float fractionalPosition65 = 0.65f;

User curUser = ApplicationController.getUser();
if (!ApplicationController
.isAuthorised(ApplicationController.getOperatorRoles())) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
MessageDialog.openError(shell, "Authorization Failure", "User '"
+ curUser.getName()
+ "' is not authorized to view this perspective");
throw new SecurityException("User '" + curUser.getName()
+ "' is not authorized to view this perspective");
}
String editorArea = layout.getEditorArea();
layout.setEditorAreaVisible(false);


layout.addActionSet("com.lggi.esp.client.gui.catalog.catalogActionSet");

IFolderLayout expFolder = layout.createFolder("Explorer", IPageLayout.TOP, fractionalPosition35, editorArea);
expFolder.addView(ExplorerTreeView.ID);


IFolderLayout propsFolder = layout.createFolder("Properties", IPageLayout.RIGHT,
fractionalPosition65, ExplorerTreeView.ID);
IFolderLayout detailFolder = layout.createFolder("Details", IPageLayout.BOTTOM, fractionalPosition65, editorArea);


        propsFolder.addView(IPageLayout.ID_PROP_SHEET);
        propsFolder.addView(MapView.ID);

        detailFolder.addView(CatalogExplorerDetailView.ID);

        layout.getViewLayout(ExplorerTreeView.ID).setCloseable(false);

layout.getViewLayout(CatalogExplorerDetailView.ID).setCloseable(false);

        layout.addShowViewShortcut(MapView.ID);
        layout.addShowViewShortcut(ExplorerTreeView.ID);
        layout.addShowViewShortcut(CatalogExplorerDetailView.ID);

        // add the properties view
        layout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET);

        // to be removed later
        detailFolder.addView(CatalogExplorerView.ID);
        detailFolder.addView(CatalogJobListView.ID);

        layout.addActionSet("lggi.viewer.actionSet");

        MainPlugin.addPerspectiveShortcuts(layout);
    }

Thanks
Mahesh

Tom Schindl wrote:
Sorry mean eclipse.platform.

Well getting Warnocked (http://en.wikipedia.org/wiki/Warnock's_Dilemma) means that you should rethink your description. Maybe a test-case would make sense?

Tom

Mahesh Soori schrieb:
Tom,

Given the number of responses I have had, I'd say 3 forums definitely was'nt enough ;-) Regardless, I dont see a platform.ui there is a platform.ua, but not ui.

Anyway, thanks for the response. At least one non answer makes it look like somewhat of an active community!
Mahesh


Tom Schindl wrote:
Please stop crossposting on 3 forums. 1 is enough. In your case you can it best fits to platform.ui, I'd say.

Tom

Mahesh Soori schrieb:
Even stranger, if I Alt+Tab to a different application after switching to this perspective and then switch back, it works as expected. I noticed that in Controll.forceFocus(), it blindly sets savedFocus to null and then back again to this as in shell.setSavedFocus (this);
Is this intentional? Anybody back from the MemorialDay yet???


Thanks
Mahesh

Mahesh Soori wrote:
What is even stranger is that if I try to navigate with the keyboard in View A (which contains a tree), the view is properly focussed and expands the nodes as I would expect. However, if I click anywhere in the window, the focus jumps to View B (which has a Pagebook and tables displayed in the Pagebook). I have tried calling setFocus(), etc.

TIA,
Mahesh

Mahesh Soori wrote:
I have 3 views in a perspective, call it A, B and C. When I switch to this perspective, the view A has the focus... but if I click on any of the other two views or the menu bar, the focus always goes to View B. This only happens once, after that the views get the proper focus. I am using Tabbed Folders in the perspective to layout my views. Has anyone else run into this strange behaviour?

Also, I want to add animated icons to certain nodes in a tree to indicate progress activity for that node. I have read in Eclipse release notes that animated gifs are now supported, but when I give an animated icons as the image for the node, its not animated.

TIA
Mahesh

------------------------------------------------------------------------