1 11 package org.eclipse.jdt.internal.ui.wizards.buildpaths; 12 13 import org.eclipse.swt.widgets.Shell; 14 15 import org.eclipse.jface.resource.ImageDescriptor; 16 import org.eclipse.jface.window.Window; 17 18 import org.eclipse.jdt.core.IClasspathAttribute; 19 import org.eclipse.jdt.core.JavaCore; 20 21 import org.eclipse.jdt.launching.JavaRuntime; 22 23 import org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration; 24 25 import org.eclipse.jdt.internal.ui.JavaPluginImages; 26 import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages; 27 28 29 public class NativeLibAttributeConfiguration extends ClasspathAttributeConfiguration { 30 31 34 public ImageDescriptor getImageDescriptor(ClasspathAttributeAccess attribute) { 35 return JavaPluginImages.DESC_OBJS_NATIVE_LIB_PATH_ATTRIB; 36 } 37 38 41 public String getNameLabel(ClasspathAttributeAccess attribute) { 42 return NewWizardMessages.CPListLabelProvider_native_library_path; 43 } 44 45 48 public String getValueLabel(ClasspathAttributeAccess attribute) { 49 String arg= attribute.getClasspathAttribute().getValue(); 50 if (arg == null) { 51 arg= NewWizardMessages.CPListLabelProvider_none; 52 } 53 return arg; 54 } 55 56 59 public boolean canEdit(ClasspathAttributeAccess attribute) { 60 return true; 61 } 62 63 66 public boolean canRemove(ClasspathAttributeAccess attribute) { 67 return attribute.getClasspathAttribute().getValue() != null; 68 } 69 70 73 public IClasspathAttribute performEdit(Shell shell, ClasspathAttributeAccess attribute) { 74 NativeLibrariesDialog dialog= new NativeLibrariesDialog(shell, attribute.getClasspathAttribute().getValue(), attribute.getParentClasspassEntry()); 75 if (dialog.open() == Window.OK) { 76 return JavaCore.newClasspathAttribute(JavaRuntime.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY, dialog.getNativeLibraryPath()); 77 } 78 return null; 79 } 80 81 84 public IClasspathAttribute performRemove(ClasspathAttributeAccess attribute) { 85 return JavaCore.newClasspathAttribute(JavaRuntime.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY, null); 86 } 87 88 } 89 | Popular Tags |