1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-01 20:53:12 +02:00

2004-09-08 Alain Magloire

Fix for PR 69330
	* src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java
	* src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java
	* src/org/eclipse/cdt/internal/ui/editor/CEditor.java
This commit is contained in:
Alain Magloire 2004-09-08 14:45:16 +00:00
parent c6fbea4a1d
commit ef6041264c
4 changed files with 39 additions and 24 deletions

View file

@ -1,3 +1,10 @@
2004-09-08 Alain Magloire
Fix for PR 69330
* src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java
* src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java
* src/org/eclipse/cdt/internal/ui/editor/CEditor.java
2004-09-03 Alain Magloire 2004-09-03 Alain Magloire
Fix for PR 73250 Fix for PR 73250

View file

@ -11,12 +11,9 @@ import java.util.Iterator;
import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.internal.ui.ICHelpContextIds; import org.eclipse.cdt.internal.ui.ICHelpContextIds;
import org.eclipse.cdt.internal.ui.IContextMenuConstants;
import org.eclipse.cdt.internal.ui.StandardCElementLabelProvider; import org.eclipse.cdt.internal.ui.StandardCElementLabelProvider;
import org.eclipse.cdt.internal.ui.cview.CViewMessages;
import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup; import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup;
import org.eclipse.cdt.internal.ui.util.ProblemTreeViewer; import org.eclipse.cdt.internal.ui.util.ProblemTreeViewer;
import org.eclipse.cdt.ui.CElementContentProvider;
import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.actions.MemberFilterActionGroup; import org.eclipse.cdt.ui.actions.MemberFilterActionGroup;
import org.eclipse.cdt.ui.actions.RefactoringActionGroup; import org.eclipse.cdt.ui.actions.RefactoringActionGroup;
@ -108,9 +105,9 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
Iterator iter= ((IStructuredSelection)sel).iterator(); Iterator iter= ((IStructuredSelection)sel).iterator();
for (;iter.hasNext();) { for (;iter.hasNext();) {
//ICElement elem= fInput.findEqualMember((ICElement)iter.next()); //ICElement elem= fInput.findEqualMember((ICElement)iter.next());
ICElement elem = (ICElement)iter.next(); Object o = iter.next();
if (elem != null) { if (o instanceof ICElement) {
newSelection.add(elem); newSelection.add(o);
} }
} }
} }
@ -144,7 +141,8 @@ 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.setContentProvider(new CElementContentProvider(true, true)); //treeViewer.setContentProvider(new CElementContentProvider(true, true));
treeViewer.setContentProvider(new CContentOutlinerProvider(this));
treeViewer.setLabelProvider(new StandardCElementLabelProvider()); treeViewer.setLabelProvider(new StandardCElementLabelProvider());
treeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS); treeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
treeViewer.addSelectionChangedListener(this); treeViewer.addSelectionChangedListener(this);
@ -259,6 +257,7 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
((ISelectionChangedListener) listeners[i]).selectionChanged(event); ((ISelectionChangedListener) listeners[i]).selectionChanged(event);
} }
} }
/* (non-Javadoc) /* (non-Javadoc)
* Method declared on IPage (and Page). * Method declared on IPage (and Page).
*/ */
@ -267,6 +266,7 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
return null; return null;
return treeViewer.getControl(); return treeViewer.getControl();
} }
/* (non-Javadoc) /* (non-Javadoc)
* Method declared on ISelectionProvider. * Method declared on ISelectionProvider.
*/ */
@ -275,6 +275,7 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
return StructuredSelection.EMPTY; return StructuredSelection.EMPTY;
return treeViewer.getSelection(); return treeViewer.getSelection();
} }
/** /**
* Returns this page's tree viewer. * Returns this page's tree viewer.
* *
@ -284,12 +285,14 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
protected TreeViewer getTreeViewer() { protected TreeViewer getTreeViewer() {
return treeViewer; return treeViewer;
} }
/* (non-Javadoc) /* (non-Javadoc)
* Method declared on ISelectionProvider. * Method declared on ISelectionProvider.
*/ */
public void removeSelectionChangedListener(ISelectionChangedListener listener) { public void removeSelectionChangedListener(ISelectionChangedListener listener) {
selectionChangedListeners.remove(listener); selectionChangedListeners.remove(listener);
} }
/* (non-Javadoc) /* (non-Javadoc)
* Method declared on ISelectionChangeListener. * Method declared on ISelectionChangeListener.
* Gives notification that the tree selection has changed. * Gives notification that the tree selection has changed.
@ -297,12 +300,14 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
public void selectionChanged(SelectionChangedEvent event) { public void selectionChanged(SelectionChangedEvent event) {
fireSelectionChanged(event.getSelection()); fireSelectionChanged(event.getSelection());
} }
/** /**
* Sets focus to a part in the page. * Sets focus to a part in the page.
*/ */
public void setFocus() { public void setFocus() {
treeViewer.getControl().setFocus(); treeViewer.getControl().setFocus();
} }
/* (non-Javadoc) /* (non-Javadoc)
* Method declared on ISelectionProvider. * Method declared on ISelectionProvider.
*/ */
@ -310,6 +315,7 @@ 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. * Set the current input to the content provider.
* @param unit * @param unit
@ -322,5 +328,4 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS
contentUpdated(); contentUpdated();
} }
} }

View file

@ -101,18 +101,18 @@ public class CContentOutlinerProvider extends BaseCElementContentProvider {
*/ */
public void propertyChange(PropertyChangeEvent event) { public void propertyChange(PropertyChangeEvent event) {
String prop = event.getProperty(); String prop = event.getProperty();
if (prop.equals(PreferenceConstants.OUTLINE_GROUP_INCLUDES)) { // if (prop.equals(PreferenceConstants.OUTLINE_GROUP_INCLUDES)) {
Object newValue = event.getNewValue(); // Object newValue = event.getNewValue();
if (newValue instanceof Boolean) { // if (newValue instanceof Boolean) {
boolean value = ((Boolean)newValue).booleanValue(); // boolean value = ((Boolean)newValue).booleanValue();
if (areIncludesGroup() != value) { // if (areIncludesGroup() != value) {
setIncludesGrouping(value); // setIncludesGrouping(value);
if (fOutliner != null) { // if (fOutliner != null) {
fOutliner.contentUpdated(); // fOutliner.contentUpdated();
} // }
} // }
} // }
} // }
} }
} }
@ -123,7 +123,7 @@ public class CContentOutlinerProvider extends BaseCElementContentProvider {
public CContentOutlinerProvider(CContentOutlinePage outliner) { public CContentOutlinerProvider(CContentOutlinePage outliner) {
super(true, true); super(true, true);
fOutliner = outliner; fOutliner = outliner;
setIncludesGrouping(PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.OUTLINE_GROUP_INCLUDES)); //setIncludesGrouping(PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.OUTLINE_GROUP_INCLUDES));
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -1029,8 +1029,11 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
* @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 && fOutlinePage != null) { // DO not do this. It will cripple performance.
fOutlinePage.contentUpdated(); // Now the Outliner is ElementChangeListener to the Core Model
} // It listens to the WorkingCopy changes.
//if(somethingHasChanged && fOutlinePage != null) {
// fOutlinePage.contentUpdated();
//}
} }
} }