KickJava   Java API By Example, From Geeks To Geeks.

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


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.Activator;
25 import org.apache.directory.ldapstudio.schemas.model.Schema;
26 import org.apache.log4j.Logger;
27 import org.eclipse.core.runtime.IProgressMonitor;
28 import org.eclipse.ui.IEditorInput;
29 import org.eclipse.ui.IEditorSite;
30 import org.eclipse.ui.PartInitException;
31 import org.eclipse.ui.forms.editor.FormEditor;
32
33
34 /**
35  * This class is the Schema Editor main class.
36  *
37  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
38  * @version $Rev$, $Date$
39  */

40 public class SchemaEditor extends FormEditor
41 {
42     /** The logger */
43     private static Logger logger = Logger.getLogger( SchemaEditor.class );
44
45     /** The ID of the Editor */
46     public static final String JavaDoc ID = Activator.PLUGIN_ID + ".view.schemaformeditor"; //$NON-NLS-1$
47

48     /** The Overview Page */
49     private SchemaEditorOverviewPage overview;
50
51     /** The Source Code page */
52     private SchemaEditorSourceCodePage sourceCode;
53
54     /** The associated schema */
55     private Schema schema;
56
57
58     /* (non-Javadoc)
59      * @see org.eclipse.ui.forms.editor.FormEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
60      */

61     public void init( IEditorSite site, IEditorInput input ) throws PartInitException
62     {
63         setSite( site );
64         setInput( input );
65         setPartName( input.getName() );
66
67         schema = ( ( SchemaEditorInput ) getEditorInput() ).getSchema();
68     }
69
70
71     /* (non-Javadoc)
72      * @see org.eclipse.ui.forms.editor.FormEditor#addPages()
73      */

74     protected void addPages()
75     {
76         try
77         {
78             overview = new SchemaEditorOverviewPage( this );
79             addPage( overview );
80             sourceCode = new SchemaEditorSourceCodePage( this );
81             addPage( sourceCode );
82         }
83         catch ( PartInitException e )
84         {
85             logger.debug( "error when adding pages" ); //$NON-NLS-1$
86
}
87     }
88
89
90     /* (non-Javadoc)
91      * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
92      */

93     public void doSave( IProgressMonitor monitor )
94     {
95         // There's nothing to save
96
}
97
98
99     /* (non-Javadoc)
100      * @see org.eclipse.ui.part.EditorPart#doSaveAs()
101      */

102     public void doSaveAs()
103     {
104     }
105
106
107     /* (non-Javadoc)
108      * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
109      */

110     public boolean isSaveAsAllowed()
111     {
112         return false;
113     }
114
115
116     /**
117      * Gets the associated schema.
118      *
119      * @return
120      * the associated schema
121      */

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