mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 338782 - [Project Explorer] If working sets are top level nodes resource changes are not refreshed properly
This commit is contained in:
parent
964d7d5c12
commit
f704e4f129
1 changed files with 3 additions and 58 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2010 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006, 2011 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -28,11 +28,6 @@ import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.ui.IMemento;
|
import org.eclipse.ui.IMemento;
|
||||||
import org.eclipse.ui.IViewPart;
|
|
||||||
import org.eclipse.ui.IWorkbenchPage;
|
|
||||||
import org.eclipse.ui.IWorkbenchWindow;
|
|
||||||
import org.eclipse.ui.PlatformUI;
|
|
||||||
import org.eclipse.ui.navigator.CommonNavigator;
|
|
||||||
import org.eclipse.ui.navigator.ICommonContentExtensionSite;
|
import org.eclipse.ui.navigator.ICommonContentExtensionSite;
|
||||||
import org.eclipse.ui.navigator.IPipelinedTreeContentProvider;
|
import org.eclipse.ui.navigator.IPipelinedTreeContentProvider;
|
||||||
import org.eclipse.ui.navigator.PipelinedShapeModification;
|
import org.eclipse.ui.navigator.PipelinedShapeModification;
|
||||||
|
@ -53,24 +48,9 @@ import org.eclipse.cdt.internal.ui.cview.CViewContentProvider;
|
||||||
*/
|
*/
|
||||||
public class CNavigatorContentProvider extends CViewContentProvider implements IPipelinedTreeContentProvider {
|
public class CNavigatorContentProvider extends CViewContentProvider implements IPipelinedTreeContentProvider {
|
||||||
|
|
||||||
/** Project Explorer view id */
|
|
||||||
private static final String PROJECT_EXPLORER_ID = "org.eclipse.ui.navigator.ProjectExplorer"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** Cloned memento key from {@link CommonNavigator}. */
|
|
||||||
private static String LINKING_ENABLED = "CommonNavigator.LINKING_ENABLED"; //$NON-NLS-1$
|
|
||||||
/** Memento key for delayed enablement of link-with-editor */
|
|
||||||
static String LINKING_ENABLED_DELAYED = LINKING_ENABLED + ".delayed"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The input object as supplied in the call to {@link #inputChanged()} */
|
/** The input object as supplied in the call to {@link #inputChanged()} */
|
||||||
private Object fRealInput;
|
private Object fRealInput;
|
||||||
private IPropertyChangeListener fPropertyChangeListener;
|
private IPropertyChangeListener fPropertyChangeListener;
|
||||||
/**
|
|
||||||
* Flag set in {@link #restoreState(IMemento) restoreState},
|
|
||||||
* indicating whether link-with-editor should be enabled delayed
|
|
||||||
* as a (old) workaround for
|
|
||||||
* <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=186344">bug 186344</a>
|
|
||||||
*/
|
|
||||||
private boolean fLinkingEnabledDelayed;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @see org.eclipse.ui.navigator.ICommonContentProvider#init(org.eclipse.ui.navigator.ICommonContentExtensionSite)
|
* @see org.eclipse.ui.navigator.ICommonContentProvider#init(org.eclipse.ui.navigator.ICommonContentExtensionSite)
|
||||||
|
@ -138,9 +118,6 @@ public class CNavigatorContentProvider extends CViewContentProvider implements I
|
||||||
// if (mementoValue != null) {
|
// if (mementoValue != null) {
|
||||||
// groupIncludes= Boolean.valueOf(mementoValue).booleanValue();
|
// groupIncludes= Boolean.valueOf(mementoValue).booleanValue();
|
||||||
// }
|
// }
|
||||||
// old workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=186344
|
|
||||||
Integer value= memento.getInteger(LINKING_ENABLED_DELAYED);
|
|
||||||
fLinkingEnabledDelayed= value != null && value.intValue() != 0;
|
|
||||||
}
|
}
|
||||||
setProvideMembers(showCUChildren);
|
setProvideMembers(showCUChildren);
|
||||||
setIncludesGrouping(groupIncludes);
|
setIncludesGrouping(groupIncludes);
|
||||||
|
@ -156,8 +133,6 @@ public class CNavigatorContentProvider extends CViewContentProvider implements I
|
||||||
memento.putString(PreferenceConstants.PREF_SHOW_CU_CHILDREN, String.valueOf(getProvideMembers()));
|
memento.putString(PreferenceConstants.PREF_SHOW_CU_CHILDREN, String.valueOf(getProvideMembers()));
|
||||||
memento.putString(PreferenceConstants.CVIEW_GROUP_INCLUDES, String.valueOf(areIncludesGroup()));
|
memento.putString(PreferenceConstants.CVIEW_GROUP_INCLUDES, String.valueOf(areIncludesGroup()));
|
||||||
memento.putString(PreferenceConstants.CVIEW_GROUP_MACROS, String.valueOf(isMacroGroupingEnabled()));
|
memento.putString(PreferenceConstants.CVIEW_GROUP_MACROS, String.valueOf(isMacroGroupingEnabled()));
|
||||||
// clear obsolete flag
|
|
||||||
memento.putInteger(LINKING_ENABLED_DELAYED, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,36 +143,6 @@ public class CNavigatorContentProvider extends CViewContentProvider implements I
|
||||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||||
fRealInput= newInput;
|
fRealInput= newInput;
|
||||||
super.inputChanged(viewer, oldInput, findInputElement(newInput));
|
super.inputChanged(viewer, oldInput, findInputElement(newInput));
|
||||||
|
|
||||||
workaroundForBug186344();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Old workaround for
|
|
||||||
* <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=186344">bug 186344</a>.
|
|
||||||
* Kept for backword compatibility.
|
|
||||||
*/
|
|
||||||
private void workaroundForBug186344() {
|
|
||||||
if (fLinkingEnabledDelayed) {
|
|
||||||
// enable linking delayed
|
|
||||||
fLinkingEnabledDelayed= false;
|
|
||||||
final IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
|
|
||||||
if (window != null) {
|
|
||||||
final IWorkbenchPage page = window.getActivePage();
|
|
||||||
if (page != null) {
|
|
||||||
IViewPart viewPart= page.findView(PROJECT_EXPLORER_ID);
|
|
||||||
if (viewPart instanceof CommonNavigator) {
|
|
||||||
final CommonNavigator cn= ((CommonNavigator)viewPart);
|
|
||||||
viewPart.getSite().getShell().getDisplay().asyncExec(
|
|
||||||
new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
cn.setLinkingEnabled(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object findInputElement(Object newInput) {
|
private Object findInputElement(Object newInput) {
|
||||||
|
@ -462,7 +407,7 @@ public class CNavigatorContentProvider extends CViewContentProvider implements I
|
||||||
if (element instanceof ICModel) {
|
if (element instanceof ICModel) {
|
||||||
// don't refresh workspace root
|
// don't refresh workspace root
|
||||||
// super.postRefresh(fRealInput);
|
// super.postRefresh(fRealInput);
|
||||||
} else if (element instanceof ICProject && fRealInput instanceof IWorkspaceRoot) {
|
} else if (element instanceof ICProject) {
|
||||||
super.postRefresh(((ICProject)element).getProject());
|
super.postRefresh(((ICProject)element).getProject());
|
||||||
} else if (element instanceof ICElement) {
|
} else if (element instanceof ICElement) {
|
||||||
super.postRefresh(element);
|
super.postRefresh(element);
|
||||||
|
@ -484,7 +429,7 @@ public class CNavigatorContentProvider extends CViewContentProvider implements I
|
||||||
super.postAdd(fRealInput, element);
|
super.postAdd(fRealInput, element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (parent instanceof ICProject && fRealInput instanceof IWorkspaceRoot) {
|
} else if (parent instanceof ICProject) {
|
||||||
super.postAdd(((ICProject)parent).getProject(), element);
|
super.postAdd(((ICProject)parent).getProject(), element);
|
||||||
} else if (parent instanceof ICElement) {
|
} else if (parent instanceof ICElement) {
|
||||||
super.postAdd(parent, element);
|
super.postAdd(parent, element);
|
||||||
|
|
Loading…
Add table
Reference in a new issue