KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > wizards > buildpaths > NativeLibAttributeConfiguration


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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 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     /* (non-Javadoc)
32      * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#getImageDescriptor(org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
33      */

34     public ImageDescriptor getImageDescriptor(ClasspathAttributeAccess attribute) {
35         return JavaPluginImages.DESC_OBJS_NATIVE_LIB_PATH_ATTRIB;
36     }
37
38     /* (non-Javadoc)
39      * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#getNameLabel(org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
40      */

41     public String JavaDoc getNameLabel(ClasspathAttributeAccess attribute) {
42         return NewWizardMessages.CPListLabelProvider_native_library_path;
43     }
44     
45     /* (non-Javadoc)
46      * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#getValueLabel(org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
47      */

48     public String JavaDoc getValueLabel(ClasspathAttributeAccess attribute) {
49         String JavaDoc arg= attribute.getClasspathAttribute().getValue();
50         if (arg == null) {
51             arg= NewWizardMessages.CPListLabelProvider_none;
52         }
53         return arg;
54     }
55
56     /* (non-Javadoc)
57      * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#canEdit(org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
58      */

59     public boolean canEdit(ClasspathAttributeAccess attribute) {
60         return true;
61     }
62
63     /* (non-Javadoc)
64      * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#canRemove(org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
65      */

66     public boolean canRemove(ClasspathAttributeAccess attribute) {
67         return attribute.getClasspathAttribute().getValue() != null;
68     }
69
70     /* (non-Javadoc)
71      * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#performEdit(org.eclipse.swt.widgets.Shell, org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
72      */

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     /* (non-Javadoc)
82      * @see org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration#performRemove(org.eclipse.jdt.ui.wizards.ClasspathAttributeConfiguration.ClasspathAttributeAccess)
83      */

84     public IClasspathAttribute performRemove(ClasspathAttributeAccess attribute) {
85         return JavaCore.newClasspathAttribute(JavaRuntime.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY, null);
86     }
87
88 }
89
Popular Tags