Java 类com.intellij.openapi.util.JDOMExternalizableStringList 实例源码

项目:intellij-ce-playground    文件:EntryPointsManagerBase.java   
@SuppressWarnings({"HardCodedStringLiteral"})
public static void writeExternal(final Element element,
                          final Map<String, SmartRefElementPointer> persistentEntryPoints,
                          final JDOMExternalizableStringList additional_annotations) {
  Element entryPointsElement = new Element("entry_points");
  entryPointsElement.setAttribute(VERSION_ATTR, VERSION);
  for (SmartRefElementPointer entryPoint : persistentEntryPoints.values()) {
    assert entryPoint.isPersistent();
    entryPoint.writeExternal(entryPointsElement);
  }

  element.addContent(entryPointsElement);
  if (!additional_annotations.isEmpty()) {
    additional_annotations.writeExternal(element);
  }
}
项目:intellij-ce-playground    文件:EntryPointsConverterTest.java   
private static void doTest(String type, String fqName, String expectedFQName) throws Exception {
  final Element entryPoints = setUpEntryPoint(type, fqName);

  final HashMap<String, SmartRefElementPointer> persistentEntryPoints = new HashMap<String, SmartRefElementPointer>();
  EntryPointsManagerBase.convert(entryPoints, persistentEntryPoints);

  final Element testElement = new Element("comp");
  EntryPointsManagerBase.writeExternal(testElement, persistentEntryPoints, new JDOMExternalizableStringList());

  final Element expectedEntryPoints = setUpEntryPoint(type, expectedFQName);
  expectedEntryPoints.setAttribute("version", "2.0");
  final Element expected = new Element("comp");
  expected.addContent(expectedEntryPoints);

  assertTrue(JDOMUtil.areElementsEqual(testElement, expected));
}
项目:intellij-ce-playground    文件:PyPackageRequirementsInspection.java   
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
  final PsiElement element = descriptor.getPsiElement();
  if (element != null) {
    final PyPackageRequirementsInspection inspection = getInstance(element);
    if (inspection != null) {
      final JDOMExternalizableStringList ignoredPackages = inspection.ignoredPackages;
      boolean changed = false;
      for (String name : myPackageNames) {
        if (!ignoredPackages.contains(name)) {
          ignoredPackages.add(name);
          changed = true;
        }
      }
      if (changed) {
        final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
        InspectionProfileManager.getInstance().fireProfileChanged(profile);
      }
    }
  }
}
项目:tools-idea    文件:EntryPointsConverterTest.java   
private static void doTest(String type, String fqName, String expectedFQName) throws Exception {
  final Element entryPoints = setUpEntryPoint(type, fqName);

  final HashMap<String, SmartRefElementPointer> persistentEntryPoints = new HashMap<String, SmartRefElementPointer>();
  EntryPointsManagerBase.convert(entryPoints, persistentEntryPoints);

  final Element testElement = new Element("comp");
  EntryPointsManagerBase.writeExternal(testElement, persistentEntryPoints, new JDOMExternalizableStringList());

  final Element expectedEntryPoints = setUpEntryPoint(type, expectedFQName);
  expectedEntryPoints.setAttribute("version", "2.0");
  final Element expected = new Element("comp");
  expected.addContent(expectedEntryPoints);

  assertTrue(JDOMUtil.areElementsEqual(testElement, expected));
}
项目:tools-idea    文件:ActionUninstallPlugin.java   
private void uninstallPlugin(IdeaPluginDescriptorImpl descriptor) {
  PluginId pluginId = descriptor.getPluginId();
  descriptor.setDeleted(true);

  try {
    PluginInstaller.prepareToUninstall(pluginId);
    final JDOMExternalizableStringList installedPlugins = PluginManagerUISettings.getInstance().getInstalledPlugins();
    final String pluginIdString = pluginId.getIdString();
    while (installedPlugins.contains(pluginIdString)) {
      installedPlugins.remove(pluginIdString);
    }
    host.setRequireShutdown(descriptor.isEnabled());
    pluginTable.updateUI();
  }
  catch (IOException e1) {
    PluginManagerMain.LOG.error(e1);
  }
}
项目:tools-idea    文件:MethodParameterInjection.java   
private void readOldFormat(final Element e) {
  final JDOMExternalizableStringList list = new JDOMExternalizableStringList();
  try {
    list.readExternal(e);
  }
  catch (InvalidDataException e1) {
    // nothing
  }
  if (list.isEmpty()) return;
  final boolean[] selection = new boolean[list.size()];
  for (int i = 0; i < list.size(); i++) {
    selection[i] = Boolean.parseBoolean(list.get(i));
  }
  final String methodSignature = fixSignature(JDOMExternalizer.readString(e, "METHOD"), false);
  myParameterMap.put(methodSignature, new MethodInfo(methodSignature, selection, false));
}
项目:consulo-java    文件:EntryPointsManagerBase.java   
public static void writeExternal(final Element element, final Map<String, SmartRefElementPointer> persistentEntryPoints, final JDOMExternalizableStringList additional_annotations)
{
    Element entryPointsElement = new Element("entry_points");
    entryPointsElement.setAttribute(VERSION_ATTR, VERSION);
    for(SmartRefElementPointer entryPoint : persistentEntryPoints.values())
    {
        assert entryPoint.isPersistent();
        entryPoint.writeExternal(entryPointsElement);
    }

    element.addContent(entryPointsElement);
    if(!additional_annotations.isEmpty())
    {
        additional_annotations.writeExternal(element);
    }
}
项目:consulo-java    文件:EntryPointsConverterTest.java   
private static void doTest(String type, String fqName, String expectedFQName) throws Exception {
  final Element entryPoints = setUpEntryPoint(type, fqName);

  final HashMap<String, SmartRefElementPointer> persistentEntryPoints = new HashMap<String, SmartRefElementPointer>();
  EntryPointsManagerImpl.convert(entryPoints, persistentEntryPoints);

  final Element testElement = new Element("comp");
  EntryPointsManagerImpl.writeExternal(testElement, persistentEntryPoints, new JDOMExternalizableStringList());

  final Element expectedEntryPoints = setUpEntryPoint(type, expectedFQName);
  expectedEntryPoints.setAttribute("version", "2.0");
  final Element expected = new Element("comp");
  expected.addContent(expectedEntryPoints);

  assertTrue(JDOMUtil.areElementsEqual(testElement, expected));
}
项目:consulo-java    文件:MethodParameterInjection.java   
private void readOldFormat(final Element e) {
  final JDOMExternalizableStringList list = new JDOMExternalizableStringList();
  try {
    list.readExternal(e);
  }
  catch (InvalidDataException e1) {
    // nothing
  }
  if (list.isEmpty()) return;
  final boolean[] selection = new boolean[list.size()];
  for (int i = 0; i < list.size(); i++) {
    selection[i] = Boolean.parseBoolean(list.get(i));
  }
  final String methodSignature = fixSignature(JDOMExternalizer.readString(e, "METHOD"), false);
  myParameterMap.put(methodSignature, new MethodInfo(methodSignature, selection, false));
}
项目:intellij-ce-playground    文件:SeverityRegistrar.java   
public void writeExternal(Element element) {
  List<HighlightSeverity> list = getOrderAsList(getOrderMap());
  for (HighlightSeverity severity : list) {
    Element info = new Element(INFO_TAG);
    String severityName = severity.getName();
    final SeverityBasedTextAttributes infoType = getAttributesBySeverity(severity);
    if (infoType != null) {
      infoType.writeExternal(info);
      final Color color = myRendererColors.get(severityName);
      if (color != null) {
        info.setAttribute(COLOR_ATTRIBUTE, Integer.toString(color.getRGB() & 0xFFFFFF, 16));
      }
      element.addContent(info);
    }
  }

  if (myReadOrder != null && !myReadOrder.isEmpty()) {
    myReadOrder.writeExternal(element);
  }
  else if (!getDefaultOrder().equals(list)) {
    final JDOMExternalizableStringList ext = new JDOMExternalizableStringList(Collections.nCopies(getOrderMap().size(), ""));
    getOrderMap().forEachEntry(new TObjectIntProcedure<HighlightSeverity>() {
      @Override
      public boolean execute(HighlightSeverity orderSeverity, int oIdx) {
        ext.set(oIdx, orderSeverity.getName());
        return true;
      }
    });
    ext.writeExternal(element);
  }
}
项目:intellij-ce-playground    文件:PySetFunctionToLiteralInspection.java   
private static boolean isAvailable(PyCallExpression node) {
  final InspectionProfile profile = InspectionProjectProfileManager.getInstance(node.getProject()).getInspectionProfile();
  final InspectionToolWrapper inspectionTool = profile.getInspectionTool("PyCompatibilityInspection", node.getProject());
  if (inspectionTool != null) {
    final InspectionProfileEntry inspection = inspectionTool.getTool();
    if (inspection instanceof PyCompatibilityInspection) {
      final JDOMExternalizableStringList versions = ((PyCompatibilityInspection)inspection).ourVersions;
      for (String s : versions) {
        if (!LanguageLevel.fromPythonVersion(s).supportsSetLiterals()) return false;
      }
    }
  }
  return LanguageLevel.forElement(node).supportsSetLiterals();
}
项目:intellij-ce-playground    文件:HtmlUnknownElementInspection.java   
protected static JDOMExternalizableStringList reparseProperties(@NotNull final String properties) {
  final JDOMExternalizableStringList result = new JDOMExternalizableStringList();

  final StringTokenizer tokenizer = new StringTokenizer(properties, ",");
  while (tokenizer.hasMoreTokens()) {
    result.add(tokenizer.nextToken().toLowerCase().trim());
  }

  return result;
}
项目:intellij-ce-playground    文件:MethodParameterInjection.java   
private void readOldFormat(final Element e) {
  final JDOMExternalizableStringList list = new JDOMExternalizableStringList();
  try {
    list.readExternal(e);
  }
  catch (IllegalDataException ignored) {
  }
  if (list.isEmpty()) return;
  final boolean[] selection = new boolean[list.size()];
  for (int i = 0; i < list.size(); i++) {
    selection[i] = Boolean.parseBoolean(list.get(i));
  }
  final String methodSignature = fixSignature(JDOMExternalizer.readString(e, "METHOD"), false);
  myParameterMap.put(methodSignature, new MethodInfo(methodSignature, selection, false));
}
项目:tools-idea    文件:SeverityRegistrar.java   
@Override
public void writeExternal(Element element) throws WriteExternalException {
  List<HighlightSeverity> list = getOrderAsList();
  for (HighlightSeverity s : list) {
    Element info = new Element(INFO);
    String severity = s.toString();
    final SeverityBasedTextAttributes infoType = myMap.get(severity);
    if (infoType != null) {
      infoType.writeExternal(info);
      final Color color = myRendererColors.get(severity);
      if (color != null) {
        info.setAttribute(COLOR, Integer.toString(color.getRGB() & 0xFFFFFF, 16));
      }
      element.addContent(info);
    }
  }

  if (myReadOrder != null && !myReadOrder.isEmpty()) {
    myReadOrder.writeExternal(element);
  }
  else if (!getDefaultOrder().equals(list)) {
    final JDOMExternalizableStringList ext = new JDOMExternalizableStringList(Collections.nCopies(myOrder.size(), ""));
    myOrder.forEachEntry(new TObjectIntProcedure<HighlightSeverity>() {
      @Override
      public boolean execute(HighlightSeverity orderSeverity, int oIdx) {
        ext.set(oIdx, orderSeverity.toString());
        return true;
      }
    });
    ext.writeExternal(element);
  }
}
项目:tools-idea    文件:InstalledPluginsTableModel.java   
public void updateRepositoryPlugins() {
  myPlugin2host.clear();
  final JDOMExternalizableStringList pluginHosts = UpdateSettings.getInstance().myPluginHosts;
  for (String host : pluginHosts) {
    try {
      final ArrayList<PluginDownloader> downloaded = new ArrayList<PluginDownloader>();
      UpdateChecker.checkPluginsHost(host, downloaded, false, null);
      for (PluginDownloader downloader : downloaded) {
        myPlugin2host.put(downloader.getPluginId(), host);
      }
    }
    catch (Exception ignored) {
    }
  }
}
项目:tools-idea    文件:InstalledPluginsTableModel.java   
private static void updateExistingPluginInfo(IdeaPluginDescriptor descr, IdeaPluginDescriptor existing) {
  int state = StringUtil.compareVersionNumbers(descr.getVersion(), existing.getVersion());
  final PluginId pluginId = existing.getPluginId();
  final String idString = pluginId.getIdString();
  final JDOMExternalizableStringList installedPlugins = PluginManagerUISettings.getInstance().getInstalledPlugins();
  if (!installedPlugins.contains(idString) && !((IdeaPluginDescriptorImpl)existing).isDeleted()){
    installedPlugins.add(idString);
  }
  final PluginManagerUISettings updateSettings = PluginManagerUISettings.getInstance();
  if (state > 0 && !PluginManager.isIncompatible(descr) && !updatedPlugins.contains(descr.getPluginId())) {
    NewVersions2Plugins.put(pluginId, 1);
    if (!updateSettings.myOutdatedPlugins.contains(idString)) {
      updateSettings.myOutdatedPlugins.add(idString);
    }

    final IdeaPluginDescriptorImpl plugin = (IdeaPluginDescriptorImpl)existing;
    plugin.setDownloadsCount(descr.getDownloads());
    plugin.setVendor(descr.getVendor());
    plugin.setVendorEmail(descr.getVendorEmail());
    plugin.setVendorUrl(descr.getVendorUrl());
    plugin.setUrl(descr.getUrl());

  } else {
    updateSettings.myOutdatedPlugins.remove(idString);
    if (NewVersions2Plugins.remove(pluginId) != null) {
      updatedPlugins.add(pluginId);
    }
  }
}
项目:tools-idea    文件:HtmlUnknownTagInspection.java   
protected static JDOMExternalizableStringList reparseProperties(@NotNull final String properties) {
  final JDOMExternalizableStringList result = new JDOMExternalizableStringList();

  final StringTokenizer tokenizer = new StringTokenizer(properties, ",");
  while (tokenizer.hasMoreTokens()) {
    result.add(tokenizer.nextToken().toLowerCase().trim());
  }

  return result;
}
项目:consulo    文件:SeverityRegistrar.java   
@Override
public void writeExternal(Element element) throws WriteExternalException {
  List<HighlightSeverity> list = getOrderAsList(getOrderMap());
  for (HighlightSeverity severity : list) {
    Element info = new Element(INFO_TAG);
    String severityName = severity.getName();
    final SeverityBasedTextAttributes infoType = getAttributesBySeverity(severity);
    if (infoType != null) {
      infoType.writeExternal(info);
      final Color color = myRendererColors.get(severityName);
      if (color != null) {
        info.setAttribute(COLOR_ATTRIBUTE, Integer.toString(color.getRGB() & 0xFFFFFF, 16));
      }
      element.addContent(info);
    }
  }

  if (myReadOrder != null && !myReadOrder.isEmpty()) {
    myReadOrder.writeExternal(element);
  }
  else if (!getDefaultOrder().equals(list)) {
    final JDOMExternalizableStringList ext = new JDOMExternalizableStringList(Collections.nCopies(getOrderMap().size(), ""));
    getOrderMap().forEachEntry(new TObjectIntProcedure<HighlightSeverity>() {
      @Override
      public boolean execute(HighlightSeverity orderSeverity, int oIdx) {
        ext.set(oIdx, orderSeverity.getName());
        return true;
      }
    });
    ext.writeExternal(element);
  }
}
项目:consulo-xml    文件:HtmlUnknownElementInspection.java   
protected static JDOMExternalizableStringList reparseProperties(@NotNull final String properties)
{
    final JDOMExternalizableStringList result = new JDOMExternalizableStringList();

    final StringTokenizer tokenizer = new StringTokenizer(properties, ",");
    while(tokenizer.hasMoreTokens())
    {
        result.add(tokenizer.nextToken().toLowerCase().trim());
    }

    return result;
}
项目:intellij-ce-playground    文件:SeverityRegistrar.java   
public void readExternal(Element element) {
  myMap.clear();
  myRendererColors.clear();
  for (Element infoElement : element.getChildren(INFO_TAG)) {
    SeverityBasedTextAttributes highlightInfo = new SeverityBasedTextAttributes(infoElement);
    String colorStr = infoElement.getAttributeValue(COLOR_ATTRIBUTE);
    Color color = colorStr == null ? null : new Color(Integer.parseInt(colorStr, 16));
    registerSeverity(highlightInfo, color);
  }
  myReadOrder = new JDOMExternalizableStringList();
  myReadOrder.readExternal(element);
  List<HighlightSeverity> read = new ArrayList<HighlightSeverity>(myReadOrder.size());
  final List<HighlightSeverity> knownSeverities = getDefaultOrder();
  for (String name : myReadOrder) {
    HighlightSeverity severity = getSeverity(name);
    if (severity == null || !knownSeverities.contains(severity)) continue;
    read.add(severity);
  }
  OrderMap orderMap = fromList(read);
  if (orderMap.isEmpty()) {
    orderMap = fromList(knownSeverities);
  }
  else {
    //enforce include all known
    List<HighlightSeverity> list = getOrderAsList(orderMap);
    for (int i = 0; i < knownSeverities.size(); i++) {
      HighlightSeverity stdSeverity = knownSeverities.get(i);
      if (!list.contains(stdSeverity)) {
        for (int oIdx = 0; oIdx < list.size(); oIdx++) {
          HighlightSeverity orderSeverity = list.get(oIdx);
          HighlightInfoType type = STANDARD_SEVERITIES.get(orderSeverity.getName());
          if (type != null && knownSeverities.indexOf(type.getSeverity(null)) > i) {
            list.add(oIdx, stdSeverity);
            myReadOrder = null;
            break;
          }
        }
      }
    }
    orderMap = fromList(list);
  }
  myOrderMap = orderMap;
  severitiesChanged();
}
项目:tools-idea    文件:PluginManagerUISettings.java   
public JDOMExternalizableStringList getInstalledPlugins() {
  return myInstalledPlugins;
}
项目:consulo    文件:SeverityRegistrar.java   
@Override
public void readExternal(Element element) throws InvalidDataException {
  myMap.clear();
  myRendererColors.clear();
  final List children = element.getChildren(INFO_TAG);
  for (Object child : children) {
    final Element infoElement = (Element)child;

    final SeverityBasedTextAttributes highlightInfo = new SeverityBasedTextAttributes(infoElement);

    Color color = null;
    final String colorStr = infoElement.getAttributeValue(COLOR_ATTRIBUTE);
    if (colorStr != null){
      color = new Color(Integer.parseInt(colorStr, 16));
    }
    registerSeverity(highlightInfo, color);
  }
  myReadOrder = new JDOMExternalizableStringList();
  myReadOrder.readExternal(element);
  List<HighlightSeverity> read = new ArrayList<HighlightSeverity>(myReadOrder.size());
  final List<HighlightSeverity> knownSeverities = getDefaultOrder();
  for (String name : myReadOrder) {
    HighlightSeverity severity = getSeverity(name);
    if (severity == null || !knownSeverities.contains(severity)) continue;
    read.add(severity);
  }
  OrderMap orderMap = fromList(read);
  if (orderMap.isEmpty()) {
    orderMap = fromList(knownSeverities);
  }
  else {
    //enforce include all known
    List<HighlightSeverity> list = getOrderAsList(orderMap);
    for (int i = 0; i < knownSeverities.size(); i++) {
      HighlightSeverity stdSeverity = knownSeverities.get(i);
      if (!list.contains(stdSeverity)) {
        for (int oIdx = 0; oIdx < list.size(); oIdx++) {
          HighlightSeverity orderSeverity = list.get(oIdx);
          HighlightInfoType type = STANDARD_SEVERITIES.get(orderSeverity.getName());
          if (type != null && knownSeverities.indexOf(type.getSeverity(null)) > i) {
            list.add(oIdx, stdSeverity);
            myReadOrder = null;
            break;
          }
        }
      }
    }
    orderMap = fromList(list);
  }
  myOrderMap = orderMap;
  severitiesChanged();
}