예제 #1
0
 public List<String> getPluginsHosts() {
   final List<String> result = new ArrayList<String>();
   for (int i = 0; i < myUrlsList.getModel().getSize(); i++) {
     result.add((String) myUrlsList.getModel().getElementAt(i));
   }
   return result;
 }
  public boolean setSelectedTemplate(@Nullable String group, @Nullable String name) {
    for (int i = 0; i < myList.getModel().getSize(); i++) {
      Object o = myList.getModel().getElementAt(i);
      if (o instanceof TemplateItem
          && ((TemplateItem) o).myGroup.getName().equals(group)
          && ((TemplateItem) o).getName().equals(name)) {
        myList.setSelectedIndex(i);
        return true;
      }
    }

    return false;
  }
예제 #3
0
 public void setPluginHosts(final List<String> pluginHosts) {
   final DefaultListModel model = (DefaultListModel) myUrlsList.getModel();
   model.clear();
   for (String host : pluginHosts) {
     //noinspection unchecked
     model.addElement(host);
   }
 }
예제 #4
0
 @TestOnly
 public boolean setSelectedTemplate(String group, String name) {
   ListModel model = myProjectTypeList.getModel();
   for (int i = 0; i < model.getSize(); i++) {
     TemplatesGroup templatesGroup = (TemplatesGroup) model.getElementAt(i);
     if (group.equals(templatesGroup.getName())) {
       myProjectTypeList.setSelectedIndex(i);
       if (name == null) return getSelectedGroup().getName().equals(group);
       Collection<ProjectTemplate> templates = myTemplatesMap.get(templatesGroup);
       setTemplatesList(templatesGroup, templates, false);
       return myTemplatesList.setSelectedTemplate(name);
     }
   }
   return false;
 }
 public void getData(CVSRevisionGraphProjectComponent data) {
   CVSRevisionGraphProjectConfig config = data.getConfig();
   config.set_useTwoTagConvention(_useTwoTagConventionCB.isSelected());
   config.set_tagNaming(_tagNamingTF.getText());
   config.set_showTags(_showTagsCB.isSelected());
   config.set_showTagFilter(_showTagR.isSelected());
   config.set_tagFilter(_tagFilterTF.getText());
   config.set_showBranchFilter(_showBranchR.isSelected());
   List<String> hiddenBranches = new ArrayList<String>();
   DefaultListModel lm = (DefaultListModel) _branchFilterL.getModel();
   for (int i = 0; i < lm.getSize(); i++) {
     String hiddenBranch = (String) lm.getElementAt(i);
     hiddenBranches.add(hiddenBranch);
   }
   data.setBranchFilter(hiddenBranches);
   config.set_showRevisionFilter(_showRevisionR.isSelected());
   config.set_afterDateTimeFilter(_afterDateTimeCB.isSelected());
   config.set_beforeDateTimeFilter(_beforeDateTimeCB.isSelected());
   config.set_afterDateTime(_afterDateTimeTF.getText());
   config.set_beforeDateTime(_beforeDateTimeTF.getText());
 }
 private void rebuildListContent() {
   ArrayList<Item> items = new ArrayList<Item>();
   int i = 0;
   List<Data> contents = new ArrayList<Data>(getContents());
   for (Data content : contents) {
     String fullString = getStringRepresentationFor(content);
     if (fullString != null) {
       String shortString;
       fullString = StringUtil.convertLineSeparators(fullString);
       int newLineIdx = fullString.indexOf('\n');
       if (newLineIdx == -1) {
         shortString = fullString.trim();
       } else {
         int lastLooked = 0;
         do {
           int nextLineIdx = fullString.indexOf("\n", lastLooked);
           if (nextLineIdx > lastLooked) {
             shortString = fullString.substring(lastLooked, nextLineIdx).trim() + " ...";
             break;
           } else if (nextLineIdx == -1) {
             shortString = " ...";
             break;
           }
           lastLooked = nextLineIdx + 1;
         } while (true);
       }
       items.add(new Item(i++, shortString, fullString));
     }
   }
   myAllContents = contents;
   FilteringListModel listModel = (FilteringListModel) myList.getModel();
   ((CollectionListModel) listModel.getOriginalModel()).removeAll();
   listModel.addAll(items);
   ListWithFilter listWithFilter = UIUtil.getParentOfType(ListWithFilter.class, myList);
   if (listWithFilter != null) {
     listWithFilter.getSpeedSearch().update();
     if (listModel.getSize() == 0) listWithFilter.resetFilter();
   }
 }
 public void setData(CVSRevisionGraphProjectComponent data) {
   CVSRevisionGraphProjectConfig config = data.getConfig();
   _useTwoTagConventionCB.setSelected(config.is_useTwoTagConvention());
   _tagNamingTF.setText(config.get_tagNaming());
   _showTagsCB.setSelected(config.is_showTags());
   if (config.is_showTagFilter()) {
     _showTagR.setSelected(true);
   } else {
     _hideTagR.setSelected(true);
   }
   _tagFilterTF.setText(config.get_tagFilter());
   if (config.is_showBranchFilter()) {
     _showBranchR.setSelected(true);
   } else {
     _hideBranchR.setSelected(true);
   }
   List<String> hiddenBranches = data.getBranchFilter();
   DefaultListModel lm = (DefaultListModel) _branchFilterL.getModel();
   lm.removeAllElements();
   for (String hiddenBranch : hiddenBranches) {
     lm.addElement(hiddenBranch);
   }
   if (config.is_showRevisionFilter()) {
     _showRevisionR.setSelected(true);
   } else {
     _hideRevisionR.setSelected(true);
   }
   _afterDateTimeCB.setSelected(config.is_afterDateTimeFilter());
   _beforeDateTimeCB.setSelected(config.is_beforeDateTimeFilter());
   _afterDateTimeTF.setText(config.get_afterDateTime());
   _beforeDateTimeTF.setText(config.get_beforeDateTime());
   updateTagNamingExample();
   updateTagFilter();
   updateAfterDateTimeFilter();
   updateBeforeDateTimeFilter();
 }
예제 #8
0
 private CollectionListModel<LookupElement> getListModel() {
   //noinspection unchecked
   return (CollectionListModel<LookupElement>) myList.getModel();
 }
 public boolean isModified(CVSRevisionGraphProjectComponent data) {
   CVSRevisionGraphProjectConfig config = data.getConfig();
   if (_useTwoTagConventionCB.isSelected() != config.is_useTwoTagConvention()) {
     return true;
   }
   if (_tagNamingTF.getText() != null
       ? !_tagNamingTF.getText().equals(config.get_tagNaming())
       : config.get_tagNaming() != null) {
     return true;
   }
   if (_showRevisionR.isSelected() != config.is_showRevisionFilter()) {
     return true;
   }
   if (_afterDateTimeCB.isSelected() != config.is_afterDateTimeFilter()) {
     return true;
   }
   if (_beforeDateTimeCB.isSelected() != config.is_beforeDateTimeFilter()) {
     return true;
   }
   if (_afterDateTimeTF.getText() != null
       ? !_afterDateTimeTF.getText().equals(config.get_afterDateTime())
       : config.get_afterDateTime() != null) {
     return true;
   }
   if (_beforeDateTimeTF.getText() != null
       ? !_beforeDateTimeTF.getText().equals(config.get_beforeDateTime())
       : config.get_beforeDateTime() != null) {
     return true;
   }
   if (_showTagsCB.isSelected() != config.is_showTags()) {
     return true;
   }
   if (_showTagR.isSelected() != config.is_showTagFilter()) {
     return true;
   }
   if (_tagFilterTF.getText() != null
       ? !_tagFilterTF.getText().equals(config.get_tagFilter())
       : config.get_tagFilter() != null) {
     return true;
   }
   if (_showBranchR.isSelected() != config.is_showBranchFilter()) {
     return true;
   }
   DefaultListModel lm = (DefaultListModel) _branchFilterL.getModel();
   List<String> hiddenBranches = data.getBranchFilter();
   if ((lm == null) && (hiddenBranches == null)) {
     return false;
   }
   if ((lm == null)) {
     return true;
   }
   if ((hiddenBranches == null)) {
     return true;
   }
   if (lm.getSize() != hiddenBranches.size()) {
     return true;
   }
   for (int i = 0; i < hiddenBranches.size(); i++) {
     String hiddenBranch = hiddenBranches.get(i);
     String hBranch = (String) lm.getElementAt(i);
     if ((hiddenBranch == null) && (hBranch == null)) {
       continue;
     }
     if (hiddenBranch == null) {
       return true;
     }
     if (hBranch == null) {
       return true;
     }
     if (!hiddenBranch.equals(hBranch)) {
       return true;
     }
   }
   return false;
 }
 public void configurationsChanged(final SearchContext searchContext) {
   ((MyListModel) myTemplatesList.getModel()).fireContentsChanged();
 }
예제 #11
0
 @Override
 protected JBList createList() {
   myList = super.createList();
   ((CollectionListModel) myList.getModel()).replaceAll(getListItems());
   return myList;
 }