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 17:30:25 UTC
svn commit: r559491 -
/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/
Author: pamarcelot
Date: Wed Jul 25 08:30:24 2007
New Revision: 559491
URL: http://svn.apache.org/viewvc?view=rev&rev=559491
Log:
Added 2 LabelProviders for AT and OC Selections Dialogs.
Added:
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/AttributeTypeSelectionDialogLabelProvider.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/ObjectClassSelectionDialogLabelProvider.java
Modified:
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/AttributeTypeSelectionDialog.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/ObjectClassSelectionDialog.java
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/AttributeTypeSelectionDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/AttributeTypeSelectionDialog.java?view=diff&rev=559491&r1=559490&r2=559491
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/AttributeTypeSelectionDialog.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/AttributeTypeSelectionDialog.java Wed Jul 25 08:30:24 2007
@@ -28,7 +28,6 @@
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
@@ -151,7 +150,7 @@
attributeTypesTableViewer.setContentProvider( new AttributeTypeSelectionDialogContentProvider(
hiddenAttributeTypes ) );
- attributeTypesTableViewer.setLabelProvider( new LabelProvider() );
+ attributeTypesTableViewer.setLabelProvider( new AttributeTypeSelectionDialogLabelProvider() );
// We need to force the input to load the complete list of attribute types
attributeTypesTableViewer.setInput( "" ); //$NON-NLS-1$
@@ -167,7 +166,7 @@
*/
protected void createButtonsForButtonBar( Composite parent )
{
- createButton( parent, IDialogConstants.OK_ID, "Add", true ); //$NON-NLS-1$
+ createButton( parent, IDialogConstants.OK_ID, "Choose", true ); //$NON-NLS-1$
createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/AttributeTypeSelectionDialogLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/AttributeTypeSelectionDialogLabelProvider.java?view=auto&rev=559491
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/AttributeTypeSelectionDialogLabelProvider.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/AttributeTypeSelectionDialogLabelProvider.java Wed Jul 25 08:30:24 2007
@@ -0,0 +1,81 @@
+/*
+ * 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.dialogs;
+
+
+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.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 Attribute Types Viewer of the AttributeTypeSelectionDialog.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AttributeTypeSelectionDialogLabelProvider 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 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 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;
+ }
+}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/ObjectClassSelectionDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/ObjectClassSelectionDialog.java?view=diff&rev=559491&r1=559490&r2=559491
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/ObjectClassSelectionDialog.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/ObjectClassSelectionDialog.java Wed Jul 25 08:30:24 2007
@@ -28,7 +28,6 @@
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
@@ -150,7 +149,7 @@
tableViewer.setUseHashlookup( true );
tableViewer.setContentProvider( new ObjectClassSelectionDialogContentProvider( hiddenObjectClasses ) );
- tableViewer.setLabelProvider( new LabelProvider() );
+ tableViewer.setLabelProvider( new ObjectClassSelectionDialogLabelProvider() );
// We need to force the input to load the complete list of attribute types
tableViewer.setInput( "" ); //$NON-NLS-1$
@@ -166,7 +165,7 @@
*/
protected void createButtonsForButtonBar( Composite parent )
{
- createButton( parent, IDialogConstants.OK_ID, "Add", true );
+ createButton( parent, IDialogConstants.OK_ID, "Choose", true );
createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/ObjectClassSelectionDialogLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/ObjectClassSelectionDialogLabelProvider.java?view=auto&rev=559491
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/ObjectClassSelectionDialogLabelProvider.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/ObjectClassSelectionDialogLabelProvider.java Wed Jul 25 08:30:24 2007
@@ -0,0 +1,81 @@
+/*
+ * 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.dialogs;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+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 Object Classes Viewer of the ObjectClassSelectionDialog.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ObjectClassSelectionDialogLabelProvider 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();
+ }
+
+ // 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() + ")";
+ }
+ }
+
+ // Default
+ return null;
+ }
+}