KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > directory > ldapstudio > schemas > view > editors > attributeType > AttributeTypeEditorInput


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  *
19  */

20
21 package org.apache.directory.ldapstudio.schemas.view.editors.attributeType;
22
23
24 import org.apache.directory.ldapstudio.schemas.Messages;
25 import org.apache.directory.ldapstudio.schemas.model.AttributeType;
26 import org.eclipse.jface.resource.ImageDescriptor;
27 import org.eclipse.ui.IEditorInput;
28 import org.eclipse.ui.IPersistableElement;
29
30
31 /**
32  * This class is the Input class for the Attribute Type Editor
33  */

34 public class AttributeTypeEditorInput implements IEditorInput
35 {
36     private AttributeType attributeType = null;
37
38
39     /**
40      * Default constructor
41      *
42      * @param at
43      * the input attribute type
44      */

45     public AttributeTypeEditorInput( AttributeType at )
46     {
47         super();
48         this.attributeType = at;
49     }
50
51
52     /*
53      * (non-Javadoc)
54      *
55      * @see org.eclipse.ui.IEditorInput#exists()
56      */

57     public boolean exists()
58     {
59         return ( this.attributeType == null );
60     }
61
62
63     /*
64      * (non-Javadoc)
65      *
66      * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
67      */

68     public ImageDescriptor getImageDescriptor()
69     {
70         // TODO Auto-generated method stub
71
return null;
72     }
73
74
75     /*
76      * (non-Javadoc)
77      *
78      * @see org.eclipse.ui.IEditorInput#getName()
79      */

80     public String JavaDoc getName()
81     {
82         return this.attributeType.getNames()[0];
83     }
84
85
86     /*
87      * (non-Javadoc)
88      *
89      * @see org.eclipse.ui.IEditorInput#getPersistable()
90      */

91     public IPersistableElement getPersistable()
92     {
93         // TODO Auto-generated method stub
94
return null;
95     }
96
97
98     /*
99      * (non-Javadoc)
100      *
101      * @see org.eclipse.ui.IEditorInput#getToolTipText()
102      */

103     public String JavaDoc getToolTipText()
104     {
105         return this.attributeType.getNames()[0]
106             + Messages.getString( "AttributeTypeEditorInput.In_the" ) //$NON-NLS-1$
107
+ this.attributeType.getOriginatingSchema().getName()
108             + Messages.getString( "AttributeTypeEditorInput.Schema" ); //$NON-NLS-1$
109
}
110
111
112     /*
113      * (non-Javadoc)
114      *
115      * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
116      */

117     public Object JavaDoc getAdapter( Class JavaDoc adapter )
118     {
119         return null;
120     }
121
122
123     /*
124      * (non-Javadoc)
125      *
126      * @see java.lang.Object#equals(java.lang.Object)
127      */

128     public boolean equals( Object JavaDoc obj )
129     {
130         if ( this == obj )
131             return true;
132         if ( !( obj instanceof AttributeTypeEditorInput ) )
133             return false;
134         AttributeTypeEditorInput other = ( AttributeTypeEditorInput ) obj;
135         return other.getAttributeType().getOid().equals( this.attributeType.getOid() );
136     }
137
138
139     /**
140      * Returns the input Attribute Type
141      *
142      * @return the input Attribute Type
143      */

144     public AttributeType getAttributeType()
145     {
146         return this.attributeType;
147     }
148 }
149
Popular Tags