summaryrefslogtreecommitdiff
path: root/plugins/svn4idea/src/org/jetbrains/idea/svn/DepthCombo.java
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/svn4idea/src/org/jetbrains/idea/svn/DepthCombo.java')
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/DepthCombo.java40
1 files changed, 11 insertions, 29 deletions
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/DepthCombo.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/DepthCombo.java
index b55b50bb323a..4eea25ac14ca 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/DepthCombo.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/DepthCombo.java
@@ -15,50 +15,32 @@
*/
package org.jetbrains.idea.svn;
-import org.tmatesoft.svn.core.SVNDepth;
+import com.intellij.ui.ListCellRendererWrapper;
+import org.jetbrains.idea.svn.api.Depth;
import javax.swing.*;
public class DepthCombo extends JComboBox {
public DepthCombo(final boolean forUpdate) {
super(forUpdate ? ourForUpdate : ourForCheckout);
- setSelectedIndex(forUpdate ? 0 : 3);
+ setRenderer(new DepthRenderer());
+ setSelectedItem(forUpdate ? Depth.UNKNOWN : Depth.INFINITY);
setEditable(false);
setToolTipText(SvnBundle.message("label.depth.description"));
}
- public SVNDepth getDepth() {
- return ((SVNDepthWithName) super.getSelectedItem()).getDepth();
+ public Depth getDepth() {
+ return (Depth)super.getSelectedItem();
}
- private final static SVNDepthWithName [] ourForUpdate = {new SVNDepthWithName(SVNDepth.UNKNOWN, "working copy"),
- new SVNDepthWithName(SVNDepth.EMPTY), new SVNDepthWithName(SVNDepth.FILES), new SVNDepthWithName(SVNDepth.IMMEDIATES),
- new SVNDepthWithName(SVNDepth.INFINITY)};
- private final static SVNDepthWithName [] ourForCheckout = {
- new SVNDepthWithName(SVNDepth.EMPTY), new SVNDepthWithName(SVNDepth.FILES), new SVNDepthWithName(SVNDepth.IMMEDIATES),
- new SVNDepthWithName(SVNDepth.INFINITY)};
+ private final static Depth[] ourForUpdate = {Depth.UNKNOWN, Depth.EMPTY, Depth.FILES, Depth.IMMEDIATES, Depth.INFINITY};
+ private final static Depth[] ourForCheckout = {Depth.EMPTY, Depth.FILES, Depth.IMMEDIATES, Depth.INFINITY};
- private static class SVNDepthWithName {
- private final SVNDepth myDepth;
- private final String myName;
-
- private SVNDepthWithName(SVNDepth depth) {
- myDepth = depth;
- myName = myDepth.toString();
- }
-
- private SVNDepthWithName(SVNDepth depth, String name) {
- myDepth = depth;
- myName = name;
- }
+ private static class DepthRenderer extends ListCellRendererWrapper<Depth> {
@Override
- public String toString() {
- return myName;
- }
-
- public SVNDepth getDepth() {
- return myDepth;
+ public void customize(JList list, Depth value, int index, boolean selected, boolean hasFocus) {
+ setText(Depth.UNKNOWN.equals(value) ? "working copy" : value.getName());
}
}
}