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
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* 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.viewers.Viewer;
|
||||
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.IPipelinedTreeContentProvider;
|
||||
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 {
|
||||
|
||||
/** 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()} */
|
||||
private Object fRealInput;
|
||||
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)
|
||||
|
@ -138,9 +118,6 @@ public class CNavigatorContentProvider extends CViewContentProvider implements I
|
|||
// if (mementoValue != null) {
|
||||
// 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);
|
||||
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.CVIEW_GROUP_INCLUDES, String.valueOf(areIncludesGroup()));
|
||||
memento.putString(PreferenceConstants.CVIEW_GROUP_MACROS, String.valueOf(isMacroGroupingEnabled()));
|
||||
// clear obsolete flag
|
||||
memento.putInteger(LINKING_ENABLED_DELAYED, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,38 +143,8 @@ public class CNavigatorContentProvider extends CViewContentProvider implements I
|
|||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
fRealInput= 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) {
|
||||
if (newInput instanceof IWorkspaceRoot) {
|
||||
return CoreModel.create((IWorkspaceRoot) newInput);
|
||||
|
@ -462,7 +407,7 @@ public class CNavigatorContentProvider extends CViewContentProvider implements I
|
|||
if (element instanceof ICModel) {
|
||||
// don't refresh workspace root
|
||||
// super.postRefresh(fRealInput);
|
||||
} else if (element instanceof ICProject && fRealInput instanceof IWorkspaceRoot) {
|
||||
} else if (element instanceof ICProject) {
|
||||
super.postRefresh(((ICProject)element).getProject());
|
||||
} else if (element instanceof ICElement) {
|
||||
super.postRefresh(element);
|
||||
|
@ -484,7 +429,7 @@ public class CNavigatorContentProvider extends CViewContentProvider implements I
|
|||
super.postAdd(fRealInput, element);
|
||||
}
|
||||
}
|
||||
} else if (parent instanceof ICProject && fRealInput instanceof IWorkspaceRoot) {
|
||||
} else if (parent instanceof ICProject) {
|
||||
super.postAdd(((ICProject)parent).getProject(), element);
|
||||
} else if (parent instanceof ICElement) {
|
||||
super.postAdd(parent, element);
|
||||
|
|
Loading…
Add table
Reference in a new issue