Java 类com.intellij.util.containers.hash.LinkedHashMap 实例源码

项目:intellij-ce-playground    文件:InspectionValidatorWrapper.java   
private static Map<ProblemDescriptor, HighlightDisplayLevel> runInspectionTool(final PsiFile file,
                                                                               final LocalInspectionTool inspectionTool,
                                                                               final HighlightDisplayLevel level) {
  Map<ProblemDescriptor, HighlightDisplayLevel> problemsMap = new LinkedHashMap<ProblemDescriptor, HighlightDisplayLevel>();
  for (ProblemDescriptor descriptor : runInspectionOnFile(file, inspectionTool)) {
    final ProblemHighlightType highlightType = descriptor.getHighlightType();

    final HighlightDisplayLevel highlightDisplayLevel;
    if (highlightType == ProblemHighlightType.WEAK_WARNING) {
      highlightDisplayLevel = HighlightDisplayLevel.WEAK_WARNING;
    }
    else if (highlightType == ProblemHighlightType.INFORMATION) {
      highlightDisplayLevel = HighlightDisplayLevel.DO_NOT_SHOW;
    }
    else {
      highlightDisplayLevel = level;
    }
    problemsMap.put(descriptor, highlightDisplayLevel);
  }
  return problemsMap;
}
项目:intellij-ce-playground    文件:PagedFileStorage.java   
public StorageLock(boolean checkThreadAccess) {
  myDefaultStorageLockContext = new StorageLockContext(this, checkThreadAccess);

  mySizeLimit = UPPER_LIMIT;
  mySegments = new LinkedHashMap<Integer, ByteBufferWrapper>(10, 0.75f, true) {
    @Override
    protected boolean removeEldestEntry(Map.Entry<Integer, ByteBufferWrapper> eldest) {
      return mySize > mySizeLimit;
    }

    @Nullable
    @Override
    public ByteBufferWrapper remove(Object key) {
      // this method can be called after removeEldestEntry
      ByteBufferWrapper wrapper = super.remove(key);
      if (wrapper != null) {
        ++myMappingChangeCount;
        mySegmentsToRemove.offer(wrapper);
        mySize -= wrapper.myLength;
      }
      return wrapper;
    }
  };
}
项目:intellij-ce-playground    文件:PagePool.java   
public PagePool(final int protectedPagesLimit, final int probationalPagesLimit) {
  myProbationalQueue = new LinkedHashMap<PoolPageKey,Page>(probationalPagesLimit * 2, 1, true) {
    @Override
    protected boolean removeEldestEntry(final Map.Entry<PoolPageKey, Page> eldest) {
      if (size() > probationalPagesLimit) {
        scheduleFinalization(eldest.getValue());
        return true;
      }
      return false;
    }
  };

  myProtectedQueue = new LinkedHashMap<PoolPageKey, Page>(protectedPagesLimit, 1, true) {
    @Override
    protected boolean removeEldestEntry(final Map.Entry<PoolPageKey, Page> eldest) {
      if (size() > protectedPagesLimit) {
        myProbationalQueue.put(eldest.getKey(), eldest.getValue());
        return true;
      }
      return false;
    }
  };
}
项目:tools-idea    文件:SLRUMap.java   
public SLRUMap(final int protectedQueueSize, final int probationalQueueSize, EqualityPolicy hashingStrategy) {
  myProtectedQueueSize = protectedQueueSize * FACTOR;
  myProbationalQueueSize = probationalQueueSize * FACTOR;

  myProtectedQueue = new LinkedHashMap<K,V>(10, 0.6f, hashingStrategy) {
    @Override
    protected boolean removeEldestEntry(Map.Entry<K, V> eldest, K key, V value) {
      if (size() > myProtectedQueueSize) {
        myProbationalQueue.put(key, value);
        return true;
      }

      return false;
    }
  };

  myProbationalQueue = new LinkedHashMap<K,V>(10, 0.6f, hashingStrategy) {
    protected boolean removeEldestEntry(final Map.Entry<K, V> eldest, K key, V value) {
      if (size() > myProbationalQueueSize) {
        onDropFromCache(key, value);
        return true;
      }
      return false;
    }
  };
}
项目:tools-idea    文件:PagedFileStorage.java   
public StorageLock(boolean checkThreadAccess) {
  myDefaultStorageLockContext = new StorageLockContext(this, checkThreadAccess);

  mySizeLimit = UPPER_LIMIT;
  mySegments = new LinkedHashMap<Integer, ByteBufferWrapper>(10, 0.75f) {
    @Override
    protected boolean removeEldestEntry(Map.Entry<Integer, ByteBufferWrapper> eldest) {
      return mySize > mySizeLimit;
    }

    @Nullable
    @Override
    public ByteBufferWrapper remove(Object key) {
      // this method can be called after removeEldestEntry
      ByteBufferWrapper wrapper = super.remove(key);
      if (wrapper != null) {
        ++myMappingChangeCount;
        mySegmentsToRemove.offer(wrapper);
        mySize -= wrapper.myLength;
      }
      return wrapper;
    }
  };
}
项目:tools-idea    文件:PagePool.java   
public PagePool(final int protectedPagesLimit, final int probationalPagesLimit) {
  myProbationalQueue = new LinkedHashMap<PoolPageKey,Page>(probationalPagesLimit * 2, 0.6f) {
    @Override
    protected boolean removeEldestEntry(final Map.Entry<PoolPageKey, Page> eldest) {
      if (size() > probationalPagesLimit) {
        scheduleFinalization(eldest.getValue());
        return true;
      }
      return false;
    }
  };

  myProtectedQueue = new LinkedHashMap<PoolPageKey, Page>(protectedPagesLimit, 0.6f) {
    @Override
    protected boolean removeEldestEntry(final Map.Entry<PoolPageKey, Page> eldest) {
      if (size() > protectedPagesLimit) {
        myProbationalQueue.put(eldest.getKey(), eldest.getValue());
        return true;
      }
      return false;
    }
  };
}
项目:consulo-apache-ant    文件:GlobalAntConfiguration.java   
@NotNull
public Map<AntReference, Sdk> getConfiguredAnts()
{
    List<Sdk> sdksOfType = SdkTable.getInstance().getSdksOfType(AntSdkType.getInstance());
    Map<AntReference, Sdk> map = new LinkedHashMap<AntReference, Sdk>();
    for(Sdk sdk : sdksOfType)
    {
        if(sdk.isPredefined())
        {
            map.put(AntReference.BUNDLED_ANT, sdk);
        }
        else
        {
            map.put(new AntReference.BindedReference(sdk), sdk);
        }
    }
    return map;
}
项目:consulo    文件:SLRUMap.java   
public SLRUMap(final int protectedQueueSize, final int probationalQueueSize, EqualityPolicy hashingStrategy) {
  myProtectedQueueSize = protectedQueueSize * FACTOR;
  myProbationalQueueSize = probationalQueueSize * FACTOR;

  myProtectedQueue = new LinkedHashMap<K,V>(10, 0.6f, hashingStrategy) {
    @Override
    protected boolean removeEldestEntry(Map.Entry<K, V> eldest, K key, V value) {
      if (size() > myProtectedQueueSize) {
        myProbationalQueue.put(key, value);
        return true;
      }

      return false;
    }
  };

  myProbationalQueue = new LinkedHashMap<K,V>(10, 0.6f, hashingStrategy) {
    protected boolean removeEldestEntry(final Map.Entry<K, V> eldest, K key, V value) {
      if (size() > myProbationalQueueSize) {
        onDropFromCache(key, value);
        return true;
      }
      return false;
    }
  };
}
项目:consulo    文件:PagedFileStorage.java   
public StorageLock(boolean checkThreadAccess) {
  myDefaultStorageLockContext = new StorageLockContext(this, checkThreadAccess);

  mySizeLimit = UPPER_LIMIT;
  mySegments = new LinkedHashMap<Integer, ByteBufferWrapper>(10, 0.75f, true) {
    @Override
    protected boolean removeEldestEntry(Map.Entry<Integer, ByteBufferWrapper> eldest) {
      return mySize > mySizeLimit;
    }

    @Nullable
    @Override
    public ByteBufferWrapper remove(Object key) {
      // this method can be called after removeEldestEntry
      ByteBufferWrapper wrapper = super.remove(key);
      if (wrapper != null) {
        ++myMappingChangeCount;
        mySegmentsToRemove.offer(wrapper);
        mySize -= wrapper.myLength;
      }
      return wrapper;
    }
  };
}
项目:consulo    文件:PagePool.java   
public PagePool(final int protectedPagesLimit, final int probationalPagesLimit) {
  myProbationalQueue = new LinkedHashMap<PoolPageKey,Page>(probationalPagesLimit * 2, 1, true) {
    @Override
    protected boolean removeEldestEntry(final Map.Entry<PoolPageKey, Page> eldest) {
      if (size() > probationalPagesLimit) {
        scheduleFinalization(eldest.getValue());
        return true;
      }
      return false;
    }
  };

  myProtectedQueue = new LinkedHashMap<PoolPageKey, Page>(protectedPagesLimit, 1, true) {
    @Override
    protected boolean removeEldestEntry(final Map.Entry<PoolPageKey, Page> eldest) {
      if (size() > protectedPagesLimit) {
        myProbationalQueue.put(eldest.getKey(), eldest.getValue());
        return true;
      }
      return false;
    }
  };
}
项目:consulo    文件:LookupArranger.java   
public final void prefixReplaced(Lookup lookup, String newPrefix) {
  //noinspection unchecked
  Map<LookupElement, PrefixMatcher> newMatchers = new LinkedHashMap(EqualityPolicy.IDENTITY);
  for (LookupElement item : myItems) {
    if (item.isValid()) {
      PrefixMatcher matcher = itemMatcher(item).cloneWithPrefix(newPrefix);
      if (matcher.prefixMatches(item)) {
        newMatchers.put(item, matcher);
      }
    }
  }
  myMatchers.clear();
  myMatchers.putAll(newMatchers);
  myItems.clear();
  myItems.addAll(newMatchers.keySet());

  prefixChanged(lookup);
}
项目:intellij-ce-playground    文件:InspectionValidatorWrapper.java   
private Map<ProblemDescriptor, HighlightDisplayLevel> runXmlFileSchemaValidation(@NotNull XmlFile xmlFile) {
  final AnnotationHolderImpl holder = new AnnotationHolderImpl(new AnnotationSession(xmlFile));

  final List<ExternalAnnotator> annotators = ExternalLanguageAnnotators.allForFile(StdLanguages.XML, xmlFile);
  for (ExternalAnnotator<?, ?> annotator : annotators) {
    processAnnotator(xmlFile, holder, annotator);
  }

  if (!holder.hasAnnotations()) return Collections.emptyMap();

  Map<ProblemDescriptor, HighlightDisplayLevel> problemsMap = new LinkedHashMap<ProblemDescriptor, HighlightDisplayLevel>();
  for (final Annotation annotation : holder) {
    final HighlightInfo info = HighlightInfo.fromAnnotation(annotation);
    if (info.getSeverity() == HighlightSeverity.INFORMATION) continue;

    final PsiElement startElement = xmlFile.findElementAt(info.startOffset);
    final PsiElement endElement = info.startOffset == info.endOffset ? startElement : xmlFile.findElementAt(info.endOffset - 1);
    if (startElement == null || endElement == null) continue;

    final ProblemDescriptor descriptor =
      myInspectionManager.createProblemDescriptor(startElement, endElement, info.getDescription(), ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
                                                  false);
    final HighlightDisplayLevel level = info.getSeverity() == HighlightSeverity.ERROR? HighlightDisplayLevel.ERROR: HighlightDisplayLevel.WARNING;
    problemsMap.put(descriptor, level);
  }
  return problemsMap;
}
项目:intellij-ce-playground    文件:EditorHyperlinkSupport.java   
@Deprecated
public Map<RangeHighlighter, HyperlinkInfo> getHyperlinks() {
  LinkedHashMap<RangeHighlighter, HyperlinkInfo> result = new LinkedHashMap<RangeHighlighter, HyperlinkInfo>();
  for (RangeHighlighter highlighter : getHyperlinks(0, myEditor.getDocument().getTextLength(), myEditor)) {
    HyperlinkInfo info = getHyperlinkInfo(highlighter);
    if (info != null) {
      result.put(highlighter, info);
    }
  }
  return result;
}
项目:intellij-ce-playground    文件:StatisticsUploadAssistantTest.java   
protected static Map<GroupDescriptor, Set<UsageDescriptor>> createDescriptors(String... strs) {
    Map<GroupDescriptor, Set<UsageDescriptor>> set = new LinkedHashMap<GroupDescriptor, Set<UsageDescriptor>>();
    for (String str : strs) {
        final List<String> list = StringUtil.split(str, ":");
        final GroupDescriptor g = GroupDescriptor.create(list.get(0));
        if (!set.containsKey(g)) {
            set.put(g, new LinkedHashSet<UsageDescriptor>());
        }
        set.get(g).add(createDescriptor(list.get(1), Integer.parseInt(list.get(2))));
    }

    return set;
}
项目:intellij-ce-playground    文件:SLRUMap.java   
public SLRUMap(final int protectedQueueSize, final int probationalQueueSize, EqualityPolicy hashingStrategy) {
  myProtectedQueueSize = protectedQueueSize * FACTOR;
  myProbationalQueueSize = probationalQueueSize * FACTOR;

  myProtectedQueue = new LinkedHashMap<K,V>(10, 0.6f, hashingStrategy, true) {
    @Override
    protected boolean removeEldestEntry(Map.Entry<K, V> eldest, K key, V value) {
      if (size() > myProtectedQueueSize) {
        myProbationalQueue.put(key, value);
        return true;
      }

      return false;
    }
  };

  myProbationalQueue = new LinkedHashMap<K,V>(10, 0.6f, hashingStrategy, true) {
    @Override
    protected boolean removeEldestEntry(final Map.Entry<K, V> eldest, K key, V value) {
      if (size() > myProbationalQueueSize) {
        onDropFromCache(key, value);
        return true;
      }
      return false;
    }
  };
}
项目:intellij-ce-playground    文件:PyTypeCheckerInspection.java   
@NotNull
private Map<PyExpression, Pair<String, ProblemHighlightType>> checkMapping(@Nullable PyExpression receiver,
                                                                           @NotNull Map<PyExpression, PyNamedParameter> mapping) {
  final Map<PyExpression, Pair<String, ProblemHighlightType>> problems = new HashMap<PyExpression, Pair<String, ProblemHighlightType>>();
  final Map<PyGenericType, PyType> substitutions = new LinkedHashMap<PyGenericType, PyType>();
  boolean genericsCollected = false;
  for (Map.Entry<PyExpression, PyNamedParameter> entry : mapping.entrySet()) {
    final PyNamedParameter param = entry.getValue();
    final PyExpression arg = entry.getKey();
    if (param.isPositionalContainer() || param.isKeywordContainer()) {
      continue;
    }
    final PyType paramType = myTypeEvalContext.getType(param);
    if (paramType == null) {
      continue;
    }
    final PyType argType = myTypeEvalContext.getType(arg);
    if (!genericsCollected) {
      substitutions.putAll(PyTypeChecker.unifyReceiver(receiver, myTypeEvalContext));
      genericsCollected = true;
    }
    final Pair<String, ProblemHighlightType> problem = checkTypes(paramType, argType, myTypeEvalContext, substitutions);
    if (problem != null) {
      problems.put(arg, problem);

    }
  }
  return problems;
}
项目:GitToolBox    文件:StatusToolTip.java   
private void prepareMultiRepoTooltip(StringBand infoPart, Collection<GitRepository> repositories) {
  PerRepoInfoCache cache = PerRepoInfoCache.getInstance(project);
  Map<GitRepository, String> statuses = new LinkedHashMap<>();
  final AtomicReference<GitRepository> currentRepo = new AtomicReference<>();
  for (GitRepository repository : GtUtil.sort(repositories)) {
    cache.getInfo(repository).count().map(StatusText::format).ifPresent(statusText -> {
      if (repository.equals(currentRepository)) {
        currentRepo.set(repository);
      }
      statuses.put(repository, statusText);
    });
  }
  if (!statuses.isEmpty()) {
    if (infoPart.length() > 0) {
      infoPart.append(Html.HR);
    }
    infoPart.append(
        statuses.entrySet().stream().map(e -> {
          String repoStatus = GitUIUtil.bold(GtUtil.name(e.getKey())) + ": " + e.getValue();
          if (Objects.equals(e.getKey(), currentRepo.get())) {
            repoStatus = Html.underline(repoStatus);
          }
          return repoStatus;
        }).collect(Collectors.joining(Html.BR))
    );
  }
}
项目:tools-idea    文件:InspectionValidatorWrapper.java   
private static Map<ProblemDescriptor, HighlightDisplayLevel> runInspectionTool(final PsiFile file,
                                                                               final LocalInspectionTool inspectionTool,
                                                                               final HighlightDisplayLevel level) {
  Map<ProblemDescriptor, HighlightDisplayLevel> problemsMap = new LinkedHashMap<ProblemDescriptor, HighlightDisplayLevel>();
  for (ProblemDescriptor descriptor : InspectionRunningUtil.runInspectionOnFile(file, inspectionTool)) {
    problemsMap.put(descriptor, level);
  }
  return problemsMap;
}
项目:tools-idea    文件:InspectionValidatorWrapper.java   
private Map<ProblemDescriptor, HighlightDisplayLevel> runXmlFileSchemaValidation(@NotNull XmlFile xmlFile) {
  final AnnotationHolderImpl holder = new AnnotationHolderImpl(new AnnotationSession(xmlFile));

  final List<ExternalAnnotator> annotators = ExternalLanguageAnnotators.allForFile(StdLanguages.XML, xmlFile);
  for (ExternalAnnotator annotator : annotators) {
    annotator.annotate(xmlFile, holder);
  }

  if (!holder.hasAnnotations()) return Collections.emptyMap();

  Map<ProblemDescriptor, HighlightDisplayLevel> problemsMap = new LinkedHashMap<ProblemDescriptor, HighlightDisplayLevel>();
  for (final Annotation annotation : holder) {
    final HighlightInfo info = HighlightInfo.fromAnnotation(annotation);
    if (info.getSeverity() == HighlightSeverity.INFORMATION) continue;

    final PsiElement startElement = xmlFile.findElementAt(info.startOffset);
    final PsiElement endElement = info.startOffset == info.endOffset ? startElement : xmlFile.findElementAt(info.endOffset - 1);
    if (startElement == null || endElement == null) continue;

    final ProblemDescriptor descriptor =
      myInspectionManager.createProblemDescriptor(startElement, endElement, info.getDescription(), ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
                                                  false);
    final HighlightDisplayLevel level = info.getSeverity() == HighlightSeverity.ERROR? HighlightDisplayLevel.ERROR: HighlightDisplayLevel.WARNING;
    problemsMap.put(descriptor, level);
  }
  return problemsMap;
}
项目:tools-idea    文件:StatisticsUploadAssistantTest.java   
protected static Map<GroupDescriptor, Set<UsageDescriptor>> createDescriptors(String... strs) {
    Map<GroupDescriptor, Set<UsageDescriptor>> set = new LinkedHashMap<GroupDescriptor, Set<UsageDescriptor>>();
    for (String str : strs) {
        final List<String> list = StringUtil.split(str, ":");
        final GroupDescriptor g = GroupDescriptor.create(list.get(0));
        if (!set.containsKey(g)) {
            set.put(g, new LinkedHashSet<UsageDescriptor>());
        }
        set.get(g).add(createDescriptor(list.get(1), Integer.parseInt(list.get(2))));
    }

    return set;
}
项目:consulo    文件:StatisticsUploadAssistantTest.java   
protected static Map<GroupDescriptor, Set<UsageDescriptor>> createDescriptors(String... strs) {
    Map<GroupDescriptor, Set<UsageDescriptor>> set = new LinkedHashMap<GroupDescriptor, Set<UsageDescriptor>>();
    for (String str : strs) {
        final List<String> list = StringUtil.split(str, ":");
        final GroupDescriptor g = GroupDescriptor.create(list.get(0));
        if (!set.containsKey(g)) {
            set.put(g, new LinkedHashSet<UsageDescriptor>());
        }
        set.get(g).add(createDescriptor(list.get(1), Integer.parseInt(list.get(2))));
    }

    return set;
}
项目:consulo    文件:EditorHyperlinkSupport.java   
@Deprecated
public Map<RangeHighlighter, HyperlinkInfo> getHyperlinks() {
  LinkedHashMap<RangeHighlighter, HyperlinkInfo> result = new LinkedHashMap<>();
  for (RangeHighlighter highlighter : getHyperlinks(0, myEditor.getDocument().getTextLength(), myEditor)) {
    HyperlinkInfo info = getHyperlinkInfo(highlighter);
    if (info != null) {
      result.put(highlighter, info);
    }
  }
  return result;
}
项目:consulo    文件:AttachToLocalProcessAction.java   
public static void addToHistory(@Nonnull Project project, @Nonnull AttachItem item) {
  LinkedHashMap<String, HistoryItem> history = project.getUserData(HISTORY_KEY);
  if (history == null) {
    project.putUserData(HISTORY_KEY, history = new LinkedHashMap<>());
  }
  ProcessInfo processInfo = item.getProcessInfo();
  history.remove(processInfo.getCommandLine());
  history.put(processInfo.getCommandLine(), new HistoryItem(processInfo, item.getGroup(),
                                                            item.getSelectedDebugger().getDebuggerDisplayName()));
  while (history.size() > 4) {
    history.remove(history.keySet().iterator().next());
  }
}
项目:intellij-ce-playground    文件:DimensionService.java   
/**
 * Invoked by reflection
 */
private DimensionService() {
  myKey2Location = new LinkedHashMap<String, Point>();
  myKey2Size = new LinkedHashMap<String, Dimension>();
  myKey2ExtendedState = new TObjectIntHashMap<String>();
}
项目:intellij-ce-playground    文件:EventLog.java   
public static LogEntry formatForLog(@NotNull final Notification notification, String indent) {
  DocumentImpl logDoc = new DocumentImpl("",true);
  AtomicBoolean showMore = new AtomicBoolean(false);
  Map<RangeMarker, HyperlinkInfo> links = new LinkedHashMap<RangeMarker, HyperlinkInfo>();
  List<RangeMarker> lineSeparators = new ArrayList<RangeMarker>();

  String title = truncateLongString(showMore, notification.getTitle());
  String content = truncateLongString(showMore, notification.getContent());

  RangeMarker afterTitle = null;
  boolean hasHtml = parseHtmlContent(title, notification, logDoc, showMore, links, lineSeparators);
  if (StringUtil.isNotEmpty(title)) {
    if (StringUtil.isNotEmpty(content)) {
      appendText(logDoc, ": ");
      afterTitle = logDoc.createRangeMarker(logDoc.getTextLength() - 2, logDoc.getTextLength());
    }
  }
  hasHtml |= parseHtmlContent(content, notification, logDoc, showMore, links, lineSeparators);

  String status = getStatusText(logDoc, showMore, lineSeparators, hasHtml);

  indentNewLines(logDoc, lineSeparators, afterTitle, hasHtml, indent);

  ArrayList<Pair<TextRange, HyperlinkInfo>> list = new ArrayList<Pair<TextRange, HyperlinkInfo>>();
  for (RangeMarker marker : links.keySet()) {
    if (!marker.isValid()) {
      showMore.set(true);
      continue;
    }
    list.add(Pair.create(new TextRange(marker.getStartOffset(), marker.getEndOffset()), links.get(marker)));
  }

  if (showMore.get()) {
    String sb = "show balloon";
    if (!logDoc.getText().endsWith(" ")) {
      appendText(logDoc, " ");
    }
    appendText(logDoc, "(" + sb + ")");
    list.add(new Pair<TextRange, HyperlinkInfo>(TextRange.from(logDoc.getTextLength() - 1 - sb.length(), sb.length()),
                                                new ShowBalloon(notification)));
  }

  return new LogEntry(logDoc.getText(), status, list);
}
项目:intellij-ce-playground    文件:LinkedMultiMap.java   
@NotNull
@Override
protected Map<K, Collection<V>> createMap() {
  return new LinkedHashMap<K, Collection<V>>();
}
项目:intellij-ce-playground    文件:LinkedMultiMap.java   
@NotNull
@Override
protected Map<K, Collection<V>> createMap(int initialCapacity, float loadFactor) {
  return new LinkedHashMap<K, Collection<V>>(initialCapacity, loadFactor);
}
项目:aem-ide-tooling-4-intellij    文件:ConsoleLog.java   
public static LogEntry formatForLog(@NotNull final Notification notification, String indent) {
    DocumentImpl logDoc = new DocumentImpl("", true);
    AtomicBoolean showMore = new AtomicBoolean(false);
    Map<RangeMarker, HyperlinkInfo> links = new LinkedHashMap<RangeMarker, HyperlinkInfo>();
    List<RangeMarker> lineSeparators = new ArrayList<RangeMarker>();

    String title = truncateLongString(showMore, notification.getTitle());
    String content = truncateLongString(showMore, notification.getContent());

    RangeMarker afterTitle = null;
    boolean hasHtml = parseHtmlContent(title, notification, logDoc, showMore, links, lineSeparators);
    if(StringUtil.isNotEmpty(title)) {
        if(StringUtil.isNotEmpty(content)) {
            appendText(logDoc, ": ");
            afterTitle = logDoc.createRangeMarker(logDoc.getTextLength() - 2, logDoc.getTextLength());
        }
    }
    hasHtml |= parseHtmlContent(content, notification, logDoc, showMore, links, lineSeparators);

    String status = getStatusText(logDoc, showMore, lineSeparators, hasHtml);

    indentNewLines(logDoc, lineSeparators, afterTitle, hasHtml, indent);

    ArrayList<Pair<TextRange, HyperlinkInfo>> list = new ArrayList<Pair<TextRange, HyperlinkInfo>>();
    for(RangeMarker marker : links.keySet()) {
        if(!marker.isValid()) {
            showMore.set(true);
            continue;
        }
        list.add(Pair.create(new TextRange(marker.getStartOffset(), marker.getEndOffset()), links.get(marker)));
    }

    if(showMore.get()) {
        String sb = "show balloon";
        if(!logDoc.getText().endsWith(" ")) {
            appendText(logDoc, " ");
        }
        appendText(logDoc, "(" + sb + ")");
        list.add(new Pair<TextRange, HyperlinkInfo>(TextRange.from(logDoc.getTextLength() - 1 - sb.length(), sb.length()),
            new ShowBalloon(notification)));
    }

    return new LogEntry(logDoc.getText(), status, list);
}
项目:tools-idea    文件:EventLog.java   
public static LogEntry formatForLog(@NotNull final Notification notification, String indent) {
  DocumentImpl logDoc = new DocumentImpl("",true);
  AtomicBoolean showMore = new AtomicBoolean(false);
  Map<RangeMarker, HyperlinkInfo> links = new LinkedHashMap<RangeMarker, HyperlinkInfo>();
  List<RangeMarker> lineSeparators = new ArrayList<RangeMarker>();

  String title = notification.getTitle();
  String content = notification.getContent();
  RangeMarker afterTitle = null;
  boolean hasHtml = parseHtmlContent(title, notification, logDoc, showMore, links, lineSeparators);
  if (StringUtil.isNotEmpty(title)) {
    if (StringUtil.isNotEmpty(content)) {
      appendText(logDoc, ": ");
      afterTitle = logDoc.createRangeMarker(logDoc.getTextLength() - 2, logDoc.getTextLength());
    }
  }
  hasHtml |= parseHtmlContent(content, notification, logDoc, showMore, links, lineSeparators);

  String status = getStatusText(logDoc, showMore, lineSeparators, hasHtml);

  indentNewLines(logDoc, lineSeparators, afterTitle, hasHtml, indent);

  ArrayList<Pair<TextRange, HyperlinkInfo>> list = new ArrayList<Pair<TextRange, HyperlinkInfo>>();
  for (RangeMarker marker : links.keySet()) {
    if (!marker.isValid()) {
      showMore.set(true);
      continue;
    }
    list.add(Pair.create(new TextRange(marker.getStartOffset(), marker.getEndOffset()), links.get(marker)));
  }

  if (showMore.get()) {
    String sb = "show balloon";
    if (!logDoc.getText().endsWith(" ")) {
      appendText(logDoc, " ");
    }
    appendText(logDoc, "(" + sb + ")");
    list.add(new Pair<TextRange, HyperlinkInfo>(TextRange.from(logDoc.getTextLength() - 1 - sb.length(), sb.length()),
                                                new ShowBalloon(notification)));
  }

  return new LogEntry(logDoc.getText(), status, list);
}
项目:consulo    文件:DimensionService.java   
/**
 * Invoked by reflection
 */
private DimensionService() {
  myKey2Location = new LinkedHashMap<String, Point>();
  myKey2Size = new LinkedHashMap<String, Dimension>();
  myKey2ExtendedState = new TObjectIntHashMap<String>();
}
项目:consulo    文件:AttachToLocalProcessAction.java   
@Nonnull
public static List<HistoryItem> getHistory(@Nonnull Project project) {
  LinkedHashMap<String, HistoryItem> history = project.getUserData(HISTORY_KEY);
  return history == null ? Collections.emptyList()
                         : Collections.unmodifiableList(new ArrayList<>(history.values()));
}