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 16:12:26 UTC
svn commit: r559471 - in
/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors:
attributetype/ schema/
Author: pamarcelot
Date: Wed Jul 25 07:12:25 2007
New Revision: 559471
URL: http://svn.apache.org/viewvc?view=rev&rev=559471
Log:
Improved the Schema Editor. Using a TableViewer instead of a simple Table
Added:
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditorTableViewerContentProvider.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditorTableViewerLabelProvider.java
Modified:
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/schema/SchemaEditorOverviewPage.java
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=559471&r1=559470&r2=559471
==============================================================================
--- 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 07:12:25 2007
@@ -46,8 +46,7 @@
String[] names = at.getNames();
if ( ( names != null ) && ( names.length > 0 ) )
{
- return ViewUtils.concateAliases( ( ( AttributeTypeImpl ) obj ).getNames() ) + " - (" + at.getOid()
- + ")";
+ return ViewUtils.concateAliases( names ) + " - (" + at.getOid() + ")";
}
else
{
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditorOverviewPage.java?view=diff&rev=559471&r1=559470&r2=559471
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditorOverviewPage.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditorOverviewPage.java Wed Jul 25 07:12:25 2007
@@ -22,28 +22,24 @@
import org.apache.directory.studio.apacheds.schemaeditor.Activator;
-import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaAdapter;
import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandler;
import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaListener;
import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
-import org.apache.directory.studio.apacheds.schemaeditor.model.MatchingRuleImpl;
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.model.SyntaxImpl;
import org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype.AttributeTypeEditor;
import org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype.AttributeTypeEditorInput;
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;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.IManagedForm;
@@ -52,7 +48,6 @@
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
@@ -75,7 +70,7 @@
/** The associated schema */
private Schema schema;
- private SchemaListener schemaListener = new SchemaListener()
+ private SchemaListener schemaListener = new SchemaAdapter()
{
/* (non-Javadoc)
* @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaListener#attributeTypeAdded(org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl)
@@ -105,33 +100,6 @@
/* (non-Javadoc)
- * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaListener#matchingRuleAdded(org.apache.directory.studio.apacheds.schemaeditor.model.MatchingRuleImpl)
- */
- public void matchingRuleAdded( MatchingRuleImpl mr )
- {
- fillInUiFields();
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaListener#matchingRuleModified(org.apache.directory.studio.apacheds.schemaeditor.model.MatchingRuleImpl)
- */
- public void matchingRuleModified( MatchingRuleImpl mr )
- {
- fillInUiFields();
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaListener#matchingRuleRemoved(org.apache.directory.studio.apacheds.schemaeditor.model.MatchingRuleImpl)
- */
- public void matchingRuleRemoved( MatchingRuleImpl mr )
- {
- fillInUiFields();
- }
-
-
- /* (non-Javadoc)
* @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaListener#objectClassAdded(org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl)
*/
public void objectClassAdded( ObjectClassImpl oc )
@@ -156,77 +124,63 @@
{
fillInUiFields();
}
-
-
- /* (non-Javadoc)
- * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaListener#syntaxAdded(org.apache.directory.studio.apacheds.schemaeditor.model.SyntaxImpl)
- */
- public void syntaxAdded( SyntaxImpl syntax )
- {
- fillInUiFields();
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaListener#syntaxModified(org.apache.directory.studio.apacheds.schemaeditor.model.SyntaxImpl)
- */
- public void syntaxModified( SyntaxImpl syntax )
- {
- fillInUiFields();
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaListener#syntaxRemoved(org.apache.directory.studio.apacheds.schemaeditor.model.SyntaxImpl)
- */
- public void syntaxRemoved( SyntaxImpl syntax )
- {
- fillInUiFields();
- }
};
// UI Fields
- private Table attributeTypesTable;
- private Table objectClassesTable;
+ private TableViewer attributeTypesTableViewer;
+ private TableViewer objectClassesTableViewer;
// Listeners
- /** The listener of the Attribute Types Table*/
- private MouseAdapter attributeTypesTableListener = new MouseAdapter()
+ /** The listener of the Attribute Types TableViewer */
+ private IDoubleClickListener attributeTypesTableViewerListener = new IDoubleClickListener()
{
- public void mouseDoubleClick( MouseEvent e )
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
+ */
+ public void doubleClick( DoubleClickEvent event )
{
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ StructuredSelection selection = ( StructuredSelection ) event.getSelection();
- AttributeTypeEditorInput input = new AttributeTypeEditorInput( schemaHandler
- .getAttributeType( attributeTypesTable.getSelection()[0].getText() ) );
- String editorId = AttributeTypeEditor.ID;
- try
+ if ( !selection.isEmpty() )
{
- page.openEditor( input, editorId );
- }
- catch ( PartInitException exception )
- {
- Logger.getLogger( SchemaEditorOverviewPage.class ).debug( "error when opening the editor" ); //$NON-NLS-1$
+ AttributeTypeImpl at = ( AttributeTypeImpl ) selection.getFirstElement();
+
+ try
+ {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(
+ new AttributeTypeEditorInput( at ), AttributeTypeEditor.ID );
+ }
+ catch ( PartInitException exception )
+ {
+ //TODO Add a logger
+ }
}
}
};
- /** The listener of the Object Classes Table*/
- private MouseAdapter objectClassesTableListener = new MouseAdapter()
+
+ /** The listener of the Object Classes TableViewer */
+ private IDoubleClickListener objectClassesTableViewerListener = new IDoubleClickListener()
{
- public void mouseDoubleClick( MouseEvent e )
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
+ */
+ public void doubleClick( DoubleClickEvent event )
{
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ StructuredSelection selection = ( StructuredSelection ) event.getSelection();
- ObjectClassEditorInput input = new ObjectClassEditorInput( schemaHandler.getObjectClass( objectClassesTable
- .getSelection()[0].getText() ) );
- String editorId = ObjectClassEditor.ID;
- try
- {
- page.openEditor( input, editorId );
- }
- catch ( PartInitException exception )
+ if ( !selection.isEmpty() )
{
- Logger.getLogger( SchemaEditorOverviewPage.class ).debug( "error when opening the editor" ); //$NON-NLS-1$
+ ObjectClassImpl oc = ( ObjectClassImpl ) selection.getFirstElement();
+
+ try
+ {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(
+ new ObjectClassEditorInput( oc ), ObjectClassEditor.ID );
+ }
+ catch ( PartInitException exception )
+ {
+ //TODO Add a logger
+ }
}
}
};
@@ -294,12 +248,13 @@
attributeTypesSectionClient.setLayout( new GridLayout() );
toolkit.paintBordersFor( attributeTypesSectionClient );
attributeTypesSection.setClient( attributeTypesSectionClient );
- attributeTypesSection.setLayoutData( new GridData( GridData.FILL, GridData.FILL, true, true ) );
+ attributeTypesSection.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
- attributeTypesTable = toolkit.createTable( attributeTypesSectionClient, SWT.NONE );
- GridData gridData = new GridData( GridData.FILL, GridData.FILL, true, true );
- gridData.heightHint = 1;
- attributeTypesTable.setLayoutData( gridData );
+ attributeTypesTableViewer = new TableViewer( attributeTypesSectionClient, SWT.SINGLE | SWT.H_SCROLL
+ | SWT.V_SCROLL | SWT.BORDER );
+ attributeTypesTableViewer.setContentProvider( new SchemaEditorTableViewerContentProvider() );
+ attributeTypesTableViewer.setLabelProvider( new SchemaEditorTableViewerLabelProvider() );
+ attributeTypesTableViewer.getTable().setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
}
@@ -325,12 +280,13 @@
objectClassesSectionClient.setLayout( new GridLayout() );
toolkit.paintBordersFor( objectClassesSectionClient );
objectClassesSection.setClient( objectClassesSectionClient );
- objectClassesSection.setLayoutData( new GridData( GridData.FILL, GridData.FILL, true, true ) );
+ objectClassesSection.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
- objectClassesTable = toolkit.createTable( objectClassesSectionClient, SWT.NONE );
- GridData gridData = new GridData( GridData.FILL, GridData.FILL, true, true );
- gridData.heightHint = 1;
- objectClassesTable.setLayoutData( gridData );
+ objectClassesTableViewer = new TableViewer( objectClassesSectionClient, SWT.SINGLE | SWT.H_SCROLL
+ | SWT.V_SCROLL | SWT.BORDER );
+ objectClassesTableViewer.setContentProvider( new SchemaEditorTableViewerContentProvider() );
+ objectClassesTableViewer.setLabelProvider( new SchemaEditorTableViewerLabelProvider() );
+ objectClassesTableViewer.getTable().setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
}
@@ -339,21 +295,8 @@
*/
private void fillInUiFields()
{
- for ( AttributeTypeImpl at : schema.getAttributeTypes() )
- {
- TableItem item = new TableItem( attributeTypesTable, SWT.NONE );
- item.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
- PluginConstants.IMG_ATTRIBUTE_TYPE ).createImage() );
- item.setText( at.getNames()[0] );
- }
-
- for ( ObjectClassImpl oc : schema.getObjectClasses() )
- {
- TableItem item = new TableItem( objectClassesTable, SWT.NONE );
- item.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
- PluginConstants.IMG_OBJECT_CLASS ).createImage() );
- item.setText( oc.getNames()[0] );
- }
+ attributeTypesTableViewer.setInput( schema.getAttributeTypes() );
+ objectClassesTableViewer.setInput( schema.getObjectClasses() );
}
@@ -362,7 +305,7 @@
*/
private void addListeners()
{
- attributeTypesTable.addMouseListener( attributeTypesTableListener );
- objectClassesTable.addMouseListener( objectClassesTableListener );
+ attributeTypesTableViewer.addDoubleClickListener( attributeTypesTableViewerListener );
+ objectClassesTableViewer.addDoubleClickListener( objectClassesTableViewerListener );
}
}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditorTableViewerContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditorTableViewerContentProvider.java?view=auto&rev=559471
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditorTableViewerContentProvider.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditorTableViewerContentProvider.java Wed Jul 25 07:12:25 2007
@@ -0,0 +1,116 @@
+/*
+ * 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.schema;
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * This class is the Content Provider for the Superiors Table of the Object
+ * Class Editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemaEditorTableViewerContentProvider implements IStructuredContentProvider
+{
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ public Object[] getElements( Object inputElement )
+ {
+ if ( inputElement instanceof List<?> )
+ {
+ List<?> list = ( List<?> ) inputElement;
+
+ List<Object> results = new ArrayList<Object>();
+ results.addAll( list );
+
+ // Sorting Elements
+ Collections.sort( results, new Comparator<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 ObjectClassImpl && o2 instanceof ObjectClassImpl )
+ {
+ 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] );
+ }
+ }
+
+ return 0;
+ }
+ } );
+
+ return results.toArray();
+ }
+
+ // Default
+ return null;
+ }
+
+
+ /*
+ * (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 )
+ {
+ }
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditorTableViewerLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditorTableViewerLabelProvider.java?view=auto&rev=559471
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditorTableViewerLabelProvider.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditorTableViewerLabelProvider.java Wed Jul 25 07:12:25 2007
@@ -0,0 +1,101 @@
+/*
+ * 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.schema;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.view.ViewUtils;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class is the Label Provider for the TableViewers of the Schema Editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemaEditorTableViewerLabelProvider extends LabelProvider implements ITableLabelProvider
+{
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ */
+ public Image getColumnImage( Object element, int columnIndex )
+ {
+ if ( element instanceof ObjectClassImpl )
+ {
+ return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_OBJECT_CLASS )
+ .createImage();
+ }
+ else if ( element instanceof AttributeTypeImpl )
+ {
+ return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_ATTRIBUTE_TYPE )
+ .createImage();
+ }
+
+ // Default
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
+ public String getColumnText( Object element, int columnIndex )
+ {
+ if ( element instanceof ObjectClassImpl )
+ {
+ ObjectClassImpl oc = ( ObjectClassImpl ) element;
+
+ String[] names = oc.getNames();
+ if ( ( names != null ) && ( names.length > 0 ) )
+ {
+ return ViewUtils.concateAliases( names ) + " - (" + oc.getOid() + ")";
+ }
+ else
+ {
+ return "(None) - (" + oc.getOid() + ")";
+ }
+ }
+ else if ( element instanceof AttributeTypeImpl )
+ {
+ AttributeTypeImpl at = ( AttributeTypeImpl ) element;
+
+ String[] names = at.getNames();
+ if ( ( names != null ) && ( names.length > 0 ) )
+ {
+ return ViewUtils.concateAliases( names ) + " - (" + at.getOid() + ")";
+ }
+ else
+ {
+ return "(None) - (" + at.getOid() + ")";
+ }
+ }
+
+ // Default
+ return null;
+ }
+}