KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > directory > ldapstudio > schemas > view > editors > objectClass > ObjectClassEditorInput


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.objectClass;
22
23
24 import org.apache.directory.ldapstudio.schemas.Messages;
25 import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
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 Object Class Editor
33  */

34 public class ObjectClassEditorInput implements IEditorInput
35 {
36     private ObjectClass objectClass = null;
37
38
39     /**
40      * Default constructor.
41      *
42      * @param obj
43      * the object class
44      */

45     public ObjectClassEditorInput( ObjectClass obj )
46     {
47         super();
48         this.objectClass = obj;
49     }
50
51
52     /* (non-Javadoc)
53      * @see org.eclipse.ui.IEditorInput#exists()
54      */

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

64     public ImageDescriptor getImageDescriptor()
65     {
66         // TODO Auto-generated method stub
67
return null;
68     }
69
70
71     /* (non-Javadoc)
72      * @see org.eclipse.ui.IEditorInput#getName()
73      */

74     public String JavaDoc getName()
75     {
76         return this.objectClass.getNames()[0];
77     }
78
79
80     /* (non-Javadoc)
81      * @see org.eclipse.ui.IEditorInput#getPersistable()
82      */

83     public IPersistableElement getPersistable()
84     {
85         return null;
86     }
87
88
89     /* (non-Javadoc)
90      * @see org.eclipse.ui.IEditorInput#getToolTipText()
91      */

92     public String JavaDoc getToolTipText()
93     {
94         return this.objectClass.getNames()[0]
95             + Messages.getString( "ObjectClassEditorInput.In_the" ) + this.objectClass.getOriginatingSchema().getName() + Messages.getString( "ObjectClassEditorInput.Schema" ); //$NON-NLS-1$ //$NON-NLS-2$
96
}
97
98
99     /* (non-Javadoc)
100      * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
101      */

102     public Object JavaDoc getAdapter( Class JavaDoc adapter )
103     {
104         return null;
105     }
106
107
108     /* (non-Javadoc)
109      * @see java.lang.Object#equals(java.lang.Object)
110      */

111     public boolean equals( Object JavaDoc obj )
112     {
113         if ( this == obj )
114             return true;
115         if ( !( obj instanceof ObjectClassEditorInput ) )
116             return false;
117         ObjectClassEditorInput other = ( ObjectClassEditorInput ) obj;
118         return other.getObjectClass().getOid().equals( this.objectClass.getOid() );
119     }
120
121
122     /**
123      * Returns the input object class
124      *
125      * @return
126      * the input object class
127      */

128     public ObjectClass getObjectClass()
129     {
130         return this.objectClass;
131     }
132 }
133
Popular Tags