directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r505289 - /directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorSourceCodePage.java
Date Fri, 09 Feb 2007 13:47:56 GMT
Author: pamarcelot
Date: Fri Feb  9 05:47:56 2007
New Revision: 505289

URL: http://svn.apache.org/viewvc?view=rev&rev=505289
Log:
Fixed DIRSTUDIO-31 (Source Code View of a schema is not refreshed when one of its objectclasses
or attributetypes is updated.)
Added a border to the Schema Source Viewer.

Modified:
    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/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=505289&r1=505288&r2=505289
==============================================================================
--- 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
Fri Feb  9 05:47:56 2007
@@ -22,8 +22,10 @@
 
 
 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.view.viewers.SchemaSourceViewer;
 import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.jface.text.Document;
@@ -47,6 +49,14 @@
     private Schema schema;
     private SchemaSourceViewer schemaSourceViewer;
 
+    private SchemaListener schemaListener = new SchemaListener()
+    {
+        public void schemaChanged( Schema originatingSchema, LDAPModelEvent e )
+        {
+            fillInUiFields();
+        }
+    };
+
 
     /**
      * Default constructor
@@ -75,27 +85,29 @@
         SchemaFormEditorInput input = ( SchemaFormEditorInput ) getEditorInput();
         schema = input.getSchema();
 
+        schema.addListener( schemaListener );
+
         // SOURCE CODE Field
-        schemaSourceViewer = new SchemaSourceViewer( form.getBody(), null, null, false, SWT.H_SCROLL
| SWT.V_SCROLL );
+        schemaSourceViewer = new SchemaSourceViewer( form.getBody(), null, null, false, SWT.BORDER
| SWT.H_SCROLL
+            | SWT.V_SCROLL );
         GridData gd = new GridData( SWT.FILL, SWT.FILL, true, true );
         gd.heightHint = 10;
         schemaSourceViewer.getTextWidget().setLayoutData( gd );
         schemaSourceViewer.getTextWidget().setEditable( false );
-        
-        
+
         // set text font
         Font font = JFaceResources.getFont( JFaceResources.TEXT_FONT );
         schemaSourceViewer.getTextWidget().setFont( font );
-        
+
         IDocument document = new Document();
         schemaSourceViewer.setDocument( document );
-        
-        // Initialization from the "input" object class
-        initFieldsContentFromInput();
+
+        // Initializes the UI from the schema
+        fillInUiFields();
     }
 
 
-    private void initFieldsContentFromInput()
+    private void fillInUiFields()
     {
         // SOURCE CODE Field
         AttributeType[] attributeTypes = schema.getAttributeTypesAsArray();
@@ -121,7 +133,7 @@
                 sb.append( "\n" ); //$NON-NLS-1$
             }
         }
-        
+
         schemaSourceViewer.getDocument().set( sb.toString() );
     }
 }



Mime
View raw message