You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by fe...@apache.org on 2007/11/05 18:15:02 UTC
svn commit: r592094 [17/35] - in
/directory/sandbox/felixk/studio-schemaeditor: ./ META-INF/ src/ src/main/
src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/directory/
src/main/java/org/apache/directory/studio/ src/m...
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditor.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditor.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditor.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.studio.schemaeditor.view.editors.schema;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.controller.SchemaHandlerAdapter;
+import org.apache.directory.studio.schemaeditor.controller.SchemaHandlerListener;
+import org.apache.directory.studio.schemaeditor.model.Schema;
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.forms.editor.FormEditor;
+
+
+/**
+ * This class is the Schema Editor main class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemaEditor extends FormEditor
+{
+ /** The logger */
+ private static Logger logger = Logger.getLogger( SchemaEditor.class );
+
+ /** The ID of the Editor */
+ public static final String ID = Activator.PLUGIN_ID + ".view.schemaEditor"; //$NON-NLS-1$
+
+ /** The editor */
+ private SchemaEditor instance;
+
+ /** The Overview Page */
+ private SchemaEditorOverviewPage overview;
+
+ /** The Source Code page */
+ private SchemaEditorSourceCodePage sourceCode;
+
+ /** The associated schema */
+ private Schema schema;
+
+ /** The SchemaHandler listener */
+ private SchemaHandlerListener schemaHandlerListener = new SchemaHandlerAdapter()
+ {
+ public void schemaRemoved( Schema s )
+ {
+ if ( schema.equals( s ) )
+ {
+ getEditorSite().getPage().closeEditor( instance, false );
+ }
+ }
+ };
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.forms.editor.FormEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
+ */
+ public void init( IEditorSite site, IEditorInput input ) throws PartInitException
+ {
+ super.init( site, input );
+
+ instance = this;
+
+ setSite( site );
+ setInput( input );
+ setPartName( input.getName() );
+
+ schema = ( ( SchemaEditorInput ) getEditorInput() ).getSchema();
+
+ Activator.getDefault().getSchemaHandler().addListener( schemaHandlerListener );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.forms.editor.FormEditor#addPages()
+ */
+ protected void addPages()
+ {
+ try
+ {
+ overview = new SchemaEditorOverviewPage( this );
+ addPage( overview );
+ sourceCode = new SchemaEditorSourceCodePage( this );
+ addPage( sourceCode );
+ }
+ catch ( PartInitException e )
+ {
+ logger.debug( "error when adding pages" ); //$NON-NLS-1$
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.forms.editor.FormEditor#dispose()
+ */
+ public void dispose()
+ {
+ Activator.getDefault().getSchemaHandler().removeListener( schemaHandlerListener );
+
+ super.dispose();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void doSave( IProgressMonitor monitor )
+ {
+ // There's nothing to save
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.EditorPart#doSaveAs()
+ */
+ public void doSaveAs()
+ {
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
+ */
+ public boolean isSaveAsAllowed()
+ {
+ return false;
+ }
+
+
+ /**
+ * Gets the associated schema.
+ *
+ * @return
+ * the associated schema
+ */
+ public Schema getSchema()
+ {
+ return schema;
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorInput.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorInput.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorInput.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorInput.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.studio.schemaeditor.view.editors.schema;
+
+
+import org.apache.directory.studio.schemaeditor.model.Schema;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+
+
+/**
+ * This class is the Input class for the Schema Editor
+ */
+public class SchemaEditorInput implements IEditorInput
+{
+ private Schema schema;
+
+
+ /**
+ * Default constructor
+ * @param schema
+ */
+ public SchemaEditorInput( Schema schema )
+ {
+ super();
+ this.schema = schema;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#exists()
+ */
+ public boolean exists()
+ {
+ return ( this.schema == null );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
+ */
+ public ImageDescriptor getImageDescriptor()
+ {
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getName()
+ */
+ public String getName()
+ {
+ return this.schema.getName();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getPersistable()
+ */
+ public IPersistableElement getPersistable()
+ {
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getToolTipText()
+ */
+ public String getToolTipText()
+ {
+ return getName();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ @SuppressWarnings("unchecked")
+ public Object getAdapter( Class adapter )
+ {
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ return true;
+ if ( !( obj instanceof SchemaEditorInput ) )
+ return false;
+ SchemaEditorInput other = ( SchemaEditorInput ) obj;
+ return other.getSchema().equals( this.schema );
+ }
+
+
+ /**
+ * Returns the input schema
+ * @return the input schema
+ */
+ public Schema getSchema()
+ {
+ return this.schema;
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorInput.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorOverviewPage.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorOverviewPage.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorOverviewPage.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,340 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.studio.schemaeditor.view.editors.schema;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginUtils;
+import org.apache.directory.studio.schemaeditor.controller.SchemaAdapter;
+import org.apache.directory.studio.schemaeditor.controller.SchemaHandler;
+import org.apache.directory.studio.schemaeditor.controller.SchemaListener;
+import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.schemaeditor.model.Schema;
+import org.apache.directory.studio.schemaeditor.view.ViewUtils;
+import org.apache.directory.studio.schemaeditor.view.editors.attributetype.AttributeTypeEditor;
+import org.apache.directory.studio.schemaeditor.view.editors.attributetype.AttributeTypeEditorInput;
+import org.apache.directory.studio.schemaeditor.view.editors.objectclass.ObjectClassEditor;
+import org.apache.directory.studio.schemaeditor.view.editors.objectclass.ObjectClassEditorInput;
+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.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+
+
+/**
+ * This class is the Overview Page of the Schema Editore.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemaEditorOverviewPage extends FormPage
+{
+ /** The page ID */
+ public static final String ID = SchemaEditor.ID + "overviewPage"; //$NON-NLS-1$
+
+ /** The page title */
+ public static final String TITLE = "Overview";
+
+ /** The SchemaHandler */
+ private SchemaHandler schemaHandler;
+
+ /** The associated schema */
+ private Schema schema;
+
+ private SchemaListener schemaListener = new SchemaAdapter()
+ {
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.controller.SchemaListener#attributeTypeAdded(org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl)
+ */
+ public void attributeTypeAdded( AttributeTypeImpl at )
+ {
+ fillInUiFields();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.controller.SchemaListener#attributeTypeModified(org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl)
+ */
+ public void attributeTypeModified( AttributeTypeImpl at )
+ {
+ fillInUiFields();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.controller.SchemaListener#attributeTypeRemoved(org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl)
+ */
+ public void attributeTypeRemoved( AttributeTypeImpl at )
+ {
+ fillInUiFields();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.controller.SchemaListener#objectClassAdded(org.apache.directory.studio.schemaeditor.model.ObjectClassImpl)
+ */
+ public void objectClassAdded( ObjectClassImpl oc )
+ {
+ fillInUiFields();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.controller.SchemaListener#objectClassModified(org.apache.directory.studio.schemaeditor.model.ObjectClassImpl)
+ */
+ public void objectClassModified( ObjectClassImpl oc )
+ {
+ fillInUiFields();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.controller.SchemaListener#objectClassRemoved(org.apache.directory.studio.schemaeditor.model.ObjectClassImpl)
+ */
+ public void objectClassRemoved( ObjectClassImpl oc )
+ {
+ fillInUiFields();
+ }
+ };
+
+ // UI Fields
+ private TableViewer attributeTypesTableViewer;
+ private TableViewer objectClassesTableViewer;
+
+ // Listeners
+ /** The listener of the Attribute Types TableViewer */
+ private IDoubleClickListener attributeTypesTableViewerListener = new IDoubleClickListener()
+ {
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
+ */
+ public void doubleClick( DoubleClickEvent event )
+ {
+ StructuredSelection selection = ( StructuredSelection ) event.getSelection();
+
+ if ( !selection.isEmpty() )
+ {
+ AttributeTypeImpl at = ( AttributeTypeImpl ) selection.getFirstElement();
+
+ try
+ {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(
+ new AttributeTypeEditorInput( at ), AttributeTypeEditor.ID );
+ }
+ catch ( PartInitException exception )
+ {
+ PluginUtils.logError( "An error occured when opening the editor.", exception );
+ ViewUtils.displayErrorMessageBox( "Error", "An error occured when opening the editor." );
+ }
+ }
+ }
+ };
+
+ /** The listener of the Object Classes TableViewer */
+ private IDoubleClickListener objectClassesTableViewerListener = new IDoubleClickListener()
+ {
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
+ */
+ public void doubleClick( DoubleClickEvent event )
+ {
+ StructuredSelection selection = ( StructuredSelection ) event.getSelection();
+
+ if ( !selection.isEmpty() )
+ {
+ ObjectClassImpl oc = ( ObjectClassImpl ) selection.getFirstElement();
+
+ try
+ {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(
+ new ObjectClassEditorInput( oc ), ObjectClassEditor.ID );
+ }
+ catch ( PartInitException exception )
+ {
+ PluginUtils.logError( "An error occured when opening the editor.", exception );
+ ViewUtils.displayErrorMessageBox( "Error", "An error occured when opening the editor." );
+ }
+ }
+ }
+ };
+
+
+ /**
+ * Creates a new instance of SchemaFormEditorOverviewPage.
+ *
+ * @param editor
+ * the associated editor
+ */
+ public SchemaEditorOverviewPage( FormEditor editor )
+ {
+ super( editor, ID, TITLE );
+ schemaHandler = Activator.getDefault().getSchemaHandler();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
+ */
+ protected void createFormContent( IManagedForm managedForm )
+ {
+ // Getting the associated schema
+ schema = ( ( SchemaEditor ) getEditor() ).getSchema();
+
+ // Creating the base UI
+ ScrolledForm form = managedForm.getForm();
+ FormToolkit toolkit = managedForm.getToolkit();
+ GridLayout layout = new GridLayout( 2, true );
+ form.getBody().setLayout( layout );
+
+ createAttributeTypesSection( form.getBody(), toolkit );
+
+ createObjectClassesSection( form.getBody(), toolkit );
+
+ // Initializes the UI from the schema
+ fillInUiFields();
+
+ // Listeners initialization
+ addListeners();
+
+ // Help Context for Dynamic Help
+ PlatformUI.getWorkbench().getHelpSystem().setHelp( form, Activator.PLUGIN_ID + "." + "schema_editor" );
+ }
+
+
+ /**
+ * Create the Attribute Types Section.
+ *
+ * @param parent
+ * the parent composite
+ * @param toolkit
+ * the FormToolKit to use
+ */
+ private void createAttributeTypesSection( Composite parent, FormToolkit toolkit )
+ {
+ // Attribute Types Section
+ Section attributeTypesSection = toolkit.createSection( parent, Section.DESCRIPTION | Section.EXPANDED
+ | Section.TITLE_BAR );
+ attributeTypesSection.setDescription( "The schema '" + schema.getName()
+ + "' contains the following attribute types." );
+ attributeTypesSection.setText( "Attribute Types" );
+
+ // Creating the layout of the section
+ Composite attributeTypesSectionClient = toolkit.createComposite( attributeTypesSection );
+ attributeTypesSectionClient.setLayout( new GridLayout() );
+ toolkit.paintBordersFor( attributeTypesSectionClient );
+ attributeTypesSection.setClient( attributeTypesSectionClient );
+ attributeTypesSection.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+
+ 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 ) );
+ }
+
+
+ /**
+ * Create the Object Classes Section.
+ *
+ * @param parent
+ * the parent composite
+ * @param toolkit
+ * the FormToolKit to use
+ */
+ private void createObjectClassesSection( Composite parent, FormToolkit toolkit )
+ {
+ // Attribute Types Section
+ Section objectClassesSection = toolkit.createSection( parent, Section.DESCRIPTION | Section.EXPANDED
+ | Section.TITLE_BAR );
+ objectClassesSection.setDescription( "The schema '" + schema.getName()
+ + "' contains the following object classes." );
+ objectClassesSection.setText( "Object Classes" );
+
+ // Creating the layout of the section
+ Composite objectClassesSectionClient = toolkit.createComposite( objectClassesSection );
+ objectClassesSectionClient.setLayout( new GridLayout() );
+ toolkit.paintBordersFor( objectClassesSectionClient );
+ objectClassesSection.setClient( objectClassesSectionClient );
+ objectClassesSection.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+
+ 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 ) );
+ }
+
+
+ /**
+ * Fills in the fields of the User Interface.
+ */
+ private void fillInUiFields()
+ {
+ attributeTypesTableViewer.setInput( schema.getAttributeTypes() );
+ objectClassesTableViewer.setInput( schema.getObjectClasses() );
+ }
+
+
+ /**
+ * Initializes and adds the listeners.
+ */
+ private void addListeners()
+ {
+ schemaHandler.addListener( schema, schemaListener );
+ attributeTypesTableViewer.addDoubleClickListener( attributeTypesTableViewerListener );
+ objectClassesTableViewer.addDoubleClickListener( objectClassesTableViewerListener );
+ }
+
+
+ /**
+ * Removes the listeners.
+ */
+ private void removeListeners()
+ {
+ schemaHandler.removeListener( schema, schemaListener );
+ attributeTypesTableViewer.removeDoubleClickListener( attributeTypesTableViewerListener );
+ objectClassesTableViewer.removeDoubleClickListener( objectClassesTableViewerListener );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.forms.editor.FormPage#dispose()
+ */
+ public void dispose()
+ {
+ removeListeners();
+
+ super.dispose();
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorOverviewPage.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorSourceCodePage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorSourceCodePage.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorSourceCodePage.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorSourceCodePage.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,266 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.studio.schemaeditor.view.editors.schema;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.controller.SchemaListener;
+import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.schemaeditor.model.MatchingRuleImpl;
+import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.schemaeditor.model.Schema;
+import org.apache.directory.studio.schemaeditor.model.SyntaxImpl;
+import org.apache.directory.studio.schemaeditor.model.io.OpenLdapSchemaFileExporter;
+import org.apache.directory.studio.schemaeditor.view.widget.SchemaSourceViewer;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+
+
+/**
+ * This class is the Source Code Page of the Schema Editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SchemaEditorSourceCodePage extends FormPage
+{
+ /** The page ID */
+ public static final String ID = SchemaEditor.ID + "sourceCode"; //$NON-NLS-1$
+
+ /** The page title */
+ public static final String TITLE = "Source Code";
+
+ /** The associated schema */
+ private Schema schema;
+
+ // UI Field
+ private SchemaSourceViewer schemaSourceViewer;
+
+ // Listerner
+ private SchemaListener schemaListener = new SchemaListener()
+ {
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.controller.SchemaListener#attributeTypeAdded(org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl)
+ */
+ public void attributeTypeAdded( AttributeTypeImpl at )
+ {
+ fillInUiFields();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.controller.SchemaListener#attributeTypeModified(org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl)
+ */
+ public void attributeTypeModified( AttributeTypeImpl at )
+ {
+ fillInUiFields();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.controller.SchemaListener#attributeTypeRemoved(org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl)
+ */
+ public void attributeTypeRemoved( AttributeTypeImpl at )
+ {
+ fillInUiFields();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.controller.SchemaListener#matchingRuleAdded(org.apache.directory.studio.schemaeditor.model.MatchingRuleImpl)
+ */
+ public void matchingRuleAdded( MatchingRuleImpl mr )
+ {
+ fillInUiFields();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.controller.SchemaListener#matchingRuleModified(org.apache.directory.studio.schemaeditor.model.MatchingRuleImpl)
+ */
+ public void matchingRuleModified( MatchingRuleImpl mr )
+ {
+ fillInUiFields();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.controller.SchemaListener#matchingRuleRemoved(org.apache.directory.studio.schemaeditor.model.MatchingRuleImpl)
+ */
+ public void matchingRuleRemoved( MatchingRuleImpl mr )
+ {
+ fillInUiFields();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.controller.SchemaListener#objectClassAdded(org.apache.directory.studio.schemaeditor.model.ObjectClassImpl)
+ */
+ public void objectClassAdded( ObjectClassImpl oc )
+ {
+ fillInUiFields();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.controller.SchemaListener#objectClassModified(org.apache.directory.studio.schemaeditor.model.ObjectClassImpl)
+ */
+ public void objectClassModified( ObjectClassImpl oc )
+ {
+ fillInUiFields();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.controller.SchemaListener#objectClassRemoved(org.apache.directory.studio.schemaeditor.model.ObjectClassImpl)
+ */
+ public void objectClassRemoved( ObjectClassImpl oc )
+ {
+ fillInUiFields();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.controller.SchemaListener#syntaxAdded(org.apache.directory.studio.schemaeditor.model.SyntaxImpl)
+ */
+ public void syntaxAdded( SyntaxImpl syntax )
+ {
+ fillInUiFields();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.controller.SchemaListener#syntaxModified(org.apache.directory.studio.schemaeditor.model.SyntaxImpl)
+ */
+ public void syntaxModified( SyntaxImpl syntax )
+ {
+ fillInUiFields();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.directory.studio.schemaeditor.controller.SchemaListener#syntaxRemoved(org.apache.directory.studio.schemaeditor.model.SyntaxImpl)
+ */
+ public void syntaxRemoved( SyntaxImpl syntax )
+ {
+ fillInUiFields();
+ }
+ };
+
+
+ /**
+ * Creates a new instance of SchemaFormEditorSourceCodePage.
+ *
+ * @param editor
+ * the associated editor
+ */
+ public SchemaEditorSourceCodePage( FormEditor editor )
+ {
+ super( editor, ID, TITLE );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
+ */
+ protected void createFormContent( IManagedForm managedForm )
+ {
+ schema = ( ( SchemaEditor ) getEditor() ).getSchema();
+
+ ScrolledForm form = managedForm.getForm();
+ FormToolkit toolkit = managedForm.getToolkit();
+ GridLayout layout = new GridLayout();
+ form.getBody().setLayout( layout );
+ toolkit.paintBordersFor( form.getBody() );
+
+ // SOURCE CODE Field
+ schemaSourceViewer = new SchemaSourceViewer( form.getBody(), null, null, false, SWT.BORDER | SWT.H_SCROLL
+ | SWT.V_SCROLL );
+ GridData gd = new GridData( SWT.FILL, SWT.FILL, true, true );
+ gd.heightHint = 10;
+ schemaSourceViewer.getTextWidget().setLayoutData( gd );
+ schemaSourceViewer.getTextWidget().setEditable( false );
+
+ // set text font
+ Font font = JFaceResources.getFont( JFaceResources.TEXT_FONT );
+ schemaSourceViewer.getTextWidget().setFont( font );
+
+ IDocument document = new Document();
+ schemaSourceViewer.setDocument( document );
+
+ // Initializes the UI from the schema
+ fillInUiFields();
+
+ addListeners();
+
+ // Help Context for Dynamic Help
+ PlatformUI.getWorkbench().getHelpSystem().setHelp( form, Activator.PLUGIN_ID + "." + "schema_editor" );
+ }
+
+
+ /**
+ * Fills in the fields of the User Interface.
+ */
+ private void fillInUiFields()
+ {
+ schemaSourceViewer.getDocument().set( OpenLdapSchemaFileExporter.toSourceCode( schema ) );
+ }
+
+
+ /**
+ * Adds the listeners.
+ */
+ private void addListeners()
+ {
+ Activator.getDefault().getSchemaHandler().addListener( schema, schemaListener );
+ }
+
+
+ /**
+ * Removes the listeners.
+ */
+ private void removeListeners()
+ {
+ Activator.getDefault().getSchemaHandler().removeListener( schema, schemaListener );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.forms.editor.FormPage#dispose()
+ */
+ public void dispose()
+ {
+ removeListeners();
+
+ super.dispose();
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorSourceCodePage.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorTableViewerContentProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorTableViewerContentProvider.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorTableViewerContentProvider.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorTableViewerContentProvider.java Mon Nov 5 09:14:24 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.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.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.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 )
+ {
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorTableViewerContentProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorTableViewerLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorTableViewerLabelProvider.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorTableViewerLabelProvider.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorTableViewerLabelProvider.java Mon Nov 5 09:14:24 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.schemaeditor.view.editors.schema;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.schemaeditor.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;
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/schema/SchemaEditorTableViewerLabelProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/preferences/HierarchyViewPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/preferences/HierarchyViewPreferencePage.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/preferences/HierarchyViewPreferencePage.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/preferences/HierarchyViewPreferencePage.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,432 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.directory.studio.schemaeditor.view.preferences;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+
+/**
+ * This class implements the Preference page for the Hierarchy View
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class HierarchyViewPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
+{
+ /** The preference page ID */
+ public static final String ID = Activator.PLUGIN_ID + ".preferences.hierarchyView"; //$NON-NLS-1$
+
+ /** The First Name category */
+ private static final String FIRST_NAME = "First Name";
+
+ /** The All Aliases category */
+ private static final String ALL_ALIASES = "All Aliases";
+
+ /** The OID category */
+ private static final String OID = "OID";
+
+ // UI fields
+ private Combo labelCombo;
+ private Button limitButton;
+ private Text lengthText;
+ private Button secondaryLabelButtonDisplay;
+ private Combo secondaryLabelCombo;
+ private Button secondaryLabelLimitButton;
+ private Text secondaryLabelLengthText;
+
+
+ /**
+ * Creates a new instance of HierarchyViewPreferencePage.
+ */
+ public HierarchyViewPreferencePage()
+ {
+ super();
+ super.setPreferenceStore( Activator.getDefault().getPreferenceStore() );
+ super.setDescription( "General settings for the Hierarchy View of the Schema Editor Plugin" );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents( Composite parent )
+ {
+ Composite composite = new Composite( parent, SWT.NONE );
+ composite.setLayout( new GridLayout() );
+ composite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+
+ // Label Group
+ Group labelGroup = new Group( composite, SWT.NONE );
+ labelGroup.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ labelGroup.setText( "Label" );
+ labelGroup.setLayout( new GridLayout() );
+ Composite labelGroupComposite = new Composite( labelGroup, SWT.NONE );
+ GridLayout gl = new GridLayout( 1, false );
+ gl.marginHeight = gl.marginWidth = 0;
+ labelGroupComposite.setLayout( gl );
+ labelGroupComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+ // Label row composite
+ Composite labelComposite = new Composite( labelGroupComposite, SWT.NONE );
+ gl = new GridLayout( 3, false );
+ gl.marginHeight = gl.marginWidth = 0;
+ labelComposite.setLayout( gl );
+ GridData gd = new GridData( SWT.FILL, SWT.NONE, true, false );
+ gd.horizontalSpan = 1;
+ labelComposite.setLayoutData( gd );
+
+ // Use Label
+ Label useLabel = new Label( labelComposite, SWT.NONE );
+ useLabel.setText( "Use" );
+
+ // Label Combo
+ labelCombo = new Combo( labelComposite, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER );
+ labelCombo.setLayoutData( new GridData() );
+ labelCombo.setItems( new String[]
+ { FIRST_NAME, ALL_ALIASES, OID } );
+ labelCombo.setEnabled( true );
+
+ // As label Label
+ Label asLabel = new Label( labelComposite, SWT.NONE );
+ asLabel.setText( "as label." );
+
+ // Abbreviate row composite
+ Composite abbreviateComposite = new Composite( labelGroupComposite, SWT.NONE );
+ gl = new GridLayout( 3, false );
+ gl.marginHeight = gl.marginWidth = 0;
+ abbreviateComposite.setLayout( gl );
+ gd = new GridData( SWT.FILL, SWT.NONE, true, false );
+ gd.horizontalSpan = 1;
+ abbreviateComposite.setLayoutData( gd );
+
+ // Limit label lenght to Label
+ limitButton = new Button( abbreviateComposite, SWT.CHECK );
+ limitButton.setText( "Limit label length to" );
+ gd = new GridData();
+ gd.horizontalSpan = 1;
+ limitButton.setLayoutData( gd );
+
+ // Lenght Text
+ lengthText = new Text( abbreviateComposite, SWT.NONE | SWT.BORDER );
+ GridData gridData = new GridData();
+ gridData.horizontalSpan = 1;
+ gridData.widthHint = 9 * 3;
+ lengthText.setLayoutData( gridData );
+ lengthText.setTextLimit( 3 );
+ lengthText.addVerifyListener( new VerifyListener()
+ {
+ public void verifyText( VerifyEvent e )
+ {
+ if ( !e.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
+ {
+ e.doit = false;
+ }
+ if ( "".equals( lengthText.getText() ) && e.text.matches( "[0]" ) ) //$NON-NLS-1$ //$NON-NLS-2$
+ {
+ e.doit = false;
+ }
+ }
+ } );
+
+ // Characters Label
+ Label charactersLabel = new Label( abbreviateComposite, SWT.NONE );
+ charactersLabel.setText( "characters." );
+
+ // Secondary Label Group
+ Group secondaryLabelGroup = new Group( composite, SWT.NONE );
+ secondaryLabelGroup.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ secondaryLabelGroup.setText( "Secondary label" );
+ secondaryLabelGroup.setLayout( new GridLayout() );
+ Composite secondaryLabelGroupComposite = new Composite( secondaryLabelGroup, SWT.NONE );
+ gl = new GridLayout( 1, false );
+ gl.marginHeight = gl.marginWidth = 0;
+ secondaryLabelGroupComposite.setLayout( gl );
+ secondaryLabelGroupComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+ secondaryLabelButtonDisplay = new Button( secondaryLabelGroupComposite, SWT.CHECK );
+ secondaryLabelButtonDisplay.setText( "Display secondary label." );
+
+ // Label row composite
+ Composite secondaryLabelComposite = new Composite( secondaryLabelGroupComposite, SWT.NONE );
+ gl = new GridLayout( 3, false );
+ gl.marginHeight = gl.marginWidth = 0;
+ secondaryLabelComposite.setLayout( gl );
+ gd = new GridData( SWT.FILL, SWT.NONE, true, false );
+ gd.horizontalSpan = 1;
+ secondaryLabelComposite.setLayoutData( gd );
+
+ // Use Label
+ Label useLabel2 = new Label( secondaryLabelComposite, SWT.NONE );
+ useLabel2.setText( "Use" );
+
+ // Label Combo
+ secondaryLabelCombo = new Combo( secondaryLabelComposite, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER );
+ secondaryLabelCombo.setLayoutData( new GridData() );
+ secondaryLabelCombo.setItems( new String[]
+ { FIRST_NAME, ALL_ALIASES, OID } );
+ secondaryLabelCombo.setEnabled( true );
+
+ // As label Label
+ Label asLabel2 = new Label( secondaryLabelComposite, SWT.NONE );
+ asLabel2.setText( "as secondary label." );
+
+ // Abbreviate row composite
+ Composite abbreviateComposite2 = new Composite( secondaryLabelGroup, SWT.NONE );
+ gl = new GridLayout( 3, false );
+ gl.marginHeight = gl.marginWidth = 0;
+ abbreviateComposite2.setLayout( gl );
+ gd = new GridData( SWT.FILL, SWT.NONE, true, false );
+ gd.horizontalSpan = 1;
+ abbreviateComposite2.setLayoutData( gd );
+
+ // Limit label length to Label
+ secondaryLabelLimitButton = new Button( abbreviateComposite2, SWT.CHECK );
+ secondaryLabelLimitButton.setText( "Limit secondary label length to" );
+ gd = new GridData();
+ gd.horizontalSpan = 1;
+ secondaryLabelLimitButton.setLayoutData( gd );
+
+ // Length Text
+ secondaryLabelLengthText = new Text( abbreviateComposite2, SWT.NONE | SWT.BORDER );
+ gridData = new GridData();
+ gridData.horizontalSpan = 1;
+ gridData.widthHint = 9 * 3;
+ secondaryLabelLengthText.setLayoutData( gridData );
+ secondaryLabelLengthText.setTextLimit( 3 );
+ secondaryLabelLengthText.addVerifyListener( new VerifyListener()
+ {
+ public void verifyText( VerifyEvent e )
+ {
+ if ( !e.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
+ {
+ e.doit = false;
+ }
+ if ( "".equals( secondaryLabelLengthText.getText() ) && e.text.matches( "[0]" ) ) //$NON-NLS-1$ //$NON-NLS-2$
+ {
+ e.doit = false;
+ }
+ }
+ } );
+
+ // Characters Label
+ Label secondaryLabelcharactersLabel = new Label( abbreviateComposite2, SWT.NONE );
+ secondaryLabelcharactersLabel.setText( "characters." );
+
+ initFieldsFromPreferences();
+
+ initListeners();
+
+ applyDialogFont( parent );
+
+ return parent;
+ }
+
+
+ /**
+ * Initializes the fields from the preferences store.
+ */
+ private void initFieldsFromPreferences()
+ {
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+
+ labelCombo.select( store.getInt( PluginConstants.PREFS_HIERARCHY_VIEW_LABEL ) );
+ limitButton.setSelection( store.getBoolean( PluginConstants.PREFS_HIERARCHY_VIEW_ABBREVIATE ) );
+ lengthText.setEnabled( limitButton.getSelection() );
+ lengthText.setText( store.getString( PluginConstants.PREFS_HIERARCHY_VIEW_ABBREVIATE_MAX_LENGTH ) );
+
+ secondaryLabelButtonDisplay.setSelection( store
+ .getBoolean( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_DISPLAY ) );
+ secondaryLabelCombo.select( store.getInt( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL ) );
+ secondaryLabelLimitButton.setSelection( store
+ .getBoolean( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE ) );
+ secondaryLabelLengthText.setText( store
+ .getString( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH ) );
+ if ( store.getBoolean( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_DISPLAY ) )
+ {
+ secondaryLabelCombo.setEnabled( true );
+ secondaryLabelLimitButton.setEnabled( true );
+ secondaryLabelLengthText.setEnabled( secondaryLabelLimitButton.getSelection() );
+ }
+ else
+ {
+ secondaryLabelCombo.setEnabled( false );
+ secondaryLabelLimitButton.setEnabled( false );
+ secondaryLabelLengthText.setEnabled( false );
+ }
+ }
+
+
+ /**
+ * Initializes the listeners.
+ */
+ private void initListeners()
+ {
+ limitButton.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ lengthText.setEnabled( limitButton.getSelection() );
+ }
+ } );
+
+ secondaryLabelButtonDisplay.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ if ( secondaryLabelButtonDisplay.getSelection() )
+ {
+ secondaryLabelCombo.setEnabled( true );
+ secondaryLabelLimitButton.setEnabled( true );
+ secondaryLabelLengthText.setEnabled( secondaryLabelLimitButton.getSelection() );
+ }
+ else
+ {
+ secondaryLabelCombo.setEnabled( false );
+ secondaryLabelLimitButton.setEnabled( false );
+ secondaryLabelLengthText.setEnabled( false );
+ }
+ }
+ } );
+
+ secondaryLabelLimitButton.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ secondaryLabelLengthText.setEnabled( secondaryLabelLimitButton.getSelection() );
+ }
+ } );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+ */
+ protected void performDefaults()
+ {
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+
+ labelCombo.select( store.getDefaultInt( PluginConstants.PREFS_HIERARCHY_VIEW_LABEL ) );
+ limitButton.setSelection( store.getDefaultBoolean( PluginConstants.PREFS_HIERARCHY_VIEW_ABBREVIATE ) );
+ lengthText.setEnabled( limitButton.getSelection() );
+ lengthText.setText( store.getDefaultString( PluginConstants.PREFS_HIERARCHY_VIEW_ABBREVIATE_MAX_LENGTH ) );
+
+ secondaryLabelButtonDisplay.setSelection( store
+ .getDefaultBoolean( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_DISPLAY ) );
+ secondaryLabelCombo.select( store.getDefaultInt( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL ) );
+ secondaryLabelLimitButton.setSelection( store
+ .getDefaultBoolean( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE ) );
+ secondaryLabelLengthText.setText( store
+ .getDefaultString( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH ) );
+
+ if ( secondaryLabelButtonDisplay.getSelection() )
+ {
+ secondaryLabelCombo.setEnabled( true );
+ secondaryLabelLimitButton.setEnabled( true );
+ secondaryLabelLengthText.setEnabled( secondaryLabelLimitButton.getSelection() );
+ }
+ else
+ {
+ secondaryLabelCombo.setEnabled( false );
+ secondaryLabelLimitButton.setEnabled( false );
+ secondaryLabelLengthText.setEnabled( false );
+ }
+
+ super.performDefaults();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#performOk()
+ */
+ public boolean performOk()
+ {
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+
+ if ( labelCombo.getItem( labelCombo.getSelectionIndex() ).equals( FIRST_NAME ) )
+ {
+ store.setValue( PluginConstants.PREFS_HIERARCHY_VIEW_LABEL,
+ PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_FIRST_NAME );
+ }
+ else if ( labelCombo.getItem( labelCombo.getSelectionIndex() ).equals( ALL_ALIASES ) )
+ {
+ store.setValue( PluginConstants.PREFS_HIERARCHY_VIEW_LABEL,
+ PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_ALL_ALIASES );
+ }
+ else if ( labelCombo.getItem( labelCombo.getSelectionIndex() ).equals( OID ) )
+ {
+ store.setValue( PluginConstants.PREFS_HIERARCHY_VIEW_LABEL, PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_OID );
+ }
+ store.setValue( PluginConstants.PREFS_HIERARCHY_VIEW_ABBREVIATE, limitButton.getSelection() );
+ store.setValue( PluginConstants.PREFS_HIERARCHY_VIEW_ABBREVIATE_MAX_LENGTH, lengthText.getText() );
+
+ store.setValue( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_DISPLAY, secondaryLabelButtonDisplay
+ .getSelection() );
+ if ( secondaryLabelCombo.getItem( secondaryLabelCombo.getSelectionIndex() ).equals( FIRST_NAME ) )
+ {
+ store.setValue( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL,
+ PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_FIRST_NAME );
+ }
+ else if ( secondaryLabelCombo.getItem( secondaryLabelCombo.getSelectionIndex() ).equals( ALL_ALIASES ) )
+ {
+ store.setValue( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL,
+ PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_ALL_ALIASES );
+ }
+ else if ( secondaryLabelCombo.getItem( secondaryLabelCombo.getSelectionIndex() ).equals( OID ) )
+ {
+ store.setValue( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL,
+ PluginConstants.PREFS_HIERARCHY_VIEW_LABEL_OID );
+ }
+ store.setValue( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE, secondaryLabelLimitButton
+ .getSelection() );
+ store.setValue( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH,
+ secondaryLabelLengthText.getText() );
+
+ return true;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init( IWorkbench workbench )
+ {
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/preferences/HierarchyViewPreferencePage.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/preferences/PluginPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/preferences/PluginPreferencePage.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/preferences/PluginPreferencePage.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/preferences/PluginPreferencePage.java Mon Nov 5 09:14:24 2007
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.schemaeditor.view.preferences;
+
+
+import java.util.Comparator;
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.PluginUtils;
+import org.apache.directory.studio.schemaeditor.model.io.SchemaConnector;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the Preference page for the Plugin
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class PluginPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
+{
+ /**
+ * Creates a new instance of PluginPreferencePage.
+ *
+ */
+ public PluginPreferencePage()
+ {
+ super();
+ setPreferenceStore( Activator.getDefault().getPreferenceStore() );
+ setDescription( "General settings for the Schema Editor Plugin" );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents( Composite parent )
+ {
+ Composite composite = new Composite( parent, SWT.NONE );
+ composite.setLayout( new GridLayout() );
+ composite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+
+ // SchemaConnectors Group
+ Group schemaConnectorsGroup = new Group( composite, SWT.NONE );
+ schemaConnectorsGroup.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ schemaConnectorsGroup.setLayout( new GridLayout( 2, true ) );
+ schemaConnectorsGroup.setText( "Schema Connectors" );
+
+ // Available Schema Connectors Label
+ Label availableSchemaConnectorsLabel = new Label( schemaConnectorsGroup, SWT.NONE );
+ availableSchemaConnectorsLabel.setText( "Available Connectors:" );
+
+ // Description Label
+ Label descriptionLabel = new Label( schemaConnectorsGroup, SWT.NONE );
+ descriptionLabel.setText( "Description:" );
+ // SchemaConnectors TableViewer
+ final TableViewer schemaConnectorsTableViewer = new TableViewer( schemaConnectorsGroup, SWT.BORDER | SWT.SINGLE
+ | SWT.FULL_SELECTION );
+ GridData gridData = new GridData( SWT.FILL, SWT.NONE, true, false );
+ gridData.heightHint = 125;
+ schemaConnectorsTableViewer.getTable().setLayoutData( gridData );
+ schemaConnectorsTableViewer.setContentProvider( new ArrayContentProvider() );
+ schemaConnectorsTableViewer.setLabelProvider( new LabelProvider()
+ {
+ public String getText( Object element )
+ {
+ return ( ( SchemaConnector ) element ).getName();
+ }
+
+
+ public Image getImage( Object element )
+ {
+ return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_SCHEMA_CONNECTOR ).createImage();
+ }
+ } );
+
+ schemaConnectorsTableViewer.setComparator( new ViewerComparator( new Comparator<String>()
+ {
+ public int compare( String o1, String o2 )
+ {
+ if ( ( o1 != null ) && ( o2 != null ) )
+ {
+ return o1.compareToIgnoreCase( o2 );
+ }
+
+ // Default
+ return 0;
+ }
+ } ) );
+
+ // schemaConnectorsTableViewer.setComparator( new ViewerComparator( new Comparator<SchemaConnector>()
+ // {
+ // public int compare( SchemaConnector o1, SchemaConnector o2 )
+ // {
+ // String name1 = o1.getName();
+ // String name2 = o2.getName();
+ //
+ // if ( ( name1 != null ) && ( name2 != null ) )
+ // {
+ // return name1.compareToIgnoreCase( name2 );
+ // }
+ //
+ // // Default
+ // return 0;
+ // }
+ // } ) );
+ schemaConnectorsTableViewer.setInput( PluginUtils.getSchemaConnectors() );
+
+ // Description Text
+ final Text descriptionText = new Text( schemaConnectorsGroup, SWT.BORDER | SWT.MULTI | SWT.READ_ONLY );
+ descriptionText.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+
+ schemaConnectorsTableViewer.addSelectionChangedListener( new ISelectionChangedListener()
+ {
+ public void selectionChanged( SelectionChangedEvent event )
+ {
+ SchemaConnector schemaConnector = ( SchemaConnector ) ( ( StructuredSelection ) schemaConnectorsTableViewer
+ .getSelection() ).getFirstElement();
+
+ if ( schemaConnector != null )
+ {
+ descriptionText.setText( schemaConnector.getDescription() );
+ }
+ }
+ } );
+
+ return parent;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init( IWorkbench workbench )
+ {
+ // Nothing to do
+ }
+}
Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/preferences/PluginPreferencePage.java
------------------------------------------------------------------------------
svn:eol-style = native