1 11 package org.eclipse.jdt.internal.corext.buildpath; 12 13 import java.lang.reflect.InvocationTargetException ; 14 import java.util.List ; 15 16 import org.eclipse.core.runtime.CoreException; 17 import org.eclipse.core.runtime.IProgressMonitor; 18 19 import org.eclipse.jdt.core.IJavaProject; 20 import org.eclipse.jdt.core.JavaModelException; 21 22 import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages; 23 import org.eclipse.jdt.internal.ui.wizards.buildpaths.newsourcepage.DialogPackageExplorerActionGroup; 24 import org.eclipse.jdt.internal.ui.wizards.buildpaths.newsourcepage.ClasspathModifierQueries.IAddLibrariesQuery; 25 26 31 public class AddLibraryOperation extends ClasspathModifierOperation { 32 33 44 public AddLibraryOperation(IClasspathModifierListener listener, IClasspathInformationProvider informationProvider) { 45 super(listener, informationProvider, NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddLibCP_tooltip, IClasspathInformationProvider.ADD_LIB_TO_BP); 46 } 47 48 56 public void run(IProgressMonitor monitor) throws InvocationTargetException { 57 List result= null; 58 fException= null; 59 try { 60 IJavaProject project= fInformationProvider.getJavaProject(); 61 IAddLibrariesQuery query= fInformationProvider.getLibrariesQuery(); 62 result= addLibraries(query, project, monitor); 63 } catch (CoreException e) { 64 fException= e; 65 result= null; 66 } 67 super.handleResult(result, monitor); 68 } 69 70 83 public boolean isValid(List elements, int[] types) throws JavaModelException { 84 return types.length == 1 && types[0] == DialogPackageExplorerActionGroup.JAVA_PROJECT; 85 } 86 87 90 public String getDescription(int type) { 91 return NewWizardMessages.PackageExplorerActionGroup_FormText_Default_toBuildpath_library; 92 } 93 94 } 95 | Popular Tags |