mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
PR 61965
From Thomas Fletcher: 2.0 mainline scalability patch to call dispose methods and remove listeners
This commit is contained in:
parent
40f9982534
commit
4a8eacaa59
10 changed files with 221 additions and 85 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2004-05-26 Alain Magloire
|
||||||
|
|
||||||
|
PR 61965
|
||||||
|
From Thomas Fletcher:
|
||||||
|
2.0 mainline scalability patch to
|
||||||
|
call dispose methods and remove listeners
|
||||||
|
|
||||||
2004-05-21 Andrew Niefer
|
2004-05-21 Andrew Niefer
|
||||||
Indexer Problem reporting (bug 43014, 62979)
|
Indexer Problem reporting (bug 43014, 62979)
|
||||||
* plugin.xml
|
* plugin.xml
|
||||||
|
|
|
@ -282,10 +282,18 @@ public class CPluginImages {
|
||||||
* Sets all available image descriptors for the given action.
|
* Sets all available image descriptors for the given action.
|
||||||
*/
|
*/
|
||||||
public static void setImageDescriptors(IAction action, String type, String relPath) {
|
public static void setImageDescriptors(IAction action, String type, String relPath) {
|
||||||
relPath= relPath.substring(NAME_PREFIX_LENGTH);
|
//Use the managed version so that we ensure that there is no resource handle leaks
|
||||||
action.setDisabledImageDescriptor(create(T + "d" + type, relPath)); //$NON-NLS-1$
|
//Let the widget itself manage the disabled/hover attribution. This was a huge leak
|
||||||
action.setHoverImageDescriptor(create(T + "c" + type, relPath)); //$NON-NLS-1$
|
// relPath= relPath.substring(NAME_PREFIX_LENGTH);
|
||||||
action.setImageDescriptor(create(T + "e" + type, relPath)); //$NON-NLS-1$
|
// action.setDisabledImageDescriptor(create(T + "d" + type, relPath)); //$NON-NLS-1$
|
||||||
|
// action.setHoverImageDescriptor(create(T + "c" + type, relPath)); //$NON-NLS-1$
|
||||||
|
// action.setImageDescriptor(create(T + "e" + type, relPath)); //$NON-NLS-1$
|
||||||
|
|
||||||
|
ImageDescriptor desc = getImageRegistry().getDescriptor(relPath);
|
||||||
|
if(desc == null) {
|
||||||
|
desc = createManaged(T + "e" + type, relPath);
|
||||||
|
}
|
||||||
|
action.setImageDescriptor(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -137,9 +137,6 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
|
||||||
}
|
}
|
||||||
|
|
||||||
fRefactoringActionGroup.fillContextMenu(menu);
|
fRefactoringActionGroup.fillContextMenu(menu);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -147,7 +144,6 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
|
||||||
*/
|
*/
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
treeViewer = new ProblemTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
|
treeViewer = new ProblemTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
|
||||||
treeViewer.addSelectionChangedListener(this);
|
|
||||||
|
|
||||||
treeViewer.setContentProvider(new CElementContentProvider(true, true));
|
treeViewer.setContentProvider(new CElementContentProvider(true, true));
|
||||||
treeViewer.setLabelProvider(new StandardCElementLabelProvider());
|
treeViewer.setLabelProvider(new StandardCElementLabelProvider());
|
||||||
|
@ -167,29 +163,54 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
|
||||||
Menu menu= manager.createContextMenu(control);
|
Menu menu= manager.createContextMenu(control);
|
||||||
control.setMenu(menu);
|
control.setMenu(menu);
|
||||||
|
|
||||||
|
|
||||||
// register global actions
|
// register global actions
|
||||||
IPageSite site= getSite();
|
IPageSite site= getSite();
|
||||||
site.registerContextMenu(fContextMenuId, manager, treeViewer);
|
site.registerContextMenu(fContextMenuId, manager, treeViewer);
|
||||||
site.setSelectionProvider(treeViewer);
|
site.setSelectionProvider(treeViewer);
|
||||||
|
|
||||||
IActionBars bars= site.getActionBars();
|
IActionBars bars= site.getActionBars();
|
||||||
bars.setGlobalActionHandler(ICEditorActionDefinitionIds.TOGGLE_PRESENTATION, fTogglePresentation);
|
bars.setGlobalActionHandler(ICEditorActionDefinitionIds.TOGGLE_PRESENTATION, fTogglePresentation);
|
||||||
|
|
||||||
registerToolbarActions();
|
|
||||||
|
|
||||||
fSelectionSearchGroup = new SelectionSearchGroup(this);
|
fSelectionSearchGroup = new SelectionSearchGroup(this);
|
||||||
fRefactoringActionGroup = new RefactoringActionGroup(this, null);
|
fRefactoringActionGroup = new RefactoringActionGroup(this, null);
|
||||||
|
|
||||||
treeViewer.setInput(fInput);
|
treeViewer.setInput(fInput);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
CUIPlugin.getDefault().getProblemMarkerManager().removeListener(treeViewer);
|
CUIPlugin.getDefault().getProblemMarkerManager().removeListener(treeViewer);
|
||||||
|
|
||||||
|
if (treeViewer != null) {
|
||||||
|
treeViewer.removeSelectionChangedListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fTogglePresentation != null) {
|
||||||
|
fTogglePresentation.setEditor(null);
|
||||||
|
fTogglePresentation= null;
|
||||||
|
}
|
||||||
|
|
||||||
if (fMemberFilterActionGroup != null) {
|
if (fMemberFilterActionGroup != null) {
|
||||||
fMemberFilterActionGroup.dispose();
|
fMemberFilterActionGroup.dispose();
|
||||||
fMemberFilterActionGroup= null;
|
fMemberFilterActionGroup= null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fRefactoringActionGroup != null) {
|
||||||
|
fRefactoringActionGroup.dispose();
|
||||||
|
fRefactoringActionGroup= null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fSelectionSearchGroup != null) {
|
||||||
|
fSelectionSearchGroup.dispose();
|
||||||
|
fSelectionSearchGroup= null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectionChangedListeners != null) {
|
||||||
|
selectionChangedListeners.clear();
|
||||||
|
selectionChangedListeners= null;
|
||||||
|
}
|
||||||
|
|
||||||
|
fInput= null;
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,6 +222,9 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
|
||||||
|
|
||||||
LexicalSortingAction action= new LexicalSortingAction(getTreeViewer());
|
LexicalSortingAction action= new LexicalSortingAction(getTreeViewer());
|
||||||
toolBarManager.add(action);
|
toolBarManager.add(action);
|
||||||
|
|
||||||
|
fMemberFilterActionGroup= new MemberFilterActionGroup(treeViewer, "COutlineViewer"); //$NON-NLS-1$
|
||||||
|
fMemberFilterActionGroup.fillActionBars(actionBars);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -276,8 +300,8 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
|
||||||
if (treeViewer != null)
|
if (treeViewer != null)
|
||||||
treeViewer.setSelection(selection);
|
treeViewer.setSelection(selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Set the current input to the content provider.
|
||||||
* @param unit
|
* @param unit
|
||||||
*/
|
*/
|
||||||
public void setInput(ITranslationUnit unit) {
|
public void setInput(ITranslationUnit unit) {
|
||||||
|
@ -288,16 +312,5 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
|
||||||
contentUpdated();
|
contentUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerToolbarActions() {
|
|
||||||
|
|
||||||
IToolBarManager toolBarManager= getSite().getActionBars().getToolBarManager();
|
|
||||||
if (toolBarManager != null) {
|
|
||||||
//toolBarManager.add(new ClassOnlyAction());
|
|
||||||
//toolBarManager.add(new LexicalSortingAction());
|
|
||||||
|
|
||||||
fMemberFilterActionGroup= new MemberFilterActionGroup(treeViewer, "COutlineViewer"); //$NON-NLS-1$
|
|
||||||
fMemberFilterActionGroup.contributeToToolBar(toolBarManager);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,13 +76,14 @@ import org.eclipse.ui.IWorkbenchWindow;
|
||||||
import org.eclipse.ui.actions.ActionGroup;
|
import org.eclipse.ui.actions.ActionGroup;
|
||||||
import org.eclipse.ui.editors.text.EditorsUI;
|
import org.eclipse.ui.editors.text.EditorsUI;
|
||||||
import org.eclipse.ui.editors.text.TextEditor;
|
import org.eclipse.ui.editors.text.TextEditor;
|
||||||
|
import org.eclipse.ui.ide.IDE;
|
||||||
import org.eclipse.ui.part.EditorActionBarContributor;
|
import org.eclipse.ui.part.EditorActionBarContributor;
|
||||||
import org.eclipse.ui.part.IShowInSource;
|
import org.eclipse.ui.part.IShowInSource;
|
||||||
import org.eclipse.ui.part.ShowInContext;
|
import org.eclipse.ui.part.ShowInContext;
|
||||||
|
import org.eclipse.ui.texteditor.AbstractTextEditor;
|
||||||
import org.eclipse.ui.texteditor.AnnotationPreference;
|
import org.eclipse.ui.texteditor.AnnotationPreference;
|
||||||
import org.eclipse.ui.texteditor.ChainedPreferenceStore;
|
import org.eclipse.ui.texteditor.ChainedPreferenceStore;
|
||||||
import org.eclipse.ui.texteditor.ContentAssistAction;
|
import org.eclipse.ui.texteditor.ContentAssistAction;
|
||||||
import org.eclipse.ui.texteditor.DefaultRangeIndicator;
|
|
||||||
import org.eclipse.ui.texteditor.IEditorStatusLine;
|
import org.eclipse.ui.texteditor.IEditorStatusLine;
|
||||||
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
||||||
import org.eclipse.ui.texteditor.MarkerAnnotation;
|
import org.eclipse.ui.texteditor.MarkerAnnotation;
|
||||||
|
@ -103,11 +104,13 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
protected CContentOutlinePage fOutlinePage;
|
protected CContentOutlinePage fOutlinePage;
|
||||||
|
|
||||||
/** Search actions **/
|
/** Search actions **/
|
||||||
|
|
||||||
private ActionGroup fSelectionSearchGroup;
|
private ActionGroup fSelectionSearchGroup;
|
||||||
private ActionGroup fRefactoringActionGroup;
|
private ActionGroup fRefactoringActionGroup;
|
||||||
|
private ShowInCViewAction fShowInCViewAction;
|
||||||
|
|
||||||
|
/** Activity Listeners **/
|
||||||
protected ISelectionChangedListener fStatusLineClearer;
|
protected ISelectionChangedListener fStatusLineClearer;
|
||||||
|
protected ISelectionChangedListener fSelectionUpdateListener;
|
||||||
|
|
||||||
/** The property change listener */
|
/** The property change listener */
|
||||||
private PropertyChangeListener fPropertyChangeListener = new PropertyChangeListener();
|
private PropertyChangeListener fPropertyChangeListener = new PropertyChangeListener();
|
||||||
|
@ -158,29 +161,30 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
*/
|
*/
|
||||||
public CEditor() {
|
public CEditor() {
|
||||||
super();
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#initializeEditor()
|
||||||
|
*/
|
||||||
|
protected void initializeEditor() {
|
||||||
|
//@@@ We should be able to get this from our parent
|
||||||
fAnnotationPreferences = new MarkerAnnotationPreferences();
|
fAnnotationPreferences = new MarkerAnnotationPreferences();
|
||||||
|
|
||||||
CTextTools textTools = CUIPlugin.getDefault().getTextTools();
|
CTextTools textTools = CUIPlugin.getDefault().getTextTools();
|
||||||
setSourceViewerConfiguration(new CSourceViewerConfiguration(textTools, this));
|
setSourceViewerConfiguration(new CSourceViewerConfiguration(textTools, this));
|
||||||
setDocumentProvider(CUIPlugin.getDefault().getDocumentProvider());
|
setDocumentProvider(CUIPlugin.getDefault().getDocumentProvider());
|
||||||
setRangeIndicator(new DefaultRangeIndicator());
|
|
||||||
//setPreferenceStore(CUIPlugin.getDefault().getPreferenceStore());
|
|
||||||
|
|
||||||
setEditorContextMenuId("#CEditorContext"); //$NON-NLS-1$
|
setEditorContextMenuId("#CEditorContext"); //$NON-NLS-1$
|
||||||
setRulerContextMenuId("#CEditorRulerContext"); //$NON-NLS-1$
|
setRulerContextMenuId("#CEditorRulerContext"); //$NON-NLS-1$
|
||||||
setOutlinerContextMenuId("#CEditorOutlinerContext"); //$NON-NLS-1$
|
setOutlinerContextMenuId("#CEditorOutlinerContext"); //$NON-NLS-1$
|
||||||
|
|
||||||
fCEditorErrorTickUpdater = new CEditorErrorTickUpdater(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#initializeEditor()
|
|
||||||
*/
|
|
||||||
protected void initializeEditor() {
|
|
||||||
IPreferenceStore[] stores = new IPreferenceStore[2];
|
IPreferenceStore[] stores = new IPreferenceStore[2];
|
||||||
stores[0] = CUIPlugin.getDefault().getPreferenceStore();
|
stores[0] = CUIPlugin.getDefault().getPreferenceStore();
|
||||||
stores[1] = EditorsUI.getPreferenceStore();
|
stores[1] = EditorsUI.getPreferenceStore();
|
||||||
IPreferenceStore store = new ChainedPreferenceStore(stores);
|
IPreferenceStore store = new ChainedPreferenceStore(stores);
|
||||||
setPreferenceStore(store);
|
setPreferenceStore(store);
|
||||||
|
|
||||||
|
fCEditorErrorTickUpdater = new CEditorErrorTickUpdater(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -188,7 +192,9 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
*/
|
*/
|
||||||
protected void doSetInput(IEditorInput input) throws CoreException {
|
protected void doSetInput(IEditorInput input) throws CoreException {
|
||||||
super.doSetInput(input);
|
super.doSetInput(input);
|
||||||
|
if (fCEditorErrorTickUpdater != null) {
|
||||||
fCEditorErrorTickUpdater.setAnnotationModel(getDocumentProvider().getAnnotationModel(input));
|
fCEditorErrorTickUpdater.setAnnotationModel(getDocumentProvider().getAnnotationModel(input));
|
||||||
|
}
|
||||||
setOutlinePageInput(fOutlinePage, input);
|
setOutlinePageInput(fOutlinePage, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,16 +303,6 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private void disableBrowserLikeLinks() {
|
|
||||||
if (fMouseListener != null) {
|
|
||||||
fMouseListener.uninstall();
|
|
||||||
fMouseListener= null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ISelectionChangedListener#selectionChanged
|
* @see ISelectionChangedListener#selectionChanged
|
||||||
*/
|
*/
|
||||||
|
@ -437,18 +433,60 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
|
|
||||||
if (fCEditorErrorTickUpdater != null) {
|
if (fCEditorErrorTickUpdater != null) {
|
||||||
fCEditorErrorTickUpdater.setAnnotationModel(null);
|
fCEditorErrorTickUpdater.setAnnotationModel(null);
|
||||||
|
fCEditorErrorTickUpdater.dispose();
|
||||||
fCEditorErrorTickUpdater = null;
|
fCEditorErrorTickUpdater = null;
|
||||||
}
|
}
|
||||||
if (fBracketMatcher != null) {
|
|
||||||
fBracketMatcher.dispose();
|
|
||||||
fBracketMatcher = null;
|
|
||||||
}
|
|
||||||
if (fPropertyChangeListener != null) {
|
if (fPropertyChangeListener != null) {
|
||||||
Preferences preferences = CCorePlugin.getDefault().getPluginPreferences();
|
Preferences preferences = CCorePlugin.getDefault().getPluginPreferences();
|
||||||
preferences.removePropertyChangeListener(fPropertyChangeListener);
|
preferences.removePropertyChangeListener(fPropertyChangeListener);
|
||||||
IPreferenceStore preferenceStore = getPreferenceStore();
|
IPreferenceStore preferenceStore = getPreferenceStore();
|
||||||
preferenceStore.removePropertyChangeListener(fPropertyChangeListener);
|
preferenceStore.removePropertyChangeListener(fPropertyChangeListener);
|
||||||
|
fPropertyChangeListener = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fSelectionUpdateListener != null) {
|
||||||
|
getSelectionProvider().addSelectionChangedListener(fSelectionUpdateListener);
|
||||||
|
fSelectionUpdateListener = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fStatusLineClearer != null) {
|
||||||
|
ISelectionProvider provider = getSelectionProvider();
|
||||||
|
provider.removeSelectionChangedListener(fStatusLineClearer);
|
||||||
|
fStatusLineClearer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fBracketMatcher != null) {
|
||||||
|
fBracketMatcher.dispose();
|
||||||
|
fBracketMatcher = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fOutlinePage != null) {
|
||||||
|
fOutlinePage.dispose();
|
||||||
|
fOutlinePage = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fShowInCViewAction != null) {
|
||||||
|
fShowInCViewAction.dispose();
|
||||||
|
fShowInCViewAction = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fRefactoringActionGroup != null) {
|
||||||
|
fRefactoringActionGroup.dispose();
|
||||||
|
fRefactoringActionGroup = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fSelectionSearchGroup != null) {
|
||||||
|
fSelectionSearchGroup.dispose();
|
||||||
|
fSelectionSearchGroup = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
stopTabConversion();
|
||||||
|
disableBrowserLikeLinks();
|
||||||
|
|
||||||
|
fAnnotationPreferences = null;
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,11 +555,12 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
action.setActionDefinitionId(ICEditorActionDefinitionIds.OPEN_DECL);
|
action.setActionDefinitionId(ICEditorActionDefinitionIds.OPEN_DECL);
|
||||||
setAction("OpenDeclarations", action); //$NON-NLS-1$
|
setAction("OpenDeclarations", action); //$NON-NLS-1$
|
||||||
|
|
||||||
action = new ShowInCViewAction(this);
|
fShowInCViewAction = new ShowInCViewAction(this);
|
||||||
|
action = fShowInCViewAction;
|
||||||
action.setActionDefinitionId(ICEditorActionDefinitionIds.OPEN_CVIEW);
|
action.setActionDefinitionId(ICEditorActionDefinitionIds.OPEN_CVIEW);
|
||||||
setAction("ShowInCView", action); //$NON-NLS-1$
|
setAction("ShowInCView", action); //$NON-NLS-1$
|
||||||
|
|
||||||
//Selection Search group
|
//Assorted action groupings
|
||||||
fSelectionSearchGroup = new SelectionSearchGroup(this);
|
fSelectionSearchGroup = new SelectionSearchGroup(this);
|
||||||
fRefactoringActionGroup = new RefactoringActionGroup(this, null);
|
fRefactoringActionGroup = new RefactoringActionGroup(this, null);
|
||||||
|
|
||||||
|
@ -574,7 +613,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
*/
|
*/
|
||||||
public void createPartControl(Composite parent) {
|
public void createPartControl(Composite parent) {
|
||||||
super.createPartControl(parent);
|
super.createPartControl(parent);
|
||||||
ISelectionChangedListener sListener = new ISelectionChangedListener() {
|
fSelectionUpdateListener = new ISelectionChangedListener() {
|
||||||
private Runnable fRunnable = new Runnable() {
|
private Runnable fRunnable = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
updateStatusField(CTextEditorActionConstants.STATUS_CURSOR_POS);
|
updateStatusField(CTextEditorActionConstants.STATUS_CURSOR_POS);
|
||||||
|
@ -589,7 +628,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
fDisplay.asyncExec(fRunnable);
|
fDisplay.asyncExec(fRunnable);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
getSelectionProvider().addSelectionChangedListener(sListener);
|
getSelectionProvider().addSelectionChangedListener(fSelectionUpdateListener);
|
||||||
|
|
||||||
if (isTabConversionEnabled())
|
if (isTabConversionEnabled())
|
||||||
startTabConversion();
|
startTabConversion();
|
||||||
|
@ -660,8 +699,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
|
|
||||||
if (nextError != null) {
|
if (nextError != null) {
|
||||||
|
|
||||||
|
IDE.gotoMarker(this, nextError);
|
||||||
gotoMarker(nextError);
|
|
||||||
|
|
||||||
IWorkbenchPage page = getSite().getPage();
|
IWorkbenchPage page = getSite().getPage();
|
||||||
|
|
||||||
|
@ -877,8 +915,10 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
String fileType = (unit != null && unit.isCXXLanguage()) ? LANGUAGE_CPP : LANGUAGE_C;
|
String fileType = (unit != null && unit.isCXXLanguage()) ? LANGUAGE_CPP : LANGUAGE_C;
|
||||||
|
|
||||||
fAnnotationAccess = createAnnotationAccess();
|
fAnnotationAccess = createAnnotationAccess();
|
||||||
ISharedTextColors sharedColors = CUIPlugin.getDefault().getSharedTextColors();
|
|
||||||
|
|
||||||
|
//TODO: TF NOTE: This can be greatly cleaned up using the parent createOverviewRuler method
|
||||||
|
//It will also totally get rid of the need for the fAnnotationPreferences in this object
|
||||||
|
ISharedTextColors sharedColors = CUIPlugin.getDefault().getSharedTextColors();
|
||||||
fOverviewRuler = new OverviewRuler(fAnnotationAccess, VERTICAL_RULER_WIDTH, sharedColors);
|
fOverviewRuler = new OverviewRuler(fAnnotationAccess, VERTICAL_RULER_WIDTH, sharedColors);
|
||||||
Iterator e = fAnnotationPreferences.getAnnotationPreferences().iterator();
|
Iterator e = fAnnotationPreferences.getAnnotationPreferences().iterator();
|
||||||
while (e.hasNext()) {
|
while (e.hasNext()) {
|
||||||
|
@ -900,6 +940,8 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
|
|
||||||
configureSourceViewerDecorationSupport(fSourceViewerDecorationSupport);
|
configureSourceViewerDecorationSupport(fSourceViewerDecorationSupport);
|
||||||
|
|
||||||
|
//TODO: TF NOTE: Add the bracket matching back in here!
|
||||||
|
|
||||||
return sourceViewer;
|
return sourceViewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -956,9 +998,8 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Links
|
|
||||||
/**
|
/**
|
||||||
* Enables browser like links.
|
* Enables browser like links, requires disable to clean up
|
||||||
*/
|
*/
|
||||||
private void enableBrowserLikeLinks() {
|
private void enableBrowserLikeLinks() {
|
||||||
if (fMouseListener == null) {
|
if (fMouseListener == null) {
|
||||||
|
@ -969,19 +1010,30 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* Disable browser like links, clean up resources
|
||||||
|
*/
|
||||||
|
private void disableBrowserLikeLinks() {
|
||||||
|
if (fMouseListener != null) {
|
||||||
|
fMouseListener.uninstall();
|
||||||
|
fMouseListener= null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if the hyperlink capability is enabled
|
||||||
|
* @return boolean indicating if hyperlinking is enabled
|
||||||
*/
|
*/
|
||||||
private boolean hyperLinkEnabled() {
|
private boolean hyperLinkEnabled() {
|
||||||
IPreferenceStore store= getPreferenceStore();
|
IPreferenceStore store= getPreferenceStore();
|
||||||
boolean Value = store.getBoolean(HYPERLINK_ENABLED);
|
return store.getBoolean(HYPERLINK_ENABLED);
|
||||||
return Value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.ui.editor.IReconcilingParticipant#reconciled()
|
* @see org.eclipse.cdt.internal.ui.editor.IReconcilingParticipant#reconciled()
|
||||||
*/
|
*/
|
||||||
public void reconciled(boolean somethingHasChanged) {
|
public void reconciled(boolean somethingHasChanged) {
|
||||||
if(somethingHasChanged)
|
if(somethingHasChanged && fOutlinePage != null) {
|
||||||
fOutlinePage.contentUpdated();
|
fOutlinePage.contentUpdated();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,4 +210,11 @@ public class CEditorActionContributor extends TextEditorActionContributor {
|
||||||
super.contributeToStatusLine(statusLineManager);
|
super.contributeToStatusLine(statusLineManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.IEditorActionBarContributor#dispose()
|
||||||
|
*/
|
||||||
|
public void dispose() {
|
||||||
|
setActiveEditor(null);
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -88,6 +88,13 @@ public class CEditorErrorTickUpdater implements IAnnotationModelListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
if (fLabelProvider != null) {
|
||||||
|
fLabelProvider.dispose();
|
||||||
|
fLabelProvider= null;
|
||||||
|
}
|
||||||
|
fAnnotationModel= null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -201,14 +201,14 @@ IPropertyChangeListener{
|
||||||
fCursor= null;
|
fCursor= null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ISourceViewer sourceViewer= fViewer;
|
|
||||||
if (sourceViewer == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
IPreferenceStore preferenceStore= fPrefStore;
|
IPreferenceStore preferenceStore= fPrefStore;
|
||||||
if (preferenceStore != null)
|
if (preferenceStore != null)
|
||||||
preferenceStore.removePropertyChangeListener(this);
|
preferenceStore.removePropertyChangeListener(this);
|
||||||
|
|
||||||
|
ISourceViewer sourceViewer= fViewer;
|
||||||
|
if (sourceViewer == null)
|
||||||
|
return;
|
||||||
|
|
||||||
StyledText text= sourceViewer.getTextWidget();
|
StyledText text= sourceViewer.getTextWidget();
|
||||||
if (text == null || text.isDisposed())
|
if (text == null || text.isDisposed())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -90,4 +90,23 @@ public class SelectionSearchGroup extends ActionGroup {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.actions.ActionGroup#dispose()
|
||||||
|
*/
|
||||||
|
public void dispose() {
|
||||||
|
if (fDeclarationsSearchGroup != null) {
|
||||||
|
fDeclarationsSearchGroup.dispose();
|
||||||
|
fDeclarationsSearchGroup= null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fRefSearchGroup != null) {
|
||||||
|
fRefSearchGroup.dispose();
|
||||||
|
fRefSearchGroup= null;
|
||||||
|
}
|
||||||
|
|
||||||
|
fEditor= null;
|
||||||
|
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,6 +260,10 @@ public class MemberFilterActionGroup extends ActionGroup {
|
||||||
* @see ActionGroup#dispose()
|
* @see ActionGroup#dispose()
|
||||||
*/
|
*/
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
fFilterActions= null;
|
||||||
|
fFilter= null;
|
||||||
|
fViewer= null;
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,9 +102,9 @@ public class RefactoringActionGroup extends ActionGroup {
|
||||||
private CEditor fEditor;
|
private CEditor fEditor;
|
||||||
private String fGroupName= IContextMenuConstants.GROUP_REORGANIZE;
|
private String fGroupName= IContextMenuConstants.GROUP_REORGANIZE;
|
||||||
|
|
||||||
private SelectionDispatchAction fRenameAction;
|
private RenameRefactoringAction fRenameAction;
|
||||||
private SelectionDispatchAction fRedoAction;
|
private RedoRefactoringAction fRedoAction;
|
||||||
private SelectionDispatchAction fUndoAction;
|
private UndoRefactoringAction fUndoAction;
|
||||||
private List fEditorActions;
|
private List fEditorActions;
|
||||||
|
|
||||||
private static class NoActionAvailable extends Action {
|
private static class NoActionAvailable extends Action {
|
||||||
|
@ -148,7 +148,7 @@ public class RefactoringActionGroup extends ActionGroup {
|
||||||
|
|
||||||
ISelectionProvider provider= editor.getSelectionProvider();
|
ISelectionProvider provider= editor.getSelectionProvider();
|
||||||
ISelection selection= provider.getSelection();
|
ISelection selection= provider.getSelection();
|
||||||
fEditorActions= new ArrayList();
|
fEditorActions= new ArrayList(3);
|
||||||
|
|
||||||
fRenameAction= new RenameRefactoringAction(editor);
|
fRenameAction= new RenameRefactoringAction(editor);
|
||||||
fRenameAction.update(selection);
|
fRenameAction.update(selection);
|
||||||
|
@ -164,7 +164,7 @@ public class RefactoringActionGroup extends ActionGroup {
|
||||||
fRedoAction.update(selection);
|
fRedoAction.update(selection);
|
||||||
editor.setAction("RedoAction", fRedoAction); //$NON-NLS-1$
|
editor.setAction("RedoAction", fRedoAction); //$NON-NLS-1$
|
||||||
fEditorActions.add(fRedoAction);
|
fEditorActions.add(fRedoAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RefactoringActionGroup(IWorkbenchSite site, String groupName) {
|
public RefactoringActionGroup(IWorkbenchSite site, String groupName) {
|
||||||
fSite= site;
|
fSite= site;
|
||||||
|
@ -212,14 +212,33 @@ public class RefactoringActionGroup extends ActionGroup {
|
||||||
*/
|
*/
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
ISelectionProvider provider= fSite.getSelectionProvider();
|
ISelectionProvider provider= fSite.getSelectionProvider();
|
||||||
|
|
||||||
|
if (fRenameAction != null) {
|
||||||
disposeAction(fRenameAction, provider);
|
disposeAction(fRenameAction, provider);
|
||||||
|
fRenameAction= null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fUndoAction != null) {
|
||||||
disposeAction(fUndoAction, provider);
|
disposeAction(fUndoAction, provider);
|
||||||
|
fUndoAction.dispose();
|
||||||
|
fUndoAction= null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fRedoAction != null) {
|
||||||
disposeAction(fRedoAction, provider);
|
disposeAction(fRedoAction, provider);
|
||||||
|
fRedoAction.dispose();
|
||||||
|
fRedoAction= null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fEditorActions != null) {
|
||||||
|
fEditorActions.clear();
|
||||||
|
fEditorActions= null;
|
||||||
|
}
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disposeAction(ISelectionChangedListener action, ISelectionProvider provider) {
|
private void disposeAction(ISelectionChangedListener action, ISelectionProvider provider) {
|
||||||
if (action != null)
|
|
||||||
provider.removeSelectionChangedListener(action);
|
provider.removeSelectionChangedListener(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue