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/03/23 15:12:35 UTC
svn commit: r521733 - in
/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main:
java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/
resources/org/apache/directory/ldapstudio/schemas/
Author: pamarcelot
Date: Fri Mar 23 07:12:34 2007
New Revision: 521733
URL: http://svn.apache.org/viewvc?view=rev&rev=521733
Log:
Improved 'Superior selection' in the Attribute Type Editor.
Added:
directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorSuperiorComboContentProvider.java
directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorSuperiorComboInput.java
directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorSuperiorComboLabelProvider.java
directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/NonExistingAttributeType.java
Modified:
directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorOverviewPage.java
directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorUsedByPage.java
directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/messages.properties
Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorOverviewPage.java?view=diff&rev=521733&r1=521732&r2=521733
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorOverviewPage.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorOverviewPage.java Fri Mar 23 07:12:34 2007
@@ -22,15 +22,13 @@
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
import org.apache.directory.ldapstudio.schemas.Messages;
import org.apache.directory.ldapstudio.schemas.model.AttributeType;
+import org.apache.directory.ldapstudio.schemas.model.LDAPModelEvent;
import org.apache.directory.ldapstudio.schemas.model.MatchingRule;
import org.apache.directory.ldapstudio.schemas.model.MatchingRules;
+import org.apache.directory.ldapstudio.schemas.model.PoolListener;
import org.apache.directory.ldapstudio.schemas.model.Schema;
import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
import org.apache.directory.ldapstudio.schemas.model.Syntax;
@@ -42,6 +40,8 @@
import org.apache.directory.shared.asn1.primitives.OID;
import org.apache.directory.shared.ldap.schema.UsageEnum;
import org.apache.log4j.Logger;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
@@ -74,7 +74,7 @@
/**
* This class is the Overview Page of the Attribute Type Editor
*/
-public class AttributeTypeEditorOverviewPage extends FormPage
+public class AttributeTypeEditorOverviewPage extends FormPage implements PoolListener
{
/** The page ID*/
public static final String ID = AttributeTypeEditor.ID + "overviewPage";
@@ -217,17 +217,16 @@
{
public void linkActivated( HyperlinkEvent e )
{
- if ( !supCombo.getItem( supCombo.getSelectionIndex() ).equals(
- Messages.getString( "AttributeTypeFormEditorOverviewPage.(None)" ) ) ) { //$NON-NLS-1$
- SchemaPool pool = SchemaPool.getInstance();
+ Object selectedItem = ( ( StructuredSelection ) supComboViewer.getSelection() ).getFirstElement();
+
+ if ( selectedItem instanceof AttributeType )
+ {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- AttributeTypeEditorInput input = new AttributeTypeEditorInput( pool.getAttributeType( supCombo
- .getItem( supCombo.getSelectionIndex() ) ) );
- String editorId = AttributeTypeEditor.ID;
+ AttributeTypeEditorInput input = new AttributeTypeEditorInput( ( AttributeType ) selectedItem );
try
{
- page.openEditor( input, editorId );
+ page.openEditor( input, AttributeTypeEditor.ID );
}
catch ( PartInitException exception )
{
@@ -242,13 +241,24 @@
{
public void modifyText( ModifyEvent e )
{
- if ( supCombo.getItem( supCombo.getSelectionIndex() ).equals(
- Messages.getString( "AttributeTypeFormEditorOverviewPage.(None)" ) ) ) { //$NON-NLS-1$
- modifiedAttributeType.setSuperior( "" ); //$NON-NLS-1$
+ Object selectedItem = ( ( StructuredSelection ) supComboViewer.getSelection() ).getFirstElement();
+
+ if ( selectedItem instanceof AttributeType )
+ {
+ modifiedAttributeType.setSuperior( ( ( AttributeType ) selectedItem ).getNames()[0] );
}
- else
+ else if ( selectedItem instanceof NonExistingAttributeType )
{
- modifiedAttributeType.setSuperior( supCombo.getItem( supCombo.getSelectionIndex() ) );
+ NonExistingAttributeType neat = ( NonExistingAttributeType ) selectedItem;
+
+ if ( NonExistingAttributeType.NONE.equals( neat.getName() ) )
+ {
+ modifiedAttributeType.setSuperior( null );
+ }
+ else
+ {
+ modifiedAttributeType.setSuperior( ( ( NonExistingAttributeType ) selectedItem ).getName() );
+ }
}
setEditorDirty();
}
@@ -405,6 +415,8 @@
}
};
+ private ComboViewer supComboViewer;
+
/**
* Default constructor.
@@ -415,6 +427,7 @@
public AttributeTypeEditorOverviewPage( FormEditor editor )
{
super( editor, ID, TITLE );
+ SchemaPool.getInstance().addListener( this );
}
@@ -512,7 +525,10 @@
.getString( "AttributeTypeFormEditorOverviewPage.Superior_type" ), SWT.WRAP ); //$NON-NLS-1$
supCombo = new Combo( client_general_information, SWT.READ_ONLY | SWT.SINGLE );
supCombo.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
- initSupCombo();
+ supComboViewer = new ComboViewer( supCombo );
+ supComboViewer.setContentProvider( new AttributeTypeEditorSuperiorComboContentProvider() );
+ supComboViewer.setLabelProvider( new AttributeTypeEditorSuperiorComboLabelProvider() );
+ supComboViewer.setInput( new AttributeTypeEditorSuperiorComboInput( originalAttributeType ) );
// USAGE Combo
toolkit.createLabel( client_general_information, Messages
@@ -607,37 +623,6 @@
}
- private void initSupCombo()
- {
- SchemaPool pool = SchemaPool.getInstance();
- List<AttributeType> atList = pool.getAttributeTypes();
-
- // Remove duplicate entries
- HashSet<AttributeType> set = new HashSet<AttributeType>( atList );
- atList = new ArrayList<AttributeType>( set );
-
- // Sorting the list
- Collections.sort( atList, new Comparator<AttributeType>()
- {
- public int compare( AttributeType arg0, AttributeType arg1 )
- {
- String oneName = arg0.getNames()[0];
- String twoName = arg1.getNames()[0];
- return oneName.compareTo( twoName );
- }
- } );
-
- // Creating the UI
- supCombo.add( Messages.getString( "AttributeTypeFormEditorOverviewPage.(None)" ) ); //$NON-NLS-1$
- supCombo.select( 0 );
- for ( AttributeType at : atList )
- {
- // TODO Add a verification, so we can't add as superior the attribute type itself
- supCombo.add( at.getNames()[0] );
- }
- }
-
-
private void initUsageCombo()
{
usageCombo.add( "directoryOperation", 0 ); //$NON-NLS-1$
@@ -726,14 +711,7 @@
}
// SUP Combo
- if ( modifiedAttributeType.getSuperior() == null )
- {
- fillSupCombo( Messages.getString( "ObjectClassFormEditorOverviewPage.(None)" ) );
- }
- else
- {
- fillSupCombo( modifiedAttributeType.getSuperior() );
- }
+ fillSupCombo();
// USAGE Combo
fillInUsageCombo();
@@ -804,15 +782,35 @@
* @param name
* the name to select
*/
- private void fillSupCombo( String name )
+ private void fillSupCombo()
{
- supCombo.select( 0 );
- for ( int i = 0; i < supCombo.getItemCount(); i++ )
+ if ( modifiedAttributeType.getSuperior() == null )
{
- if ( name.equals( supCombo.getItem( i ) ) )
+ supComboViewer.setSelection( new StructuredSelection( new NonExistingAttributeType(
+ NonExistingAttributeType.NONE ) ), true );
+ }
+ else
+ {
+ String supAtName = modifiedAttributeType.getSuperior();
+
+ SchemaPool schemaPool = SchemaPool.getInstance();
+
+ AttributeType supAT = schemaPool.getAttributeType( supAtName );
+ if ( supAT != null )
{
- supCombo.select( i );
- return;
+ supComboViewer.setSelection( new StructuredSelection( supAT ), true );
+ }
+ else
+ {
+ AttributeTypeEditorSuperiorComboInput input = ( AttributeTypeEditorSuperiorComboInput ) supComboViewer
+ .getInput();
+ NonExistingAttributeType neat = new NonExistingAttributeType( supAtName );
+ if ( !input.getChildren().contains( neat ) )
+ {
+ input.addChild( neat );
+ }
+ supComboViewer.refresh();
+ supComboViewer.setSelection( new StructuredSelection( neat ), true );
}
}
}
@@ -1026,6 +1024,18 @@
{
removeListeners();
fillInUiFields();
+ addListeners();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.ldapstudio.schemas.model.PoolListener#poolChanged(org.apache.directory.ldapstudio.schemas.model.SchemaPool, org.apache.directory.ldapstudio.schemas.model.LDAPModelEvent)
+ */
+ public void poolChanged( SchemaPool p, LDAPModelEvent e )
+ {
+ removeListeners();
+ supComboViewer.setInput( new AttributeTypeEditorSuperiorComboInput( originalAttributeType ) );
+ fillSupCombo();
addListeners();
}
}
Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorSuperiorComboContentProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorSuperiorComboContentProvider.java?view=auto&rev=521733
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorSuperiorComboContentProvider.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorSuperiorComboContentProvider.java Fri Mar 23 07:12:34 2007
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.ldapstudio.schemas.view.editors.attributeType;
+
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.directory.ldapstudio.schemas.Messages;
+import org.apache.directory.ldapstudio.schemas.model.AttributeType;
+import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * This class implements the Content Provider for the Superior Combo of the Attribute Type Editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AttributeTypeEditorSuperiorComboContentProvider implements IStructuredContentProvider
+{
+ /** The Schema Pool */
+ private SchemaPool schemaPool;
+
+
+ /**
+ * Creates a new instance of AttributeTypeEditorSuperiorComboContentProvider.
+ */
+ public AttributeTypeEditorSuperiorComboContentProvider()
+ {
+ schemaPool = SchemaPool.getInstance();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ public Object[] getElements( Object inputElement )
+ {
+ if ( inputElement instanceof AttributeTypeEditorSuperiorComboInput )
+ {
+ AttributeTypeEditorSuperiorComboInput input = ( AttributeTypeEditorSuperiorComboInput ) inputElement;
+
+ if ( input.getChildren().isEmpty() )
+ {
+ AttributeType editorAT = input.getAttributeType();
+
+ // Creating the '(None)' item
+ input.addChild( new NonExistingAttributeType( Messages
+ .getString( "AttributeTypeFormEditorOverviewPage.(None)" ) ) );
+
+ // Creating Children
+ List<AttributeType> ats = schemaPool.getAttributeTypes();
+ for ( AttributeType at : ats )
+ {
+ if ( !isSubType( at, editorAT ) )
+ {
+ input.addChild( at );
+ }
+ }
+ }
+
+ // Getting Children
+ List<Object> children = input.getChildren();
+
+ // Sorting Children
+ Collections.sort( children, new Comparator<Object>()
+ {
+ public int compare( Object o1, Object o2 )
+ {
+ if ( o1 instanceof AttributeType && o2 instanceof AttributeType )
+ {
+ return ( ( AttributeType ) o1 ).getNames()[0].compareToIgnoreCase( ( ( AttributeType ) o2 )
+ .getNames()[0] );
+ }
+ else if ( o1 instanceof AttributeType && o2 instanceof NonExistingAttributeType )
+ {
+ return ( ( AttributeType ) o1 ).getNames()[0]
+ .compareToIgnoreCase( ( ( NonExistingAttributeType ) o2 ).getName() );
+ }
+ else if ( o1 instanceof NonExistingAttributeType && o2 instanceof AttributeType )
+ {
+ return ( ( NonExistingAttributeType ) o1 ).getName().compareToIgnoreCase(
+ ( ( AttributeType ) o2 ).getNames()[0] );
+ }
+ else if ( o1 instanceof NonExistingAttributeType && o2 instanceof NonExistingAttributeType )
+ {
+ return ( ( NonExistingAttributeType ) o1 ).getName().compareToIgnoreCase(
+ ( ( NonExistingAttributeType ) o2 ).getName() );
+ }
+
+ return 0;
+ }
+ } );
+
+ return children.toArray();
+ }
+
+ // Default
+ return new Object[0];
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ public void dispose()
+ {
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+ {
+ }
+
+
+ /**
+ * Checks id an Attribute Type is a sub type of another Attribute Type.
+ *
+ * @param at1
+ * the first Attribute Type
+ * @param at2
+ * the second Attribute Type
+ * @return
+ * true if at1 is a sub type of at2
+ */
+ private boolean isSubType( AttributeType at1, AttributeType at2 )
+ {
+ if ( at1.equals( at2 ) )
+ {
+ return true;
+ }
+ else
+ {
+ String sup = at1.getSuperior();
+
+ if ( sup == null )
+ {
+ return false;
+ }
+ else
+ {
+ AttributeType supAT = schemaPool.getAttributeType( sup );
+ if ( supAT == null )
+ {
+ return false;
+ }
+ else
+ {
+ return isSubType( supAT, at2 );
+ }
+ }
+ }
+ }
+}
Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorSuperiorComboInput.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorSuperiorComboInput.java?view=auto&rev=521733
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorSuperiorComboInput.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorSuperiorComboInput.java Fri Mar 23 07:12:34 2007
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.ldapstudio.schemas.view.editors.attributeType;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.ldapstudio.schemas.model.AttributeType;
+
+
+/**
+ * This class implements the Input of the Superior Combo of the Attribute Type Editor
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AttributeTypeEditorSuperiorComboInput
+{
+ /** The Attribute Type */
+ private AttributeType at;
+
+ private List<Object> children;
+
+
+ /**
+ * Creates a new instance of AttributeTypeEditorSuperiorComboInput.
+ *
+ * @param at
+ * the Attribute Type
+ */
+ public AttributeTypeEditorSuperiorComboInput( AttributeType at )
+ {
+ this.at = at;
+ }
+
+
+ /**
+ * Gets the Attribute Type.
+ *
+ * @return
+ * the attribute type
+ */
+ public AttributeType getAttributeType()
+ {
+ return at;
+ }
+
+
+ /**
+ * Adds a child.
+ *
+ * @param child
+ * the child to add
+ */
+ public void addChild( Object child )
+ {
+ if ( children == null )
+ {
+ children = new ArrayList<Object>();
+ }
+
+ children.add( child );
+ }
+
+
+ /**
+ * Gets the children.
+ *
+ * @return
+ * the children
+ */
+ public List<Object> getChildren()
+ {
+ if ( children == null )
+ {
+ children = new ArrayList<Object>();
+ }
+
+ return children;
+ }
+}
Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorSuperiorComboLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorSuperiorComboLabelProvider.java?view=auto&rev=521733
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorSuperiorComboLabelProvider.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorSuperiorComboLabelProvider.java Fri Mar 23 07:12:34 2007
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.ldapstudio.schemas.view.editors.attributeType;
+
+
+import org.apache.directory.ldapstudio.schemas.model.AttributeType;
+import org.apache.directory.ldapstudio.schemas.view.ViewUtils;
+import org.eclipse.jface.viewers.LabelProvider;
+
+
+/**
+ * This class implements the Label Provider of the Superior Combo of the Attribute Type Editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AttributeTypeEditorSuperiorComboLabelProvider extends LabelProvider
+{
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+ */
+ public String getText( Object obj )
+ {
+ if ( obj instanceof AttributeType )
+ {
+ return ViewUtils.concateAliases( ( ( AttributeType ) obj ).getNames() );
+ }
+ else if ( obj instanceof NonExistingAttributeType )
+ {
+ return ( ( NonExistingAttributeType ) obj ).getDisplayName();
+ }
+
+ // Default
+ return null;
+ }
+}
Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorUsedByPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorUsedByPage.java?view=diff&rev=521733&r1=521732&r2=521733
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorUsedByPage.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorUsedByPage.java Fri Mar 23 07:12:34 2007
@@ -103,8 +103,8 @@
{
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- ObjectClassEditorInput input = new ObjectClassEditorInput( schemaPool
- .getObjectClass( optionalAttibuteTable.getSelection()[0].getText() ) );
+ ObjectClassEditorInput input = new ObjectClassEditorInput( schemaPool.getObjectClass( optionalAttibuteTable
+ .getSelection()[0].getText() ) );
String editorId = ObjectClassEditor.ID;
try
{
Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/NonExistingAttributeType.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/NonExistingAttributeType.java?view=auto&rev=521733
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/NonExistingAttributeType.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/NonExistingAttributeType.java Fri Mar 23 07:12:34 2007
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.ldapstudio.schemas.view.editors.attributeType;
+
+
+import org.apache.directory.ldapstudio.schemas.Messages;
+
+
+/**
+ * This class implements the Non Existing Attribute Type.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NonExistingAttributeType
+{
+ public static final String NONE = Messages.getString( "ObjectClassFormEditorOverviewPage.(None)" );
+
+ /** The name */
+ private String name;
+
+
+ /**
+ * Creates a new instance of NonExistingAttributeType.
+ *
+ * @param name
+ * the name the NonExistingAttributeType
+ */
+ public NonExistingAttributeType( String name )
+ {
+ this.name = name;
+ }
+
+
+ /**
+ * Gets the name of the NonExistingAttributeType.
+ *
+ * @return
+ * the name of the NonExistingAttributeType
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+
+ /**
+ * Gets the displayable name of the NonExistingAttributeType.
+ *
+ * @return
+ * the displayable name of the NonExistingAttributeType
+ */
+ public String getDisplayName()
+ {
+ if ( name.equals( NONE ) )
+ {
+ return NONE;
+ }
+ else
+ {
+ return name + " " + Messages.getString( "NonExistingAttributeType.(This_attribute_type_doesnt_exist)" );
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals( Object obj )
+ {
+ if ( obj instanceof NonExistingAttributeType )
+ {
+ NonExistingAttributeType nnat = ( NonExistingAttributeType ) obj;
+ return name.equalsIgnoreCase( nnat.getName() );
+ }
+
+ return false;
+ }
+}
Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/messages.properties
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/messages.properties?view=diff&rev=521733&r1=521732&r2=521733
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/messages.properties (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/messages.properties Fri Mar 23 07:12:34 2007
@@ -170,6 +170,10 @@
ObjectClassFormEditorOverviewPage.Auxiliary=Auxiliary
ObjectClassFormEditorOverviewPage.Structural=Structural
+# NonExistingAttributeType - org.apache.directory.ldapstudio.schemas.view.editors
+NonExistingAttributeType.(None)=(None)
+NonExistingAttributeType.(This_attribute_type_doesnt_exist)=(This attribute type doesn't exist)
+
# SchemaFormEditor - org.apache.directory.ldapstudio.schemas.view.editors
SchemaFormEditor.Source_code=Source code