directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r515078 - in /directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas: controller/ controller/actions/ view/editors/
Date Tue, 06 Mar 2007 11:26:11 GMT
Author: pamarcelot
Date: Tue Mar  6 03:26:03 2007
New Revision: 515078

URL: http://svn.apache.org/viewvc?view=rev&rev=515078
Log:
Fixed DIRSTUDIO-41 (Add an Overview page on the Schema Editor that displays all ATs and OCs
of the schema).

Added:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorOverviewPage.java
Modified:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemaSourceCode.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditor.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorSourceCodePage.java

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java?view=diff&rev=515078&r1=515077&r2=515078
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java
Tue Mar  6 03:26:03 2007
@@ -169,8 +169,7 @@
         deleteAction = new DeleteAction();
         collapseAll = new CollapseAllAction( view.getViewer() );
         linkWithEditor = new LinkWithEditorSchemasView( view );
-        openSchemaSourceCode = new OpenSchemaSourceCode( PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
-            "View source code" );
+        openSchemaSourceCode = new OpenSchemaSourceCode();
         save = new SaveAction();
         saveAs = new SaveAsAction();
         openSortDialog = new OpenSchemasViewSortDialogAction();

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemaSourceCode.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemaSourceCode.java?view=diff&rev=515078&r1=515077&r2=515078
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemaSourceCode.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenSchemaSourceCode.java
Tue Mar  6 03:26:03 2007
@@ -26,43 +26,40 @@
 import org.apache.directory.ldapstudio.schemas.controller.ICommandIds;
 import org.apache.directory.ldapstudio.schemas.view.editors.SchemaFormEditor;
 import org.apache.directory.ldapstudio.schemas.view.editors.SchemaFormEditorInput;
+import org.apache.directory.ldapstudio.schemas.view.editors.SchemaFormEditorSourceCodePage;
 import org.apache.directory.ldapstudio.schemas.view.viewers.SchemasView;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
 import org.apache.log4j.Logger;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.viewers.TreeSelection;
 import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.editor.FormEditor;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 
 
 /**
- * This class implements the Action for deleting an element (object class or attribute type)
+ * This class implements the Action for deleting an element (object class or attribute type).
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
  */
-@SuppressWarnings("unused")//$NON-NLS-1$
 public class OpenSchemaSourceCode extends Action
 {
-    private static Logger logger = Logger.getLogger( OpenSchemaSourceCode.class );
-    private final IWorkbenchWindow window;
-
-
     /**
-     * Default constructor
-     * @param window
-     * @param label
+     * Creates a new instance of OpenSchemaSourceCode.
      */
-    public OpenSchemaSourceCode( IWorkbenchWindow window, String label )
+    public OpenSchemaSourceCode()
     {
-        this.window = window;
-        setText( label );
+        setText( "View source code" );
 
         // The id is used to refer to the action in a menu or toolbar
         setId( ICommandIds.CMD_OPEN_SCHEMA_SOURCE_CODE );
         // Associate the action with a pre-defined command, to allow key bindings.
         setActionDefinitionId( ICommandIds.CMD_OPEN_SCHEMA_SOURCE_CODE );
-        setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
PluginConstants.IMG_SCHEMA ) );
+        setImageDescriptor( AbstractUIPlugin
+            .imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_SCHEMA )
);
     }
 
 
@@ -82,11 +79,13 @@
             try
             {
                 IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
-                page.openEditor( new SchemaFormEditorInput( schemaWrapper.getMySchema() ),
SchemaFormEditor.ID );
+                FormEditor editor = ( FormEditor ) page.openEditor( new SchemaFormEditorInput(
schemaWrapper
+                    .getMySchema() ), SchemaFormEditor.ID );
+                editor.setActivePage( SchemaFormEditorSourceCodePage.ID );
             }
             catch ( PartInitException e )
             {
-                logger.debug( "error when opening the editor" ); //$NON-NLS-1$
+                Logger.getLogger( OpenSchemaSourceCode.class ).debug( "error when opening
the editor" ); //$NON-NLS-1$
             }
         }
     }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditor.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditor.java?view=diff&rev=515078&r1=515077&r2=515078
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditor.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditor.java
Tue Mar  6 03:26:03 2007
@@ -22,6 +22,7 @@
 
 
 import org.apache.directory.ldapstudio.schemas.Activator;
+import org.apache.directory.ldapstudio.schemas.model.Schema;
 import org.apache.log4j.Logger;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.ui.IEditorInput;
@@ -31,46 +32,52 @@
 
 
 /**
- * This class is the Schema Editor main class
+ * This class is the Schema Editor main class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
  */
 public class SchemaFormEditor extends FormEditor
 {
+    /** The logger */
     private static Logger logger = Logger.getLogger( SchemaFormEditor.class );
+
+    /** The ID of the Editor */
     public static final String ID = Activator.PLUGIN_ID + ".view.schemaformeditor"; //$NON-NLS-1$
-    private SchemaFormEditorSourceCodePage sourceCode;
 
+    /** The Overview Page */
+    private SchemaFormEditorOverviewPage overview;
 
-    /**
-     * Default constructor
-     */
-    public SchemaFormEditor()
-    {
-        super();
-    }
+    /** The Source Code page */
+    private SchemaFormEditorSourceCodePage sourceCode;
+
+    /** The associated schema */
+    private Schema schema;
 
 
     /* (non-Javadoc)
      * @see org.eclipse.ui.forms.editor.FormEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
      */
-    @Override
     public void init( IEditorSite site, IEditorInput input ) throws PartInitException
     {
         setSite( site );
         setInput( input );
         setPartName( input.getName() );
+
+        schema = ( ( SchemaFormEditorInput ) getEditorInput() ).getSchema();
     }
 
 
     /* (non-Javadoc)
      * @see org.eclipse.ui.forms.editor.FormEditor#addPages()
      */
-    @Override
     protected void addPages()
     {
         try
         {
-            sourceCode = new SchemaFormEditorSourceCodePage( this,
-                "sourceCode", Messages.getString( "SchemaFormEditor.Source_code" ) ); //$NON-NLS-1$
//$NON-NLS-2$
+            overview = new SchemaFormEditorOverviewPage( this );
+            addPage( overview );
+            sourceCode = new SchemaFormEditorSourceCodePage( this );
             addPage( sourceCode );
         }
         catch ( PartInitException e )
@@ -83,7 +90,6 @@
     /* (non-Javadoc)
      * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
      */
-    @Override
     public void doSave( IProgressMonitor monitor )
     {
         // There's nothing to save
@@ -93,7 +99,6 @@
     /* (non-Javadoc)
      * @see org.eclipse.ui.part.EditorPart#doSaveAs()
      */
-    @Override
     public void doSaveAs()
     {
     }
@@ -102,10 +107,20 @@
     /* (non-Javadoc)
      * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
      */
-    @Override
     public boolean isSaveAsAllowed()
     {
         return false;
     }
 
+
+    /**
+     * Gets the associated schema.
+     *
+     * @return
+     *      the associated schema
+     */
+    public Schema getSchema()
+    {
+        return schema;
+    }
 }

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorOverviewPage.java?view=auto&rev=515078
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorOverviewPage.java
(added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorOverviewPage.java
Tue Mar  6 03:26:03 2007
@@ -0,0 +1,263 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.editors;
+
+
+import org.apache.directory.ldapstudio.schemas.Activator;
+import org.apache.directory.ldapstudio.schemas.PluginConstants;
+import org.apache.directory.ldapstudio.schemas.model.AttributeType;
+import org.apache.directory.ldapstudio.schemas.model.LDAPModelEvent;
+import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
+import org.apache.directory.ldapstudio.schemas.model.Schema;
+import org.apache.directory.ldapstudio.schemas.model.SchemaListener;
+import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.apache.log4j.Logger;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class is the Overview Page of the Schema Editore.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemaFormEditorOverviewPage extends FormPage
+{
+    /** The page ID */
+    public static final String ID = SchemaFormEditor.ID + "overviewPage";
+
+    /** The page title */
+    public static final String TITLE = "Overview";
+
+    /** The Schema Pool */
+    private SchemaPool schemaPool;
+
+    /** The associated schema */
+    private Schema schema;
+
+    private SchemaListener schemaListener = new SchemaListener()
+    {
+        public void schemaChanged( Schema originatingSchema, LDAPModelEvent e )
+        {
+            fillInUiFields();
+        }
+    };
+
+    // UI Fields
+    private Table attributeTypesTable;
+    private Table objectClassesTable;
+
+    // Listeners
+    /** The listener of the Attribute Types Table*/
+    private MouseAdapter attributeTypesTableListener = new MouseAdapter()
+    {
+        public void mouseDoubleClick( MouseEvent e )
+        {
+            IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+            AttributeTypeFormEditorInput input = new AttributeTypeFormEditorInput( schemaPool
+                .getAttributeType( attributeTypesTable.getSelection()[0].getText() ) );
+            String editorId = AttributeTypeFormEditor.ID;
+            try
+            {
+                page.openEditor( input, editorId );
+            }
+            catch ( PartInitException exception )
+            {
+                Logger.getLogger( SchemaFormEditorOverviewPage.class ).debug( "error when
opening the editor" ); //$NON-NLS-1$
+            }
+        }
+    };
+    /** The listener of the Object Classes Table*/
+    private MouseAdapter objectClassesTableListener = new MouseAdapter()
+    {
+        public void mouseDoubleClick( MouseEvent e )
+        {
+            IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+            ObjectClassFormEditorInput input = new ObjectClassFormEditorInput( schemaPool
+                .getObjectClass( objectClassesTable.getSelection()[0].getText() ) );
+            String editorId = ObjectClassFormEditor.ID;
+            try
+            {
+                page.openEditor( input, editorId );
+            }
+            catch ( PartInitException exception )
+            {
+                Logger.getLogger( SchemaFormEditorOverviewPage.class ).debug( "error when
opening the editor" ); //$NON-NLS-1$
+            }
+        }
+    };
+
+
+    /**
+     * Creates a new instance of SchemaFormEditorOverviewPage.
+     *
+     * @param editor
+     *      the associated editor
+     */
+    public SchemaFormEditorOverviewPage( FormEditor editor )
+    {
+        super( editor, ID, TITLE );
+        schemaPool = SchemaPool.getInstance();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
+     */
+    protected void createFormContent( IManagedForm managedForm )
+    {
+        // Getting the associated schema
+        schema = ( ( SchemaFormEditor ) getEditor() ).getSchema();
+        schema.addListener( schemaListener );
+
+        // Creating the base UI
+        ScrolledForm form = managedForm.getForm();
+        FormToolkit toolkit = managedForm.getToolkit();
+        GridLayout layout = new GridLayout( 2, true );
+        form.getBody().setLayout( layout );
+
+        createAttributeTypesSection( form.getBody(), toolkit );
+
+        createObjectClassesSection( form.getBody(), toolkit );
+
+        // Initializes the UI from the schema
+        fillInUiFields();
+
+        // Listeners initialization
+        addListeners();
+    }
+
+
+    /**
+     * Create the Attribute Types Section.
+     *
+     * @param parent
+     *      the parent composite
+     * @param toolkit
+     *      the FormToolKit to use
+     */
+    private void createAttributeTypesSection( Composite parent, FormToolkit toolkit )
+    {
+        // Attribute Types Section
+        Section attributeTypesSection = toolkit.createSection( parent, Section.DESCRIPTION
| Section.EXPANDED
+            | Section.TITLE_BAR );
+        attributeTypesSection.setDescription( "The schema '" + schema.getName()
+            + "' contains the following attribute types." );
+        attributeTypesSection.setText( "Attribute types" );
+
+        // Creating the layout of the section
+        Composite attributeTypesSectionClient = toolkit.createComposite( attributeTypesSection
);
+        attributeTypesSectionClient.setLayout( new GridLayout() );
+        toolkit.paintBordersFor( attributeTypesSectionClient );
+        attributeTypesSection.setClient( attributeTypesSectionClient );
+        attributeTypesSection.setLayoutData( new GridData( GridData.FILL, GridData.FILL,
true, true ) );
+
+        attributeTypesTable = toolkit.createTable( attributeTypesSectionClient, SWT.NONE
);
+        GridData gridData = new GridData( GridData.FILL, GridData.FILL, true, true );
+        gridData.heightHint = 1;
+        attributeTypesTable.setLayoutData( gridData );
+    }
+
+
+    /**
+     * Create the Object Classes Section.
+     *
+     * @param parent
+     *      the parent composite
+     * @param toolkit
+     *      the FormToolKit to use
+     */
+    private void createObjectClassesSection( Composite parent, FormToolkit toolkit )
+    {
+        // Attribute Types Section
+        Section objectClassesSection = toolkit.createSection( parent, Section.DESCRIPTION
| Section.EXPANDED
+            | Section.TITLE_BAR );
+        objectClassesSection.setDescription( "The schema '" + schema.getName()
+            + "' contains the following object classes." );
+        objectClassesSection.setText( "Object classes" );
+
+        // Creating the layout of the section
+        Composite objectClassesSectionClient = toolkit.createComposite( objectClassesSection
);
+        objectClassesSectionClient.setLayout( new GridLayout() );
+        toolkit.paintBordersFor( objectClassesSectionClient );
+        objectClassesSection.setClient( objectClassesSectionClient );
+        objectClassesSection.setLayoutData( new GridData( GridData.FILL, GridData.FILL, true,
true ) );
+
+        objectClassesTable = toolkit.createTable( objectClassesSectionClient, SWT.NONE );
+        GridData gridData = new GridData( GridData.FILL, GridData.FILL, true, true );
+        gridData.heightHint = 1;
+        objectClassesTable.setLayoutData( gridData );
+    }
+
+
+    /**
+     * Fills in the fields of the User Interface.
+     */
+    private void fillInUiFields()
+    {
+        AttributeType[] attributeTypes = schema.getAttributeTypesAsArray();
+        for ( int i = 0; i < attributeTypes.length; i++ )
+        {
+            TableItem item = new TableItem( attributeTypesTable, SWT.NONE );
+            item.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                PluginConstants.IMG_ATTRIBUTE_TYPE ).createImage() );
+            item.setText( attributeTypes[i].getNames()[0] );
+        }
+
+        ObjectClass[] objectClasses = schema.getObjectClassesAsArray();
+        for ( int i = 0; i < objectClasses.length; i++ )
+        {
+            TableItem item = new TableItem( objectClassesTable, SWT.NONE );
+            item.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                PluginConstants.IMG_OBJECT_CLASS ).createImage() );
+            item.setText( objectClasses[i].getNames()[0] );
+        }
+    }
+
+
+    /**
+     * Initializes and adds the listners.
+     */
+    private void addListeners()
+    {
+        attributeTypesTable.addMouseListener( attributeTypesTableListener );
+        objectClassesTable.addMouseListener( objectClassesTableListener );
+    }
+}

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorSourceCodePage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorSourceCodePage.java?view=diff&rev=515078&r1=515077&r2=515078
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorSourceCodePage.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorSourceCodePage.java
Tue Mar  6 03:26:03 2007
@@ -42,13 +42,26 @@
 
 
 /**
- * This class is the Source Code Page of the Schema Editor
+ * This class is the Source Code Page of the Schema Editor.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
  */
 public class SchemaFormEditorSourceCodePage extends FormPage
 {
+    /** The page ID */
+    public static final String ID = SchemaFormEditor.ID + "sourceCode";
+
+    /** The page title */
+    public static final String TITLE = Messages.getString( "SchemaFormEditor.Source_code"
);
+
+    /** The associated schema */
     private Schema schema;
+
+    // UI Field
     private SchemaSourceViewer schemaSourceViewer;
 
+    // Listerner
     private SchemaListener schemaListener = new SchemaListener()
     {
         public void schemaChanged( Schema originatingSchema, LDAPModelEvent e )
@@ -59,14 +72,14 @@
 
 
     /**
-     * Default constructor
+     * Creates a new instance of SchemaFormEditorSourceCodePage.
+     * 
      * @param editor
-     * @param id
-     * @param title
+     *      the associated editor
      */
-    public SchemaFormEditorSourceCodePage( FormEditor editor, String id, String title )
+    public SchemaFormEditorSourceCodePage( FormEditor editor )
     {
-        super( editor, id, title );
+        super( editor, ID, TITLE );
     }
 
 
@@ -75,18 +88,15 @@
      */
     protected void createFormContent( IManagedForm managedForm )
     {
+        schema = ( ( SchemaFormEditor ) getEditor() ).getSchema();
+        schema.addListener( schemaListener );
+
         ScrolledForm form = managedForm.getForm();
         FormToolkit toolkit = managedForm.getToolkit();
         GridLayout layout = new GridLayout();
         form.getBody().setLayout( layout );
         toolkit.paintBordersFor( form.getBody() );
 
-        // Getting the input and the objectClass
-        SchemaFormEditorInput input = ( SchemaFormEditorInput ) getEditorInput();
-        schema = input.getSchema();
-
-        schema.addListener( schemaListener );
-
         // SOURCE CODE Field
         schemaSourceViewer = new SchemaSourceViewer( form.getBody(), null, null, false, SWT.BORDER
| SWT.H_SCROLL
             | SWT.V_SCROLL );
@@ -107,9 +117,11 @@
     }
 
 
+    /**
+     * Fills in the fields of the User Interface.
+     */
     private void fillInUiFields()
     {
-        // SOURCE CODE Field
         AttributeType[] attributeTypes = schema.getAttributeTypesAsArray();
         ObjectClass[] objectClasses = schema.getObjectClassesAsArray();
 



Mime
View raw message