1 11 12 package org.eclipse.jdt.internal.corext.buildpath; 13 14 import java.lang.reflect.InvocationTargetException ; 15 import java.util.ArrayList ; 16 import java.util.List ; 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.IPackageFragmentRoot; 23 24 import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages; 25 import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElementAttribute; 26 import org.eclipse.jdt.internal.ui.wizards.buildpaths.newsourcepage.ClasspathModifierQueries.IOutputLocationQuery; 27 28 33 public class CreateOutputFolderOperation extends ClasspathModifierOperation { 34 35 46 public CreateOutputFolderOperation(IClasspathModifierListener listener, IClasspathInformationProvider informationProvider) { 47 super(listener, informationProvider, NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_CreateOutput_tooltip, IClasspathInformationProvider.CREATE_OUTPUT); 48 } 49 50 58 public void run(IProgressMonitor monitor) throws InvocationTargetException , InterruptedException { 59 List result= new ArrayList (); 60 fException= null; 61 try { 62 IPackageFragmentRoot root= (IPackageFragmentRoot)getSelectedElements().get(0); 63 IJavaProject project= fInformationProvider.getJavaProject(); 64 IOutputLocationQuery query= fInformationProvider.getOutputLocationQuery(); 65 CPListElementAttribute res= createOutputFolder(root, query, project, monitor); 66 if (res != null) { 67 result.add(res); 68 } 69 } catch (CoreException e) { 70 fException= e; 71 result= null; 72 } 73 74 super.handleResult(result, monitor); 75 } 76 77 90 public boolean isValid(List elements, int[] types) { 91 if (elements.size() == 0) 92 return false; 93 Object element= elements.get(0); 94 return elements.size() == 1 && element instanceof IPackageFragmentRoot; 95 } 96 97 109 public String getDescription(int type) { 110 return NewWizardMessages.PackageExplorerActionGroup_FormText_Default_CreateOutput; 111 } 112 } 113 | Popular Tags |