directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1220876 - in /directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors: ./ attributetype/ objectclass/
Date Mon, 19 Dec 2011 18:04:29 GMT
Author: pamarcelot
Date: Mon Dec 19 18:04:29 2011
New Revision: 1220876

URL: http://svn.apache.org/viewvc?rev=1220876&view=rev
Log:
Added utility methods for adding/removing listeners (with checks for nullity of the widget
and if the widget is disposed).

Modified:
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/AbstractSchemaObjectEditorPage.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorSourceCodePage.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorUsedByPage.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorSourceCodePage.java

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/AbstractSchemaObjectEditorPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/AbstractSchemaObjectEditorPage.java?rev=1220876&r1=1220875&r2=1220876&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/AbstractSchemaObjectEditorPage.java
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/AbstractSchemaObjectEditorPage.java
Mon Dec 19 18:04:29 2011
@@ -21,9 +21,22 @@
 package org.apache.directory.studio.schemaeditor.view.editors;
 
 
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
 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.events.IHyperlinkListener;
+import org.eclipse.ui.forms.widgets.Hyperlink;
 
 
 /**
@@ -114,4 +127,250 @@ public abstract class AbstractSchemaObje
             addListeners();
         }
     }
+
+
+    /**
+     * Adds a modify listener to the given Text.
+     *
+     * @param text the Text control
+     * @param listener the listener
+     */
+    protected void addModifyListener( Text text, ModifyListener listener )
+    {
+        if ( ( text != null ) && ( !text.isDisposed() ) && ( listener !=
null ) )
+        {
+            text.addModifyListener( listener );
+        }
+    }
+
+
+    /**
+     * Adds a modify listener to the given Text.
+     *
+     * @param text the StyledText control
+     * @param listener the listener
+     */
+    protected void addModifyListener( StyledText text, ModifyListener listener )
+    {
+        if ( ( text != null ) && ( !text.isDisposed() ) && ( listener !=
null ) )
+        {
+            text.addModifyListener( listener );
+        }
+    }
+
+
+    /**
+     * Adds a modify listener to the given Text.
+     *
+     * @param combo the Combo control
+     * @param listener the listener
+     */
+    protected void addModifyListener( Combo combo, ModifyListener listener )
+    {
+        if ( ( combo != null ) && ( !combo.isDisposed() ) && ( listener !=
null ) )
+        {
+            combo.addModifyListener( listener );
+        }
+    }
+
+
+    /**
+     * Adds a verify listener to the given Text.
+     *
+     * @param text the Text control
+     * @param listener the listener
+     */
+    protected void addVerifyListener( Text text, VerifyListener listener )
+    {
+        if ( ( text != null ) && ( !text.isDisposed() ) && ( listener !=
null ) )
+        {
+            text.addVerifyListener( listener );
+        }
+    }
+
+
+    /**
+     * Adds a selection changed listener to the given Viewer.
+     *
+     * @param viewer the viewer control
+     * @param listener the listener
+     */
+    protected void addSelectionChangedListener( Viewer viewer, ISelectionChangedListener
listener )
+    {
+        if ( ( viewer != null ) && ( viewer.getControl() != null ) && ( !viewer.getControl().isDisposed()
)
+            && ( listener != null ) )
+        {
+            viewer.addSelectionChangedListener( listener );
+        }
+    }
+
+
+    /**
+     * Adds an hyperlink listener to the given HyperLink.
+     *
+     * @param hyperLink the HyperLink
+     * @param listener the listener
+     */
+    protected void addHyperlinkListener( Hyperlink hyperLink, IHyperlinkListener listener
)
+    {
+        if ( ( hyperLink != null ) && ( !hyperLink.isDisposed() ) && ( listener
!= null ) )
+        {
+            hyperLink.addHyperlinkListener( listener );
+        }
+    }
+
+
+    /**
+     * Adds a selection listener to the given Button.
+     *
+     * @param button the Button control
+     * @param listener the listener
+     */
+    protected void addSelectionListener( Button button, SelectionListener listener )
+    {
+        if ( ( button != null ) && ( !button.isDisposed() ) && ( listener
!= null ) )
+        {
+            button.addSelectionListener( listener );
+        }
+    }
+
+
+    /**
+     * Adds a mouse listener to the given Table.
+     *
+     * @param table the Table control
+     * @param listener the listener
+     */
+    protected void addMouseListener( Table table, MouseListener listener )
+    {
+        if ( ( table != null ) && ( !table.isDisposed() ) && ( listener !=
null ) )
+        {
+            table.addMouseListener( listener );
+        }
+    }
+
+
+    /**
+     * Removes a modify listener from the given Text.
+     *
+     * @param text the Text control
+     * @param listener the listener
+     */
+    protected void removeModifyListener( Text text, ModifyListener listener )
+    {
+        if ( ( text != null ) && ( !text.isDisposed() ) && ( listener !=
null ) )
+        {
+            text.removeModifyListener( listener );
+        }
+    }
+
+
+    /**
+     * Removes a modify listener from the given Text.
+     *
+     * @param text the StyledText control
+     * @param listener the listener
+     */
+    protected void removeModifyListener( StyledText text, ModifyListener listener )
+    {
+        if ( ( text != null ) && ( !text.isDisposed() ) && ( listener !=
null ) )
+        {
+            text.removeModifyListener( listener );
+        }
+    }
+
+
+    /**
+     * Removes a modify listener from the given Text.
+     *
+     * @param combo the Combo control
+     * @param listener the listener
+     */
+    protected void removeModifyListener( Combo combo, ModifyListener listener )
+    {
+        if ( ( combo != null ) && ( !combo.isDisposed() ) && ( listener !=
null ) )
+        {
+            combo.removeModifyListener( listener );
+        }
+    }
+
+
+    /**
+     * Removes a verify listener from the given Text.
+     *
+     * @param text the Text control
+     * @param listener the listener
+     */
+    protected void removeVerifyListener( Text text, VerifyListener listener )
+    {
+        if ( ( text != null ) && ( !text.isDisposed() ) && ( listener !=
null ) )
+        {
+            text.removeVerifyListener( listener );
+        }
+    }
+
+
+    /**
+     * Removes a selection changed listener from the given Viewer.
+     *
+     * @param viewer
+     *      the viewer control
+     * @param listener
+     *      the listener
+     */
+    protected void removeSelectionChangedListener( Viewer viewer, ISelectionChangedListener
listener )
+    {
+        if ( ( viewer != null ) && ( viewer.getControl() != null ) && ( !viewer.getControl().isDisposed()
)
+            && ( listener != null ) )
+        {
+            viewer.removeSelectionChangedListener( listener );
+        }
+    }
+
+
+    /**
+     * Removes an hyperlink listener from the given HyperLink.
+     *
+     * @param hyperLink the HyperLink
+     * @param listener the listener
+     */
+    protected void removeHyperlinkListener( Hyperlink hyperLink, IHyperlinkListener listener
)
+    {
+        if ( ( hyperLink != null ) && ( !hyperLink.isDisposed() ) && ( listener
!= null ) )
+        {
+            hyperLink.removeHyperlinkListener( listener );
+        }
+    }
+
+
+    /**
+     * Removes a selection listener from the given Button.
+     *
+     * @param button
+     *      the Button control
+     * @param listener
+     *      the listener
+     */
+    protected void removeSelectionListener( Button button, SelectionListener listener )
+    {
+        if ( ( button != null ) && ( !button.isDisposed() ) && ( listener
!= null ) )
+        {
+            button.removeSelectionListener( listener );
+        }
+    }
+
+
+    /**
+     * Removes a mouse listener from the given Table.
+     *
+     * @param table the Table control
+     * @param listener the listener
+     */
+    protected void removeMouseListener( Table table, MouseListener listener )
+    {
+        if ( ( table != null ) && ( !table.isDisposed() ) && ( listener !=
null ) )
+        {
+            table.removeMouseListener( listener );
+        }
+    }
 }

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java?rev=1220876&r1=1220875&r2=1220876&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java
Mon Dec 19 18:04:29 2011
@@ -1144,25 +1144,25 @@ public class AttributeTypeEditorOverview
      */
     protected void addListeners()
     {
-        aliasesText.addModifyListener( aliasesTextModifyListener );
-        aliasesButton.addSelectionListener( aliasesButtonListener );
-        oidText.addModifyListener( oidTextModifyListener );
-        oidText.addVerifyListener( oidTextVerifyListener );
-        schemaLink.addHyperlinkListener( schemaLinkListener );
-        descriptionText.addModifyListener( descriptionTextListener );
-        supLabel.addHyperlinkListener( supLabelListener );
-        supComboViewer.addSelectionChangedListener( supComboViewerListener );
-        usageCombo.addModifyListener( usageComboListener );
-        syntaxComboViewer.addSelectionChangedListener( syntaxComboViewerListener );
-        syntaxLengthText.addModifyListener( syntaxLengthTextModifyListener );
-        syntaxLengthText.addVerifyListener( syntaxLengthTextVerifyListener );
-        obsoleteCheckbox.addSelectionListener( obsoleteCheckboxListener );
-        singleValueCheckbox.addSelectionListener( singleValueCheckboxListener );
-        collectiveCheckbox.addSelectionListener( collectiveCheckboxListener );
-        noUserModificationCheckbox.addSelectionListener( noUserModificationCheckboxListener
);
-        equalityComboViewer.addSelectionChangedListener( equalityComboViewerListener );
-        orderingComboViewer.addSelectionChangedListener( orderingComboViewerListener );
-        substringComboViewer.addSelectionChangedListener( substringComboViewerListener );
+        addModifyListener( aliasesText, aliasesTextModifyListener );
+        addSelectionListener( aliasesButton, aliasesButtonListener );
+        addModifyListener( oidText, oidTextModifyListener );
+        addVerifyListener( oidText, oidTextVerifyListener );
+        addHyperlinkListener( schemaLink, schemaLinkListener );
+        addModifyListener( descriptionText, descriptionTextListener );
+        addHyperlinkListener( supLabel, supLabelListener );
+        addSelectionChangedListener( supComboViewer, supComboViewerListener );
+        addModifyListener( usageCombo, usageComboListener );
+        addSelectionChangedListener( syntaxComboViewer, syntaxComboViewerListener );
+        addModifyListener( syntaxLengthText, syntaxLengthTextModifyListener );
+        addVerifyListener( syntaxLengthText, syntaxLengthTextVerifyListener );
+        addSelectionListener( obsoleteCheckbox, obsoleteCheckboxListener );
+        addSelectionListener( singleValueCheckbox, singleValueCheckboxListener );
+        addSelectionListener( collectiveCheckbox, collectiveCheckboxListener );
+        addSelectionListener( noUserModificationCheckbox, noUserModificationCheckboxListener
);
+        addSelectionChangedListener( equalityComboViewer, equalityComboViewerListener );
+        addSelectionChangedListener( orderingComboViewer, orderingComboViewerListener );
+        addSelectionChangedListener( substringComboViewer, substringComboViewerListener );
 
         Display.getCurrent().addFilter( SWT.MouseWheel, mouseWheelFilter );
     }
@@ -1173,25 +1173,25 @@ public class AttributeTypeEditorOverview
      */
     protected void removeListeners()
     {
-        aliasesText.removeModifyListener( aliasesTextModifyListener );
-        aliasesButton.removeSelectionListener( aliasesButtonListener );
-        oidText.removeModifyListener( oidTextModifyListener );
-        oidText.removeVerifyListener( oidTextVerifyListener );
-        schemaLink.removeHyperlinkListener( schemaLinkListener );
-        descriptionText.removeModifyListener( descriptionTextListener );
-        supLabel.removeHyperlinkListener( supLabelListener );
-        supComboViewer.removeSelectionChangedListener( supComboViewerListener );
-        usageCombo.removeModifyListener( usageComboListener );
-        syntaxComboViewer.removeSelectionChangedListener( syntaxComboViewerListener );
-        syntaxLengthText.removeModifyListener( syntaxLengthTextModifyListener );
-        syntaxLengthText.removeVerifyListener( syntaxLengthTextVerifyListener );
-        obsoleteCheckbox.removeSelectionListener( obsoleteCheckboxListener );
-        singleValueCheckbox.removeSelectionListener( singleValueCheckboxListener );
-        collectiveCheckbox.removeSelectionListener( collectiveCheckboxListener );
-        noUserModificationCheckbox.removeSelectionListener( noUserModificationCheckboxListener
);
-        equalityComboViewer.removeSelectionChangedListener( equalityComboViewerListener );
-        orderingComboViewer.removeSelectionChangedListener( orderingComboViewerListener );
-        substringComboViewer.removeSelectionChangedListener( substringComboViewerListener
);
+        removeModifyListener( aliasesText, aliasesTextModifyListener );
+        removeSelectionListener( aliasesButton, aliasesButtonListener );
+        removeModifyListener( oidText, oidTextModifyListener );
+        removeVerifyListener( oidText, oidTextVerifyListener );
+        removeHyperlinkListener( schemaLink, schemaLinkListener );
+        removeModifyListener( descriptionText, descriptionTextListener );
+        removeHyperlinkListener( supLabel, supLabelListener );
+        removeSelectionChangedListener( supComboViewer, supComboViewerListener );
+        removeModifyListener( usageCombo, usageComboListener );
+        removeSelectionChangedListener( syntaxComboViewer, syntaxComboViewerListener );
+        removeModifyListener( syntaxLengthText, syntaxLengthTextModifyListener );
+        removeVerifyListener( syntaxLengthText, syntaxLengthTextVerifyListener );
+        removeSelectionListener( obsoleteCheckbox, obsoleteCheckboxListener );
+        removeSelectionListener( singleValueCheckbox, singleValueCheckboxListener );
+        removeSelectionListener( collectiveCheckbox, collectiveCheckboxListener );
+        removeSelectionListener( noUserModificationCheckbox, noUserModificationCheckboxListener
);
+        removeSelectionChangedListener( equalityComboViewer, equalityComboViewerListener
);
+        removeSelectionChangedListener( orderingComboViewer, orderingComboViewerListener
);
+        removeSelectionChangedListener( substringComboViewer, substringComboViewerListener
);
 
         Display.getCurrent().removeFilter( SWT.MouseWheel, mouseWheelFilter );
     }

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorSourceCodePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorSourceCodePage.java?rev=1220876&r1=1220875&r2=1220876&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorSourceCodePage.java
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorSourceCodePage.java
Mon Dec 19 18:04:29 2011
@@ -152,7 +152,10 @@ public class AttributeTypeEditorSourceCo
      */
     protected void addListeners()
     {
-        schemaSourceViewer.getTextWidget().addModifyListener( schemaSourceViewerListener
);
+        if ( schemaSourceViewer != null )
+        {
+            addModifyListener( schemaSourceViewer.getTextWidget(), schemaSourceViewerListener
);
+        }
     }
 
 
@@ -161,7 +164,10 @@ public class AttributeTypeEditorSourceCo
      */
     protected void removeListeners()
     {
-        schemaSourceViewer.getTextWidget().removeModifyListener( schemaSourceViewerListener
);
+        if ( schemaSourceViewer != null )
+        {
+            removeModifyListener( schemaSourceViewer.getTextWidget(), schemaSourceViewerListener
);
+        }
     }
 
 

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorUsedByPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorUsedByPage.java?rev=1220876&r1=1220875&r2=1220876&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorUsedByPage.java
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorUsedByPage.java
Mon Dec 19 18:04:29 2011
@@ -351,8 +351,8 @@ public class AttributeTypeEditorUsedByPa
      */
     protected void addListeners()
     {
-        mandatoryAttributeTable.addMouseListener( mandatoryAttributeTableListener );
-        optionalAttibuteTable.addMouseListener( optionalAttibuteTableListener );
+        addMouseListener( mandatoryAttributeTable, mandatoryAttributeTableListener );
+        addMouseListener( optionalAttibuteTable, optionalAttibuteTableListener );
     }
 
 
@@ -361,8 +361,8 @@ public class AttributeTypeEditorUsedByPa
      */
     protected void removeListeners()
     {
-        mandatoryAttributeTable.removeMouseListener( mandatoryAttributeTableListener );
-        optionalAttibuteTable.removeMouseListener( optionalAttibuteTableListener );
+        removeMouseListener( mandatoryAttributeTable, mandatoryAttributeTableListener );
+        removeMouseListener( optionalAttibuteTable, optionalAttibuteTableListener );
     }
 
 

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java?rev=1220876&r1=1220875&r2=1220876&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java
Mon Dec 19 18:04:29 2011
@@ -1186,23 +1186,23 @@ public class ObjectClassEditorOverviewPa
      */
     protected void addListeners()
     {
-        aliasesText.addModifyListener( aliasesTextModifyListener );
-        aliasesButton.addSelectionListener( aliasesButtonListener );
-        oidText.addModifyListener( oidTextModifyListener );
-        oidText.addVerifyListener( oidTextVerifyListener );
-        descriptionText.addModifyListener( descriptionTextListener );
-        addButtonSuperiorsTable.addSelectionListener( addButtonSuperiorsTableListener );
-        removeButtonSuperiorsTable.addSelectionListener( removeButtonSuperiorsTableListener
);
-        classTypeCombo.addModifyListener( classTypeListener );
-        obsoleteCheckbox.addSelectionListener( obsoleteListener );
-        addButtonMandatoryTable.addSelectionListener( addButtonMandatoryTableListener );
-        removeButtonMandatoryTable.addSelectionListener( removeButtonMandatoryTableListener
);
-        addButtonOptionalTable.addSelectionListener( addButtonOptionalTableListener );
-        removeButtonOptionalTable.addSelectionListener( removeButtonOptionalTableListener
);
-        schemaLink.addHyperlinkListener( schemaLinkListener );
-        superiorsTable.addMouseListener( superiorsTableListener );
-        mandatoryAttributesTable.addMouseListener( mandatoryAttributesTableListener );
-        optionalAttributesTable.addMouseListener( optionalAttributesTableListener );
+        addModifyListener( aliasesText, aliasesTextModifyListener );
+        addSelectionListener( aliasesButton, aliasesButtonListener );
+        addModifyListener( oidText, oidTextModifyListener );
+        addVerifyListener( oidText, oidTextVerifyListener );
+        addModifyListener( descriptionText, descriptionTextListener );
+        addSelectionListener( addButtonSuperiorsTable, addButtonSuperiorsTableListener );
+        addSelectionListener( removeButtonSuperiorsTable, removeButtonSuperiorsTableListener
);
+        addModifyListener( classTypeCombo, classTypeListener );
+        addSelectionListener( obsoleteCheckbox, obsoleteListener );
+        addSelectionListener( addButtonMandatoryTable, addButtonMandatoryTableListener );
+        addSelectionListener( addButtonMandatoryTable, removeButtonMandatoryTableListener
);
+        addSelectionListener( addButtonOptionalTable, addButtonOptionalTableListener );
+        addSelectionListener( removeButtonOptionalTable, removeButtonOptionalTableListener
);
+        addHyperlinkListener( schemaLink, schemaLinkListener );
+        addMouseListener( superiorsTable, superiorsTableListener );
+        addMouseListener( mandatoryAttributesTable, mandatoryAttributesTableListener );
+        addMouseListener( optionalAttributesTable, optionalAttributesTableListener );
 
         Display.getCurrent().addFilter( SWT.MouseWheel, mouseWheelFilter );
     }
@@ -1213,23 +1213,23 @@ public class ObjectClassEditorOverviewPa
      */
     protected void removeListeners()
     {
-        aliasesText.removeModifyListener( aliasesTextModifyListener );
-        aliasesButton.removeSelectionListener( aliasesButtonListener );
-        oidText.removeModifyListener( oidTextModifyListener );
-        oidText.removeVerifyListener( oidTextVerifyListener );
-        schemaLink.removeHyperlinkListener( schemaLinkListener );
-        descriptionText.removeModifyListener( descriptionTextListener );
-        superiorsTable.removeMouseListener( superiorsTableListener );
-        addButtonSuperiorsTable.removeSelectionListener( addButtonSuperiorsTableListener
);
-        removeButtonSuperiorsTable.removeSelectionListener( removeButtonSuperiorsTableListener
);
-        classTypeCombo.removeModifyListener( classTypeListener );
-        obsoleteCheckbox.removeSelectionListener( obsoleteListener );
-        mandatoryAttributesTable.removeMouseListener( mandatoryAttributesTableListener );
-        addButtonMandatoryTable.removeSelectionListener( addButtonMandatoryTableListener
);
-        removeButtonMandatoryTable.removeSelectionListener( removeButtonMandatoryTableListener
);
-        optionalAttributesTable.removeMouseListener( optionalAttributesTableListener );
-        addButtonOptionalTable.removeSelectionListener( addButtonOptionalTableListener );
-        removeButtonOptionalTable.removeSelectionListener( removeButtonOptionalTableListener
);
+        removeModifyListener( aliasesText, aliasesTextModifyListener );
+        removeSelectionListener( aliasesButton, aliasesButtonListener );
+        removeModifyListener( oidText, oidTextModifyListener );
+        removeVerifyListener( oidText, oidTextVerifyListener );
+        removeHyperlinkListener( schemaLink, schemaLinkListener );
+        removeModifyListener( descriptionText, descriptionTextListener );
+        removeMouseListener( superiorsTable, superiorsTableListener );
+        removeSelectionListener( addButtonSuperiorsTable, addButtonSuperiorsTableListener
);
+        removeSelectionListener( removeButtonSuperiorsTable, removeButtonSuperiorsTableListener
);
+        removeModifyListener( classTypeCombo, classTypeListener );
+        removeSelectionListener( obsoleteCheckbox, obsoleteListener );
+        removeMouseListener( mandatoryAttributesTable, mandatoryAttributesTableListener );
+        removeSelectionListener( addButtonMandatoryTable, addButtonMandatoryTableListener
);
+        removeSelectionListener( removeButtonMandatoryTable, removeButtonMandatoryTableListener
);
+        removeMouseListener( optionalAttributesTable, optionalAttributesTableListener );
+        removeSelectionListener( addButtonOptionalTable, addButtonOptionalTableListener );
+        removeSelectionListener( removeButtonOptionalTable, removeButtonOptionalTableListener
);
 
         Display.getCurrent().removeFilter( SWT.MouseWheel, mouseWheelFilter );
     }

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorSourceCodePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorSourceCodePage.java?rev=1220876&r1=1220875&r2=1220876&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorSourceCodePage.java
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorSourceCodePage.java
Mon Dec 19 18:04:29 2011
@@ -150,7 +150,10 @@ public class ObjectClassEditorSourceCode
      */
     protected void addListeners()
     {
-        schemaSourceViewer.getTextWidget().addModifyListener( schemaSourceViewerListener
);
+        if ( schemaSourceViewer != null )
+        {
+            schemaSourceViewer.getTextWidget().addModifyListener( schemaSourceViewerListener
);
+        }
     }
 
 
@@ -159,7 +162,10 @@ public class ObjectClassEditorSourceCode
      */
     protected void removeListeners()
     {
-        schemaSourceViewer.getTextWidget().removeModifyListener( schemaSourceViewerListener
);
+        if ( schemaSourceViewer != null )
+        {
+            schemaSourceViewer.getTextWidget().removeModifyListener( schemaSourceViewerListener
);
+        }
     }
 
 



Mime
View raw message