diff options
Diffstat (limited to 'bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java')
-rw-r--r-- | bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java index f92cbbc9e3..244dfd932d 100644 --- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java +++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2012 IBM Corporation and others. + * Copyright (c) 2001, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -105,6 +105,8 @@ import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.custom.VerifyKeyListener; import org.eclipse.swt.dnd.DND; import org.eclipse.swt.dnd.DropTarget; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.events.VerifyEvent; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Image; @@ -1112,7 +1114,7 @@ public class StructuredTextEditor extends TextEditor { private boolean fSelectionChangedFromGoto = false; - private final CharacterPairListener fPairInserter = new CharacterPairListener(); + private CharacterPairListener fPairInserter = new CharacterPairListener(); /** * Creates a new Structured Text Editor. @@ -1736,6 +1738,7 @@ public class StructuredTextEditor extends TextEditor { if (fOutlineHandler != null) { fOutlineHandler.dispose(); + fOutlineHandler = null; } // dispose of selection history if (fSelectionHistory != null) { @@ -1756,9 +1759,11 @@ public class StructuredTextEditor extends TextEditor { // dispose of menus that were being tracked if (fTextContextMenu != null) { fTextContextMenu.dispose(); + fTextContextMenu = null; } if (fRulerContextMenu != null) { fRulerContextMenu.dispose(); + fRulerContextMenu = null; } if (fTextContextMenuManager != null) { fTextContextMenuManager.removeMenuListener(getContextMenuListener()); @@ -1779,6 +1784,8 @@ public class StructuredTextEditor extends TextEditor { // less severe. if (fStructuredModel != null) { fStructuredModel.removeModelStateListener(getInternalModelStateListener()); + //fStructuredModel.setStructuredDocument(null); + fStructuredModel = null; } // BUG155335 - if there was no document provider, there was nothing @@ -1801,7 +1808,9 @@ public class StructuredTextEditor extends TextEditor { } if (fOutlinePageListener != null) { fOutlinePage.removeSelectionChangedListener(fOutlinePageListener); + fOutlinePageListener = null; } + fOutlinePage = null; } fEditorDisposed = true; @@ -1817,8 +1826,10 @@ public class StructuredTextEditor extends TextEditor { uninstallSemanticHighlighting(); - if (fPairInserter != null) + if (fPairInserter != null) { fPairInserter.dispose(); + fPairInserter = null; + } setPreferenceStore(null); @@ -1833,6 +1844,12 @@ public class StructuredTextEditor extends TextEditor { if (fStructuredSelectionProvider != null) { fStructuredSelectionProvider.dispose(); + fStructuredSelectionProvider = null; + } + + if (fStatusLineLabelProvider != null) { + fStatusLineLabelProvider.dispose(); + fStatusLineLabelProvider = null; } setStatusLineMessage(null); @@ -2083,7 +2100,7 @@ public class StructuredTextEditor extends TextEditor { } // content outline page else if (IContentOutlinePage.class.equals(required)) { - if (fOutlinePage == null || fOutlinePage.getControl() == null || fOutlinePage.getControl().isDisposed()) { + if (fOutlinePage == null) { ContentOutlineConfiguration cfg = createContentOutlineConfiguration(); if (cfg != null) { ConfigurableContentOutlinePage outlinePage = new ConfigurableContentOutlinePage(); @@ -2637,6 +2654,14 @@ public class StructuredTextEditor extends TextEditor { fDropAdapter.setTextViewer(textViewer); fDropTarget.setTransfer(fDropAdapter.getTransfers()); fDropTarget.addDropListener(fDropAdapter); + fDropTarget.addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + fDropTarget.removeDropListener(fDropAdapter); + fDropTarget.removeDisposeListener(this); + fDropTarget.dispose(); + } + }); } /* |