1 11 12 package org.eclipse.jdt.internal.corext.buildpath; 13 14 import java.lang.reflect.InvocationTargetException ; 15 import java.util.List ; 16 17 import org.eclipse.core.runtime.CoreException; 18 import org.eclipse.core.runtime.IProgressMonitor; 19 20 import org.eclipse.jdt.core.IJavaProject; 21 import org.eclipse.jdt.core.JavaModelException; 22 23 import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages; 24 import org.eclipse.jdt.internal.ui.wizards.buildpaths.newsourcepage.DialogPackageExplorerActionGroup; 25 26 27 34 public class UnincludeOperation extends ClasspathModifierOperation { 35 36 48 public UnincludeOperation(IClasspathModifierListener listener, IClasspathInformationProvider informationProvider) { 49 super(listener, informationProvider, NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Uninclude_tooltip, IClasspathInformationProvider.UNINCLUDE); 50 } 51 52 59 public void run(IProgressMonitor monitor) throws InvocationTargetException { 60 List result= null; 61 fException= null; 62 try { 63 List elements= getSelectedElements(); 64 IJavaProject project= fInformationProvider.getJavaProject(); 65 result= unInclude(elements, project, monitor); 66 } catch (CoreException e) { 67 fException= e; 68 result= null; 69 } 70 super.handleResult(result, monitor); 71 } 72 73 87 public boolean isValid(List elements, int[] types) throws JavaModelException { 88 if (types.length == 0) 89 return false; 90 for(int i= 0; i < types.length; i++) { 91 int type= types[i]; 92 if (type != DialogPackageExplorerActionGroup.INCLUDED_FILE && type != DialogPackageExplorerActionGroup.INCLUDED_FOLDER) 93 return false; 94 } 95 return true; 96 } 97 98 110 public String getDescription(int type) { 111 if (type == DialogPackageExplorerActionGroup.PACKAGE_FRAGMENT || 112 type == DialogPackageExplorerActionGroup.INCLUDED_FOLDER) 113 return NewWizardMessages.PackageExplorerActionGroup_FormText_UnincludeFolder; 114 if (type == DialogPackageExplorerActionGroup.COMPILATION_UNIT || 115 type == DialogPackageExplorerActionGroup.INCLUDED_FILE) 116 return NewWizardMessages.PackageExplorerActionGroup_FormText_UnincludeFile; 117 return NewWizardMessages.PackageExplorerActionGroup_FormText_Default_Uninclude; 118 } 119 } 120 | Popular Tags |