blob: 817e0da8c4cf2d2b00f34fd0bb33ad9ad0c31fb5 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.internal.presentations;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.internal.WorkbenchMessages;
import org.eclipse.ui.presentations.IPresentablePart;
import org.eclipse.ui.presentations.IStackPresentationSite;
public class SystemMenuCloseAll extends Action implements ISelfUpdatingAction {
private IStackPresentationSite presentation;
public SystemMenuCloseAll(IStackPresentationSite presentation) {
this.presentation = presentation;
setText(WorkbenchMessages.PartPane_closeAll);
}
public void dispose() {
presentation = null;
}
public void run() {
presentation.close(presentation.getPartList());
}
public void update() {
IPresentablePart[] parts = presentation.getPartList();
setEnabled(parts.length != 0);
}
public boolean shouldBeVisible() {
return true;
}
}