mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+1
-1
@@ -860,7 +860,7 @@ public class AsmCodeGenerator {
|
||||
|
||||
Type borderFactoryType = ourBorderFactoryType;
|
||||
StringDescriptor borderFactoryValue = (StringDescriptor)container.getDelegeeClientProperties().get(ourBorderFactoryClientProperty);
|
||||
if (borderFactoryValue == null && Boolean.valueOf(System.getProperty("idea.is.internal")).booleanValue()) {
|
||||
if (borderFactoryValue == null && borderTitle != null && Boolean.valueOf(System.getProperty("idea.is.internal")).booleanValue()) {
|
||||
borderFactoryValue = StringDescriptor.create("com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent");
|
||||
container.getDelegeeClientProperties().put(ourBorderFactoryClientProperty, borderFactoryValue);
|
||||
}
|
||||
|
||||
-7
@@ -55,13 +55,6 @@ public class RecursiveMethodCallFoldingBuilder extends FoldingBuilderEx {
|
||||
}
|
||||
});
|
||||
|
||||
Collections.sort(result, new Comparator<FoldingDescriptor>() {
|
||||
@Override
|
||||
public int compare(FoldingDescriptor o1, FoldingDescriptor o2) {
|
||||
return o2.getRange().getStartOffset() - o1.getRange().getStartOffset();
|
||||
}
|
||||
});
|
||||
|
||||
return result.toArray(new FoldingDescriptor[result.size()]);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class LightModifierList extends LightElement implements PsiModifierList {
|
||||
|
||||
public LightModifierList(PsiManager manager, final Language language, String... modifiers) {
|
||||
super(manager, language);
|
||||
myModifiers = CollectionFactory.newTroveSet(modifiers);
|
||||
myModifiers = CollectionFactory.troveSet(modifiers);
|
||||
}
|
||||
|
||||
public void addModifier(String modifier) {
|
||||
|
||||
@@ -167,7 +167,7 @@ public class PsiDocumentManagerImplTest extends PlatformTestCase {
|
||||
assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length);
|
||||
}
|
||||
|
||||
public void testDocumentFromAlienProjectDoesNotEndsUpInMyUncommittedList() throws Exception {
|
||||
public void testDocumentFromAlienProjectDoesNotEndUpInMyUncommittedList() throws Exception {
|
||||
PsiFile file = getPsiManager().findFile(createFile());
|
||||
|
||||
final Document document = getPsiDocumentManager().getDocument(file);
|
||||
|
||||
+2
-2
@@ -56,7 +56,7 @@ public abstract class TextEditorHighlightingPass implements HighlightingPass {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void collectInformation(ProgressIndicator progress) {
|
||||
public final void collectInformation(@NotNull ProgressIndicator progress) {
|
||||
if (!isValid()) return; //Document has changed.
|
||||
myDumb = DumbService.getInstance(myProject).isDumb();
|
||||
doCollectInformation(progress);
|
||||
@@ -103,7 +103,7 @@ public abstract class TextEditorHighlightingPass implements HighlightingPass {
|
||||
doApplyInformationToEditor();
|
||||
}
|
||||
|
||||
public abstract void doCollectInformation(ProgressIndicator progress);
|
||||
public abstract void doCollectInformation(@NotNull ProgressIndicator progress);
|
||||
public abstract void doApplyInformationToEditor();
|
||||
|
||||
public final int getId() {
|
||||
|
||||
@@ -41,7 +41,7 @@ class CodeFoldingPass extends TextEditorHighlightingPass implements DumbAware {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCollectInformation(ProgressIndicator progress) {
|
||||
public void doCollectInformation(@NotNull ProgressIndicator progress) {
|
||||
final boolean firstTime = isFirstTime(myFile, myEditor, THE_FIRST_TIME);
|
||||
Runnable runnable = CodeFoldingManager.getInstance(myProject).updateFoldRegionsAsync(myEditor, firstTime);
|
||||
synchronized (this) {
|
||||
|
||||
@@ -80,7 +80,7 @@ public class ExternalToolPass extends TextEditorHighlightingPass {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCollectInformation(ProgressIndicator progress) {
|
||||
public void doCollectInformation(@NotNull ProgressIndicator progress) {
|
||||
myDocumentChanged = false;
|
||||
|
||||
final FileViewProvider viewProvider = myFile.getViewProvider();
|
||||
|
||||
+2
-1
@@ -42,6 +42,7 @@ import com.intellij.psi.search.LocalSearchScope;
|
||||
import com.intellij.psi.search.searches.ReferencesSearch;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -71,7 +72,7 @@ public class IdentifierHighlighterPass extends TextEditorHighlightingPass {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCollectInformation(final ProgressIndicator progress) {
|
||||
public void doCollectInformation(@NotNull final ProgressIndicator progress) {
|
||||
if (!CodeInsightSettings.getInstance().HIGHLIGHT_IDENTIFIER_UNDER_CARET) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ public class IndentsPass extends TextEditorHighlightingPass implements DumbAware
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCollectInformation(ProgressIndicator progress) {
|
||||
public void doCollectInformation(@NotNull ProgressIndicator progress) {
|
||||
final Long stamp = myEditor.getUserData(LAST_TIME_INDENTS_BUILT);
|
||||
if (stamp != null && stamp.longValue() == nowStamp()) return;
|
||||
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ class InjectedCodeFoldingPass extends TextEditorHighlightingPass implements Dumb
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCollectInformation(ProgressIndicator progress) {
|
||||
public void doCollectInformation(@NotNull ProgressIndicator progress) {
|
||||
boolean firstTime = CodeFoldingPass.isFirstTime(myFile, myEditor, THE_FIRST_TIME_KEY);
|
||||
Runnable runnable = FoldingUpdate.updateInjectedFoldRegions(myEditor, myFile, firstTime);
|
||||
synchronized (this) {
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ public abstract class PassExecutorService implements Disposable {
|
||||
// run all passes in sequence
|
||||
textEditorHighlightingPass = new TextEditorHighlightingPass(myProject, document, true) {
|
||||
@Override
|
||||
public void doCollectInformation(ProgressIndicator progress) {
|
||||
public void doCollectInformation(@NotNull ProgressIndicator progress) {
|
||||
pass.collectInformation(progress);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -53,7 +53,7 @@ public abstract class ProgressableTextEditorHighlightingPass extends TextEditorH
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void doCollectInformation(final ProgressIndicator progress) {
|
||||
public final void doCollectInformation(@NotNull final ProgressIndicator progress) {
|
||||
myFinished = false;
|
||||
collectInformationWithProgress(progress);
|
||||
repaintTrafficIcon();
|
||||
@@ -130,7 +130,7 @@ public abstract class ProgressableTextEditorHighlightingPass extends TextEditorH
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCollectInformation(final ProgressIndicator progress) {
|
||||
public void doCollectInformation(@NotNull final ProgressIndicator progress) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ShowAutoImportPass extends TextEditorHighlightingPass {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCollectInformation(ProgressIndicator progress) {
|
||||
public void doCollectInformation(@NotNull ProgressIndicator progress) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -120,7 +120,7 @@ public class ShowIntentionsPass extends TextEditorHighlightingPass {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCollectInformation(ProgressIndicator progress) {
|
||||
public void doCollectInformation(@NotNull ProgressIndicator progress) {
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode() && !myEditor.getContentComponent().hasFocus()) return;
|
||||
TemplateState state = TemplateManagerImpl.getTemplateState(myEditor);
|
||||
if (state != null && !state.isFinished()) return;
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ public class SlowLineMarkersPass extends TextEditorHighlightingPass implements L
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCollectInformation(ProgressIndicator progress) {
|
||||
public void doCollectInformation(@NotNull ProgressIndicator progress) {
|
||||
final FileViewProvider viewProvider = myFile.getViewProvider();
|
||||
final Set<Language> relevantLanguages = viewProvider.getLanguages();
|
||||
List<LineMarkerInfo> markers = new SmartList<LineMarkerInfo>();
|
||||
|
||||
+2
-2
@@ -31,8 +31,8 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class NaturalLanguageTextSelectioner extends ExtendWordSelectionHandlerBase {
|
||||
private static final Set<Character> NATURAL = CollectionFactory.newTroveSet('(', ')', '.', ',', ':', ';', '!', '?', '$', '@', '%', '\"', '\'');
|
||||
private static final Set<Character> SENTENCE_END = CollectionFactory.newTroveSet('.', '!', '?');
|
||||
private static final Set<Character> NATURAL = CollectionFactory.troveSet('(', ')', '.', ',', ':', ';', '!', '?', '$', '@', '%', '\"', '\'');
|
||||
private static final Set<Character> SENTENCE_END = CollectionFactory.troveSet('.', '!', '?');
|
||||
|
||||
public boolean canSelect(PsiElement e) {
|
||||
return e instanceof PsiPlainText || e instanceof PsiComment;
|
||||
|
||||
+4
-4
@@ -36,7 +36,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.intellij.util.containers.CollectionFactory.arrayList;
|
||||
import static com.intellij.util.containers.CollectionFactory.newTroveMap;
|
||||
import static com.intellij.util.containers.CollectionFactory.troveMap;
|
||||
|
||||
/**
|
||||
* @author cdr
|
||||
@@ -70,12 +70,12 @@ class UpdateFoldRegionsOperation implements Runnable {
|
||||
public void run() {
|
||||
EditorFoldingInfo info = EditorFoldingInfo.get(myEditor);
|
||||
FoldingModelEx foldingModel = (FoldingModelEx)myEditor.getFoldingModel();
|
||||
Map<TextRange,Boolean> rangeToExpandStatusMap = newTroveMap();
|
||||
Map<TextRange,Boolean> rangeToExpandStatusMap = troveMap();
|
||||
|
||||
removeInvalidRegions(info, foldingModel, rangeToExpandStatusMap);
|
||||
|
||||
Map<FoldRegion, Boolean> shouldExpand = newTroveMap();
|
||||
Map<FoldingGroup, Boolean> groupExpand = newTroveMap();
|
||||
Map<FoldRegion, Boolean> shouldExpand = troveMap();
|
||||
Map<FoldingGroup, Boolean> groupExpand = troveMap();
|
||||
List<FoldRegion> newRegions = addNewRegions(info, foldingModel, rangeToExpandStatusMap, shouldExpand, groupExpand);
|
||||
|
||||
applyExpandStatus(newRegions, shouldExpand, groupExpand);
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ public class ListTemplatesHandler implements CodeInsightActionHandler {
|
||||
if (description == null) {
|
||||
return super.getAllLookupStrings();
|
||||
}
|
||||
return CollectionFactory.newSet(getLookupString(), description);
|
||||
return CollectionFactory.hashSet(getLookupString(), description);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class ConsoleFoldingSettings implements PersistentStateComponent<ConsoleF
|
||||
}
|
||||
|
||||
private void writeDiff(List<String> added, List<String> removed, boolean negated) {
|
||||
Set<String> baseline = CollectionFactory.newTroveSet();
|
||||
Set<String> baseline = CollectionFactory.troveSet();
|
||||
for (CustomizableConsoleFoldingBean regexp : CustomizableConsoleFoldingBean.EP_NAME.getExtensions()) {
|
||||
if (regexp.negate == negated) {
|
||||
baseline.add(regexp.substring);
|
||||
|
||||
+1
-1
@@ -302,7 +302,7 @@ public class FrameworkDetectionManager extends AbstractProjectComponent implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCollectInformation(ProgressIndicator progress) {
|
||||
public void doCollectInformation(@NotNull ProgressIndicator progress) {
|
||||
ensureIndexIsUpToDate(myDetectors);
|
||||
}
|
||||
|
||||
|
||||
+7
-2
@@ -80,10 +80,10 @@ public class NativeFileIconProvider implements FileIconProvider {
|
||||
assert SwingComponentHolder.ourFileChooser != null || !ApplicationManager.getApplication().isReadAccessAllowed();
|
||||
|
||||
if (SystemInfo.isMac && virtualFile.isDirectory() && (flags & Iconable.ICON_FLAG_OPEN) == Iconable.ICON_FLAG_OPEN) {
|
||||
icon = Foundation.isPackageAtPath(f) ? SwingComponentHolder.ourFileChooser.getIcon(f) : DIR_OPEN_ICON;
|
||||
icon = Foundation.isPackageAtPath(f) ? getNativeIcon(f) : DIR_OPEN_ICON;
|
||||
}
|
||||
else {
|
||||
icon = SwingComponentHolder.ourFileChooser.getIcon(f);
|
||||
icon = getNativeIcon(f);
|
||||
}
|
||||
}
|
||||
catch (Exception e) { // see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4854174
|
||||
@@ -104,6 +104,11 @@ public class NativeFileIconProvider implements FileIconProvider {
|
||||
});
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Icon getNativeIcon(@Nullable File file) {
|
||||
return file == null ? null : SwingComponentHolder.ourFileChooser.getIcon(file);
|
||||
}
|
||||
|
||||
private static Ext getExtension(final VirtualFile file, final int flags) {
|
||||
if (file.isDirectory()) {
|
||||
if (file.getExtension() == null) {
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ public abstract class PlatformIdTableBuilding {
|
||||
@NotNull
|
||||
@Override
|
||||
public Map<TodoIndexEntry, Integer> map(FileContent inputData) {
|
||||
Map<TodoIndexEntry, Integer> result = CollectionFactory.newTroveMap();
|
||||
Map<TodoIndexEntry, Integer> result = CollectionFactory.troveMap();
|
||||
for (DataIndexer<TodoIndexEntry, Integer, FileContent> indexer : indexers) {
|
||||
for (Map.Entry<TodoIndexEntry, Integer> entry : indexer.map(inputData).entrySet()) {
|
||||
TodoIndexEntry key = entry.getKey();
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ public class ChangeSignaturePassFactory extends AbstractProjectComponent impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCollectInformation(ProgressIndicator progress) {
|
||||
public void doCollectInformation(@NotNull ProgressIndicator progress) {
|
||||
myRange = null;
|
||||
final ChangeSignatureGestureDetector detector = ChangeSignatureGestureDetector.getInstance(myProject);
|
||||
final ChangeInfo changeInfo = detector.getInitialChangeInfo(myFile);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.codeHighlighting;
|
||||
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface HighlightingPass {
|
||||
HighlightingPass[] EMPTY_ARRAY = new HighlightingPass[0];
|
||||
@@ -27,7 +28,7 @@ public interface HighlightingPass {
|
||||
* @param progress to check for highlighting process is cancelled. Pass is to check progress.isCanceled() as often as possible and
|
||||
* throw {@link com.intellij.openapi.progress.ProcessCanceledException} if <code>true</code> is returned.
|
||||
*/
|
||||
void collectInformation(ProgressIndicator progress);
|
||||
void collectInformation(@NotNull ProgressIndicator progress);
|
||||
|
||||
/**
|
||||
* Called to apply information collected by {@linkplain #collectInformation(com.intellij.openapi.progress.ProgressIndicator)} to the editor.
|
||||
|
||||
@@ -73,7 +73,7 @@ public class EventLog implements Notifications {
|
||||
private static final String A_CLOSING = "</a>";
|
||||
private static final Pattern TAG_PATTERN = Pattern.compile("<[^>]*>");
|
||||
private static final Pattern A_PATTERN = Pattern.compile("<a ([^>]* )?href=[\"\']([^>]*)[\"\'][^>]*>");
|
||||
private static final Set<String> NEW_LINES = CollectionFactory.newSet("<br>", "</br>", "<br/>", "<p>", "</p>", "<p/>");
|
||||
private static final Set<String> NEW_LINES = CollectionFactory.hashSet("<br>", "</br>", "<br/>", "<p>", "</p>", "<p/>");
|
||||
|
||||
public EventLog() {
|
||||
ApplicationManager.getApplication().getMessageBus().connect().subscribe(Notifications.TOPIC, this);
|
||||
|
||||
@@ -93,7 +93,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
private final HashMap<String, FloatingDecorator> myId2FloatingDecorator;
|
||||
private final HashMap<String, StripeButton> myId2StripeButton;
|
||||
private final HashMap<String, FocusWatcher> myId2FocusWatcher;
|
||||
private final Set<String> myDumbAwareIds = Collections.synchronizedSet(CollectionFactory.<String>newTroveSet());
|
||||
private final Set<String> myDumbAwareIds = Collections.synchronizedSet(CollectionFactory.<String>troveSet());
|
||||
|
||||
private final EditorComponentFocusWatcher myEditorComponentFocusWatcher;
|
||||
private final MyToolWindowPropertyChangeListener myToolWindowPropertyChangeListener;
|
||||
|
||||
+1
-1
@@ -144,7 +144,7 @@ public abstract class LibraryTableBase implements PersistentStateComponent<Eleme
|
||||
return DependencyScope.COMPILE;
|
||||
}
|
||||
|
||||
public void fireLibraryRenamed(LibraryImpl library) {
|
||||
public void fireLibraryRenamed(@NotNull LibraryImpl library) {
|
||||
myDispatcher.getMulticaster().afterLibraryRenamed(library);
|
||||
}
|
||||
|
||||
|
||||
@@ -793,7 +793,7 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da
|
||||
|
||||
final String[] myUrls = mySdk.getRootProvider().getUrls(OrderRootType.CLASSES);
|
||||
final String[] newUrls = newSdk.getRootProvider().getUrls(OrderRootType.CLASSES);
|
||||
return CollectionFactory.newSet(myUrls).equals(CollectionFactory.newSet(newUrls));
|
||||
return CollectionFactory.hashSet(myUrls).equals(CollectionFactory.hashSet(newUrls));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -48,10 +48,26 @@ public class FileUtil extends FileUtilRt {
|
||||
|
||||
@NonNls public static final String ASYNC_DELETE_EXTENSION = ".__del__";
|
||||
|
||||
public static final int REGEX_PATTERN_FLAGS = SystemInfo.isFileSystemCaseSensitive ? 0 : Pattern.CASE_INSENSITIVE;
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public static final TObjectHashingStrategy<String> PATH_HASHING_STRATEGY =
|
||||
SystemInfo.isFileSystemCaseSensitive ? TObjectHashingStrategy.CANONICAL : CaseInsensitiveStringHashingStrategy.INSTANCE;
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public static final TObjectHashingStrategy<File> FILE_HASHING_STRATEGY =
|
||||
SystemInfo.isFileSystemCaseSensitive ? TObjectHashingStrategy.CANONICAL : new TObjectHashingStrategy<File>() {
|
||||
@Override
|
||||
public int computeHashCode(File object) {
|
||||
return fileHashCode(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(File o1, File o2) {
|
||||
return filesEqual(o1, o2);
|
||||
}
|
||||
};
|
||||
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.util.io.FileUtil");
|
||||
|
||||
// do not use channels to copy files larger than 5 Mb because of possible MapFailed error
|
||||
|
||||
@@ -15,16 +15,13 @@
|
||||
*/
|
||||
package com.intellij.util.containers;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import gnu.trove.THashMap;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Stack;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
@@ -33,34 +30,118 @@ public class CollectionFactory {
|
||||
private CollectionFactory() {
|
||||
}
|
||||
|
||||
public static <T> Set<T> newSet(T... elements) {
|
||||
return new HashSet<T>(Arrays.asList(elements));
|
||||
@NotNull
|
||||
public static <T> Set<T> hashSet() {
|
||||
return new HashSet<T>();
|
||||
}
|
||||
|
||||
public static <T> Set<T> newTroveSet(T... elements) {
|
||||
return newTroveSet(Arrays.asList(elements));
|
||||
@NotNull
|
||||
public static <T> Set<T> hashSet(@NotNull Collection<T> elements) {
|
||||
return new HashSet<T>(elements);
|
||||
}
|
||||
|
||||
public static <T> Set<T> newTroveSet(Collection<T> elements) {
|
||||
@NotNull
|
||||
public static <T> Set<T> hashSet(@NotNull T... elements) {
|
||||
return hashSet(Arrays.asList(elements));
|
||||
}
|
||||
|
||||
public static <T> LinkedHashSet<T> linkedHashSet() {
|
||||
return new LinkedHashSet<T>();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> Set<T> troveSet(@NotNull T... elements) {
|
||||
return troveSet(Arrays.asList(elements));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> Set<T> troveSet(@NotNull Collection<T> elements) {
|
||||
return new THashSet<T>(elements);
|
||||
}
|
||||
|
||||
public static <T> T[] ar(T... elements) {
|
||||
return elements;
|
||||
@NotNull
|
||||
public static <T> TreeSet<T> treeSet() {
|
||||
return new TreeSet<T>();
|
||||
}
|
||||
|
||||
public static <T,V> THashMap<T, V> newTroveMap() {
|
||||
return new THashMap<T,V>();
|
||||
@NotNull
|
||||
public static <T> TreeSet<T> treeSet(@NotNull Collection<T> elements) {
|
||||
return new TreeSet<T>(elements);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> TreeSet<T> treeSet(@NotNull T... elements) {
|
||||
return treeSet(Arrays.asList(elements));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> TreeSet<T> treeSet(@NotNull Comparator<? super T> comparator) {
|
||||
return new TreeSet<T>(comparator);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> Set<T> unmodifiableHashSet(@NotNull T... elements) {
|
||||
return unmodifiableHashSet(Arrays.asList(elements));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> Set<T> unmodifiableHashSet(@NotNull Collection<T> elements) {
|
||||
return Collections.unmodifiableSet(hashSet(elements));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T, V> HashMap<T, V> hashMap() {
|
||||
return new HashMap<T, V>();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T, V> TreeMap<T, V> treeMap() {
|
||||
return new TreeMap<T, V>();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T, V> THashMap<T, V> troveMap() {
|
||||
return new THashMap<T, V>();
|
||||
}
|
||||
|
||||
public static <T, V> LinkedHashMap<T, V> linkedHashMap() {
|
||||
return new LinkedHashMap<T, V>();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T, V> Map<T, V> hashMap(@NotNull final List<T> keys, @NotNull final List<V> values) {
|
||||
if (keys.size() != values.size()) {
|
||||
throw new IllegalArgumentException(keys + " should have same length as " + values);
|
||||
}
|
||||
|
||||
final HashMap<T, V> map = new HashMap<T, V>();
|
||||
for (int i = 0; i < keys.size(); ++i) {
|
||||
map.put(keys.get(i), values.get(i));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> ArrayList<T> arrayList() {
|
||||
return Lists.newArrayList();
|
||||
return new ArrayList<T>();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> ArrayList<T> arrayList(int initialCapacity) {
|
||||
return new ArrayList<T>(initialCapacity);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> ArrayList<T> arrayList(Collection<T> elements) {
|
||||
return new ArrayList<T>(elements);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> ArrayList<T> arrayList(T... elements) {
|
||||
return new ArrayList<T>(Arrays.asList(elements));
|
||||
return arrayList(Arrays.asList(elements));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> List<T> arrayList(@NotNull final T[] elements, final int start, final int end) {
|
||||
if (start < 0 || start > end || end > elements.length) throw new IllegalArgumentException("start:" + start + " end:" + end + " length:" + elements.length);
|
||||
|
||||
@@ -80,35 +161,13 @@ public class CollectionFactory {
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> Stack<T> stack() {
|
||||
return new Stack<T>();
|
||||
}
|
||||
|
||||
public static <T> Set<T> hashSet() {
|
||||
return Sets.newHashSet();
|
||||
}
|
||||
|
||||
public static <T, V> Map<T, V> hashMap() {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
|
||||
public static <T, V> Map<T, V> hashMap(@NotNull final List<T> keys, @NotNull final List<V> values) {
|
||||
if (keys.size() != values.size()) {
|
||||
throw new IllegalArgumentException(keys + " should have some length as " + values);
|
||||
}
|
||||
|
||||
final HashMap<T,V> map = Maps.newHashMap();
|
||||
for (int i = 0; i < keys.size(); ++i) {
|
||||
map.put(keys.get(i), values.get(i));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public static <T, V> LinkedHashMap<T, V> linkedMap() {
|
||||
return Maps.newLinkedHashMap();
|
||||
}
|
||||
|
||||
public static <T> LinkedHashSet<T> linkedHashSet() {
|
||||
return Sets.newLinkedHashSet();
|
||||
@NotNull
|
||||
public static <T> T[] ar(@NotNull T... elements) {
|
||||
return elements;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,8 +77,8 @@
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="1c31e" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="10" left="0" bottom="10" right="0"/>
|
||||
<grid id="1c31e" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="3">
|
||||
<margin top="5" left="0" bottom="5" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="true"/>
|
||||
</constraints>
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class TestDataHighlightingPass extends TextEditorHighlightingPass {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCollectInformation(ProgressIndicator progress) {
|
||||
public void doCollectInformation(@NotNull ProgressIndicator progress) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ public class GroovyPostHighlightingPass extends TextEditorHighlightingPass {
|
||||
myEditor = editor;
|
||||
}
|
||||
|
||||
public void doCollectInformation(final ProgressIndicator progress) {
|
||||
public void doCollectInformation(@NotNull final ProgressIndicator progress) {
|
||||
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(myProject).getInspectionProfile();
|
||||
final boolean deadCodeEnabled = profile.isToolEnabled(HighlightDisplayKey.find(GroovyUnusedDeclarationInspection.SHORT_NAME), myFile);
|
||||
ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
|
||||
|
||||
+1
-1
@@ -448,7 +448,7 @@ public class GroovyCompletionUtil {
|
||||
return TailType.insertChar(editor, offset, ')');
|
||||
}
|
||||
|
||||
public static final Set<String> OPERATOR_METHOD_NAMES = CollectionFactory.newSet(
|
||||
public static final Set<String> OPERATOR_METHOD_NAMES = CollectionFactory.hashSet(
|
||||
"plus", "minus", "multiply", "power", "div", "mod", "or", "and", "xor", "next", "previous", "getAt", "putAt", "leftShift", "rightShift",
|
||||
"isCase", "bitwiseNegate", "negative", "positive", "call"
|
||||
);
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class GrKindWeigher extends CompletionWeigher {
|
||||
private static final Set<String> TRASH_CLASSES = new HashSet<String>(10);
|
||||
private static final Set<String> PRIORITY_KEYWORDS = CollectionFactory.newSet(
|
||||
private static final Set<String> PRIORITY_KEYWORDS = CollectionFactory.hashSet(
|
||||
PsiKeyword.RETURN, PsiKeyword.INSTANCEOF, "in",
|
||||
PsiKeyword.PRIVATE, PsiKeyword.PROTECTED, PsiKeyword.PUBLIC, PsiKeyword.STATIC, "def",
|
||||
PsiKeyword.TRUE, PsiKeyword.FALSE, PsiKeyword.NULL);
|
||||
|
||||
@@ -44,7 +44,7 @@ public class GdkMethodUtil {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(GdkMethodUtil.class);
|
||||
|
||||
public static final Set<String> COLLECTION_METHOD_NAMES = CollectionFactory.newSet(
|
||||
public static final Set<String> COLLECTION_METHOD_NAMES = CollectionFactory.hashSet(
|
||||
"each", "eachWithIndex", "any", "every", "reverseEach", "collect", "collectAll", "find", "findAll", "retainAll", "removeAll", "split",
|
||||
"groupBy", "groupEntriesBy", "findLastIndexOf", "findIndexValues", "findIndexOf"
|
||||
);
|
||||
|
||||
@@ -331,8 +331,8 @@ public class MvcModuleStructureUtil {
|
||||
}
|
||||
|
||||
private static void removeInvalidSourceRoots(List<Consumer<ModifiableRootModel>> actions, MvcProjectStructure structure) {
|
||||
final Set<SourceFolder> toRemove = CollectionFactory.newTroveSet();
|
||||
final Set<ContentEntry> toRemoveContent = CollectionFactory.newTroveSet();
|
||||
final Set<SourceFolder> toRemove = CollectionFactory.troveSet();
|
||||
final Set<ContentEntry> toRemoveContent = CollectionFactory.troveSet();
|
||||
for (ContentEntry entry : ModuleRootManager.getInstance(structure.myModule).getContentEntries()) {
|
||||
final VirtualFile file = entry.getFile();
|
||||
if (file == null || !structure.isValidContentRoot(file)) {
|
||||
|
||||
+1
-1
@@ -167,7 +167,7 @@ public class StubGenerator implements ClassItemGenerator {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
final Set<String> result = CollectionFactory.newTroveSet(ArrayUtil.EMPTY_STRING_ARRAY);
|
||||
final Set<String> result = CollectionFactory.troveSet(ArrayUtil.EMPTY_STRING_ARRAY);
|
||||
for (PsiClassType type : chainedConstructor.getThrowsList().getReferencedTypes()) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
writeType(builder, substitutor.substitute(type), constructor, classNameProvider);
|
||||
|
||||
@@ -190,7 +190,7 @@ class FooSpec extends spock.lang.Specification {
|
||||
|
||||
assertNotNull(lookupElements);
|
||||
|
||||
Set<String> missedVariants = CollectionFactory.newSet(expectedVariants);
|
||||
Set<String> missedVariants = CollectionFactory.hashSet(expectedVariants);
|
||||
|
||||
for (LookupElement lookupElement : lookupElements) {
|
||||
missedVariants.remove(lookupElement.getLookupString());
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ import java.util.regex.Pattern;
|
||||
public class MavenResourceCompiler implements ClassPostProcessingCompiler {
|
||||
private static final Key<List<String>> FILES_TO_DELETE_KEY = Key.create(MavenResourceCompiler.class.getSimpleName() + ".FILES_TO_DELETE");
|
||||
|
||||
private static final Set<String> DEFAULT_NON_FILTERED_EXTENSIONS = CollectionFactory.newSet("jpg", "jpeg", "gif", "bmp", "png");
|
||||
private static final Set<String> DEFAULT_NON_FILTERED_EXTENSIONS = CollectionFactory.hashSet("jpg", "jpeg", "gif", "bmp", "png");
|
||||
|
||||
private Map<String, Set<String>> myOutputItemsCache = new THashMap<String, Set<String>>();
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ import java.util.regex.Pattern;
|
||||
public class MavenDomUtil {
|
||||
|
||||
// see http://maven.apache.org/settings.html
|
||||
private static final Set<String> SUBTAGS_IN_SETTINGS_FILE = CollectionFactory.newSet("localRepository", "interactiveMode",
|
||||
private static final Set<String> SUBTAGS_IN_SETTINGS_FILE = CollectionFactory.hashSet("localRepository", "interactiveMode",
|
||||
"usePluginRegistry", "offline", "pluginGroups",
|
||||
"servers", "mirrors", "proxies", "profiles",
|
||||
"activeProfiles");
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ public class MavenResumeAction extends AnAction {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(MavenResumeAction.class);
|
||||
|
||||
private static final Set<String> PARAMS_DISABLING_RESUME = CollectionFactory.newSet("-rf", "-resume-from", "-pl", "-projects", "-am",
|
||||
private static final Set<String> PARAMS_DISABLING_RESUME = CollectionFactory.hashSet("-rf", "-resume-from", "-pl", "-projects", "-am",
|
||||
"-also-make", "-amd", "-also-make-dependents");
|
||||
|
||||
public static final int STATE_INITIAL = 0;
|
||||
|
||||
@@ -617,7 +617,7 @@ public class MavenProject {
|
||||
|
||||
@NotNull
|
||||
public Set<String> getSupportedPackagings() {
|
||||
Set<String> result = CollectionFactory.newSet(MavenConstants.TYPE_POM,
|
||||
Set<String> result = CollectionFactory.hashSet(MavenConstants.TYPE_POM,
|
||||
MavenConstants.TYPE_JAR,
|
||||
"ejb", "ejb-client", "war", "ear", "bundle", "maven-plugin");
|
||||
for (MavenImporter each : getSuitableImporters()) {
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.codeHighlighting.HighlightingPass;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.uiDesigner.designSurface.GuiEditor;
|
||||
import com.intellij.uiDesigner.propertyInspector.UIDesignerToolWindowManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
@@ -31,7 +32,7 @@ public class FormHighlightingPass implements HighlightingPass {
|
||||
myEditor = editor;
|
||||
}
|
||||
|
||||
public void collectInformation(ProgressIndicator progress) {
|
||||
public void collectInformation(@NotNull ProgressIndicator progress) {
|
||||
ErrorAnalyzer.analyzeErrors(myEditor, myEditor.getRootContainer(), progress);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -19,6 +19,7 @@ import com.intellij.codeHighlighting.HighlightingPass;
|
||||
import com.intellij.designer.DesignerToolWindowManager;
|
||||
import com.intellij.designer.designSurface.DesignerEditorPanel;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
@@ -31,7 +32,7 @@ public final class DesignerHighlightingPass implements HighlightingPass {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectInformation(ProgressIndicator progress) {
|
||||
public void collectInformation(@NotNull ProgressIndicator progress) {
|
||||
myDesigner.loadInspections(progress);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class AddToCompositeCollectionInvocation implements Invocation {
|
||||
}
|
||||
|
||||
public Object invoke(final DomInvocationHandler<?> handler, final Object[] args) throws Throwable {
|
||||
Set<XmlTag> set = CollectionFactory.newTroveSet();
|
||||
Set<XmlTag> set = CollectionFactory.troveSet();
|
||||
for (final CollectionChildDescriptionImpl qname : myQnames) {
|
||||
set.addAll(qname.getTagsGetter().fun(handler));
|
||||
}
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ public class XmlTagTreeHighlightingPass extends TextEditorHighlightingPass {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doCollectInformation(ProgressIndicator progress) {
|
||||
public void doCollectInformation(@NotNull ProgressIndicator progress) {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user