update copyright
[fedora-idea.git] / plugins / svn4idea / src / org / jetbrains / idea / svn / dialogs / WCInfoWithBranches.java
blobcdf186803a72d96f9300c3ab60977c5ecaf4647d
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;
18 import com.intellij.openapi.vfs.VirtualFile;
19 import org.jetbrains.idea.svn.WorkingCopyFormat;
20 import org.tmatesoft.svn.core.SVNURL;
21 import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
23 import java.util.List;
25 public class WCInfoWithBranches extends WCInfo {
26 private final List<Branch> myBranches;
27 private final VirtualFile myRoot;
28 private final String myTrunkRoot;
30 public WCInfoWithBranches(final String path, final SVNURL url, final WorkingCopyFormat format, final String repositoryRoot, final boolean isWcRoot,
31 final List<Branch> branches,
32 final VirtualFile root,
33 final String trunkToot) {
34 super(path, url, format, repositoryRoot, isWcRoot);
35 myBranches = branches;
36 myRoot = root;
37 myTrunkRoot = trunkToot;
40 // to be used in combo
41 @Override
42 public String toString() {
43 return getPath();
46 @Override
47 public VirtualFile getVcsRoot() {
48 return myRoot;
51 public List<Branch> getBranches() {
52 return myBranches;
55 public VirtualFile getRoot() {
56 return myRoot;
59 public String getTrunkRoot() {
60 return myTrunkRoot;
63 public static class Branch {
64 private final String myName;
65 private final String myUrl;
67 public Branch(final String url) {
68 myName = SVNPathUtil.tail(url);
69 myUrl = url;
72 public String getName() {
73 return myName;
76 public String getUrl() {
77 return myUrl;
80 @Override
81 public String toString() {
82 return myName;
85 @Override
86 public boolean equals(final Object o) {
87 if (this == o) return true;
88 if (o == null || getClass() != o.getClass()) return false;
90 final Branch branch = (Branch)o;
92 if (myUrl != null ? !myUrl.equals(branch.myUrl) : branch.myUrl != null) return false;
94 return true;
97 @Override
98 public int hashCode() {
99 return (myUrl != null ? myUrl.hashCode() : 0);