You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2007/07/25 14:51:27 UTC
svn commit: r559434 - in
/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor:
controller/ model/schemachecker/ view/dialogs/ view/editors/attributetype/
view/editors/objectclass/
Author: pamarcelot
Date: Wed Jul 25 05:51:19 2007
New Revision: 559434
URL: http://svn.apache.org/viewvc?view=rev&rev=559434
Log:
Fixed potential NPE if an attribute type, object class, matching rule or syntax does not have any alias.
Added:
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboComparator.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESyntaxComboComparator.java
Modified:
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/AttributeTypeSelectionDialogContentProvider.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/ObjectClassSelectionDialogContentProvider.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboComparator.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboLabelProvider.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboContentProvider.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboLabelProvider.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESyntaxComboContentProvider.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESyntaxComboLabelProvider.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEUsedByMandatoryTableContentProvider.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEUsedByOptionalTableContentProvider.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditor.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditorInput.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditorUsedByPage.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorAttributesTableContentProvider.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorInput.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorSuperiorsTableContentProvider.java
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java?view=diff&rev=559434&r1=559433&r2=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java Wed Jul 25 05:51:19 2007
@@ -526,9 +526,13 @@
{
AttributeTypeImpl at = ( AttributeTypeImpl ) object;
attributeTypesList.add( at );
- for ( String name : at.getNames() )
+ String[] names = at.getNames();
+ if ( names != null )
{
- attributeTypesMap.put( name.toLowerCase(), at );
+ for ( String name : names )
+ {
+ attributeTypesMap.put( name.toLowerCase(), at );
+ }
}
attributeTypesMap.put( at.getOid(), at );
}
@@ -536,9 +540,13 @@
{
MatchingRuleImpl mr = ( MatchingRuleImpl ) object;
matchingRulesList.add( mr );
- for ( String name : mr.getNames() )
+ String[] names = mr.getNames();
+ if ( names != null )
{
- matchingRulesMap.put( name.toLowerCase(), mr );
+ for ( String name : names )
+ {
+ matchingRulesMap.put( name.toLowerCase(), mr );
+ }
}
matchingRulesMap.put( mr.getOid(), mr );
}
@@ -546,9 +554,13 @@
{
ObjectClassImpl oc = ( ObjectClassImpl ) object;
objectClassesList.add( oc );
- for ( String name : oc.getNames() )
+ String[] names = oc.getNames();
+ if ( names != null )
{
- objectClassesMap.put( name.toLowerCase(), oc );
+ for ( String name : names )
+ {
+ objectClassesMap.put( name.toLowerCase(), oc );
+ }
}
objectClassesMap.put( oc.getOid(), oc );
}
@@ -556,9 +568,13 @@
{
SyntaxImpl syntax = ( SyntaxImpl ) object;
syntaxesList.add( syntax );
- for ( String name : syntax.getNames() )
+ String[] names = syntax.getNames();
+ if ( names != null )
{
- syntaxesMap.put( name.toLowerCase(), syntax );
+ for ( String name : names )
+ {
+ syntaxesMap.put( name.toLowerCase(), syntax );
+ }
}
syntaxesMap.put( syntax.getOid(), syntax );
}
@@ -617,9 +633,13 @@
{
AttributeTypeImpl at = ( AttributeTypeImpl ) object;
attributeTypesList.remove( at );
- for ( String name : at.getNames() )
+ String[] names = at.getNames();
+ if ( names != null )
{
- attributeTypesMap.remove( name.toLowerCase() );
+ for ( String name : names )
+ {
+ attributeTypesMap.remove( name.toLowerCase() );
+ }
}
attributeTypesMap.remove( at.getOid() );
}
@@ -627,9 +647,13 @@
{
MatchingRuleImpl mr = ( MatchingRuleImpl ) object;
matchingRulesList.remove( mr );
- for ( String name : mr.getNames() )
+ String[] names = mr.getNames();
+ if ( names != null )
{
- matchingRulesMap.remove( name.toLowerCase() );
+ for ( String name : mr.getNames() )
+ {
+ matchingRulesMap.remove( name.toLowerCase() );
+ }
}
matchingRulesMap.remove( mr.getOid() );
}
@@ -637,9 +661,13 @@
{
ObjectClassImpl oc = ( ObjectClassImpl ) object;
objectClassesList.remove( oc );
- for ( String name : oc.getNames() )
+ String[] names = oc.getNames();
+ if ( names != null )
{
- objectClassesMap.remove( name.toLowerCase() );
+ for ( String name : oc.getNames() )
+ {
+ objectClassesMap.remove( name.toLowerCase() );
+ }
}
objectClassesMap.remove( oc.getOid() );
}
@@ -647,9 +675,13 @@
{
SyntaxImpl syntax = ( SyntaxImpl ) object;
syntaxesList.remove( syntax );
- for ( String name : syntax.getNames() )
+ String[] names = syntax.getNames();
+ if ( names != null )
{
- syntaxesMap.remove( name.toLowerCase() );
+ for ( String name : syntax.getNames() )
+ {
+ syntaxesMap.remove( name.toLowerCase() );
+ }
}
syntaxesMap.remove( syntax.getOid() );
}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java?view=diff&rev=559434&r1=559433&r2=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/schemachecker/SchemaChecker.java Wed Jul 25 05:51:19 2007
@@ -66,6 +66,9 @@
/** The warnings MultiMap */
private MultiMap warningsMap;
+ /** The dependencies MultiMap */
+ private MultiMap dependenciesMap;
+
/** The 'listening to modifications' flag*/
private boolean listeningToModifications = false;
@@ -154,6 +157,7 @@
errorsMap = new MultiValueMap();
warningsList = new ArrayList<SchemaWarning>();
warningsMap = new MultiValueMap();
+ dependenciesMap = new MultiValueMap();
listeners = new ArrayList<SchemaCheckerListener>();
}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/AttributeTypeSelectionDialogContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/AttributeTypeSelectionDialogContentProvider.java?view=diff&rev=559434&r1=559433&r2=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/AttributeTypeSelectionDialogContentProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/AttributeTypeSelectionDialogContentProvider.java Wed Jul 25 05:51:19 2007
@@ -89,24 +89,26 @@
{
public int compare( AttributeTypeImpl at1, AttributeTypeImpl at2 )
{
- if ( ( at1.getNames() == null || at1.getNames().length == 0 )
- && ( at2.getNames() == null || at2.getNames().length == 0 ) )
+ String[] at1Names = ( ( AttributeTypeImpl ) at1 ).getNames();
+ String[] at2Names = ( ( AttributeTypeImpl ) at2 ).getNames();
+
+ if ( ( at1Names == null || at1Names.length == 0 ) && ( at2Names == null || at2Names.length == 0 ) )
{
return 0;
}
- else if ( ( at1.getNames() == null || at1.getNames().length == 0 )
- && ( at2.getNames() != null && at2.getNames().length > 0 ) )
+ else if ( ( at1Names == null || at1Names.length == 0 )
+ && ( at2Names != null && at2Names.length > 0 ) )
{
- return "".compareToIgnoreCase( at2.getNames()[0] ); //$NON-NLS-1$
+ return "".compareToIgnoreCase( at2Names[0] ); //$NON-NLS-1$
}
- else if ( ( at1.getNames() != null && at1.getNames().length > 0 )
- && ( at2.getNames() == null || at2.getNames().length == 0 ) )
+ else if ( ( at1Names != null && at1Names.length > 0 )
+ && ( at2Names == null || at2Names.length == 0 ) )
{
- return at1.getNames()[0].compareToIgnoreCase( "" ); //$NON-NLS-1$
+ return at1Names[0].compareToIgnoreCase( "" ); //$NON-NLS-1$
}
else
{
- return at1.getNames()[0].compareToIgnoreCase( at2.getNames()[0] );
+ return at1Names[0].compareToIgnoreCase( at2Names[0] );
}
}
} );
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/ObjectClassSelectionDialogContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/ObjectClassSelectionDialogContentProvider.java?view=diff&rev=559434&r1=559433&r2=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/ObjectClassSelectionDialogContentProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/ObjectClassSelectionDialogContentProvider.java Wed Jul 25 05:51:19 2007
@@ -89,24 +89,26 @@
{
public int compare( ObjectClassImpl oc1, ObjectClassImpl oc2 )
{
- if ( ( oc1.getNames() == null || oc1.getNames().length == 0 )
- && ( oc2.getNames() == null || oc2.getNames().length == 0 ) )
+ String[] oc1Names = ( ( ObjectClassImpl ) oc1 ).getNames();
+ String[] oc2Names = ( ( ObjectClassImpl ) oc2 ).getNames();
+
+ if ( ( oc1Names == null || oc1Names.length == 0 ) && ( oc2Names == null || oc2Names.length == 0 ) )
{
return 0;
}
- else if ( ( oc1.getNames() == null || oc1.getNames().length == 0 )
- && ( oc2.getNames() != null && oc2.getNames().length > 0 ) )
+ else if ( ( oc1Names == null || oc1Names.length == 0 )
+ && ( oc2Names != null && oc2Names.length > 0 ) )
{
- return "".compareToIgnoreCase( oc2.getNames()[0] ); //$NON-NLS-1$
+ return "".compareToIgnoreCase( oc2Names[0] ); //$NON-NLS-1$
}
- else if ( ( oc1.getNames() != null && oc1.getNames().length > 0 )
- && ( oc2.getNames() == null || oc2.getNames().length == 0 ) )
+ else if ( ( oc1Names != null && oc1Names.length > 0 )
+ && ( oc2Names == null || oc2Names.length == 0 ) )
{
- return oc1.getNames()[0].compareToIgnoreCase( "" ); //$NON-NLS-1$
+ return oc1Names[0].compareToIgnoreCase( "" ); //$NON-NLS-1$
}
else
{
- return oc1.getNames()[0].compareToIgnoreCase( oc2.getNames()[0] );
+ return oc1Names[0].compareToIgnoreCase( oc2Names[0] );
}
}
} );
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboComparator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboComparator.java?view=diff&rev=559434&r1=559433&r2=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboComparator.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboComparator.java Wed Jul 25 05:51:19 2007
@@ -41,22 +41,43 @@
{
if ( o1 instanceof MatchingRuleImpl && o2 instanceof MatchingRuleImpl )
{
- return ( ( MatchingRuleImpl ) o1 ).getName().compareToIgnoreCase( ( ( MatchingRuleImpl ) o2 ).getName() );
+ String[] mr1Names = ( ( MatchingRuleImpl ) o1 ).getNames();
+ String[] mr2Names = ( ( MatchingRuleImpl ) o2 ).getNames();
+
+ if ( ( mr1Names != null ) && ( mr2Names != null ) && ( mr1Names.length > 0 ) && ( mr2Names.length > 0 ) )
+ {
+ return mr1Names[0].compareToIgnoreCase( mr1Names[0] );
+ }
}
else if ( o1 instanceof MatchingRuleImpl && o2 instanceof NonExistingMatchingRule )
{
- return ( ( MatchingRuleImpl ) o1 ).getName().compareToIgnoreCase(
- ( ( NonExistingMatchingRule ) o2 ).getName() );
+ String[] mr1Names = ( ( MatchingRuleImpl ) o1 ).getNames();
+ String mr2Name = ( ( NonExistingMatchingRule ) o2 ).getName();
+
+ if ( ( mr1Names != null ) && ( mr2Name != null ) && ( mr1Names.length > 0 ) )
+ {
+ return mr1Names[0].compareToIgnoreCase( mr2Name );
+ }
}
else if ( o1 instanceof NonExistingMatchingRule && o2 instanceof MatchingRuleImpl )
{
- return ( ( NonExistingMatchingRule ) o1 ).getName().compareToIgnoreCase(
- ( ( MatchingRuleImpl ) o2 ).getName() );
+ String mr1Name = ( ( NonExistingMatchingRule ) o1 ).getName();
+ String[] mr2Names = ( ( MatchingRuleImpl ) o2 ).getNames();
+
+ if ( ( mr1Name != null ) && ( mr2Names != null ) && ( mr2Names.length > 0 ) )
+ {
+ return mr1Name.compareToIgnoreCase( mr2Names[0] );
+ }
}
else if ( o1 instanceof NonExistingMatchingRule && o2 instanceof NonExistingMatchingRule )
{
- return ( ( NonExistingMatchingRule ) o1 ).getName().compareToIgnoreCase(
- ( ( NonExistingMatchingRule ) o2 ).getName() );
+ String mr1Name = ( ( NonExistingMatchingRule ) o1 ).getName();
+ String mr2Name = ( ( NonExistingMatchingRule ) o2 ).getName();
+
+ if ( ( mr1Name != null ) && ( mr2Name != null ) )
+ {
+ return mr1Name.compareToIgnoreCase( mr2Name );
+ }
}
return 0;
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboLabelProvider.java?view=diff&rev=559434&r1=559433&r2=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboLabelProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboLabelProvider.java Wed Jul 25 05:51:19 2007
@@ -40,7 +40,17 @@
{
if ( obj instanceof MatchingRuleImpl )
{
- return ( ( MatchingRuleImpl ) obj ).getName();
+ MatchingRuleImpl mr = ( MatchingRuleImpl ) obj;
+
+ String name = mr.getName();
+ if ( name != null )
+ {
+ return name + " - (" + mr.getOid() + ")";
+ }
+ else
+ {
+ return "(None) - (" + mr.getOid() + ")";
+ }
}
else if ( obj instanceof NonExistingMatchingRule )
{
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboComparator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboComparator.java?view=auto&rev=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboComparator.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboComparator.java Wed Jul 25 05:51:19 2007
@@ -0,0 +1,85 @@
+/*
+ * 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.apacheds.schemaeditor.view.editors.attributetype;
+
+
+import java.util.Comparator;
+
+import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.view.editors.NonExistingAttributeType;
+
+
+/**
+ * This class implements the Comparator used to compare elements in the Matching Rules Content Providers.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ATESuperiorComboComparator implements Comparator<Object>
+{
+ /* (non-Javadoc)
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ public int compare( Object o1, Object o2 )
+ {
+ if ( o1 instanceof AttributeTypeImpl && o2 instanceof AttributeTypeImpl )
+ {
+ String[] at1Names = ( ( AttributeTypeImpl ) o1 ).getNames();
+ String[] at2Names = ( ( AttributeTypeImpl ) o2 ).getNames();
+
+ if ( ( at1Names != null ) && ( at2Names != null ) && ( at1Names.length > 0 ) && ( at2Names.length > 0 ) )
+ {
+ return at1Names[0].compareToIgnoreCase( at2Names[0] );
+ }
+ }
+ else if ( o1 instanceof AttributeTypeImpl && o2 instanceof NonExistingAttributeType )
+ {
+ String[] at1Names = ( ( AttributeTypeImpl ) o1 ).getNames();
+ String at2Name = ( ( NonExistingAttributeType ) o2 ).getName();
+
+ if ( ( at1Names != null ) && ( at2Name != null ) && ( at1Names.length > 0 ) )
+ {
+ return at1Names[0].compareToIgnoreCase( at2Name );
+ }
+ }
+ else if ( o1 instanceof NonExistingAttributeType && o2 instanceof AttributeTypeImpl )
+ {
+ String at1Name = ( ( NonExistingAttributeType ) o1 ).getName();
+ String[] at2Names = ( ( AttributeTypeImpl ) o2 ).getNames();
+
+ if ( ( at1Name != null ) && ( at2Names != null ) && ( at2Names.length > 0 ) )
+ {
+ return at1Name.compareToIgnoreCase( at2Names[0] );
+ }
+ }
+ else if ( o1 instanceof NonExistingAttributeType && o2 instanceof NonExistingAttributeType )
+ {
+ String at1Name = ( ( NonExistingAttributeType ) o1 ).getName();
+ String at2Name = ( ( NonExistingAttributeType ) o2 ).getName();
+
+ if ( ( at1Name != null ) && ( at2Name != null ) )
+ {
+ return at1Name.compareToIgnoreCase( at2Name );
+ }
+ }
+
+ return 0;
+ }
+}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboContentProvider.java?view=diff&rev=559434&r1=559433&r2=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboContentProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboContentProvider.java Wed Jul 25 05:51:19 2007
@@ -21,7 +21,6 @@
import java.util.Collections;
-import java.util.Comparator;
import java.util.List;
import org.apache.directory.studio.apacheds.schemaeditor.Activator;
@@ -84,34 +83,7 @@
List<Object> children = input.getChildren();
// Sorting Children
- Collections.sort( children, new Comparator<Object>()
- {
- public int compare( Object o1, Object o2 )
- {
- if ( o1 instanceof AttributeTypeImpl && o2 instanceof AttributeTypeImpl )
- {
- return ( ( AttributeTypeImpl ) o1 ).getNames()[0]
- .compareToIgnoreCase( ( ( AttributeTypeImpl ) o2 ).getNames()[0] );
- }
- else if ( o1 instanceof AttributeTypeImpl && o2 instanceof NonExistingAttributeType )
- {
- return ( ( AttributeTypeImpl ) o1 ).getNames()[0]
- .compareToIgnoreCase( ( ( NonExistingAttributeType ) o2 ).getName() );
- }
- else if ( o1 instanceof NonExistingAttributeType && o2 instanceof AttributeTypeImpl )
- {
- return ( ( NonExistingAttributeType ) o1 ).getName().compareToIgnoreCase(
- ( ( AttributeTypeImpl ) o2 ).getNames()[0] );
- }
- else if ( o1 instanceof NonExistingAttributeType && o2 instanceof NonExistingAttributeType )
- {
- return ( ( NonExistingAttributeType ) o1 ).getName().compareToIgnoreCase(
- ( ( NonExistingAttributeType ) o2 ).getName() );
- }
-
- return 0;
- }
- } );
+ Collections.sort( children, new ATESuperiorComboComparator() );
return children.toArray();
}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboLabelProvider.java?view=diff&rev=559434&r1=559433&r2=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboLabelProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboLabelProvider.java Wed Jul 25 05:51:19 2007
@@ -41,7 +41,18 @@
{
if ( obj instanceof AttributeTypeImpl )
{
- return ViewUtils.concateAliases( ( ( AttributeTypeImpl ) obj ).getNames() );
+ AttributeTypeImpl at = ( AttributeTypeImpl ) obj;
+
+ String[] names = at.getNames();
+ if ( ( names != null ) && ( names.length > 0 ) )
+ {
+ return ViewUtils.concateAliases( ( ( AttributeTypeImpl ) obj ).getNames() ) + " - (" + at.getOid()
+ + ")";
+ }
+ else
+ {
+ return "(None) - (" + at.getOid() + ")";
+ }
}
else if ( obj instanceof NonExistingAttributeType )
{
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESyntaxComboComparator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESyntaxComboComparator.java?view=auto&rev=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESyntaxComboComparator.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESyntaxComboComparator.java Wed Jul 25 05:51:19 2007
@@ -0,0 +1,86 @@
+/*
+ * 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.apacheds.schemaeditor.view.editors.attributetype;
+
+
+import java.util.Comparator;
+
+import org.apache.directory.studio.apacheds.schemaeditor.model.SyntaxImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.view.editors.NonExistingSyntax;
+
+
+/**
+ * This class implements the Comparator used to compare elements in the Matching Rules Content Providers.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ATESyntaxComboComparator implements Comparator<Object>
+{
+ /* (non-Javadoc)
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ public int compare( Object o1, Object o2 )
+ {
+ if ( o1 instanceof SyntaxImpl && o2 instanceof SyntaxImpl )
+ {
+ String[] syntax1Names = ( ( SyntaxImpl ) o1 ).getNames();
+ String[] syntax2Names = ( ( SyntaxImpl ) o2 ).getNames();
+
+ if ( ( syntax1Names != null ) && ( syntax2Names != null ) && ( syntax1Names.length > 0 )
+ && ( syntax2Names.length > 0 ) )
+ {
+ return syntax1Names[0].compareToIgnoreCase( syntax2Names[0] );
+ }
+ }
+ else if ( o1 instanceof SyntaxImpl && o2 instanceof NonExistingSyntax )
+ {
+ String[] syntax1Names = ( ( SyntaxImpl ) o1 ).getNames();
+ String syntax2Name = ( ( NonExistingSyntax ) o2 ).getName();
+
+ if ( ( syntax1Names != null ) && ( syntax2Name != null ) && ( syntax1Names.length > 0 ) )
+ {
+ return syntax1Names[0].compareToIgnoreCase( syntax2Name );
+ }
+ }
+ else if ( o1 instanceof NonExistingSyntax && o2 instanceof SyntaxImpl )
+ {
+ String syntax1Name = ( ( NonExistingSyntax ) o1 ).getName();
+ String[] syntax2Names = ( ( SyntaxImpl ) o2 ).getNames();
+
+ if ( ( syntax1Name != null ) && ( syntax2Names != null ) && ( syntax2Names.length > 0 ) )
+ {
+ return syntax1Name.compareToIgnoreCase( syntax2Names[0] );
+ }
+ }
+ else if ( o1 instanceof NonExistingSyntax && o2 instanceof NonExistingSyntax )
+ {
+ String syntax1Name = ( ( NonExistingSyntax ) o1 ).getName();
+ String syntax2Name = ( ( NonExistingSyntax ) o2 ).getName();
+
+ if ( ( syntax1Name != null ) && ( syntax2Name != null ) )
+ {
+ return syntax1Name.compareToIgnoreCase( syntax2Name );
+ }
+ }
+
+ return 0;
+ }
+}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESyntaxComboContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESyntaxComboContentProvider.java?view=diff&rev=559434&r1=559433&r2=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESyntaxComboContentProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESyntaxComboContentProvider.java Wed Jul 25 05:51:19 2007
@@ -21,7 +21,6 @@
import java.util.Collections;
-import java.util.Comparator;
import java.util.List;
import org.apache.directory.studio.apacheds.schemaeditor.Activator;
@@ -65,33 +64,7 @@
List<Object> children = input.getChildren();
// Sorting Children
- Collections.sort( children, new Comparator<Object>()
- {
- public int compare( Object o1, Object o2 )
- {
- if ( o1 instanceof SyntaxImpl && o2 instanceof SyntaxImpl )
- {
- return ( ( SyntaxImpl ) o1 ).getName().compareToIgnoreCase( ( ( SyntaxImpl ) o2 ).getName() );
- }
- else if ( o1 instanceof SyntaxImpl && o2 instanceof NonExistingSyntax )
- {
- return ( ( SyntaxImpl ) o1 ).getName().compareToIgnoreCase(
- ( ( NonExistingSyntax ) o2 ).getName() );
- }
- else if ( o1 instanceof NonExistingSyntax && o2 instanceof SyntaxImpl )
- {
- return ( ( NonExistingSyntax ) o1 ).getName().compareToIgnoreCase(
- ( ( SyntaxImpl ) o2 ).getName() );
- }
- else if ( o1 instanceof NonExistingSyntax && o2 instanceof NonExistingSyntax )
- {
- return ( ( NonExistingSyntax ) o1 ).getName().compareToIgnoreCase(
- ( ( NonExistingSyntax ) o2 ).getName() );
- }
-
- return 0;
- }
- } );
+ Collections.sort( children, new ATESyntaxComboComparator() );
return children.toArray();
}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESyntaxComboLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESyntaxComboLabelProvider.java?view=diff&rev=559434&r1=559433&r2=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESyntaxComboLabelProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESyntaxComboLabelProvider.java Wed Jul 25 05:51:19 2007
@@ -42,7 +42,15 @@
{
SyntaxImpl syntax = ( SyntaxImpl ) obj;
- return syntax.getName() + " - (" + syntax.getOid() + ")";
+ String name = syntax.getName();
+ if ( name != null )
+ {
+ return name + " - (" + syntax.getOid() + ")";
+ }
+ else
+ {
+ return "(None) - (" + syntax.getOid() + ")";
+ }
}
else if ( obj instanceof NonExistingSyntax )
{
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEUsedByMandatoryTableContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEUsedByMandatoryTableContentProvider.java?view=diff&rev=559434&r1=559433&r2=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEUsedByMandatoryTableContentProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEUsedByMandatoryTableContentProvider.java Wed Jul 25 05:51:19 2007
@@ -86,8 +86,14 @@
{
if ( oc1 instanceof ObjectClassImpl && oc1 instanceof ObjectClassImpl )
{
- return ( ( ObjectClassImpl ) oc1 ).getNames()[0]
- .compareToIgnoreCase( ( ( ObjectClassImpl ) oc2 ).getNames()[0] );
+ String[] oc1Names = ( ( ObjectClassImpl ) oc1 ).getNames();
+ String[] oc2Names = ( ( ObjectClassImpl ) oc2 ).getNames();
+
+ if ( ( oc1Names != null ) && ( oc2Names != null ) && ( oc1Names.length > 0 )
+ && ( oc2Names.length > 0 ) )
+ {
+ return oc1Names[0].compareToIgnoreCase( oc2Names[0] );
+ }
}
return 0;
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEUsedByOptionalTableContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEUsedByOptionalTableContentProvider.java?view=diff&rev=559434&r1=559433&r2=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEUsedByOptionalTableContentProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEUsedByOptionalTableContentProvider.java Wed Jul 25 05:51:19 2007
@@ -86,8 +86,14 @@
{
if ( oc1 instanceof ObjectClassImpl && oc1 instanceof ObjectClassImpl )
{
- return ( ( ObjectClassImpl ) oc1 ).getNames()[0]
- .compareToIgnoreCase( ( ( ObjectClassImpl ) oc2 ).getNames()[0] );
+ String[] oc1Names = ( ( ObjectClassImpl ) oc1 ).getNames();
+ String[] oc2Names = ( ( ObjectClassImpl ) oc2 ).getNames();
+
+ if ( ( oc1Names != null ) && ( oc2Names != null ) && ( oc1Names.length > 0 )
+ && ( oc2Names.length > 0 ) )
+ {
+ return oc1Names[0].compareToIgnoreCase( oc2Names[0] );
+ }
}
return 0;
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditor.java?view=diff&rev=559434&r1=559433&r2=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditor.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditor.java Wed Jul 25 05:51:19 2007
@@ -79,7 +79,7 @@
{
if ( !sourceCode.canLeaveThePage() )
{
- notifyError( "AttributeTypeEditor.Souce_Code_Error_cannot_return_to_Overview_page" );
+ notifyError( "AttributeTypeEditor.Souce_Code_Error_cannot_return_to_Overview_page" ); //TODO
return;
}
@@ -106,7 +106,6 @@
setPartName( input.getName() );
originalAttributeType = ( ( AttributeTypeEditorInput ) getEditorInput() ).getAttributeType();
- // originalAttributeType.setEditor( this );
modifiedAttributeType = ( AttributeTypeImpl ) PluginUtils.getClone( originalAttributeType );
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditorInput.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditorInput.java?view=diff&rev=559434&r1=559433&r2=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditorInput.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditorInput.java Wed Jul 25 05:51:19 2007
@@ -73,9 +73,10 @@
*/
public String getName()
{
- if ( attributeType.getNames().length != 0 )
+ String[] names = attributeType.getNames();
+ if ( ( names != null ) && ( names.length > 0 ) )
{
- return attributeType.getNames()[0];
+ return names[0];
}
else
{
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditorUsedByPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditorUsedByPage.java?view=diff&rev=559434&r1=559433&r2=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditorUsedByPage.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditorUsedByPage.java Wed Jul 25 05:51:19 2007
@@ -28,6 +28,7 @@
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.model.Schema;
+import org.apache.directory.studio.apacheds.schemaeditor.view.ViewUtils;
import org.apache.directory.studio.apacheds.schemaeditor.view.editors.objectclass.ObjectClassEditor;
import org.apache.directory.studio.apacheds.schemaeditor.view.editors.objectclass.ObjectClassEditorInput;
import org.apache.log4j.Logger;
@@ -258,8 +259,17 @@
// As Mandatory Attribute Section
Section mandatoryAttributeSection = toolkit.createSection( parent, Section.DESCRIPTION | Section.EXPANDED
| Section.TITLE_BAR );
- mandatoryAttributeSection.setDescription( "The attribute type" + " '" + modifiedAttributeType.getNames()[0]
- + "' " + "is used as a mandatory attribute in the following object classes." );
+ String names[] = modifiedAttributeType.getNames();
+ if ( ( names != null ) && ( names.length > 0 ) )
+ {
+ mandatoryAttributeSection.setDescription( "The attribute type" + " '" + ViewUtils.concateAliases( names )
+ + "' " + "is used as a mandatory attribute in the following object classes." );
+ }
+ else
+ {
+ mandatoryAttributeSection.setDescription( "The attribute type" + " '" + modifiedAttributeType.getOid()
+ + "' " + "is used as a mandatory attribute in the following object classes." );
+ }
mandatoryAttributeSection.setText( "As Mandatory Attribute" );
// Creating the layout of the section
@@ -292,8 +302,17 @@
// Matching Rules Section
Section optionalAttributeSection = toolkit.createSection( parent, Section.DESCRIPTION | Section.EXPANDED
| Section.TITLE_BAR );
- optionalAttributeSection.setDescription( "The attribute type" + " '" + modifiedAttributeType.getNames()[0]
- + "' " + "is used as an optional attribute in the following object classes." );
+ String names[] = modifiedAttributeType.getNames();
+ if ( ( names != null ) && ( names.length > 0 ) )
+ {
+ optionalAttributeSection.setDescription( "The attribute type" + " '" + ViewUtils.concateAliases( names )
+ + "' " + "is used as an optional attribute in the following object classes." );
+ }
+ else
+ {
+ optionalAttributeSection.setDescription( "The attribute type" + " '" + modifiedAttributeType.getOid()
+ + "' " + "is used as an optional attribute in the following object classes." );
+ }
optionalAttributeSection.setText( "As Optional Attribute" );
// Creating the layout of the section
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorAttributesTableContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorAttributesTableContentProvider.java?view=diff&rev=559434&r1=559433&r2=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorAttributesTableContentProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorAttributesTableContentProvider.java Wed Jul 25 05:51:19 2007
@@ -84,23 +84,44 @@
{
if ( o1 instanceof AttributeTypeImpl && o2 instanceof AttributeTypeImpl )
{
- return ( ( AttributeTypeImpl ) o1 ).getNames()[0]
- .compareToIgnoreCase( ( ( AttributeTypeImpl ) o2 ).getNames()[0] );
+ String[] at1Names = ( ( AttributeTypeImpl ) o1 ).getNames();
+ String[] at2Names = ( ( AttributeTypeImpl ) o2 ).getNames();
+
+ if ( ( at1Names != null ) && ( at2Names != null ) && ( at1Names.length > 0 )
+ && ( at2Names.length > 0 ) )
+ {
+ return at1Names[0].compareToIgnoreCase( at2Names[0] );
+ }
}
else if ( o1 instanceof AttributeTypeImpl && o2 instanceof NonExistingAttributeType )
{
- return ( ( AttributeTypeImpl ) o1 ).getNames()[0]
- .compareToIgnoreCase( ( ( NonExistingAttributeType ) o2 ).getName() );
+ String[] at1Names = ( ( AttributeTypeImpl ) o1 ).getNames();
+ String at2Name = ( ( NonExistingAttributeType ) o2 ).getName();
+
+ if ( ( at1Names != null ) && ( at2Name != null ) && ( at1Names.length > 0 ) )
+ {
+ return at1Names[0].compareToIgnoreCase( at2Name );
+ }
}
else if ( o1 instanceof NonExistingAttributeType && o2 instanceof AttributeTypeImpl )
{
- return ( ( NonExistingAttributeType ) o1 ).getName().compareToIgnoreCase(
- ( ( AttributeTypeImpl ) o2 ).getNames()[0] );
+ String at1Name = ( ( NonExistingAttributeType ) o1 ).getName();
+ String[] at2Names = ( ( AttributeTypeImpl ) o2 ).getNames();
+
+ if ( ( at1Name != null ) && ( at2Names != null ) && ( at2Names.length > 0 ) )
+ {
+ return at1Name.compareToIgnoreCase( at2Names[0] );
+ }
}
else if ( o1 instanceof NonExistingAttributeType && o2 instanceof NonExistingAttributeType )
{
- return ( ( NonExistingAttributeType ) o1 ).getName().compareToIgnoreCase(
- ( ( NonExistingAttributeType ) o2 ).getName() );
+ String at1Name = ( ( NonExistingAttributeType ) o1 ).getName();
+ String at2Name = ( ( NonExistingAttributeType ) o2 ).getName();
+
+ if ( ( at1Name != null ) && ( at2Name != null ) )
+ {
+ return at1Name.compareToIgnoreCase( at2Name );
+ }
}
return 0;
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorInput.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorInput.java?view=diff&rev=559434&r1=559433&r2=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorInput.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorInput.java Wed Jul 25 05:51:19 2007
@@ -71,9 +71,10 @@
*/
public String getName()
{
- if ( objectClass.getNames().length != 0 )
+ String[] names = objectClass.getNames();
+ if ( ( names != null ) && ( names.length > 0 ) )
{
- return objectClass.getNames()[0];
+ return names[0];
}
else
{
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorSuperiorsTableContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorSuperiorsTableContentProvider.java?view=diff&rev=559434&r1=559433&r2=559434
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorSuperiorsTableContentProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorSuperiorsTableContentProvider.java Wed Jul 25 05:51:19 2007
@@ -88,23 +88,44 @@
{
if ( o1 instanceof ObjectClassImpl && o2 instanceof ObjectClassImpl )
{
- return ( ( ObjectClassImpl ) o1 ).getNames()[0].compareToIgnoreCase( ( ( ObjectClassImpl ) o2 )
- .getNames()[0] );
+ String[] oc1Names = ( ( ObjectClassImpl ) o1 ).getNames();
+ String[] oc2Names = ( ( ObjectClassImpl ) o2 ).getNames();
+
+ if ( ( oc1Names != null ) && ( oc2Names != null ) && ( oc1Names.length > 0 )
+ && ( oc2Names.length > 0 ) )
+ {
+ return oc1Names[0].compareToIgnoreCase( oc2Names[0] );
+ }
}
else if ( o1 instanceof ObjectClassImpl && o2 instanceof NonExistingObjectClass )
{
- return ( ( ObjectClassImpl ) o1 ).getNames()[0]
- .compareToIgnoreCase( ( ( NonExistingObjectClass ) o2 ).getName() );
+ String[] oc1Names = ( ( ObjectClassImpl ) o1 ).getNames();
+ String oc2Name = ( ( NonExistingObjectClass ) o2 ).getName();
+
+ if ( ( oc1Names != null ) && ( oc2Name != null ) && ( oc1Names.length > 0 ) )
+ {
+ return oc1Names[0].compareToIgnoreCase( oc2Name );
+ }
}
else if ( o1 instanceof NonExistingObjectClass && o2 instanceof ObjectClassImpl )
{
- return ( ( NonExistingObjectClass ) o1 ).getName().compareToIgnoreCase(
- ( ( ObjectClassImpl ) o2 ).getNames()[0] );
+ String oc1Name = ( ( NonExistingObjectClass ) o1 ).getName();
+ String[] oc2Names = ( ( ObjectClassImpl ) o2 ).getNames();
+
+ if ( ( oc1Name != null ) && ( oc2Names != null ) && ( oc2Names.length > 0 ) )
+ {
+ return oc1Name.compareToIgnoreCase( oc2Names[0] );
+ }
}
else if ( o1 instanceof NonExistingObjectClass && o2 instanceof NonExistingObjectClass )
{
- return ( ( NonExistingObjectClass ) o1 ).getName().compareToIgnoreCase(
- ( ( NonExistingObjectClass ) o2 ).getName() );
+ String oc1Name = ( ( NonExistingObjectClass ) o1 ).getName();
+ String oc2Name = ( ( NonExistingObjectClass ) o2 ).getName();
+
+ if ( ( oc1Name != null ) && ( oc2Name != null ) )
+ {
+ return oc1Name.compareToIgnoreCase( oc2Name );
+ }
}
return 0;