use of org.jetbrains.idea.svn.browse.DirectoryEntry in project intellij-community by JetBrains.
the class RepositoryBrowserDialog method doCheckout.
protected void doCheckout(@Nullable final CheckoutProvider.Listener listener, final RepositoryTreeNode selectedNode) {
if (selectedNode == null) {
return;
}
SVNURL url = selectedNode.getURL();
String relativePath = "";
final DirectoryEntry entry = selectedNode.getSVNDirEntry();
if (entry != null) {
if (entry.getRepositoryRoot() != null) {
if (!entry.getRepositoryRoot().equals(url)) {
relativePath = SVNPathUtil.getRelativePath(entry.getRepositoryRoot().toString(), url.toDecodedString());
}
} else {
relativePath = entry.getRelativePath();
}
} else {
relativePath = url.getPath();
}
File dir = selectFile(SvnBundle.message("svn.checkout.destination.directory.title"), SvnBundle.message("svn.checkout.destination.directory.description"));
if (dir == null) {
return;
}
Project p = myProject;
CheckoutOptionsDialog dialog = new CheckoutOptionsDialog(p, url, dir, SvnUtil.getVirtualFile(dir.getAbsolutePath()), relativePath);
dialog.show();
dir = dialog.getTarget();
if (dialog.isOK() && dir != null) {
final SVNRevision revision;
try {
revision = dialog.getRevision();
} catch (ConfigurationException e) {
Messages.showErrorDialog(SvnBundle.message("message.text.cannot.checkout", e.getMessage()), SvnBundle.message("message.title.check.out"));
return;
}
SvnCheckoutProvider.doCheckout(myProject, dir, url.toString(), revision, dialog.getDepth(), dialog.isIgnoreExternals(), listener);
}
}
use of org.jetbrains.idea.svn.browse.DirectoryEntry in project intellij-community by JetBrains.
the class SvnRepositoryTreeCellRenderer method customizeCellRenderer.
public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
setIcon(null);
if (value instanceof RepositoryTreeNode) {
RepositoryTreeNode node = (RepositoryTreeNode) value;
if (node.getSVNDirEntry() == null) {
append(node.getURL().toString(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
setIcon(PlatformIcons.DIRECTORY_CLOSED_ICON);
} else {
String name = node.getSVNDirEntry().getName();
append(name, node.isCached() ? SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES);
if (myIsShowDetails) {
DirectoryEntry entry = node.getSVNDirEntry();
append(" " + entry.getRevision(), SimpleTextAttributes.GRAY_ATTRIBUTES);
if (entry.getAuthor() != null) {
append(" " + entry.getAuthor(), SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES);
}
if (entry.getDate() != null) {
append(" " + DateFormatUtil.formatPrettyDateTime(entry.getDate()), SimpleTextAttributes.GRAY_ATTRIBUTES);
}
}
setIcon(node.getSVNDirEntry().isFile() ? FileTypeManager.getInstance().getFileTypeByFileName(name).getIcon() : PlatformIcons.DIRECTORY_CLOSED_ICON);
}
} else if (value instanceof SimpleTextNode) {
SimpleTextNode node = (SimpleTextNode) value;
append(node.getText(), node.isError() ? SimpleTextAttributes.ERROR_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
}
use of org.jetbrains.idea.svn.browse.DirectoryEntry in project intellij-community by JetBrains.
the class RepositoryBrowserComponent method getSelectedVcsFile.
@Nullable
public VirtualFile getSelectedVcsFile() {
final RepositoryTreeNode node = getSelectedNode();
if (node == null)
return null;
DirectoryEntry entry = node.getSVNDirEntry();
if (entry == null || !entry.isFile()) {
return null;
}
String name = entry.getName();
FileTypeManager manager = FileTypeManager.getInstance();
if (entry.getName().lastIndexOf('.') > 0 && !manager.getFileTypeByFileName(name).isBinary()) {
SVNURL url = node.getURL();
final SvnFileRevision revision = new SvnFileRevision(myVCS, SVNRevision.UNDEFINED, SVNRevision.HEAD, url.toString(), entry.getAuthor(), entry.getDate(), null, null);
return new VcsVirtualFile(node.getSVNDirEntry().getName(), revision, VcsFileSystem.getInstance());
} else {
return null;
}
}
use of org.jetbrains.idea.svn.browse.DirectoryEntry in project intellij-community by JetBrains.
the class RepositoryTreeNode method setChildren.
public void setChildren(@NotNull List<DirectoryEntry> children, @NotNull NodeLoadState state) {
final List<TreeNode> nodes = new ArrayList<>();
for (final DirectoryEntry entry : children) {
if (!myModel.isShowFiles() && !entry.isDirectory()) {
continue;
}
nodes.add(new RepositoryTreeNode(myModel, this, entry.getUrl(), entry, state));
}
myChildrenLoadState = state;
myChildren.clear();
myChildren.addAll(nodes);
myModel.reload(this);
}
use of org.jetbrains.idea.svn.browse.DirectoryEntry in project intellij-community by JetBrains.
the class SyntheticWorker method removeSelf.
public void removeSelf() {
final String parentUrl;
try {
parentUrl = myUrl.removePathTail().toString();
} catch (SVNException e) {
return;
}
final List<DirectoryEntry> children = myCache.getChildren(parentUrl);
if (children == null) {
return;
}
for (Iterator<DirectoryEntry> iterator = children.iterator(); iterator.hasNext(); ) {
final DirectoryEntry entry = iterator.next();
if (myUrl.equals(entry.getUrl())) {
iterator.remove();
}
}
myCache.put(parentUrl, children);
}
Aggregations