01: /*******************************************************************************
02: * Copyright (c) 2004, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.presentations;
11:
12: import org.eclipse.jface.action.Action;
13: import org.eclipse.ui.internal.WorkbenchMessages;
14: import org.eclipse.ui.presentations.IPresentablePart;
15: import org.eclipse.ui.presentations.IStackPresentationSite;
16:
17: public class SystemMenuCloseAll extends Action implements
18: ISelfUpdatingAction {
19:
20: private IStackPresentationSite presentation;
21:
22: public SystemMenuCloseAll(IStackPresentationSite presentation) {
23: this .presentation = presentation;
24: setText(WorkbenchMessages.PartPane_closeAll);
25: }
26:
27: public void dispose() {
28: presentation = null;
29: }
30:
31: public void run() {
32: presentation.close(presentation.getPartList());
33: }
34:
35: public void update() {
36: IPresentablePart[] parts = presentation.getPartList();
37: setEnabled(parts.length != 0);
38: }
39:
40: public boolean shouldBeVisible() {
41: return true;
42: }
43:
44: }
|