Project

General

Profile

Download (1.41 KB) Statistics
| Branch: | Tag: | Revision:
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.ui.internal.navigator.actions;
12

    
13
import org.eclipse.jface.action.Action;
14
import org.eclipse.ui.handlers.CollapseAllHandler;
15
import org.eclipse.ui.internal.navigator.CommonNavigatorMessages;
16
import org.eclipse.ui.navigator.CommonViewer;
17

    
18
/**
19
 * This action delegate collapses all expanded elements in a Navigator view.
20
 * 
21
 */
22
public class CollapseAllAction extends Action {
23

    
24
	private final CommonViewer commonViewer;
25

    
26
	/**
27
	 * Create the CollapseAll action.
28
	 * 
29
	 * @param aViewer
30
	 *            The viewer to be collapsed.
31
	 */
32
	public CollapseAllAction(CommonViewer aViewer) {
33
		super(CommonNavigatorMessages.CollapseAllActionDelegate_0);
34
		setToolTipText(CommonNavigatorMessages.CollapseAllActionDelegate_0);
35
		setActionDefinitionId(CollapseAllHandler.COMMAND_ID);
36
		commonViewer = aViewer;
37
	}
38

    
39
	public void run() {
40
		if (commonViewer != null) {
41
			commonViewer.collapseAll();
42
		}
43
	}
44
}
(1-1/4)