1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-28 11:25:35 +02:00

[cleanup] format and javadoc

This commit is contained in:
David Dykstal 2006-09-15 19:59:01 +00:00
parent 88d784e901
commit 3c00fb249e

View file

@ -15,10 +15,10 @@
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.actions; package org.eclipse.rse.ui.actions;
import java.util.Iterator; import java.util.Iterator;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.model.ISystemResourceChangeEvents; import org.eclipse.rse.model.ISystemResourceChangeEvents;
import org.eclipse.rse.model.ISystemResourceChangeListener; import org.eclipse.rse.model.ISystemResourceChangeListener;
import org.eclipse.rse.model.SystemRegistry; import org.eclipse.rse.model.SystemRegistry;
@ -30,53 +30,42 @@ import org.eclipse.rse.ui.view.ISystemTree;
import org.eclipse.rse.ui.view.ISystemViewElementAdapter; import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
/** /**
* The action allows users to collapse the selected nodes in the Remote Systems Explorer tree view * The action allows users to collapse the selected nodes in the Remote Systems Explorer tree view
*/ */
public class SystemCollapseAction extends SystemBaseAction public class SystemCollapseAction extends SystemBaseAction {
{
// see defect 41203 // see defect 41203
/** /**
* Constructor * Constructor
* @param parent the parent shell for this action
*/ */
public SystemCollapseAction(Shell parent) public SystemCollapseAction(Shell parent) {
{ super(SystemResources.ACTION_COLLAPSE_SELECTED_LABEL, SystemResources.ACTION_COLLAPSE_SELECTED_TOOLTIP, parent);
super(SystemResources.ACTION_COLLAPSE_SELECTED_LABEL, SystemResources.ACTION_COLLAPSE_SELECTED_TOOLTIP, allowOnMultipleSelection(true);
parent);
allowOnMultipleSelection(true);
setContextMenuGroup(ISystemContextMenuConstants.GROUP_EXPAND); setContextMenuGroup(ISystemContextMenuConstants.GROUP_EXPAND);
setAccelerator('-'); setAccelerator('-');
setHelp(RSEUIPlugin.HELPPREFIX+"actn0024"); setHelp(RSEUIPlugin.HELPPREFIX + "actn0024");
setAvailableOffline(true); setAvailableOffline(true);
} }
/** /**
* <p>
* We intercept to ensure at least one selected item is collapsable * We intercept to ensure at least one selected item is collapsable
*
* @see SystemBaseAction#updateSelection(IStructuredSelection) * @see SystemBaseAction#updateSelection(IStructuredSelection)
*/ */
public boolean updateSelection(IStructuredSelection selection) public boolean updateSelection(IStructuredSelection selection) {
{
boolean enable = false; boolean enable = false;
if ((viewer != null) && (viewer instanceof ISystemTree)) if ((viewer != null) && (viewer instanceof ISystemTree)) {
{ return ((ISystemTree) viewer).areAnySelectedItemsExpanded();
return ((ISystemTree)viewer).areAnySelectedItemsExpanded();
} }
Iterator e = selection.iterator(); Iterator e = selection.iterator();
ISystemViewElementAdapter adapter = null; ISystemViewElementAdapter adapter = null;
while (!enable && e.hasNext()) while (!enable && e.hasNext()) {
{
Object selectedObject = e.next(); Object selectedObject = e.next();
adapter = getAdapter(selectedObject); adapter = getAdapter(selectedObject);
if (adapter != null) if (adapter != null) {
{ if (adapter.hasChildren(selectedObject)) enable = true;
if (adapter.hasChildren(selectedObject))
enable = true;
} }
} }
return enable; return enable;
@ -86,17 +75,12 @@ public class SystemCollapseAction extends SystemBaseAction
* This is the method called when the user selects this action. * This is the method called when the user selects this action.
* @see org.eclipse.jface.action.Action#run() * @see org.eclipse.jface.action.Action#run()
*/ */
public void run() public void run() {
{
//System.out.println("Inside run of SystemRefreshAction"); //System.out.println("Inside run of SystemRefreshAction");
SystemRegistry sr = RSEUIPlugin.getTheSystemRegistry(); SystemRegistry sr = RSEUIPlugin.getTheSystemRegistry();
if ((viewer != null) && (viewer instanceof ISystemResourceChangeListener)) if ((viewer != null) && (viewer instanceof ISystemResourceChangeListener)) {
{ sr.fireEvent((ISystemResourceChangeListener) viewer, new SystemResourceChangeEvent("dummy", ISystemResourceChangeEvents.EVENT_COLLAPSE_SELECTED, null));
sr.fireEvent((ISystemResourceChangeListener)viewer, } else
new SystemResourceChangeEvent("dummy", sr.fireEvent(new SystemResourceChangeEvent("dummy", ISystemResourceChangeEvents.EVENT_COLLAPSE_SELECTED, null));
ISystemResourceChangeEvents.EVENT_COLLAPSE_SELECTED, null)); }
}
else
sr.fireEvent(new SystemResourceChangeEvent("dummy", ISystemResourceChangeEvents.EVENT_COLLAPSE_SELECTED, null));
}
} }