Search in sources :

Example 1 with CheckoutStrategy

use of com.intellij.openapi.vcs.checkout.CheckoutStrategy in project intellij-community by JetBrains.

the class ChooseCheckoutMode method rebuildList.

private void rebuildList() {
    final File selected = myCvsPaths.iterator().next();
    setStepTitle(CvsBundle.message("dialog.title.check.out.to", selected));
    myCheckoutModeModel.removeAllElements();
    final boolean forFile = getWizard().getSelectedElements()[0] instanceof CvsFile;
    final CheckoutStrategy[] strategies = CheckoutStrategy.createAllStrategies(mySelectedLocation, selected, forFile);
    final Collection<File> results = new HashSet();
    final List<CheckoutStrategy> resultModes = new ArrayList();
    for (CheckoutStrategy strategy : strategies) {
        final File resultFile = strategy.getResult();
        if (resultFile != null && !results.contains(resultFile)) {
            results.add(resultFile);
            resultModes.add(strategy);
        }
    }
    Collections.sort(resultModes);
    for (CheckoutStrategy resultMode : resultModes) {
        myCheckoutModeModel.addElement(resultMode);
    }
    myCheckoutModeList.setSelectedIndex(0);
}
Also used : CheckoutStrategy(com.intellij.openapi.vcs.checkout.CheckoutStrategy) File(java.io.File) CvsFile(com.intellij.cvsSupport2.cvsBrowser.CvsFile) CvsFile(com.intellij.cvsSupport2.cvsBrowser.CvsFile) HashSet(com.intellij.util.containers.HashSet)

Example 2 with CheckoutStrategy

use of com.intellij.openapi.vcs.checkout.CheckoutStrategy in project intellij-community by JetBrains.

the class CheckoutOptionsDialog method fillTargetList.

private void fillTargetList(final File target) {
    final DefaultListModel listModel = new DefaultListModel();
    final List<CheckoutStrategy> strategies = new ArrayList<>();
    Collections.addAll(strategies, CheckoutStrategy.createAllStrategies(target, new File(myRelativePath), false));
    strategies.add(new SvnTrunkCheckoutStrategy(target, new File(myRelativePath), false));
    final List<File> targets = new ArrayList<>(5);
    for (CheckoutStrategy strategy : strategies) {
        final File result = strategy.getResult();
        if (result != null && (!targets.contains(result))) {
            targets.add(result);
        }
    }
    Collections.sort(targets);
    for (File file : targets) {
        listModel.addElement(file);
    }
    myLocalTargetList.setModel(listModel);
    myLocalTargetList.setVisibleRowCount(4);
    myLocalTargetList.setPreferredSize(new Dimension(20, 80));
    myLocalTargetList.setMinimumSize(new Dimension(20, 80));
    myLocalTargetList.setSelectedValue(target, true);
    if (myLocalTargetList.getSelectedValues() == null && (!targets.isEmpty())) {
        myLocalTargetList.setSelectedIndex(0);
    }
}
Also used : ArrayList(java.util.ArrayList) CheckoutStrategy(com.intellij.openapi.vcs.checkout.CheckoutStrategy) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) File(java.io.File)

Aggregations

CheckoutStrategy (com.intellij.openapi.vcs.checkout.CheckoutStrategy)2 File (java.io.File)2 CvsFile (com.intellij.cvsSupport2.cvsBrowser.CvsFile)1 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 HashSet (com.intellij.util.containers.HashSet)1 ArrayList (java.util.ArrayList)1