1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-30 03:33:37 +02:00

[257721] Doubleclick doing special handling and expanding

This commit is contained in:
David McKnight 2009-01-05 15:16:45 +00:00
parent 67c88a7d1a
commit f7c9ff507f
3 changed files with 20 additions and 26 deletions

View file

@ -66,6 +66,7 @@
* David McKnight (IBM) - [241744] Refresh collapse low level nodes which is expended before. * David McKnight (IBM) - [241744] Refresh collapse low level nodes which is expended before.
* David McKnight (IBM) - [249245] not showing inappropriate popup actions for: Refresh, Show In Table, Go Into, etc. * David McKnight (IBM) - [249245] not showing inappropriate popup actions for: Refresh, Show In Table, Go Into, etc.
* David McKnight (IBM) - [251625] Widget disposed exception when renaming/pasting a folder * David McKnight (IBM) - [251625] Widget disposed exception when renaming/pasting a folder
* David McKnight (IBM) - [257721] Doubleclick doing special handling and expanding
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
@ -391,6 +392,8 @@ public class SystemView extends SafeTreeViewer
protected ViewerFilter[] initViewerFilters = null; protected ViewerFilter[] initViewerFilters = null;
protected List _setList; protected List _setList;
protected boolean _allowAdapterToHandleDoubleClick = true;
/** /**
* Constructor * Constructor
@ -643,7 +646,14 @@ public class SystemView extends SafeTreeViewer
TreePath[] paths = s.getPathsFor(element); TreePath[] paths = s.getPathsFor(element);
if (paths == null || paths.length == 0 || paths[0] == null) return; if (paths == null || paths.length == 0 || paths[0] == null) return;
TreePath elementPath = paths[0]; TreePath elementPath = paths[0];
if (isExpandable(elementPath)) {
// bringing back handling at the adapter level here due to bug 257721
ISystemViewElementAdapter adapter = getViewAdapter(element);
boolean alreadyHandled = false;
if (adapter != null && _allowAdapterToHandleDoubleClick)
alreadyHandled = adapter.handleDoubleClick(element);
if (!alreadyHandled && isExpandable(element)) {
boolean expandedState = getExpandedState(elementPath); boolean expandedState = getExpandedState(elementPath);
setExpandedState(elementPath, !expandedState); setExpandedState(elementPath, !expandedState);
// DWD: fire collapse / expand event // DWD: fire collapse / expand event
@ -6642,5 +6652,8 @@ public class SystemView extends SafeTreeViewer
} }
} }
public void allowAdapterToHandleDoubleClick(boolean flag)
{
_allowAdapterToHandleDoubleClick = flag;
}
} }

View file

@ -16,6 +16,7 @@
* Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
* David McKnight (IBM) - [187711] select SystemView APIs exposed by the ISystemTree interface * David McKnight (IBM) - [187711] select SystemView APIs exposed by the ISystemTree interface
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
* David McKnight (IBM) - [257721] Doubleclick doing special handling and expanding
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
import java.util.List; import java.util.List;
@ -437,6 +438,9 @@ public class SystemViewForm extends Composite implements ISystemTree
treeData.heightHint= 200; treeData.heightHint= 200;
tree.getTree().setLayoutData(treeData); tree.getTree().setLayoutData(treeData);
tree.setShowActions(showActions); tree.setShowActions(showActions);
// for bug 257721, when using system view from a dialog, by default, we don't let adapter handle double-click
tree.allowAdapterToHandleDoubleClick(false);
} }
protected void addOurMouseListener() protected void addOurMouseListener()

View file

@ -36,6 +36,7 @@
* David McKnight (IBM) - [247544] [performance] Restoring Selection on Restart can cause the UI to freeze * David McKnight (IBM) - [247544] [performance] Restoring Selection on Restart can cause the UI to freeze
* Kevin Doyle (IBM) - [242431] Register a new unique context menu id, so contributions can be made to all our views * Kevin Doyle (IBM) - [242431] Register a new unique context menu id, so contributions can be made to all our views
* Li Ding (IBM) - [256135] Subsystem not restored in system view tree if subsystem configuration does not support filter * Li Ding (IBM) - [256135] Subsystem not restored in system view tree if subsystem configuration does not support filter
* David McKnight (IBM) - [257721] Doubleclick doing special handling and expanding
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
@ -61,8 +62,6 @@ import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator; import org.eclipse.jface.action.Separator;
import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionChangedListener;
@ -383,11 +382,6 @@ public class SystemViewPart
//hook the part focus to the viewer's control focus. //hook the part focus to the viewer's control focus.
//hookFocus(systemView.getControl()); //hookFocus(systemView.getControl());
systemView.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
handleDoubleClick(event);
}
});
//prime the selection //prime the selection
//selectionChanged(null, getSite().getDesktopWindow().getSelectionService().getSelection()); //selectionChanged(null, getSite().getDesktopWindow().getSelectionService().getSelection());
@ -476,23 +470,6 @@ public class SystemViewPart
} }
} }
/**
* Handles double clicks in viewer.
* Opens editor if file double-clicked.
*/
protected void handleDoubleClick(DoubleClickEvent event) {
if (!systemView.enabledMode) {
//event.doit = false;
return;
}
IStructuredSelection s = (IStructuredSelection) event.getSelection();
Object element = s.getFirstElement();
if (element == null) return;
ISystemViewElementAdapter adapter = systemView.getViewAdapter(element);
if (adapter != null)
adapter.handleDoubleClick(element);
}
/** /**
* Creates the frame source and frame list, and connects them. * Creates the frame source and frame list, and connects them.