当前位置: 首页>>代码示例>>Java>>正文


Java Convertor类代码示例

本文整理汇总了Java中com.intellij.util.containers.Convertor的典型用法代码示例。如果您正苦于以下问题:Java Convertor类的具体用法?Java Convertor怎么用?Java Convertor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Convertor类属于com.intellij.util.containers包,在下文中一共展示了Convertor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: requestClientAuthentication

import com.intellij.util.containers.Convertor; //导入依赖的package包/类
@Override
public SVNAuthentication requestClientAuthentication(String kind,
                                                     SVNURL url,
                                                     String realm,
                                                     SVNErrorMessage errorMessage,
                                                     SVNAuthentication previousAuth,
                                                     boolean authMayBeStored) {
  authMayBeStored = authMayBeStored && mySaveData;
  Convertor<SVNURL, SVNAuthentication> convertor = myData.get(kind);
  SVNAuthentication result = convertor == null ? null : convertor.convert(url);
  if (result == null) {
    if (ISVNAuthenticationManager.USERNAME.equals(kind)) {
      result = new SVNUserNameAuthentication("username", authMayBeStored);
    } else if (ISVNAuthenticationManager.PASSWORD.equals(kind)) {
      result = new SVNPasswordAuthentication("username", "abc", authMayBeStored, url, false);
    } else if (ISVNAuthenticationManager.SSH.equals(kind)) {
      result = new SVNSSHAuthentication("username", "abc", -1, authMayBeStored, url, false);
    } else if (ISVNAuthenticationManager.SSL.equals(kind)) {
      result = new SVNSSLAuthentication(new File("aaa"), "abc", authMayBeStored, url, false);
    }
  }
  if (! ISVNAuthenticationManager.USERNAME.equals(kind)) {
    myManager.requested(ProviderType.interactive, url, realm, kind, result == null);
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:SvnTestInteractiveAuthentication.java

示例2: importPlaces

import com.intellij.util.containers.Convertor; //导入依赖的package包/类
private int importPlaces(final List<BaseInjection> injections) {
  final Map<String, Set<BaseInjection>> map = ContainerUtil.classify(injections.iterator(), new Convertor<BaseInjection, String>() {
    @Override
    public String convert(final BaseInjection o) {
      return o.getSupportId();
    }
  });
  List<BaseInjection> originalInjections = new ArrayList<BaseInjection>();
  List<BaseInjection> newInjections = new ArrayList<BaseInjection>();
  for (String supportId : InjectorUtils.getActiveInjectionSupportIds()) {
    final Set<BaseInjection> importingInjections = map.get(supportId);
    if (importingInjections == null) continue;
    importInjections(getInjections(supportId), importingInjections, originalInjections, newInjections);
  }
  if (!newInjections.isEmpty()) configurationModified();
  replaceInjections(newInjections, originalInjections, true);
  return newInjections.size();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:Configuration.java

示例3: StepIntersection

import com.intellij.util.containers.Convertor; //导入依赖的package包/类
public StepIntersection(Convertor<Data, TextRange> dataConvertor,
                        Convertor<Area, TextRange> areasConvertor,
                        final List<Area> areas,
                        Getter<String> debugDocumentTextGetter) {
  myAreas = areas;
  myDebugDocumentTextGetter = debugDocumentTextGetter;
  myAreaIndex = 0;
  myDataConvertor = dataConvertor;
  myAreasConvertor = areasConvertor;
  myHackSearch = new HackSearch<Data, Area, TextRange>(myDataConvertor, myAreasConvertor, new Comparator<TextRange>() {
    @Override
    public int compare(TextRange o1, TextRange o2) {
      return o1.intersects(o2) ? 0 : o1.getStartOffset() < o2.getStartOffset() ? -1 : 1;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:StepIntersection.java

示例4: HackSearch

import com.intellij.util.containers.Convertor; //导入依赖的package包/类
public HackSearch(Convertor<T, Z> TZConvertor, Convertor<S, Z> SZConvertor, Comparator<Z> zComparator) {
  myTZConvertor = TZConvertor;
  mySZConvertor = SZConvertor;
  myZComparator = zComparator;
  myComparator = new Comparator<S>() {
  @Override
  public int compare(S o1, S o2) {
    Z z1 = mySZConvertor.convert(o1);
    Z z2 = mySZConvertor.convert(o2);
    if (o1 == myFake) {
      z1 = myFakeConverted;
    } else if (o2 == myFake) {
      z2 = myFakeConverted;
    }
    return myZComparator.compare(z1, z2);
  }
};
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:HackSearch.java

示例5: createTree

import com.intellij.util.containers.Convertor; //导入依赖的package包/类
private static Tree createTree(TreeModel treeModel) {
  final Tree tree = new Tree(treeModel);

  tree.setRootVisible(false);
  tree.setShowsRootHandles(true);
  tree.setDragEnabled(false);
  tree.setEditable(false);
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);


  final TreeSpeedSearch speedSearch = new TreeSpeedSearch(
    tree,
    new Convertor<TreePath, String>() {
      public String convert(TreePath object) {
        final Object userObject = ((DefaultMutableTreeNode)object.getLastPathComponent()).getUserObject();
        return (userObject instanceof Configuration) ? ((Configuration)userObject).getName() : userObject.toString();
      }
    }
  );
  tree.setCellRenderer(new ExistingTemplatesTreeCellRenderer(speedSearch));

  return tree;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ExistingTemplatesComponent.java

示例6: run

import com.intellij.util.containers.Convertor; //导入依赖的package包/类
@Override
public void run(ContinuationContext context) {
  final Project project = myVcs.getProject();
  final List<FilePatch> patches;
  try {
    patches = IdeaTextPatchBuilder.buildPatch(project, myTheirsChanges, myBaseForPatch.getPath(), false);
    myTextPatches = ObjectsConvertor.convert(patches, new Convertor<FilePatch, TextFilePatch>() {
      @Override
      public TextFilePatch convert(FilePatch o) {
        return (TextFilePatch)o;
      }
    });
  }
  catch (VcsException e) {
    context.handleException(e, true);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:MergeFromTheirsResolver.java

示例7: installSpeedSearch

import com.intellij.util.containers.Convertor; //导入依赖的package包/类
@Override
protected void installSpeedSearch() {
  new TreeSpeedSearch(this, new Convertor<TreePath, String>() {
    @Override
    public String convert(TreePath path) {
      Object node = path.getLastPathComponent();
      if (node instanceof BreakpointItemNode) {
        return ((BreakpointItemNode)node).getBreakpointItem().speedSearchText();
      }
      else if (node instanceof BreakpointsGroupNode) {
        return ((BreakpointsGroupNode)node).getGroup().getName();
      }
      return "";
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:BreakpointsCheckboxTree.java

示例8: getDefaultRoots

import com.intellij.util.containers.Convertor; //导入依赖的package包/类
public List<VirtualFile> getDefaultRoots() {
  synchronized (myLock) {
    final String defaultVcs = haveDefaultMapping();
    if (defaultVcs == null) return Collections.emptyList();
    final List<VirtualFile> list = new ArrayList<VirtualFile>();
    myDefaultVcsRootPolicy.addDefaultVcsRoots(this, defaultVcs, list);
    if (StringUtil.isEmptyOrSpaces(defaultVcs)) {
      return AbstractVcs.filterUniqueRootsDefault(list, Convertor.SELF);
    }
    else {
      final AbstractVcs<?> vcs = AllVcses.getInstance(myProject).getByName(defaultVcs);
      if (vcs == null) {
        return AbstractVcs.filterUniqueRootsDefault(list, Convertor.SELF);
      }
      return vcs.filterUniqueRoots(list, Convertor.SELF);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:NewMappings.java

示例9: init

import com.intellij.util.containers.Convertor; //导入依赖的package包/类
public void init(final Convertor<String, VcsShowConfirmationOption.Value> initOptions) {
  createSettingFor(VcsConfiguration.StandardOption.ADD);
  createSettingFor(VcsConfiguration.StandardOption.REMOVE);
  createSettingFor(VcsConfiguration.StandardOption.CHECKOUT);
  createSettingFor(VcsConfiguration.StandardOption.UPDATE);
  createSettingFor(VcsConfiguration.StandardOption.STATUS);
  createSettingFor(VcsConfiguration.StandardOption.EDIT);

  myConfirmations.put(VcsConfiguration.StandardConfirmation.ADD.getId(), new VcsShowConfirmationOptionImpl(
    VcsConfiguration.StandardConfirmation.ADD.getId(),
    VcsBundle.message("label.text.when.files.created.with.idea", ApplicationNamesInfo.getInstance().getProductName()),
    VcsBundle.message("radio.after.creation.do.not.add"), VcsBundle.message("radio.after.creation.show.options"),
    VcsBundle.message("radio.after.creation.add.silently")));

  myConfirmations.put(VcsConfiguration.StandardConfirmation.REMOVE.getId(), new VcsShowConfirmationOptionImpl(
    VcsConfiguration.StandardConfirmation.REMOVE.getId(),
    VcsBundle.message("label.text.when.files.are.deleted.with.idea", ApplicationNamesInfo.getInstance().getProductName()),
    VcsBundle.message("radio.after.deletion.do.not.remove"), VcsBundle.message("radio.after.deletion.show.options"),
    VcsBundle.message("radio.after.deletion.remove.silently")));

  restoreReadConfirm(VcsConfiguration.StandardConfirmation.ADD, initOptions);
  restoreReadConfirm(VcsConfiguration.StandardConfirmation.REMOVE, initOptions);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:OptionsAndConfirmations.java

示例10: formatTextWithLinks

import com.intellij.util.containers.Convertor; //导入依赖的package包/类
@SuppressWarnings({"HardCodedStringLiteral"})
public static String formatTextWithLinks(final Project project, final String c, final Convertor<String, String> convertor) {
  if (c == null) return "";
  String comment = XmlTagUtilBase.escapeString(c, false);

  StringBuilder commentBuilder = new StringBuilder();
  IssueNavigationConfiguration config = IssueNavigationConfiguration.getInstance(project);
  final List<IssueNavigationConfiguration.LinkMatch> list = config.findIssueLinks(comment);
  int pos = 0;
  for(IssueNavigationConfiguration.LinkMatch match: list) {
    TextRange range = match.getRange();
    commentBuilder.append(convertor.convert(comment.substring(pos, range.getStartOffset()))).append("<a href=\"").append(match.getTargetUrl()).append("\">");
    commentBuilder.append(range.substring(comment)).append("</a>");
    pos = range.getEndOffset();
  }
  commentBuilder.append(convertor.convert(comment.substring(pos)));
  comment = commentBuilder.toString();

  return comment.replace("\n", "<br>");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:IssueLinkHtmlRenderer.java

示例11: createComponent

import com.intellij.util.containers.Convertor; //导入依赖的package包/类
private void createComponent() {
  setLayout(new BorderLayout());
  myRepositoryTree = new Tree();
  myRepositoryTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  myRepositoryTree.setRootVisible(false);
  myRepositoryTree.setShowsRootHandles(true);
  JScrollPane scrollPane =
    ScrollPaneFactory.createScrollPane(myRepositoryTree, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
  add(scrollPane, BorderLayout.CENTER);
  myRepositoryTree.setCellRenderer(new SvnRepositoryTreeCellRenderer());
  TreeSpeedSearch search = new TreeSpeedSearch(myRepositoryTree, new Convertor<TreePath, String>() {
    @Override
    public String convert(TreePath o) {
      Object component = o.getLastPathComponent();
      if (component instanceof RepositoryTreeNode) {
        return ((RepositoryTreeNode)component).getURL().toDecodedString();
      }
      return null;
    }
  });
  search.setComparator(new SpeedSearchComparator(false, true));

  EditSourceOnDoubleClickHandler.install(myRepositoryTree);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:RepositoryBrowserComponent.java

示例12: installSpeedSearch

import com.intellij.util.containers.Convertor; //导入依赖的package包/类
@Override
protected void installSpeedSearch() {
  new TreeSpeedSearch(this, new Convertor<TreePath, String>() {
    @Override
    public String convert(TreePath o) {
      Object object = ((DefaultMutableTreeNode)o.getLastPathComponent()).getUserObject();
      if (object instanceof TemplateGroup) {
        return ((TemplateGroup)object).getName();
      }
      if (object instanceof TemplateImpl) {
        TemplateImpl template = (TemplateImpl)object;
        return StringUtil.notNullize(template.getGroupName()) + " " +
               StringUtil.notNullize(template.getKey()) + " " +
               StringUtil.notNullize(template.getDescription()) + " " +
               template.getTemplateText();
      }
      return "";
    }
  }, true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LiveTemplateTree.java

示例13: wrapEditor

import com.intellij.util.containers.Convertor; //导入依赖的package包/类
private <T> SettingsEditor<RunnerAndConfigurationSettings> wrapEditor(SettingsEditor<T> editor,
                                                                      Convertor<RunnerAndConfigurationSettings, T> convertor,
                                                                      ProgramRunner runner) {
  SettingsEditor<RunnerAndConfigurationSettings> wrappedEditor
    = new SettingsEditorWrapper<RunnerAndConfigurationSettings, T>(editor, convertor);

  List<SettingsEditor> unwrappedEditors = myRunner2UnwrappedEditors.get(runner);
  if (unwrappedEditors == null) {
    unwrappedEditors = new ArrayList<SettingsEditor>();
    myRunner2UnwrappedEditors.put(runner, unwrappedEditors);
  }
  unwrappedEditors.add(editor);

  myRunnerEditors.add(wrappedEditor);
  Disposer.register(this, wrappedEditor);

  return wrappedEditor;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ConfigurationSettingsEditor.java

示例14: installTree

import com.intellij.util.containers.Convertor; //导入依赖的package包/类
private void installTree() {
  getTree().getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
  myAutoScrollToSourceHandler.install(getTree());
  myAutoScrollFromSourceHandler.install();

  TreeUtil.installActions(getTree());

  new TreeSpeedSearch(getTree(), new Convertor<TreePath, String>() {
    @Override
    public String convert(final TreePath treePath) {
      final DefaultMutableTreeNode node = (DefaultMutableTreeNode)treePath.getLastPathComponent();
      final Object userObject = node.getUserObject();
      if (userObject != null) {
        return FileStructurePopup.getSpeedSearchText(userObject);
      }
      return null;
    }
  });

  addTreeKeyListener();
  addTreeMouseListeners();
  restoreState();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:StructureViewComponent.java

示例15: installSpeedSearch

import com.intellij.util.containers.Convertor; //导入依赖的package包/类
protected void installSpeedSearch() {
  final TreeSpeedSearch treeSpeedSearch = new TreeSpeedSearch(myTree, new Convertor<TreePath, String>() {
    @Override
    @Nullable
    public String convert(TreePath path) {
      final ElementNode lastPathComponent = (ElementNode)path.getLastPathComponent();
      if (lastPathComponent == null) return null;
      String text = lastPathComponent.getDelegate().getText();
      if (text != null) {
        text = convertElementText(text);
      }
      return text;
    }
  });
  treeSpeedSearch.setComparator(getSpeedSearchComparator());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:MemberChooser.java


注:本文中的com.intellij.util.containers.Convertor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。