mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -20,6 +20,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.roots.ProjectFileIndex;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
@@ -79,6 +80,7 @@ public class CollectHighlightsUtil {
|
||||
|
||||
PsiElement child = element.getFirstChild();
|
||||
if (child != null) {
|
||||
ProgressManager.getInstance().checkCanceled();
|
||||
// composite element
|
||||
while (child != null) {
|
||||
if (offset > endOffset) break;
|
||||
|
||||
@@ -34,7 +34,7 @@ public class JobSchedulerImpl extends JobScheduler implements Disposable {
|
||||
private static final ThreadFactory WORKERS_FACTORY = new ThreadFactory() {
|
||||
int i;
|
||||
public Thread newThread(final Runnable r) {
|
||||
return new Thread(r, "JobScheduler pool "+i++);
|
||||
return new Thread(r, "JobScheduler pool "+i+++"/"+CORES_COUNT);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
*/
|
||||
package com.intellij.util.containers;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class LimitedPool<T> {
|
||||
private final int capacity;
|
||||
private final ObjectFactory<T> factory;
|
||||
@@ -38,11 +40,14 @@ public class LimitedPool<T> {
|
||||
|
||||
public T alloc() {
|
||||
if (index == 0) return factory.create();
|
||||
int i = --index;
|
||||
//noinspection unchecked
|
||||
return (T)storage[--index];
|
||||
T result = (T)storage[i];
|
||||
storage[i] = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
public void recycle(T t) {
|
||||
public void recycle(@NotNull T t) {
|
||||
factory.cleanup(t);
|
||||
|
||||
if (index >= capacity) return;
|
||||
|
||||
@@ -21,8 +21,8 @@ import gnu.trove.TObjectHashingStrategy;
|
||||
import java.util.*;
|
||||
|
||||
public class OrderedSet<T> extends AbstractSet<T> implements List<T> {
|
||||
private THashSet<T> myHashSet;
|
||||
private ArrayList<T> myElements;
|
||||
private final THashSet<T> myHashSet;
|
||||
private final ArrayList<T> myElements;
|
||||
|
||||
public OrderedSet(TObjectHashingStrategy<T> hashingStrategy) {
|
||||
myHashSet = new THashSet<T>(hashingStrategy);
|
||||
@@ -77,9 +77,10 @@ public class OrderedSet<T> extends AbstractSet<T> implements List<T> {
|
||||
|
||||
public Object clone() {
|
||||
try{
|
||||
OrderedSet newSet = (OrderedSet)super.clone();
|
||||
newSet.myHashSet = (THashSet)myHashSet.clone();
|
||||
newSet.myElements = (ArrayList)myElements.clone();
|
||||
OrderedSet<T> newSet = (OrderedSet<T>)super.clone();
|
||||
newSet.myHashSet.addAll(myHashSet);
|
||||
newSet.myElements.clear();
|
||||
newSet.myElements.addAll(myElements);
|
||||
return newSet;
|
||||
}
|
||||
catch(CloneNotSupportedException e){
|
||||
|
||||
@@ -18,13 +18,10 @@ package org.jetbrains.plugins.groovy.lang;
|
||||
|
||||
import com.intellij.codeInsight.daemon.LineMarkerInfo;
|
||||
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl;
|
||||
import com.intellij.codeInsight.daemon.impl.LineMarkersPass;
|
||||
import com.intellij.codeInsight.daemon.impl.SlowLineMarkersPass;
|
||||
import com.intellij.mock.MockProgressIndicator;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import com.intellij.testFramework.fixtures.impl.JavaCodeInsightTestFixtureImpl;
|
||||
import org.jetbrains.plugins.groovy.util.TestUtils;
|
||||
|
||||
import java.util.List;
|
||||
@@ -73,17 +70,10 @@ public class GroovyLineMarkerTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
private void doTest(int count) {
|
||||
final PsiFile file = myFixture.getFile();
|
||||
final Editor editor = myFixture.getEditor();
|
||||
final Project project = myFixture.getProject();
|
||||
|
||||
LineMarkersPass pass = new LineMarkersPass(project, file, editor.getDocument(), 0, file.getTextLength(), false);
|
||||
pass.collectInformation(new MockProgressIndicator());
|
||||
pass.applyInformationToEditor();
|
||||
|
||||
final SlowLineMarkersPass slowLineMarkersPass = new SlowLineMarkersPass(project, file, editor.getDocument(), 0, file.getTextLength());
|
||||
slowLineMarkersPass.collectInformation(new MockProgressIndicator());
|
||||
slowLineMarkersPass.applyInformationToEditor();
|
||||
((JavaCodeInsightTestFixtureImpl)myFixture).doHighlighting();
|
||||
|
||||
final List<LineMarkerInfo> infoList = DaemonCodeAnalyzerImpl.getLineMarkers(editor.getDocument(), project);
|
||||
assertNotNull(infoList);
|
||||
|
||||
Reference in New Issue
Block a user