update copyright
[fedora-idea.git] / plugins / svn4idea / src / org / jetbrains / idea / svn / dialogs / browserCache / Loader.java
blob726ea8f13fe2d1f24299c605aff220e32dad0548
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.jetbrains.idea.svn.dialogs.browserCache;
18 import org.jetbrains.idea.svn.dialogs.RepositoryTreeNode;
19 import org.tmatesoft.svn.core.SVNDirEntry;
20 import org.tmatesoft.svn.core.SVNErrorMessage;
22 import java.util.List;
24 public abstract class Loader {
25 protected final SvnRepositoryCache myCache;
27 protected Loader(final SvnRepositoryCache cache) {
28 myCache = cache;
31 public abstract void load(final RepositoryTreeNode node, final Expander afterRefreshExpander);
32 public abstract void forceRefresh(final String repositoryRootUrl);
33 protected abstract NodeLoadState getNodeLoadState();
35 protected void refreshNodeError(final RepositoryTreeNode node, final SVNErrorMessage text) {
36 if (node.isDisposed()) {
37 return;
39 final RepositoryTreeNode existingNode = node.getNodeWithSamePathUnderModelRoot();
40 if (existingNode == null) {
41 return;
43 if (existingNode.isDisposed()) {
44 return;
47 existingNode.setErrorNode(text, getNodeLoadState());
50 protected void refreshNode(final RepositoryTreeNode node, final List<SVNDirEntry> data, final Expander expander) {
51 if (node.isDisposed()) {
52 return;
54 final RepositoryTreeNode existingNode = node.getNodeWithSamePathUnderModelRoot();
55 if (existingNode == null) {
56 return;
59 if (existingNode.isDisposed()) {
60 return;
62 expander.onBeforeRefresh(existingNode);
63 existingNode.setChildren(data, getNodeLoadState());
64 expander.onAfterRefresh(existingNode);