KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > ui > wizards > ClasspathAttributeConfiguration


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.ui.wizards;
12
13 import org.eclipse.swt.widgets.Shell;
14
15 import org.eclipse.jface.resource.ImageDescriptor;
16
17 import org.eclipse.jdt.core.IClasspathAttribute;
18 import org.eclipse.jdt.core.IClasspathEntry;
19 import org.eclipse.jdt.core.IJavaProject;
20
21 /**
22  * A {@link ClasspathAttributeConfiguration} specifies how a {@link IClasspathAttribute class path attribute} is presented and configured
23  * in the Java build path dialog.
24  * <p>
25  * Clients should implement this interface and include the name of their
26  * class in an extension contributed to the jdt.ui's classpath attribute configuration
27  * extension point (named <code>org.eclipse.jdt.ui.classpathAttributeConfiguration
28  * </code>).
29  * </p>
30  *
31  * @since 3.3
32  */

33 public abstract class ClasspathAttributeConfiguration {
34     
35     /**
36      * This class provides information about the attribute to be rendered or configured.
37      */

38     public static abstract class ClasspathAttributeAccess {
39         
40         /**
41          * Returns the classpath attribute
42          * @return the classpath attribute
43          */

44         public abstract IClasspathAttribute getClasspathAttribute();
45         
46         /**
47          * Returns the classpath entry the current attribute is part of
48          * @return the parent classpath entry
49          */

50         public abstract IClasspathEntry getParentClasspassEntry();
51         
52         /**
53          * Returns the Java project the current attribute is part of.
54          * @return the parent Java project
55          */

56         public abstract IJavaProject getJavaProject();
57         
58     }
59     
60     /**
61      * Returns the image descriptor of the classpath attributes name as a translated string.
62      *
63      * @param attribute access to the attributes to render
64      * @return returns the label value of the value
65      */

66     public abstract ImageDescriptor getImageDescriptor(ClasspathAttributeAccess attribute);
67     
68
69     /**
70      * Returns the label of the classpath attributes name as a translated string.
71      *
72      * @param attribute access to the attributes to render
73      * @return returns the label value of the value
74      */

75     public abstract String JavaDoc getNameLabel(ClasspathAttributeAccess attribute);
76     
77     
78     /**
79      * Returns the label of the classpath attributes value as a translated string.
80      *
81      * @param attribute access to the attributes to render
82      * @return returns the label value of the value
83      */

84     public abstract String JavaDoc getValueLabel(ClasspathAttributeAccess attribute);
85     
86     /**
87      * Specifies if the given attribute can be edited. This will enable the <em>Edit</em> button that typically
88      * shows the edit dialog.
89      *
90      * @param attribute access to the attribute to answer the question of
91      * @return returns true if the attribute can be edited.
92      */

93     public abstract boolean canEdit(ClasspathAttributeAccess attribute);
94     
95     /**
96      * Specifies if 'Remove' is a valid action on the given attribute. This will enable the <em>Remove</em> button. The action
97      * will typically clear the attributes value. The method should only return <code>true</code> if the element isn't already cleared.
98      *
99      * @param attribute access to the attribute to answer the question of
100      * @return returns true if the attribute can be edited.
101      */

102     public abstract boolean canRemove(ClasspathAttributeAccess attribute);
103
104     /**
105      * This method is invoked when the <em>Edit</em> is pressed. The method is expected to show a configuration dialog.
106      *
107      * @param shell the parent shell
108      * @param attribute access to the attribute to configure
109      * @return returns the configured attribute or <code>null</code> if the action has been cancelled.
110      */

111     public abstract IClasspathAttribute performEdit(Shell shell, ClasspathAttributeAccess attribute);
112     
113     /**
114      * This method is invoked when the <em>Remove</em> is pressed. The method should not show a dialog.
115      *
116      * @param attribute access to the attribute to configure
117      * @return returns the configured attribute
118      */

119     public abstract IClasspathAttribute performRemove(ClasspathAttributeAccess attribute);
120     
121
122 }
123
Popular Tags