Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Fix for PR 61695 (1.2 release branch)

Folks,

  This is a patch for the 1.2 release branch which addresses the editor
scalability problem described in PR 61695.  In going through the editor
code, I realized that there is a lot of cruft lying around from the 1.0
days.  I'll follow up this patch with a head branch patch which does 
some of this clean-up.

  This patch should be applied to the 1.2 branch for anyone who is 
wanting to release/support product on that branch.

For the changelog:

- Remove listeners when the component is destroyed and properly call out
  to all of the dispose methods.

Index: src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java,v
retrieving revision 1.15
diff -u -r1.15 CContentOutlinePage.java
--- src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java	11 Sep 2003 17:13:00 -0000	1.15
+++ src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java	21 May 2004 00:53:38 -0000
@@ -216,6 +216,11 @@
 	
 	public void dispose() {
 		CUIPlugin.getDefault().getProblemMarkerManager().removeListener(treeViewer);
+		
+		if (fTogglePresentation != null) {
+			fTogglePresentation.setEditor(null);	
+		}
+		
 		if (fMemberFilterActionGroup != null) {
 			fMemberFilterActionGroup.dispose();
 			fMemberFilterActionGroup= null;
Index: src/org/eclipse/cdt/internal/ui/editor/CEditor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java,v
retrieving revision 1.32.2.1
diff -u -r1.32.2.1 CEditor.java
--- src/org/eclipse/cdt/internal/ui/editor/CEditor.java	30 Dec 2003 16:34:41 -0000	1.32.2.1
+++ src/org/eclipse/cdt/internal/ui/editor/CEditor.java	21 May 2004 00:53:38 -0000
@@ -155,6 +155,8 @@
 		CTextTools textTools = CUIPlugin.getDefault().getTextTools();
 		setSourceViewerConfiguration(new CSourceViewerConfiguration(textTools, this));
 		setDocumentProvider(CUIPlugin.getDefault().getDocumentProvider());
+		
+		//TF NOTE: This should be handled by the parent class
 		setRangeIndicator(new DefaultRangeIndicator());
 		setPreferenceStore(CUIPlugin.getDefault().getPreferenceStore());
 
@@ -401,18 +403,34 @@
 
 		if (fCEditorErrorTickUpdater != null) {
 			fCEditorErrorTickUpdater.setAnnotationModel(null);
+			fCEditorErrorTickUpdater.dispose();
 			fCEditorErrorTickUpdater = null;
 		}
+		
 		if (fBracketMatcher != null) {
 			fBracketMatcher.dispose();
 			fBracketMatcher = null;
 		}
+		
 		if (fPropertyChangeListener != null) {
 			Preferences preferences = CCorePlugin.getDefault().getPluginPreferences();
 			preferences.removePropertyChangeListener(fPropertyChangeListener);			
 			IPreferenceStore preferenceStore = getPreferenceStore();
 			preferenceStore.removePropertyChangeListener(fPropertyChangeListener);
 		}
+		
+		if (fBracketMatcher != null) {
+			fBracketMatcher.dispose();
+			fBracketMatcher = null;
+		}
+		
+		if (fOutlinePage != null) {
+			fOutlinePage.dispose();
+			fOutlinePage = null;
+		}
+		
+		fAnnotationPreferences = null;
+		
 		super.dispose();
 	}
 
Index: src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java,v
retrieving revision 1.10
diff -u -r1.10 CEditorActionContributor.java
--- src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java	21 Apr 2003 16:21:13 -0000	1.10
+++ src/org/eclipse/cdt/internal/ui/editor/CEditorActionContributor.java	21 May 2004 00:53:39 -0000
@@ -190,6 +190,14 @@
 		fAddInclude.setAction(getAction(textEditor, "AddIncludeOnSelection")); //$NON-NLS-1$
 		fOpenOnSelection.setAction(getAction(textEditor, "OpenOnSelection")); //$NON-NLS-1$
 	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.IEditorActionBarContributor#dispose()
+	 */
+	public void dispose() {
+		setActiveEditor(null);
+		super.dispose();
+	}
 	
 	/*
 	 * @see EditorActionBarContributor#contributeToStatusLine(IStatusLineManager)
Index: src/org/eclipse/cdt/internal/ui/editor/CEditorErrorTickUpdater.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorErrorTickUpdater.java,v
retrieving revision 1.3
diff -u -r1.3 CEditorErrorTickUpdater.java
--- src/org/eclipse/cdt/internal/ui/editor/CEditorErrorTickUpdater.java	6 Feb 2003 20:48:31 -0000	1.3
+++ src/org/eclipse/cdt/internal/ui/editor/CEditorErrorTickUpdater.java	21 May 2004 00:53:39 -0000
@@ -91,6 +91,14 @@
 		}
 	}	
 	
+	public void dispose() {
+		if(fLabelProvider != null) {
+			fLabelProvider.dispose();
+			fLabelProvider = null;		
+		}
+		fAnnotationModel = null;
+	}
+	
 }
 
 

Back to the top