KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > directory > ldapstudio > schemas > view > editors > schema > SchemaEditorInput


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

34 public class SchemaEditorInput implements IEditorInput
35 {
36     private Schema schema;
37
38
39     /**
40      * Default constructor
41      * @param schema
42      */

43     public SchemaEditorInput( Schema schema )
44     {
45         super();
46         this.schema = schema;
47     }
48
49
50     /* (non-Javadoc)
51      * @see org.eclipse.ui.IEditorInput#exists()
52      */

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

62     public ImageDescriptor getImageDescriptor()
63     {
64         return null;
65     }
66
67
68     /* (non-Javadoc)
69      * @see org.eclipse.ui.IEditorInput#getName()
70      */

71     public String JavaDoc getName()
72     {
73         return this.schema.getName();
74     }
75
76
77     /* (non-Javadoc)
78      * @see org.eclipse.ui.IEditorInput#getPersistable()
79      */

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

89     public String JavaDoc getToolTipText()
90     {
91         return Messages.getString( "SchemaEditorInput.Source_code_of" ) + this.schema.getName(); //$NON-NLS-1$
92
}
93
94
95     /* (non-Javadoc)
96      * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
97      */

98     public Object JavaDoc getAdapter( Class JavaDoc adapter )
99     {
100         return null;
101     }
102
103
104     /* (non-Javadoc)
105      * @see java.lang.Object#equals(java.lang.Object)
106      */

107     public boolean equals( Object JavaDoc obj )
108     {
109         if ( this == obj )
110             return true;
111         if ( !( obj instanceof SchemaEditorInput ) )
112             return false;
113         SchemaEditorInput other = ( SchemaEditorInput ) obj;
114         return other.getSchema().getName().equals( this.schema.getName() );
115     }
116
117
118     /**
119      * Returns the input schema
120      * @return the input schema
121      */

122     public Schema getSchema()
123     {
124         return this.schema;
125     }
126 }
127
Popular Tags