mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-04 07:35:24 +02:00
[193148] Kevin's patch so that Clear Selection Action only enabled on root elements
This commit is contained in:
parent
8e07b5c675
commit
6694aa7ae2
1 changed files with 17 additions and 0 deletions
|
@ -14,12 +14,15 @@
|
|||
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
|
||||
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
|
||||
* Kevin Doyle (IBM) - [189150] setSelection(null) added to clear()
|
||||
* Kevin Doyle (IBM) - [193148] Clear Selected Action enabled when not on a root element
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.ui.view.scratchpad;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.jface.viewers.TreePath;
|
||||
import org.eclipse.jface.viewers.TreeSelection;
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
|
||||
import org.eclipse.rse.core.events.SystemResourceChangeEvent;
|
||||
|
@ -54,6 +57,20 @@ public class ClearSelectedAction extends BrowseAction
|
|||
setEnabled(false);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (selection instanceof TreeSelection)
|
||||
{
|
||||
TreeSelection treeSelection = (TreeSelection) selection;
|
||||
TreePath[] paths = treeSelection.getPathsFor(obj);
|
||||
// if paths[0].getSegmentCount is not 1 then it's not a root
|
||||
if (paths.length > 0 && paths[0].getSegmentCount() != 1)
|
||||
{
|
||||
setEnabled(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
setEnabled(true);
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue