directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r798617 [1/2] - in /directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor: ./ controller/ controller/actions/ model/ model/io/ view/dialogs/ view/wizards/
Date Tue, 28 Jul 2009 17:46:13 GMT
Author: seelmann
Date: Tue Jul 28 17:46:12 2009
New Revision: 798617

URL: http://svn.apache.org/viewvc?rev=798617&view=rev
Log:
DIRSTUDIO-510 (Add functionality to copy/merge schema elements between schema projects)
o Added merge of schema projects
o Added referencs from AttributeTypeImpl to Schema, from ObjectClassImpl to Schema, form Schema to Project
o Improved GenericSchemaConnector
o Improved async run of finish method in NewProjectWizard


Added:
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/MergeSchemasAction.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/MessageDialogWithTextarea.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/MergeSchemasOptionsWizardPage.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/MergeSchemasSelectionWizardPage.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/MergeSchemasWizard.java
Modified:
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginUtils.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages.properties
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_de.properties
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_fr.properties
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/AttributeTypeImpl.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/MatchingRuleImpl.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/ObjectClassImpl.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Project.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Schema.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SchemaImpl.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SyntaxImpl.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ApacheDsSchemaConnector.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/GenericSchemaConnector.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/OpenLdapSchemaFileImporter.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ProjectsImporter.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/XMLSchemaFileImporter.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/ImportCoreSchemasWizard.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/ImportSchemasFromOpenLdapWizard.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/ImportSchemasFromXmlWizard.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/NewAttributeTypeWizard.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/NewObjectClassWizard.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/NewProjectWizard.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/NewSchemaWizard.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/messages.properties
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/messages_de.properties
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/messages_fr.properties

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginUtils.java?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginUtils.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/PluginUtils.java Tue Jul 28 17:46:12 2009
@@ -93,6 +93,7 @@
         AttributeTypeImpl clone = new AttributeTypeImpl( at.getOid() );
         clone.setNames( at.getNamesRef() );
         clone.setSchema( at.getSchema() );
+        clone.setSchemaObject( at.getSchemaObject() );
         clone.setDescription( at.getDescription() );
         clone.setSuperiorName( at.getSuperiorName() );
         clone.setUsage( at.getUsage() );
@@ -122,6 +123,7 @@
     {
         ObjectClassImpl clone = new ObjectClassImpl( oc.getOid() );
         clone.setNames( oc.getNamesRef() );
+        clone.setSchemaObject( oc.getSchemaObject() );
         clone.setSchema( oc.getSchema() );
         clone.setDescription( oc.getDescription() );
         clone.setSuperClassesNames( oc.getSuperClassesNames() );

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java Tue Jul 28 17:46:12 2009
@@ -35,6 +35,7 @@
 import org.apache.directory.studio.schemaeditor.controller.actions.ImportSchemasFromOpenLdapAction;
 import org.apache.directory.studio.schemaeditor.controller.actions.ImportSchemasFromXmlAction;
 import org.apache.directory.studio.schemaeditor.controller.actions.LinkWithEditorSchemaViewAction;
+import org.apache.directory.studio.schemaeditor.controller.actions.MergeSchemasAction;
 import org.apache.directory.studio.schemaeditor.controller.actions.NewAttributeTypeAction;
 import org.apache.directory.studio.schemaeditor.controller.actions.NewObjectClassAction;
 import org.apache.directory.studio.schemaeditor.controller.actions.NewSchemaAction;
@@ -239,6 +240,7 @@
     private SwitchSchemaPresentationToHierarchicalAction switchSchemaPresentationToHierarchical;
     private OpenSchemaViewPreferenceAction openSchemaViewPreference;
     private LinkWithEditorSchemaViewAction linkWithEditor;
+    private MergeSchemasAction mergeSchema;
 
 
     //    private CommitChangesAction commitChanges;
@@ -290,6 +292,7 @@
         switchSchemaPresentationToHierarchical = new SwitchSchemaPresentationToHierarchicalAction();
         openSchemaViewPreference = new OpenSchemaViewPreferenceAction();
         linkWithEditor = new LinkWithEditorSchemaViewAction( view );
+        mergeSchema = new MergeSchemasAction();
         //        commitChanges = new CommitChangesAction();
     }
 
@@ -360,6 +363,8 @@
                 importManager.add( new Separator() );
                 importManager.add( importSchemasFromOpenLdap );
                 importManager.add( importSchemasFromXml );
+                importManager.add( new Separator() );
+                importManager.add( mergeSchema );
                 manager.add( exportManager );
                 exportManager.add( exportSchemasAsOpenLdap );
                 exportManager.add( exportSchemasAsXml );

Added: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/MergeSchemasAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/MergeSchemasAction.java?rev=798617&view=auto
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/MergeSchemasAction.java (added)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/MergeSchemasAction.java Tue Jul 28 17:46:12 2009
@@ -0,0 +1,105 @@
+/*
+ *  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.studio.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.view.wizards.MergeSchemasWizard;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This action launches the {@link MergeSchemasWizard}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class MergeSchemasAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /**
+     * Creates a new instance of MergeSchemasAction.
+     */
+    public MergeSchemasAction()
+    {
+        super( Messages.getString( "MergeSchemasAction.MergeSchemas" ) ); //$NON-NLS-1$
+        setToolTipText( getText() );
+        setImageDescriptor( Activator.getDefault().getImageDescriptor( PluginConstants.IMG_SCHEMAS_IMPORT ) );
+        setEnabled( true );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.action.Action#run()
+     */
+    public void run()
+    {
+        // Instantiates and initializes the wizard
+        MergeSchemasWizard wizard = new MergeSchemasWizard();
+        wizard.init( PlatformUI.getWorkbench(), StructuredSelection.EMPTY );
+        // Instantiates the wizard container with the wizard and opens it
+        WizardDialog dialog = new WizardDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard );
+        dialog.create();
+        dialog.open();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        run();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+     */
+    public void dispose()
+    {
+        // Nothing to do
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+     */
+    public void init( IWorkbenchWindow window )
+    {
+        // Nothing to do
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+        // Nothing to do
+    }
+}

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages.properties?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages.properties (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages.properties Tue Jul 28 17:46:12 2009
@@ -88,3 +88,4 @@
 SwitchSchemaPresentationToFlatAction.FlatToolTip=Flat
 SwitchSchemaPresentationToHierarchicalAction.HierarchicalAction=&Hierarchical
 SwitchSchemaPresentationToHierarchicalAction.HierarchicalToolTip=Hierarchical
+MergeSchemasAction.MergeSchemas=Merge Schemas from other Projects
\ No newline at end of file

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_de.properties?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_de.properties (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_de.properties Tue Jul 28 17:46:12 2009
@@ -88,3 +88,4 @@
 SwitchSchemaPresentationToFlatAction.FlatToolTip=Flach
 SwitchSchemaPresentationToHierarchicalAction.HierarchicalAction=&Hierarchisch
 SwitchSchemaPresentationToHierarchicalAction.HierarchicalToolTip=Hierarchisch
+MergeSchemasAction.MergeSchemas=Schemas von anderen Projekten kopieren

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_fr.properties?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_fr.properties (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/messages_fr.properties Tue Jul 28 17:46:12 2009
@@ -88,3 +88,4 @@
 SwitchSchemaPresentationToFlatAction.FlatToolTip=A plat
 SwitchSchemaPresentationToHierarchicalAction.HierarchicalAction=&Hi\u00E9rarchique
 SwitchSchemaPresentationToHierarchicalAction.HierarchicalToolTip=Hi\u00E9rarchique
+MergeSchemasAction.MergeSchemas=TODO:Merge Schemas from other Projects
\ No newline at end of file

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/AttributeTypeImpl.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/AttributeTypeImpl.java?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/AttributeTypeImpl.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/AttributeTypeImpl.java Tue Jul 28 17:46:12 2009
@@ -58,6 +58,8 @@
     /** The name of the substr matching rule */
     private String substrName;
 
+    /** The schema object */
+    private Schema schemaObject;
 
     /**
      * Creates a new instance of AttributeTypeImpl.
@@ -330,6 +332,18 @@
     }
 
 
+    public Schema getSchemaObject()
+    {
+        return schemaObject;
+    }
+
+
+    public void setSchemaObject( Schema schemaObject )
+    {
+        this.schemaObject = schemaObject;
+    }
+
+
     /* (non-Javadoc)
      * @see org.apache.directory.shared.ldap.schema.AbstractSchemaObject#equals(java.lang.Object)
      */

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/MatchingRuleImpl.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/MatchingRuleImpl.java?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/MatchingRuleImpl.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/MatchingRuleImpl.java Tue Jul 28 17:46:12 2009
@@ -43,6 +43,8 @@
     /** The OID of the syntax */
     private String syntaxOid;
 
+    /** The schema object */
+    private Schema schemaObject;
 
     /**
      * Gets the OID of the syntax.
@@ -132,4 +134,16 @@
     {
         super.setObsolete( obsolete );
     }
+
+
+    public Schema getSchemaObject()
+    {
+        return schemaObject;
+    }
+
+
+    public void setSchemaObject( Schema schemaObject )
+    {
+        this.schemaObject = schemaObject;
+    }
 }
\ No newline at end of file

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/ObjectClassImpl.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/ObjectClassImpl.java?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/ObjectClassImpl.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/ObjectClassImpl.java Tue Jul 28 17:46:12 2009
@@ -54,6 +54,8 @@
     /** The super class names list */
     private String[] superClassesNames = new String[0];
 
+    /** The schema object */
+    private Schema schemaObject;
 
     /**
      * Creates a new instance of ObjectClassImpl.
@@ -278,6 +280,18 @@
     }
 
 
+    public Schema getSchemaObject()
+    {
+        return schemaObject;
+    }
+
+
+    public void setSchemaObject( Schema schemaObject )
+    {
+        this.schemaObject = schemaObject;
+    }
+
+
     /*
      * (non-Javadoc)
      * 

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Project.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Project.java?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Project.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Project.java Tue Jul 28 17:46:12 2009
@@ -256,6 +256,10 @@
         if ( ( !hasOnlineSchemaBeenFetched ) && ( connection != null ) && ( schemaConnector != null ) )
         {
             schemaBackup = schemaConnector.importSchema( connection, monitor );
+            for ( Schema schema : schemaBackup )
+            {
+                schema.setProject( this );
+            }
 
             if ( schemaBackup != null )
             {

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Schema.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Schema.java?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Schema.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/Schema.java Tue Jul 28 17:46:12 2009
@@ -50,6 +50,24 @@
 
 
     /**
+     * Gets the project of the Schema.
+     * 
+     * @return
+     * 		the project of the Schema
+     */
+    public Project getProject();
+
+
+    /**
+     * Sets the project of the Schema.
+     * 
+     * @param name
+     * 		the project of the schema
+     */
+    public void setProject( Project project );
+
+
+    /**
      * Gets all the ObjectClassImpl objects contained in the Schema.
      * 
      * @return

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SchemaImpl.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SchemaImpl.java?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SchemaImpl.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SchemaImpl.java Tue Jul 28 17:46:12 2009
@@ -35,6 +35,9 @@
     /** The name */
     private String name;
 
+    /** The project */
+    private Project project;
+
     /** The AttributeType List */
     private List<AttributeTypeImpl> attributeTypes = new ArrayList<AttributeTypeImpl>();
 
@@ -180,6 +183,15 @@
 
 
     /* (non-Javadoc)
+     * @see org.apache.directory.studio.schemaeditor.model.Schema#getProject()
+     */
+    public Project getProject()
+    {
+        return project;
+    }
+
+
+    /* (non-Javadoc)
      * @see org.apache.directory.studio.schemaeditor.model.Schema#getObjectClass(java.lang.String)
      */
     public ObjectClassImpl getObjectClass( String id )
@@ -299,6 +311,15 @@
 
 
     /* (non-Javadoc)
+     * @see org.apache.directory.studio.schemaeditor.model.Schema#setProject(org.apache.directory.studio.schemaeditor.model.Project)
+     */
+    public void setProject( Project project )
+    {
+        this.project = project;
+    }
+
+
+    /* (non-Javadoc)
      * @see java.lang.Object#toString()
      */
     public String toString()

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SyntaxImpl.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SyntaxImpl.java?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SyntaxImpl.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/SyntaxImpl.java Tue Jul 28 17:46:12 2009
@@ -36,6 +36,8 @@
 {
     private static final long serialVersionUID = 1L;
 
+    /** The schema object */
+    private Schema schemaObject;
 
     /**
      * Creates a new instance of SyntaxImpl.
@@ -92,4 +94,16 @@
     {
         return null;
     }
+
+
+    public Schema getSchemaObject()
+    {
+        return schemaObject;
+    }
+
+
+    public void setSchemaObject( Schema schemaObject )
+    {
+        this.schemaObject = schemaObject;
+    }
 }

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ApacheDsSchemaConnector.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ApacheDsSchemaConnector.java?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ApacheDsSchemaConnector.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ApacheDsSchemaConnector.java Tue Jul 28 17:46:12 2009
@@ -215,21 +215,25 @@
                     case ATTRIBUTE_TYPE:
                         AttributeTypeImpl at = createAttributeType( searchResult );
                         at.setSchema( name );
+                        at.setSchemaObject( schema );
                         schema.addAttributeType( at );
                         break;
                     case OBJECT_CLASS:
                         ObjectClassImpl oc = createObjectClass( searchResult );
                         oc.setSchema( name );
+                        oc.setSchemaObject( schema );
                         schema.addObjectClass( oc );
                         break;
                     case MATCHING_RULE:
                         MatchingRuleImpl mr = createMatchingRule( searchResult );
                         mr.setSchema( name );
+                        mr.setSchemaObject( schema );
                         schema.addMatchingRule( mr );
                         break;
                     case SYNTAX:
                         SyntaxImpl syntax = createSyntax( searchResult );
                         syntax.setSchema( name );
+                        syntax.setSchemaObject( schema );
                         schema.addSyntax( syntax );
                         break;
                     default:

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/GenericSchemaConnector.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/GenericSchemaConnector.java?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/GenericSchemaConnector.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/GenericSchemaConnector.java Tue Jul 28 17:46:12 2009
@@ -206,6 +206,13 @@
                     impl.setOrderingName( atd.getOrderingMatchingRule() );
                     impl.setSubstrName( atd.getSubstringsMatchingRule() );
                     impl.setSchema( schema.getName() );
+                    impl.setSchemaObject( schema );
+
+                    // Active Directory hack
+                    if ( impl.getSyntaxOid() != null && "OctetString".equalsIgnoreCase( impl.getSyntaxOid() ) )
+                    {
+                        impl.setSyntaxOid( "1.3.6.1.4.1.1466.115.121.1.40" );
+                    }
 
                     schema.addAttributeType( impl );
                 }
@@ -235,6 +242,7 @@
                     impl.setMustNamesList( ocd.getMustAttributeTypes().toArray( new String[0] ) );
                     impl.setMayNamesList( ocd.getMayAttributeTypes().toArray( new String[0] ) );
                     impl.setSchema( schema.getName() );
+                    impl.setSchemaObject( schema );
 
                     schema.addObjectClass( impl );
                 }
@@ -261,35 +269,28 @@
                     //impl.setObsolete( lsd.isObsolete() );
                     impl.setHumanReadable( true );
                     impl.setSchema( schema.getName() );
+                    impl.setSchemaObject( schema );
 
                     schema.addSyntax( impl );
                 }
             }
         }
-        // TODO: if online -> all received syntaxes in attributes are valid -> create dummy syntaxes if missing
-        try
+        // if online: assume all received syntaxes in attributes are valid -> create dummy syntaxes if missing
+        for ( AttributeTypeImpl at : schema.getAttributeTypes() )
         {
-            for ( AttributeTypeImpl at : schema.getAttributeTypes() )
+            String syntaxOid = at.getSyntaxOid();
+            if ( syntaxOid != null && schema.getSyntax( syntaxOid ) == null )
             {
-                String syntaxOid = at.getSyntaxOid();
-
-                if ( syntaxOid != null && schema.getSyntax( syntaxOid ) == null )
-                {
-                    SyntaxImpl impl = new SyntaxImpl( syntaxOid );
-                    impl.setSchema( schema.getName() );
-                    // TODO: lookup description/name
-                    impl.setDescription( "Dummy" );
-                    impl.setNames( new String[]
-                        { "Dummy" } );
-                    schema.addSyntax( impl );
-                }
+                SyntaxImpl impl = new SyntaxImpl( syntaxOid );
+                impl.setSchema( schema.getName() );
+                impl.setSchemaObject( schema );
+                // TODO: lookup description/name
+                impl.setDescription( "Dummy" );
+                impl.setNames( new String[]
+                    { "Dummy" } );
+                schema.addSyntax( impl );
             }
         }
-        catch ( Exception e1 )
-        {
-            // TODO Auto-generated catch block
-            e1.printStackTrace();
-        }
 
         Attribute matchingRulesAttribute = searchResult.getAttributes().get( "matchingRules" );
         if ( matchingRulesAttribute != null )
@@ -310,26 +311,19 @@
                     impl.setObsolete( mrd.isObsolete() );
                     impl.setSyntaxOid( mrd.getSyntax() );
                     impl.setSchema( schema.getName() );
+                    impl.setSchemaObject( schema );
 
                     schema.addMatchingRule( impl );
                 }
             }
         }
-        // TODO: if online -> all received matching rules in attributes are valid -> create dummy matching rules if missing
-        try
-        {
-            for ( AttributeTypeImpl at : schema.getAttributeTypes() )
-            {
-                String equalityName = at.getEqualityName();
-                String orderingName = at.getOrderingName();
-                String substrName = at.getSubstrName();
-                checkMatchingRules( schema, equalityName, orderingName, substrName );
-            }
-        }
-        catch ( Exception e )
+        // if online: assume all received matching rules in attributes are valid -> create dummy matching rules if missing
+        for ( AttributeTypeImpl at : schema.getAttributeTypes() )
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            String equalityName = at.getEqualityName();
+            String orderingName = at.getOrderingName();
+            String substrName = at.getSubstrName();
+            checkMatchingRules( schema, equalityName, orderingName, substrName );
         }
 
         return schema;
@@ -344,14 +338,14 @@
             {
                 MatchingRuleImpl impl = new MatchingRuleImpl( matchingRuleName );
                 impl.setSchema( schema.getName() );
+                impl.setSchemaObject( schema );
                 // TODO: lookup description/name
                 impl.setDescription( "Dummy" );
                 impl.setNames( new String[]
                     { matchingRuleName } );
                 schema.addMatchingRule( impl );
             }
-
         }
-
     }
+
 }

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/OpenLdapSchemaFileImporter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/OpenLdapSchemaFileImporter.java?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/OpenLdapSchemaFileImporter.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/OpenLdapSchemaFileImporter.java Tue Jul 28 17:46:12 2009
@@ -101,6 +101,7 @@
         {
             AttributeTypeImpl at = convertAttributeType( ( AttributeTypeLiteral ) ats.get( i ) );
             at.setSchema( schemaName );
+            at.setSchemaObject( schema );
             schema.addAttributeType( at );
         }
 
@@ -109,6 +110,7 @@
         {
             ObjectClassImpl oc = convertObjectClass( ( ObjectClassLiteral ) ocs.get( i ) );
             oc.setSchema( schemaName );
+            oc.setSchemaObject( schema );
             schema.addObjectClass( oc );
         }
 

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ProjectsImporter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ProjectsImporter.java?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ProjectsImporter.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/ProjectsImporter.java Tue Jul 28 17:46:12 2009
@@ -233,6 +233,10 @@
                     try
                     {
                         schemas = XMLSchemaFileImporter.readSchemas( schemasElement, path );
+                        for ( Schema schema : schemas )
+                        {
+                            schema.setProject( project );
+                        }
                     }
                     catch ( XMLSchemaFileImportException e )
                     {
@@ -259,6 +263,7 @@
             }
             for ( Schema schema : schemas )
             {
+                schema.setProject( project );
                 project.getSchemaHandler().addSchema( schema );
             }
         }

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/XMLSchemaFileImporter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/XMLSchemaFileImporter.java?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/XMLSchemaFileImporter.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/model/io/XMLSchemaFileImporter.java Tue Jul 28 17:46:12 2009
@@ -324,6 +324,7 @@
 
         // Schema
         at.setSchema( schema.getName() );
+        at.setSchemaObject( schema );
 
         // Aliases
         Element aliasesElement = element.element( ALIASES_TAG );
@@ -494,6 +495,7 @@
 
         // Schema
         oc.setSchema( schema.getName() );
+        oc.setSchemaObject( schema );
 
         // Aliases
         Element aliasesElement = element.element( ALIASES_TAG );
@@ -640,6 +642,7 @@
 
         // Schema
         mr.setSchema( schema.getName() );
+        mr.setSchemaObject( schema );
 
         // Aliases
         Element aliasesElement = element.element( ALIASES_TAG );
@@ -731,6 +734,7 @@
 
         // Schema
         syntax.setSchema( schema.getName() );
+        syntax.setSchemaObject( schema );
 
         // Aliases
         Element aliasesElement = element.element( ALIASES_TAG );

Added: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/MessageDialogWithTextarea.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/MessageDialogWithTextarea.java?rev=798617&view=auto
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/MessageDialogWithTextarea.java (added)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/MessageDialogWithTextarea.java Tue Jul 28 17:46:12 2009
@@ -0,0 +1,79 @@
+/*
+ *  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.studio.schemaeditor.view.dialogs;
+
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+
+/**
+ * Message dialog with an text area.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class MessageDialogWithTextarea extends MessageDialog
+{
+
+    private String detailMessage;
+    private Text textArea;
+
+
+    /**
+     * Instantiates a dialog.
+     * 
+     * @param parentShell the parent shell
+     * @param title the title
+     * @param message the message
+     * @param detailMessage the detail message
+     */
+    public MessageDialogWithTextarea( Shell parentShell, String title, String message, String detailMessage )
+    {
+        super( parentShell, title, null, message, INFORMATION, new String[]
+            { IDialogConstants.OK_LABEL }, OK );
+        setShellStyle( SWT.RESIZE );
+        this.detailMessage = detailMessage;
+    }
+
+
+    @Override
+    protected Control createCustomArea( Composite parent )
+    {
+        textArea = new Text( parent, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY );
+        textArea.setFont( JFaceResources.getFont( JFaceResources.TEXT_FONT ) );
+        GridData gd = new GridData( GridData.FILL_BOTH );
+        gd.widthHint = convertHorizontalDLUsToPixels( ( int ) ( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2 ) );
+        gd.heightHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 4 );
+        textArea.setLayoutData( gd );
+        //textArea.setBackground( parent.getBackground() );
+        textArea.setText( detailMessage );
+
+        return textArea;
+    }
+
+}

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/ImportCoreSchemasWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/ImportCoreSchemasWizard.java?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/ImportCoreSchemasWizard.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/ImportCoreSchemasWizard.java Tue Jul 28 17:46:12 2009
@@ -76,6 +76,7 @@
                     Schema schema = PluginUtils.loadCoreSchema( serverType, selectedSchema );
                     if ( schema != null )
                     {
+                        schema.setProject( project );
                         schemaHandler.addSchema( schema );
                     }
                 }

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/ImportSchemasFromOpenLdapWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/ImportSchemasFromOpenLdapWizard.java?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/ImportSchemasFromOpenLdapWizard.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/ImportSchemasFromOpenLdapWizard.java Tue Jul 28 17:46:12 2009
@@ -102,6 +102,7 @@
                         {
                             Schema schema = OpenLdapSchemaFileImporter.getSchema( new FileInputStream( schemaFile ),
                                 schemaFile.getAbsolutePath() );
+                            schema.setProject( Activator.getDefault().getProjectsHandler().getOpenProject() );
                             schemaHandler.addSchema( schema );
                         }
                         catch ( OpenLdapSchemaFileImportException e )

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/ImportSchemasFromXmlWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/ImportSchemasFromXmlWizard.java?rev=798617&r1=798616&r2=798617&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/ImportSchemasFromXmlWizard.java (original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/ImportSchemasFromXmlWizard.java Tue Jul 28 17:46:12 2009
@@ -107,6 +107,8 @@
                                 case SINGLE:
                                     Schema importedSchema = XMLSchemaFileImporter.getSchema( new FileInputStream(
                                         schemaFile ), schemaFile.getAbsolutePath() );
+                                    importedSchema.setProject( Activator.getDefault().getProjectsHandler()
+                                        .getOpenProject() );
                                     schemaHandler.addSchema( importedSchema );
                                     break;
                                 case MULTIPLE:
@@ -114,6 +116,7 @@
                                         schemaFile ), schemaFile.getAbsolutePath() );
                                     for ( Schema schema : schemas )
                                     {
+                                        schema.setProject( Activator.getDefault().getProjectsHandler().getOpenProject() );
                                         schemaHandler.addSchema( schema );
                                     }
                                     break;

Added: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/MergeSchemasOptionsWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/MergeSchemasOptionsWizardPage.java?rev=798617&view=auto
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/MergeSchemasOptionsWizardPage.java (added)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/MergeSchemasOptionsWizardPage.java Tue Jul 28 17:46:12 2009
@@ -0,0 +1,109 @@
+/*
+ *  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.studio.schemaeditor.view.wizards;
+
+
+import org.apache.directory.studio.connection.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * This class represents the page to select options of the MergeSchemasWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class MergeSchemasOptionsWizardPage extends WizardPage
+{
+    // UI Fields
+    private Button replaceUnknowNSyntaxButton;
+    private Button mergeDependenciesButton;
+    private Button pullUpAttributesButton;
+
+
+    /**
+     * Creates a new instance of MergeSchemasOptionsWizardPage.
+     */
+    protected MergeSchemasOptionsWizardPage()
+    {
+        super( "MergeSchemasOptionsWizardPage" ); //$NON-NLS-1$
+        setTitle( Messages.getString( "MergeSchemasSelectionWizardPage.ImportSchemasFromProjects" ) ); //$NON-NLS-1$
+        setDescription( Messages.getString( "MergeSchemasSelectionWizardPage.SelectOptions" ) ); //$NON-NLS-1$
+        setImageDescriptor( Activator.getDefault().getImageDescriptor( PluginConstants.IMG_SCHEMAS_IMPORT_WIZARD ) );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+     */
+    public void createControl( Composite parent )
+    {
+        Composite composite = new Composite( parent, SWT.NULL );
+        GridLayout layout = new GridLayout();
+        composite.setLayout( layout );
+        composite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        replaceUnknowNSyntaxButton = BaseWidgetUtils.createCheckbox( composite, Messages
+            .getString( "MergeSchemasOptionsWizardPage.ReplaceUnknownSyntax" ), 1 );
+        replaceUnknowNSyntaxButton.setToolTipText( Messages
+            .getString( "MergeSchemasOptionsWizardPage.ReplaceUnknownSyntaxTooltip" ) );
+        replaceUnknowNSyntaxButton.setSelection( true );
+
+        mergeDependenciesButton = BaseWidgetUtils.createCheckbox( composite, Messages
+            .getString( "MergeSchemasOptionsWizardPage.MergeDependencies" ), 1 );
+        mergeDependenciesButton.setToolTipText( Messages
+            .getString( "MergeSchemasOptionsWizardPage.MergeDependenciesTooltip" ) );
+        mergeDependenciesButton.setSelection( true );
+
+        pullUpAttributesButton = BaseWidgetUtils.createCheckbox( composite, Messages
+            .getString( "MergeSchemasOptionsWizardPage.PullUpAttributes" ), 1 );
+        pullUpAttributesButton.setToolTipText( Messages
+            .getString( "MergeSchemasOptionsWizardPage.PullUpAttributesTooltip" ) );
+        pullUpAttributesButton.setSelection( true );
+
+        setControl( composite );
+    }
+
+
+    public boolean isReplaceUnknownSyntax()
+    {
+        return replaceUnknowNSyntaxButton.getSelection();
+    }
+
+
+    public boolean isMergeDependencies()
+    {
+        return mergeDependenciesButton.getSelection();
+    }
+
+
+    public boolean isPullUpAttributes()
+    {
+        return pullUpAttributesButton.getSelection();
+    }
+
+}

Added: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/MergeSchemasSelectionWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/MergeSchemasSelectionWizardPage.java?rev=798617&view=auto
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/MergeSchemasSelectionWizardPage.java (added)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/MergeSchemasSelectionWizardPage.java Tue Jul 28 17:46:12 2009
@@ -0,0 +1,361 @@
+/*
+ *  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.studio.schemaeditor.view.wizards;
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.ObjectClass;
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.schemaeditor.model.Project;
+import org.apache.directory.studio.schemaeditor.model.ProjectType;
+import org.apache.directory.studio.schemaeditor.model.Schema;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+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.swt.widgets.Tree;
+
+
+/**
+ * This class represents the page to select merged elements of the MergeSchemasWizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class MergeSchemasSelectionWizardPage extends AbstractWizardPage
+{
+    /** The selected projects */
+    private Project[] selectedProjects = new Project[0];
+
+    // UI Fields
+    private CheckboxTreeViewer projectsTreeViewer;
+
+
+    /**
+     * Creates a new instance of MergeSchemasSelectionWizardPage.
+     */
+    protected MergeSchemasSelectionWizardPage()
+    {
+        super( "MergeSchemasSelectionWizardPage" ); //$NON-NLS-1$
+        setTitle( Messages.getString( "MergeSchemasSelectionWizardPage.ImportSchemasFromProjects" ) ); //$NON-NLS-1$
+        setDescription( Messages.getString( "MergeSchemasSelectionWizardPage.PleaseSelectElements" ) ); //$NON-NLS-1$
+        setImageDescriptor( Activator.getDefault().getImageDescriptor( PluginConstants.IMG_SCHEMAS_IMPORT_WIZARD ) );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+     */
+    public void createControl( Composite parent )
+    {
+        Composite composite = new Composite( parent, SWT.NULL );
+        GridLayout layout = new GridLayout();
+        composite.setLayout( layout );
+
+        // Projects TreeViewer
+        Label projectsLabel = new Label( composite, SWT.NONE );
+        projectsLabel.setText( Messages.getString( "MergeSchemasSelectionWizardPage.SelectElements" ) ); //$NON-NLS-1$
+        projectsLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 1, 1 ) );
+        projectsTreeViewer = new CheckboxTreeViewer( new Tree( composite, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION ) );
+        GridData projectsTableViewerGridData = new GridData( SWT.FILL, SWT.FILL, true, true, 1, 1 );
+        projectsTableViewerGridData.widthHint = 450;
+        projectsTableViewerGridData.heightHint = 250;
+        projectsTreeViewer.getTree().setLayoutData( projectsTableViewerGridData );
+        projectsTreeViewer.setContentProvider( new ITreeContentProvider()
+        {
+            public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+            {
+            }
+
+
+            public void dispose()
+            {
+            }
+
+
+            public Object[] getElements( Object inputElement )
+            {
+                return getChildren( inputElement );
+            }
+
+
+            public boolean hasChildren( Object element )
+            {
+                return getChildren( element ).length > 0;
+            }
+
+
+            public Object getParent( Object element )
+            {
+                return null;
+            }
+
+
+            public Object[] getChildren( Object parentElement )
+            {
+                if ( parentElement instanceof List<?> )
+                {
+                    return ( ( List<?> ) parentElement ).toArray();
+                }
+                if ( parentElement instanceof Project )
+                {
+                    Project project = ( Project ) parentElement;
+                    List<Schema> schemas = project.getSchemaHandler().getSchemas();
+                    return schemas.toArray();
+                }
+                if ( parentElement instanceof Schema )
+                {
+                    Schema schema = ( Schema ) parentElement;
+                    Object[] children = new Object[]
+                        { new AttributeTypeFolder( schema ), new ObjectClassFolder( schema ) };
+                    return children;
+                }
+                if ( parentElement instanceof AttributeTypeFolder )
+                {
+                    AttributeTypeFolder folder = ( AttributeTypeFolder ) parentElement;
+                    List<AttributeTypeImpl> attributeTypes = folder.schema.getAttributeTypes();
+                    return attributeTypes.toArray();
+                }
+                if ( parentElement instanceof ObjectClassFolder )
+                {
+                    ObjectClassFolder folder = ( ObjectClassFolder ) parentElement;
+                    List<ObjectClassImpl> objectClasses = folder.schema.getObjectClasses();
+                    return objectClasses.toArray();
+                }
+
+                return new Object[0];
+            }
+        } );
+        projectsTreeViewer.setLabelProvider( new LabelProvider()
+        {
+            public String getText( Object element )
+            {
+                if ( element instanceof Project )
+                {
+                    return ( ( Project ) element ).getName();
+                }
+                else if ( element instanceof Schema )
+                {
+                    return ( ( Schema ) element ).getName();
+                }
+                else if ( element instanceof ObjectClassFolder )
+                {
+                    return Messages.getString( "MergeSchemasSelectionWizardPage.ObjectClasses" );
+                }
+                else if ( element instanceof AttributeTypeFolder )
+                {
+                    return Messages.getString( "MergeSchemasSelectionWizardPage.AttributeTypes" );
+                }
+                else if ( element instanceof AttributeType )
+                {
+                    AttributeType at = ( ( AttributeType ) element );
+                    String[] names = at.getNamesRef();
+                    if ( ( names != null ) && ( names.length > 0 ) )
+                    {
+                        return names[0];
+                    }
+                    else
+                    {
+                        return at.getOid();
+                    }
+                }
+                else if ( element instanceof ObjectClass )
+                {
+                    ObjectClass oc = ( ( ObjectClass ) element );
+                    String[] names = oc.getNamesRef();
+                    if ( ( names != null ) && ( names.length > 0 ) )
+                    {
+                        return names[0];
+                    }
+                    else
+                    {
+                        return oc.getOid();
+                    }
+                }
+
+                // Default
+                return super.getText( element );
+            }
+
+
+            public Image getImage( Object element )
+            {
+                if ( element instanceof Project )
+                {
+                    ProjectType type = ( ( Project ) element ).getType();
+                    switch ( type )
+                    {
+                        case OFFLINE:
+                            return Activator.getDefault().getImage( PluginConstants.IMG_PROJECT_OFFLINE_CLOSED );
+                        case ONLINE:
+                            return Activator.getDefault().getImage( PluginConstants.IMG_PROJECT_ONLINE_CLOSED );
+                    }
+                }
+                else if ( element instanceof Schema )
+                {
+                    return Activator.getDefault().getImage( PluginConstants.IMG_SCHEMA );
+                }
+                else if ( element instanceof ObjectClassFolder )
+                {
+                    return Activator.getDefault().getImage( PluginConstants.IMG_FOLDER_OC );
+                }
+                else if ( element instanceof AttributeTypeFolder )
+                {
+                    return Activator.getDefault().getImage( PluginConstants.IMG_FOLDER_AT );
+                }
+                else if ( element instanceof AttributeType )
+                {
+                    return Activator.getDefault().getImage( PluginConstants.IMG_ATTRIBUTE_TYPE );
+                }
+                else if ( element instanceof ObjectClass )
+                {
+                    return Activator.getDefault().getImage( PluginConstants.IMG_OBJECT_CLASS );
+                }
+
+                // Default
+                return super.getImage( element );
+            }
+        } );
+        projectsTreeViewer.setSorter( new ViewerSorter() );
+        projectsTreeViewer.addCheckStateListener( new ICheckStateListener()
+        {
+            /**
+             * Notifies of a change to the checked state of an element.
+             *
+             * @param event
+             *      event object describing the change
+             */
+            public void checkStateChanged( CheckStateChangedEvent event )
+            {
+                dialogChanged();
+            }
+        } );
+
+        initFields();
+
+        setControl( composite );
+    }
+
+
+    /**
+     * Initializes the UI Fields.
+     */
+    private void initFields()
+    {
+        // Filling the Schemas table
+        List<Project> projects = new ArrayList<Project>();
+        projects.addAll( Activator.getDefault().getProjectsHandler().getProjects() );
+        Collections.sort( projects, new Comparator<Project>()
+        {
+            public int compare( Project o1, Project o2 )
+            {
+                return o1.getName().compareToIgnoreCase( o2.getName() );
+            }
+
+        } );
+        projectsTreeViewer.setInput( projects );
+
+        // Setting the selected projects
+        projectsTreeViewer.setCheckedElements( selectedProjects );
+
+        displayErrorMessage( null );
+        setPageComplete( false );
+    }
+
+
+    /**
+     * This method is called when the user modifies something in the UI.
+     */
+    private void dialogChanged()
+    {
+        // Schemas table
+        if ( projectsTreeViewer.getCheckedElements().length == 0 )
+        {
+            displayErrorMessage( Messages.getString( "MergeSchemasSelectionWizardPage.ErrorNoElementsSelected" ) ); //$NON-NLS-1$
+            return;
+        }
+
+        displayErrorMessage( null );
+    }
+
+
+    /**
+     * Gets the selected objects.
+     *
+     * @return
+     *      the selected objects
+     */
+    public Object[] getSelectedObjects()
+    {
+        Object[] selectedObjects = projectsTreeViewer.getCheckedElements();
+        return selectedObjects;
+    }
+
+
+    /**
+     * Sets the selected projects.
+     *
+     * @param projects
+     *      the projects
+     */
+    public void setSelectedProjects( Project[] projects )
+    {
+        selectedProjects = projects;
+    }
+
+    class ObjectClassFolder
+    {
+        Schema schema;
+
+
+        public ObjectClassFolder( Schema schema )
+        {
+            this.schema = schema;
+        }
+    }
+
+    class AttributeTypeFolder
+    {
+        Schema schema;
+
+
+        public AttributeTypeFolder( Schema schema )
+        {
+            this.schema = schema;
+        }
+    }
+}



Mime
View raw message