KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > presentations > SystemMenuCloseAll


1 /*******************************************************************************
2  * Copyright (c) 2004, 2005 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.presentations;
12
13 import org.eclipse.jface.action.Action;
14 import org.eclipse.ui.internal.WorkbenchMessages;
15 import org.eclipse.ui.presentations.IPresentablePart;
16 import org.eclipse.ui.presentations.IStackPresentationSite;
17
18 public class SystemMenuCloseAll extends Action implements 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 }
45
Popular Tags