KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > corext > buildpath > ResetAllOutputFoldersOperation


1 /*******************************************************************************
2  * Copyright (c) 2000, 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
12 package org.eclipse.jdt.internal.corext.buildpath;
13
14 import java.lang.reflect.InvocationTargetException JavaDoc;
15 import java.util.ArrayList JavaDoc;
16 import java.util.List JavaDoc;
17
18 import org.eclipse.core.runtime.CoreException;
19 import org.eclipse.core.runtime.IProgressMonitor;
20
21 import org.eclipse.jdt.core.IJavaProject;
22 import org.eclipse.jdt.core.JavaModelException;
23
24 import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages;
25
26 /**
27  * Operation to reset all output folders of the project's source folders
28  */

29 public class ResetAllOutputFoldersOperation extends ClasspathModifierOperation {
30     
31     /**
32      * Constructor
33      *
34      * @param listener a <code>IClasspathModifierListener</code> that is notified about
35      * changes on classpath entries or <code>null</code> if no such notification is
36      * necessary.
37      * @param informationProvider a provider to offer information to the operation
38      *
39      * @see IClasspathInformationProvider
40      * @see ClasspathModifier
41      */

42     public ResetAllOutputFoldersOperation(IClasspathModifierListener listener, IClasspathInformationProvider informationProvider) {
43         super(listener, informationProvider, NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Reset_tooltip, IClasspathInformationProvider.RESET);
44     }
45     
46     /**
47      * Method which runs the actions with a progress monitor.<br>
48      *
49      * This operation does not require any queries from the provider.
50      *
51      * @param monitor a progress monitor, can be <code>null</code>
52      */

53     public void run(IProgressMonitor monitor) throws InvocationTargetException JavaDoc {
54         List JavaDoc result= new ArrayList JavaDoc();
55         fException= null;
56         try {
57             IJavaProject project= fInformationProvider.getJavaProject();
58             resetOutputFolders(project, monitor);
59         } catch (CoreException e) {
60             fException= e;
61             result= null;
62         }
63         super.handleResult(result, monitor);
64     }
65     
66     /**
67      * Find out whether this operation can be executed on
68      * the provided list of elements.
69      *
70      * @param elements a list of elements
71      * @param types an array of types for each element, that is,
72      * the type at position 'i' belongs to the selected element
73      * at position 'i'
74      *
75      * @return <code>true</code> if the operation can be
76      * executed on the provided list of elements, <code>
77      * false</code> otherwise.
78      * @throws JavaModelException
79      */

80     public boolean isValid(List JavaDoc elements, int[] types) throws JavaModelException {
81         return true; // does not depend on any elements
82
}
83     
84     /**
85      * Get a description for this operation. The description depends on
86      * the provided type parameter, which must be a constant of
87      * <code>DialogPackageExplorerActionGroup</code>. If the type is
88      * <code>DialogPackageExplorerActionGroup.MULTI</code>, then the
89      * description will be very general to describe the situation of
90      * all the different selected objects as good as possible.
91      *
92      * @param type the type of the selected object, must be a constant of
93      * <code>DialogPackageExplorerActionGroup</code>.
94      * @return a string describing the operation
95      */

96     public String JavaDoc getDescription(int type) {
97         return NewWizardMessages.PackageExplorerActionGroup_FormText_Default_ResetAllOutputFolders;
98     }
99 }
100
Popular Tags