| 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 - Initial API and implementation |
| 10 | *******************************************************************************/ |
| 11 | package org.eclipse.ui.internal.ide.actions; |
| 12 | |
| 13 | import org.eclipse.core.resources.IProject; |
| 14 | import org.eclipse.jface.action.Action; |
| 15 | import org.eclipse.ui.IWorkbenchWindow; |
| 16 | import org.eclipse.ui.actions.ActionFactory; |
| 17 | import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; |
| 18 | import org.eclipse.ui.internal.ide.dialogs.CleanDialog; |
| 19 | |
| 20 | /** |
| 21 | * The clean action replaces the rebuild actions. Clean will discard all built |
| 22 | * state for all projects in the workspace, and deletes all problem markers. |
| 23 | * The next time a build is run, projects will have to be built from scratch. |
| 24 | * Technically this is only necessary if an incremental builder misbehaves. |
| 25 | * |
| 26 | * @since 3.0 |
| 27 | */ |
| 28 | public class BuildCleanAction extends Action implements ActionFactory.IWorkbenchAction { |
| 29 | private IWorkbenchWindow window; |
| 30 | |
| 31 | /** |
| 32 | * Creates a new BuildCleanAction |
| 33 | * |
| 34 | * @param window The window for parenting this action |
| 35 | */ |
| 36 | public BuildCleanAction(IWorkbenchWindow window) { |
| 37 | super(IDEWorkbenchMessages.Workbench_buildClean); |
| 38 | setActionDefinitionId("org.eclipse.ui.project.cleanAction"); //$NON-NLS-1$ |
| 39 | this.window = window; |
| 40 | } |
| 41 | |
| 42 | /* (non-Javadoc) |
| 43 | * @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction#dispose() |
| 44 | */ |
| 45 | public void dispose() { |
| 46 | //nothing to dispose |
| 47 | } |
| 48 | |
| 49 | public void run() { |
| 50 | IProject[] selected = BuildUtilities.findSelectedProjects(window); |
| 51 | new CleanDialog(window, selected).open(); |
| 52 | } |
| 53 | } |