directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r562058 - in /directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor: controller/HierarchyViewController.java view/views/HierarchyView.java
Date Thu, 02 Aug 2007 09:53:36 GMT
Author: pamarcelot
Date: Thu Aug  2 02:53:36 2007
New Revision: 562058

URL: http://svn.apache.org/viewvc?view=rev&rev=562058
Log:
Added an Overview Label in the Hierarchy View indicating the aliases, OID and schema of the
selected schema object.

Modified:
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/HierarchyViewController.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/HierarchyView.java

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/HierarchyViewController.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/HierarchyViewController.java?view=diff&rev=562058&r1=562057&r2=562058
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/HierarchyViewController.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/HierarchyViewController.java
Thu Aug  2 02:53:36 2007
@@ -72,6 +72,9 @@
     {
         public void openProjectChanged( Project oldProject, Project newProject )
         {
+            // Since we're changing of project, let's set the input as null
+            view.setInput( null );
+
             if ( newProject != null )
             {
                 view.getViewer().getTree().setEnabled( true );
@@ -82,7 +85,6 @@
             }
             else
             {
-                view.setInput( null );
                 view.getViewer().getTree().setEnabled( false );
                 showSupertypeHierarchy.setEnabled( false );
                 showSubtypeHierarchy.setEnabled( false );

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/HierarchyView.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/HierarchyView.java?view=diff&rev=562058&r1=562057&r2=562058
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/HierarchyView.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/HierarchyView.java
Thu Aug  2 02:53:36 2007
@@ -20,12 +20,20 @@
 package org.apache.directory.studio.apacheds.schemaeditor.view.views;
 
 
+import org.apache.directory.shared.ldap.schema.SchemaObject;
 import org.apache.directory.studio.apacheds.schemaeditor.Activator;
 import org.apache.directory.studio.apacheds.schemaeditor.controller.HierarchyViewController;
+import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.view.ViewUtils;
 import org.eclipse.jface.viewers.DecoratingLabelProvider;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
 import org.eclipse.ui.part.ViewPart;
 
 
@@ -46,12 +54,35 @@
     /** The controller */
     private HierarchyViewController controller;
 
+    /** The Overview label */
+    private Label overviewLabel;
+
 
     /* (non-Javadoc)
      * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
      */
     public void createPartControl( Composite parent )
     {
+        GridLayout gridLayout = new GridLayout();
+        gridLayout.horizontalSpacing = 0;
+        gridLayout.marginBottom = 0;
+        gridLayout.marginHeight = 0;
+        gridLayout.marginLeft = 0;
+        gridLayout.marginRight = 0;
+        gridLayout.marginTop = 0;
+        gridLayout.marginWidth = 0;
+        gridLayout.verticalSpacing = 0;
+        parent.setLayout( gridLayout );
+
+        // Overview Label
+        overviewLabel = new Label( parent, SWT.WRAP );
+        overviewLabel.setText( "" );
+        overviewLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Separator Label
+        Label separatorLabel = new Label( parent, SWT.SEPARATOR | SWT.HORIZONTAL );
+        separatorLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
         initViewer( parent );
 
         controller = new HierarchyViewController( this );
@@ -66,10 +97,11 @@
      */
     private void initViewer( Composite parent )
     {
-        viewer = new TreeViewer( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER
);
+        viewer = new TreeViewer( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL );
         viewer.setContentProvider( new HierarchyViewContentProvider() );
         viewer.setLabelProvider( new DecoratingLabelProvider( new HierarchyViewLabelProvider(),
Activator.getDefault()
             .getWorkbench().getDecoratorManager().getLabelDecorator() ) );
+        viewer.getTree().setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
         viewer.getTree().setEnabled( false );
     }
 
@@ -109,6 +141,53 @@
     {
         viewer.setInput( input );
         viewer.expandAll();
+        if ( input == null )
+        {
+            overviewLabel.setText( "" );
+        }
+        else
+        {
+            if ( input instanceof AttributeTypeImpl )
+            {
+                setOverviewLabel( ( AttributeTypeImpl ) input );
+            }
+            else if ( input instanceof ObjectClassImpl )
+            {
+                setOverviewLabel( ( ObjectClassImpl ) input );
+            }
+            else
+            {
+                overviewLabel.setText( "" );
+            }
+        }
+    }
+
+
+    /**
+     * Set the overview label for the given schema object.
+     *
+     * @param object
+     *      the schema object
+     */
+    private void setOverviewLabel( SchemaObject object )
+    {
+        StringBuffer sb = new StringBuffer();
+
+        String[] names = object.getNames();
+        if ( ( names != null ) && ( names.length > 0 ) )
+        {
+            sb.append( ViewUtils.concateAliases( names ) );
+        }
+        else
+        {
+            sb.append( "(None)" );
+        }
+        sb.append( " (" );
+        sb.append( object.getOid() );
+        sb.append( ")  -  Schema:" );
+        sb.append( object.getSchema() );
+
+        overviewLabel.setText( sb.toString() );
     }
 
 
@@ -118,7 +197,7 @@
     public void dispose()
     {
         controller.dispose();
-        
+
         super.dispose();
     }
 }



Mime
View raw message