blob: 6c8b5a7ee511d92c5c87695cbdef3d3a68fc8c2b [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ant.internal.ui.views.actions;
import org.eclipse.ant.internal.ui.AntUIImages;
import org.eclipse.ant.internal.ui.IAntUIConstants;
import org.eclipse.ant.internal.ui.IAntUIHelpContextIds;
import org.eclipse.ant.internal.ui.views.AntView;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.texteditor.IUpdate;
public class RemoveAllAction extends Action implements IUpdate {
private AntView view;
public RemoveAllAction(AntView view) {
super(AntViewActionMessages.getString("RemoveAllAction.Remove_All"), AntUIImages.getImageDescriptor(IAntUIConstants.IMG_REMOVE_ALL)); //$NON-NLS-1$
setDescription(AntViewActionMessages.getString("RemoveAllAction.Remove_All")); //$NON-NLS-1$
setToolTipText(AntViewActionMessages.getString("RemoveAllAction.Remove_All")); //$NON-NLS-1$
this.view= view;
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IAntUIHelpContextIds.REMOVE_ALL_ACTION);
}
public void run() {
boolean proceed = MessageDialog.openQuestion(view.getViewSite().getShell(), AntViewActionMessages.getString("RemoveAllAction.0"), AntViewActionMessages.getString("RemoveAllAction.1")); //$NON-NLS-1$ //$NON-NLS-2$
if (proceed) {
view.removeAllProjects();
}
}
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.IUpdate#update()
*/
public void update() {
setEnabled(view.getViewer().getTree().getItemCount() != 0);
}
}