use of com.intellij.ide.util.treeView.AbstractTreeUpdater in project intellij-community by JetBrains.
the class ProjectViewPsiTreeChangeListener method propertyChanged.
@Override
public void propertyChanged(@NotNull PsiTreeChangeEvent event) {
String propertyName = event.getPropertyName();
PsiElement element = event.getElement();
DefaultMutableTreeNode rootNode = getRootNode();
AbstractTreeUpdater updater = getUpdater();
if (propertyName.equals(PsiTreeChangeEvent.PROP_ROOTS)) {
updater.addSubtreeToUpdate(rootNode);
} else if (propertyName.equals(PsiTreeChangeEvent.PROP_WRITABLE)) {
if (!updater.addSubtreeToUpdateByElement(element) && element instanceof PsiFile) {
updater.addSubtreeToUpdateByElement(((PsiFile) element).getContainingDirectory());
}
} else if (propertyName.equals(PsiTreeChangeEvent.PROP_FILE_NAME) || propertyName.equals(PsiTreeChangeEvent.PROP_DIRECTORY_NAME)) {
if (element instanceof PsiDirectory && isFlattenPackages()) {
updater.addSubtreeToUpdate(rootNode);
return;
}
final PsiElement parent = element.getParent();
if (parent == null || !updater.addSubtreeToUpdateByElement(parent)) {
updater.addSubtreeToUpdateByElement(element);
}
} else if (propertyName.equals(PsiTreeChangeEvent.PROP_FILE_TYPES)) {
updater.addSubtreeToUpdate(rootNode);
}
}
use of com.intellij.ide.util.treeView.AbstractTreeUpdater in project intellij-community by JetBrains.
the class BaseProjectTreeBuilder method _select.
@NotNull
private ActionCallback _select(final Object element, final VirtualFile file, final boolean requestFocus, final Condition<AbstractTreeNode> nonStopCondition) {
AbstractTreeUpdater updater = getUpdater();
if (updater == null)
return ActionCallback.REJECTED;
final ActionCallback result = new ActionCallback();
final FocusRequestor requestor = IdeFocusManager.getInstance(myProject).getFurtherRequestor();
UiActivityMonitor.getInstance().addActivity(myProject, new UiActivity.AsyncBgOperation("projectViewSelect"), updater.getModalityState());
batch(indicator -> {
_select(element, file, requestFocus, nonStopCondition, result, indicator, null, requestor, false);
UiActivityMonitor.getInstance().removeActivity(myProject, new UiActivity.AsyncBgOperation("projectViewSelect"));
});
return result;
}
Aggregations