mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git@git.labs.intellij.net:idea/community
This commit is contained in:
@@ -22,6 +22,7 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Icons;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -188,7 +189,7 @@ public class RegExpPropertyImpl extends RegExpElementImpl implements RegExpPrope
|
||||
}
|
||||
}
|
||||
}
|
||||
UNICODE_BLOCKS = unicodeBlocks.toArray(new String[unicodeBlocks.size()]);
|
||||
UNICODE_BLOCKS = ArrayUtil.toStringArray(unicodeBlocks);
|
||||
}
|
||||
public static final String[][] PROPERTY_NAMES = {
|
||||
{ "Cn", "UNASSIGNED" },
|
||||
|
||||
@@ -17,6 +17,7 @@ package test;
|
||||
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.testFramework.fixtures.CodeInsightFixtureTestCase;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.intellij.lang.regexp.psi.impl.RegExpPropertyImpl;
|
||||
|
||||
import java.io.File;
|
||||
@@ -54,7 +55,7 @@ public class RegExpCompletionTest extends CodeInsightFixtureTestCase {
|
||||
for (String[] stringArray : RegExpPropertyImpl.PROPERTY_NAMES) {
|
||||
nameList.add("p{" + stringArray[0] + "}");
|
||||
}
|
||||
myFixture.testCompletionVariants(getInputDataFileName(getTestName(true)), nameList.toArray(new String[nameList.size()]));
|
||||
myFixture.testCompletionVariants(getInputDataFileName(getTestName(true)), ArrayUtil.toStringArray(nameList));
|
||||
}
|
||||
|
||||
public void testPropertyVariants() throws Throwable {
|
||||
@@ -62,7 +63,7 @@ public class RegExpCompletionTest extends CodeInsightFixtureTestCase {
|
||||
for (String[] stringArray : RegExpPropertyImpl.PROPERTY_NAMES) {
|
||||
nameList.add("{" + stringArray[0] + "}");
|
||||
}
|
||||
myFixture.testCompletionVariants(getInputDataFileName(getTestName(true)), nameList.toArray(new String[nameList.size()]));
|
||||
myFixture.testCompletionVariants(getInputDataFileName(getTestName(true)), ArrayUtil.toStringArray(nameList));
|
||||
}
|
||||
|
||||
public void testPropertyAlpha() throws Throwable {
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.DefaultJDOMExternalizer;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
@@ -91,7 +92,7 @@ public class RmicSettings implements PersistentStateComponent<Element> {
|
||||
}
|
||||
options.add(token);
|
||||
}
|
||||
return options.toArray(new String[options.size()]);
|
||||
return ArrayUtil.toStringArray(options);
|
||||
}
|
||||
|
||||
public static RmicSettings getInstance(Project project) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -54,7 +55,7 @@ public class PropertyFileGeneratorImpl extends PropertyFileGenerator {
|
||||
final PathMacros pathMacros = PathMacros.getInstance();
|
||||
final Set<String> macroNamesSet = pathMacros.getUserMacroNames();
|
||||
if (macroNamesSet.size() > 0) {
|
||||
final String[] macroNames = macroNamesSet.toArray(new String[macroNamesSet.size()]);
|
||||
final String[] macroNames = ArrayUtil.toStringArray(macroNamesSet);
|
||||
Arrays.sort(macroNames);
|
||||
for (final String macroName : macroNames) {
|
||||
addProperty(BuildProperties.getPathMacroProperty(macroName), pathMacros.getValue(macroName));
|
||||
|
||||
-88
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.intellij.compiler.impl.packagingCompiler;
|
||||
|
||||
import com.intellij.openapi.compiler.CompileContext;
|
||||
import com.intellij.openapi.compiler.FileProcessingCompiler;
|
||||
import com.intellij.openapi.util.MultiValuesMap;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public abstract class ProcessingItemsBuilderContext<Item extends FileProcessingCompiler.ProcessingItem> {
|
||||
protected final Map<VirtualFile, Item> myItemsBySource;
|
||||
private final Map<String, VirtualFile> mySourceByOutput;
|
||||
private final MultiValuesMap<String, JarInfo> myJarsByPath;
|
||||
private final CompileContext myCompileContext;
|
||||
|
||||
public ProcessingItemsBuilderContext(final CompileContext compileContext) {
|
||||
myCompileContext = compileContext;
|
||||
myItemsBySource = new HashMap<VirtualFile, Item>();
|
||||
mySourceByOutput = new HashMap<String, VirtualFile>();
|
||||
myJarsByPath = new MultiValuesMap<String, JarInfo>();
|
||||
}
|
||||
|
||||
public abstract Item[] getProcessingItems();
|
||||
|
||||
public boolean checkOutputPath(final String outputPath, final VirtualFile sourceFile) {
|
||||
VirtualFile old = mySourceByOutput.get(outputPath);
|
||||
if (old == null) {
|
||||
mySourceByOutput.put(outputPath, sourceFile);
|
||||
return true;
|
||||
}
|
||||
//todo[nik] show warning?
|
||||
return false;
|
||||
}
|
||||
|
||||
public Item getItemBySource(VirtualFile source) {
|
||||
return myItemsBySource.get(source);
|
||||
}
|
||||
|
||||
public void registerJarFile(@NotNull JarInfo jarInfo, @NotNull String outputPath) {
|
||||
myJarsByPath.put(outputPath, jarInfo);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Collection<JarInfo> getJarInfos(String outputPath) {
|
||||
return myJarsByPath.get(outputPath);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public VirtualFile getSourceByOutput(String outputPath) {
|
||||
return mySourceByOutput.get(outputPath);
|
||||
}
|
||||
|
||||
public CompileContext getCompileContext() {
|
||||
return myCompileContext;
|
||||
}
|
||||
|
||||
public Item getOrCreateProcessingItem(VirtualFile sourceFile) {
|
||||
Item item = myItemsBySource.get(sourceFile);
|
||||
if (item == null) {
|
||||
item = createProcessingItem(sourceFile);
|
||||
myItemsBySource.put(sourceFile, item);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
protected abstract Item createProcessingItem(VirtualFile sourceFile);
|
||||
}
|
||||
@@ -39,6 +39,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.StringBuilderSpinAllocator;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -301,7 +302,7 @@ public class RmicCompiler implements ClassPostProcessingCompiler{
|
||||
for (RmicProcessingItem item : items) {
|
||||
commandLine.add(item.getClassQName());
|
||||
}
|
||||
return commandLine.toArray(new String[commandLine.size()]);
|
||||
return ArrayUtil.toStringArray(commandLine);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+55
-7
@@ -17,22 +17,33 @@ package com.intellij.packaging.impl.compiler;
|
||||
|
||||
import com.intellij.compiler.impl.packagingCompiler.DestinationInfo;
|
||||
import com.intellij.compiler.impl.packagingCompiler.ExplodedDestinationInfo;
|
||||
import com.intellij.compiler.impl.packagingCompiler.ProcessingItemsBuilderContext;
|
||||
import com.intellij.compiler.impl.packagingCompiler.JarInfo;
|
||||
import com.intellij.openapi.compiler.CompileContext;
|
||||
import com.intellij.openapi.util.MultiValuesMap;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.packaging.elements.ArtifactIncrementalCompilerContext;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class ArtifactsProcessingItemsBuilderContext extends ProcessingItemsBuilderContext<ArtifactPackagingProcessingItem> implements ArtifactIncrementalCompilerContext {
|
||||
public class ArtifactsProcessingItemsBuilderContext implements ArtifactIncrementalCompilerContext {
|
||||
private boolean myCollectingEnabledItems;
|
||||
protected final Map<VirtualFile, ArtifactPackagingProcessingItem> myItemsBySource;
|
||||
private final Map<String, VirtualFile> mySourceByOutput;
|
||||
private final MultiValuesMap<String, JarInfo> myJarsByPath;
|
||||
private final CompileContext myCompileContext;
|
||||
|
||||
public ArtifactsProcessingItemsBuilderContext(CompileContext compileContext) {
|
||||
super(compileContext);
|
||||
myCompileContext = compileContext;
|
||||
myItemsBySource = new HashMap<VirtualFile, ArtifactPackagingProcessingItem>();
|
||||
mySourceByOutput = new HashMap<String, VirtualFile>();
|
||||
myJarsByPath = new MultiValuesMap<String, JarInfo>();
|
||||
}
|
||||
|
||||
public boolean addDestination(@NotNull VirtualFile sourceFile, @NotNull DestinationInfo destinationInfo) {
|
||||
@@ -47,10 +58,6 @@ public class ArtifactsProcessingItemsBuilderContext extends ProcessingItemsBuild
|
||||
return false;
|
||||
}
|
||||
|
||||
protected ArtifactPackagingProcessingItem createProcessingItem(VirtualFile sourceFile) {
|
||||
return new ArtifactPackagingProcessingItem(sourceFile);
|
||||
}
|
||||
|
||||
public ArtifactPackagingProcessingItem[] getProcessingItems() {
|
||||
final Collection<ArtifactPackagingProcessingItem> processingItems = myItemsBySource.values();
|
||||
return processingItems.toArray(new ArtifactPackagingProcessingItem[processingItems.size()]);
|
||||
@@ -59,4 +66,45 @@ public class ArtifactsProcessingItemsBuilderContext extends ProcessingItemsBuild
|
||||
public void setCollectingEnabledItems(boolean collectingEnabledItems) {
|
||||
myCollectingEnabledItems = collectingEnabledItems;
|
||||
}
|
||||
|
||||
public boolean checkOutputPath(final String outputPath, final VirtualFile sourceFile) {
|
||||
VirtualFile old = mySourceByOutput.get(outputPath);
|
||||
if (old == null) {
|
||||
mySourceByOutput.put(outputPath, sourceFile);
|
||||
return true;
|
||||
}
|
||||
//todo[nik] show warning?
|
||||
return false;
|
||||
}
|
||||
|
||||
public ArtifactPackagingProcessingItem getItemBySource(VirtualFile source) {
|
||||
return myItemsBySource.get(source);
|
||||
}
|
||||
|
||||
public void registerJarFile(@NotNull JarInfo jarInfo, @NotNull String outputPath) {
|
||||
myJarsByPath.put(outputPath, jarInfo);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Collection<JarInfo> getJarInfos(String outputPath) {
|
||||
return myJarsByPath.get(outputPath);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public VirtualFile getSourceByOutput(String outputPath) {
|
||||
return mySourceByOutput.get(outputPath);
|
||||
}
|
||||
|
||||
public CompileContext getCompileContext() {
|
||||
return myCompileContext;
|
||||
}
|
||||
|
||||
public ArtifactPackagingProcessingItem getOrCreateProcessingItem(VirtualFile sourceFile) {
|
||||
ArtifactPackagingProcessingItem item = myItemsBySource.get(sourceFile);
|
||||
if (item == null) {
|
||||
item = new ArtifactPackagingProcessingItem(sourceFile);
|
||||
myItemsBySource.put(sourceFile, item);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -316,7 +316,7 @@ public class IncrementalArtifactsCompiler implements PackagingCompiler {
|
||||
public void processOutdatedItem(final CompileContext context, final String url, @Nullable final ValidityState state) {
|
||||
}
|
||||
|
||||
protected boolean collectFilesToDelete(final CompileContext context, final ArtifactPackagingProcessingItem[] allProcessingItems) {
|
||||
private boolean collectFilesToDelete(final CompileContext context, final ArtifactPackagingProcessingItem[] allProcessingItems) {
|
||||
List<String> filesToDelete = new ArrayList<String>();
|
||||
Set<String> outputPaths = createPathsHashSet();
|
||||
for (ArtifactPackagingProcessingItem item : allProcessingItems) {
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -76,7 +77,7 @@ public abstract class ChunkBuildExtension {
|
||||
if (allTargets.isEmpty()) {
|
||||
allTargets.add(BuildProperties.getCompileTargetName(chunk.getName()));
|
||||
}
|
||||
return allTargets.toArray(new String[allTargets.size()]);
|
||||
return ArrayUtil.toStringArray(allTargets);
|
||||
}
|
||||
|
||||
public static void process(CompositeGenerator generator, ModuleChunk chunk, GenerationOptions genOptions) {
|
||||
|
||||
@@ -22,7 +22,13 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author nik
|
||||
*/
|
||||
public abstract class ArtifactTemplate {
|
||||
|
||||
public abstract String getPresentableName();
|
||||
|
||||
public abstract CompositePackagingElement<?> createRootElement(@NotNull String artifactName);
|
||||
|
||||
@NotNull
|
||||
public String suggestArtifactName() {
|
||||
return "unnamed";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,10 +49,7 @@ public class FacetEditorImpl extends UnnamedConfigurableGroup implements Unnamed
|
||||
private final FacetEditorContext myContext;
|
||||
private final Set<FacetEditorTab> myVisitedTabs = new HashSet<FacetEditorTab>();
|
||||
private int mySelectedTabIndex = 0;
|
||||
private Disposable myDisposable = new Disposable() {
|
||||
public void dispose() {
|
||||
}
|
||||
};
|
||||
private final Disposable myDisposable = Disposer.newDisposable();
|
||||
|
||||
public FacetEditorImpl(final FacetEditorContext context, final FacetConfiguration configuration) {
|
||||
myContext = context;
|
||||
|
||||
@@ -83,10 +83,7 @@ public class SdkEditor implements Configurable, Place.Navigator {
|
||||
private String myInitialPath;
|
||||
private final History myHistory;
|
||||
|
||||
private Disposable myDisposable = new Disposable() {
|
||||
public void dispose() {
|
||||
}
|
||||
};
|
||||
private Disposable myDisposable = Disposer.newDisposable();
|
||||
|
||||
public SdkEditor(NotifiableSdkModel sdkModel, History history, final ProjectJdkImpl sdk) {
|
||||
mySdkModel = sdkModel;
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.intellij.openapi.roots.ModuleRootListener;
|
||||
import com.intellij.openapi.roots.OrderEntry;
|
||||
import com.intellij.openapi.roots.impl.storage.ClasspathStorage;
|
||||
import com.intellij.openapi.roots.impl.storage.ClasspathStorageProvider;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.ui.OrderPanelListener;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -52,9 +53,7 @@ public class ClasspathEditor extends ModuleElementsEditor implements ModuleRootL
|
||||
public ClasspathEditor(final ModuleConfigurationState state) {
|
||||
super(state);
|
||||
|
||||
final Disposable disposable = new Disposable() {
|
||||
public void dispose() {}
|
||||
};
|
||||
final Disposable disposable = Disposer.newDisposable();
|
||||
|
||||
state.getProject().getMessageBus().connect(disposable).subscribe(ProjectTopics.PROJECT_ROOTS, this);
|
||||
registerDisposable(disposable);
|
||||
|
||||
+3
-4
@@ -34,7 +34,6 @@ import com.intellij.openapi.ui.MasterDetailsStateService;
|
||||
import com.intellij.packaging.artifacts.*;
|
||||
import com.intellij.packaging.elements.CompositePackagingElement;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -49,7 +48,6 @@ import java.util.*;
|
||||
storages = {@Storage(id = "other", file = "$WORKSPACE_FILE$")}
|
||||
)
|
||||
public class ArtifactsStructureConfigurable extends BaseStructureConfigurable {
|
||||
@NonNls private static final String DEFAULT_ARTIFACT_NAME = "unnamed";
|
||||
private ArtifactsStructureConfigurableContextImpl myPackagingEditorContext;
|
||||
private ArtifactEditorSettings myDefaultSettings = new ArtifactEditorSettings();
|
||||
|
||||
@@ -172,10 +170,11 @@ public class ArtifactsStructureConfigurable extends BaseStructureConfigurable {
|
||||
}
|
||||
|
||||
private void addArtifact(@NotNull ArtifactType type, @NotNull ArtifactTemplate artifactTemplate) {
|
||||
String name = DEFAULT_ARTIFACT_NAME;
|
||||
final String baseName = artifactTemplate.suggestArtifactName();
|
||||
String name = baseName;
|
||||
int i = 2;
|
||||
while (myPackagingEditorContext.getArtifactModel().findArtifact(name) != null) {
|
||||
name = DEFAULT_ARTIFACT_NAME + i;
|
||||
name = baseName + i;
|
||||
i++;
|
||||
}
|
||||
final ModifiableArtifact artifact = myPackagingEditorContext.getOrCreateModifiableArtifactModel().addArtifact(name, type, artifactTemplate.createRootElement(name));
|
||||
|
||||
@@ -270,7 +270,7 @@ public class JavaCompletionUtil {
|
||||
|
||||
|
||||
}
|
||||
return result.toArray(new String[result.size()]);
|
||||
return ArrayUtil.toStringArray(result);
|
||||
}
|
||||
|
||||
private static void tunePreferencePolicy(final List<LookupElement> list, final SuggestedNameInfo suggestedNameInfo) {
|
||||
@@ -319,7 +319,7 @@ public class JavaCompletionUtil {
|
||||
newSuggestions.add(suggestion);
|
||||
}
|
||||
}
|
||||
return newSuggestions.toArray(new String[newSuggestions.size()]);
|
||||
return ArrayUtil.toStringArray(newSuggestions);
|
||||
}
|
||||
|
||||
static int getOverlap(final String propertyName, final String prefix) {
|
||||
|
||||
+2
-1
@@ -35,6 +35,7 @@ import com.intellij.psi.codeStyle.VariableKind;
|
||||
import com.intellij.psi.search.LocalSearchScope;
|
||||
import com.intellij.psi.search.searches.ReferencesSearch;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -151,7 +152,7 @@ public class CreateFieldFromParameterAction implements IntentionAction {
|
||||
else {
|
||||
namesList.add(0, defaultName);
|
||||
}
|
||||
names = namesList.toArray(new String[namesList.size()]);
|
||||
names = ArrayUtil.toStringArray(namesList);
|
||||
|
||||
boolean myBeFinal = method.isConstructor();
|
||||
CreateFieldFromParameterDialog dialog = new CreateFieldFromParameterDialog(
|
||||
|
||||
+2
-1
@@ -27,6 +27,7 @@ import com.intellij.psi.PsiVariable;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class SuggestVariableNameMacro implements Macro {
|
||||
@@ -88,7 +89,7 @@ public class SuggestVariableNameMacro implements Macro {
|
||||
}
|
||||
}
|
||||
|
||||
return (String[]) namesList.toArray(new String[namesList.size()]);
|
||||
return (String[])ArrayUtil.toStringArray(namesList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -424,7 +424,7 @@ public class ClsStubBuilder {
|
||||
}
|
||||
|
||||
if (parsedViaGenericSignature && throwables != null) {
|
||||
return throwables.toArray(new String[throwables.size()]);
|
||||
return ArrayUtil.toStringArray(throwables);
|
||||
}
|
||||
else {
|
||||
String[] converted = ArrayUtil.newStringArray(exceptions.length);
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.scope.processor.FilterScopeProcessor;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.CharTable;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.SmartList;
|
||||
@@ -182,7 +183,7 @@ public class PsiDocMethodOrFieldRef extends CompositePsiElement implements PsiDo
|
||||
}
|
||||
}
|
||||
|
||||
return types.toArray(new String[types.size()]);
|
||||
return ArrayUtil.toStringArray(types);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ public abstract class LightCompletionTestCase extends LightCodeInsightTestCase {
|
||||
|
||||
protected void testByCount(int finalCount, @NonNls String... values) {
|
||||
if (myItems == null) {
|
||||
assertEquals(0, finalCount);
|
||||
assertEquals(finalCount, 0);
|
||||
return;
|
||||
}
|
||||
int index = 0;
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ public class UnknownConfigurationType implements ConfigurationType {
|
||||
}
|
||||
|
||||
public String getConfigurationTypeDescription() {
|
||||
return "Configuration which cannot be loaded due to some resons";
|
||||
return "Configuration which cannot be loaded due to some reasons";
|
||||
}
|
||||
|
||||
public Icon getIcon() {
|
||||
|
||||
@@ -118,5 +118,4 @@ public class FoldingDescriptor {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public class PomModelEvent extends EventObject {
|
||||
super(source);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<PomModelAspect> getChangedAspects() {
|
||||
if (myChangeSets != null) {
|
||||
return myChangeSets.keySet();
|
||||
|
||||
@@ -57,8 +57,8 @@ public abstract class WalkingState<T> {
|
||||
T parent = myWalker.getParent(element);
|
||||
T next = myWalker.getNextSibling(element);
|
||||
visit(element);
|
||||
assert myWalker.getNextSibling(element) == next;
|
||||
assert myWalker.getParent(element) == parent;
|
||||
assert myWalker.getNextSibling(element) == next : "Next sibling of the element '"+element+"' changed. Was: "+next+"; Now:"+myWalker.getNextSibling(element)+"; Root:"+root;
|
||||
assert myWalker.getParent(element) == parent : "Parent of the element '"+element+"' changed. Was: "+parent+"; Now:"+myWalker.getParent(element)+"; Root:"+root;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -87,10 +87,7 @@ public class ColorAndFontOptions extends SearchableConfigurable.Parent.Abstract
|
||||
|
||||
private boolean myApplyCompleted = false;
|
||||
private boolean myDisposeCompleted = false;
|
||||
private final Disposable myDisposable = new Disposable() {
|
||||
public void dispose() {
|
||||
}
|
||||
};
|
||||
private final Disposable myDisposable = Disposer.newDisposable();
|
||||
|
||||
public boolean isModified() {
|
||||
boolean listModified = isSchemeListModified();
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.intellij.codeInsight.daemon.impl;
|
||||
|
||||
import com.intellij.codeHighlighting.TextEditorHighlightingPass;
|
||||
import com.intellij.codeInsight.folding.impl.FoldingUpdate;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.IndexNotReadyException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class InjectedCodeFoldingPass extends TextEditorHighlightingPass implements DumbAware {
|
||||
private Runnable myRunnable;
|
||||
private final Editor myEditor;
|
||||
private final PsiFile myFile;
|
||||
|
||||
InjectedCodeFoldingPass(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
|
||||
super(project, editor.getDocument(), false);
|
||||
myEditor = editor;
|
||||
myFile = file;
|
||||
}
|
||||
|
||||
public void doCollectInformation(ProgressIndicator progress) {
|
||||
Runnable runnable = FoldingUpdate.updateInjectedFoldRegions(myEditor, myFile);
|
||||
synchronized (this) {
|
||||
myRunnable = runnable;
|
||||
}
|
||||
}
|
||||
|
||||
public void doApplyInformationToEditor() {
|
||||
Runnable runnable;
|
||||
synchronized (this) {
|
||||
runnable = myRunnable;
|
||||
}
|
||||
if (runnable != null){
|
||||
try {
|
||||
runnable.run();
|
||||
}
|
||||
catch (IndexNotReadyException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.intellij.codeInsight.daemon.impl;
|
||||
|
||||
import com.intellij.codeHighlighting.Pass;
|
||||
import com.intellij.codeHighlighting.TextEditorHighlightingPass;
|
||||
import com.intellij.codeHighlighting.TextEditorHighlightingPassFactory;
|
||||
import com.intellij.codeHighlighting.TextEditorHighlightingPassRegistrar;
|
||||
import com.intellij.openapi.components.AbstractProjectComponent;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author cdr
|
||||
*/
|
||||
public class InjectedCodeFoldingPassFactory extends AbstractProjectComponent implements TextEditorHighlightingPassFactory {
|
||||
public InjectedCodeFoldingPassFactory(Project project, TextEditorHighlightingPassRegistrar highlightingPassRegistrar) {
|
||||
super(project);
|
||||
highlightingPassRegistrar.registerTextEditorHighlightingPass(this, new int[]{Pass.UPDATE_ALL}, null, false, -1);
|
||||
}
|
||||
|
||||
@NonNls
|
||||
@NotNull
|
||||
public String getComponentName() {
|
||||
return "InjectedCodeFoldingPassFactory";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public TextEditorHighlightingPass createHighlightingPass(@NotNull PsiFile file, @NotNull final Editor editor) {
|
||||
return new InjectedCodeFoldingPass(myProject, editor, file);
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -28,6 +28,7 @@ import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.ui.LayeredIcon;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.ui.EmptyIcon;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -102,8 +103,8 @@ public class TrafficLightRenderer implements ErrorStripeRenderer {
|
||||
}
|
||||
}
|
||||
DaemonCodeAnalyzerStatus status = new DaemonCodeAnalyzerStatus();
|
||||
status.noInspectionRoots = noInspectionRoots.isEmpty() ? null : noInspectionRoots.toArray(new String[noInspectionRoots.size()]);
|
||||
status.noHighlightingRoots = noHighlightingRoots.isEmpty() ? null : noHighlightingRoots.toArray(new String[noHighlightingRoots.size()]);
|
||||
status.noInspectionRoots = noInspectionRoots.isEmpty() ? null : ArrayUtil.toStringArray(noInspectionRoots);
|
||||
status.noHighlightingRoots = noHighlightingRoots.isEmpty() ? null : ArrayUtil.toStringArray(noHighlightingRoots);
|
||||
|
||||
final SeverityRegistrar severityRegistrar = SeverityRegistrar.getInstance(myProject);
|
||||
status.errorCount = new int[severityRegistrar.getSeveritiesCount()];
|
||||
|
||||
@@ -36,16 +36,16 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.TreeMap;
|
||||
|
||||
class FoldingUpdate {
|
||||
public class FoldingUpdate {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.folding.impl.FoldingUpdate");
|
||||
|
||||
private static final Key<Object> LAST_UPDATE_STAMP_KEY = Key.create("LAST_UPDATE_STAMP_KEY");
|
||||
private static final Comparator<PsiElement> COMPARE_BY_OFFSET = new Comparator<PsiElement>() {
|
||||
public int compare(PsiElement element, PsiElement element1) {
|
||||
int startOffsetDiff = element.getTextRange().getStartOffset() - element1.getTextRange().getStartOffset();
|
||||
return startOffsetDiff == 0 ? element.getTextRange().getEndOffset() - element1.getTextRange().getEndOffset() : startOffsetDiff;
|
||||
}
|
||||
};
|
||||
public int compare(PsiElement element, PsiElement element1) {
|
||||
int startOffsetDiff = element.getTextRange().getStartOffset() - element1.getTextRange().getStartOffset();
|
||||
return startOffsetDiff == 0 ? element.getTextRange().getEndOffset() - element1.getTextRange().getEndOffset() : startOffsetDiff;
|
||||
}
|
||||
};
|
||||
|
||||
private FoldingUpdate() {
|
||||
}
|
||||
@@ -69,14 +69,7 @@ class FoldingUpdate {
|
||||
final TreeMap<PsiElement, FoldingDescriptor> elementsToFoldMap = new TreeMap<PsiElement, FoldingDescriptor>(COMPARE_BY_OFFSET);
|
||||
getFoldingsFor(file, document, elementsToFoldMap, quick);
|
||||
|
||||
List<DocumentWindow> injectedDocuments = InjectedLanguageUtil.getCachedInjectedDocuments(file);
|
||||
for (DocumentWindow injectedDocument : injectedDocuments) {
|
||||
PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(injectedDocument);
|
||||
if (psiFile == null || !psiFile.isValid() || !injectedDocument.isValid()) continue;
|
||||
getFoldingsFor(psiFile, injectedDocument, elementsToFoldMap, quick);
|
||||
}
|
||||
|
||||
final Runnable operation = new UpdateFoldRegionsOperation(editor, elementsToFoldMap, applyDefaultState);
|
||||
final Runnable operation = new UpdateFoldRegionsOperation(project, editor, elementsToFoldMap, applyDefaultState, false);
|
||||
return new Runnable() {
|
||||
public void run() {
|
||||
editor.getFoldingModel().runBatchFoldingOperationDoNotCollapseCaret(operation);
|
||||
@@ -87,6 +80,39 @@ class FoldingUpdate {
|
||||
};
|
||||
}
|
||||
|
||||
private static final Key<Object> LAST_UPDATE_INJECTED_STAMP_KEY = Key.create("LAST_UPDATE_INJECTED_STAMP_KEY");
|
||||
@Nullable
|
||||
public static Runnable updateInjectedFoldRegions(@NotNull final Editor editor, @NotNull PsiFile file) {
|
||||
if (file instanceof PsiCompiledElement) return null;
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
|
||||
final Project project = file.getProject();
|
||||
Document document = editor.getDocument();
|
||||
LOG.assertTrue(!PsiDocumentManager.getInstance(project).isUncommited(document));
|
||||
|
||||
final long timeStamp = document.getModificationStamp();
|
||||
Object lastTimeStamp = editor.getUserData(LAST_UPDATE_INJECTED_STAMP_KEY);
|
||||
if (lastTimeStamp instanceof Long && ((Long)lastTimeStamp).longValue() == timeStamp) return null;
|
||||
|
||||
final TreeMap<PsiElement, FoldingDescriptor> elementsToFoldMap = new TreeMap<PsiElement, FoldingDescriptor>(COMPARE_BY_OFFSET);
|
||||
|
||||
List<DocumentWindow> injectedDocuments = InjectedLanguageUtil.getCachedInjectedDocuments(file);
|
||||
if (injectedDocuments.isEmpty()) return null;
|
||||
for (DocumentWindow injectedDocument : injectedDocuments) {
|
||||
PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(injectedDocument);
|
||||
if (psiFile == null || !psiFile.isValid() || !injectedDocument.isValid()) continue;
|
||||
getFoldingsFor(psiFile, injectedDocument, elementsToFoldMap, false);
|
||||
}
|
||||
|
||||
final Runnable operation = new UpdateFoldRegionsOperation(project, editor, elementsToFoldMap, false, true);
|
||||
return new Runnable() {
|
||||
public void run() {
|
||||
editor.getFoldingModel().runBatchFoldingOperationDoNotCollapseCaret(operation);
|
||||
editor.putUserData(LAST_UPDATE_INJECTED_STAMP_KEY, timeStamp);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static void getFoldingsFor(PsiFile file, Document document, TreeMap<PsiElement, FoldingDescriptor> elementsToFoldMap, boolean quick) {
|
||||
final FileViewProvider viewProvider = file.getViewProvider();
|
||||
for (final Language language : viewProvider.getLanguages()) {
|
||||
|
||||
+25
-18
@@ -17,34 +17,43 @@
|
||||
package com.intellij.codeInsight.folding.impl;
|
||||
|
||||
import com.intellij.lang.folding.FoldingDescriptor;
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.FoldRegion;
|
||||
import com.intellij.openapi.editor.FoldingGroup;
|
||||
import com.intellij.openapi.editor.ex.FoldingModelEx;
|
||||
import com.intellij.openapi.editor.impl.FoldRegionImpl;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import static com.intellij.util.containers.CollectionFactory.arrayList;
|
||||
import static com.intellij.util.containers.CollectionFactory.newTroveMap;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import static com.intellij.util.containers.CollectionFactory.arrayList;
|
||||
import static com.intellij.util.containers.CollectionFactory.newTroveMap;
|
||||
|
||||
/**
|
||||
* @author cdr
|
||||
*/
|
||||
class UpdateFoldRegionsOperation implements Runnable {
|
||||
private final Project myProject;
|
||||
private final Editor myEditor;
|
||||
private final boolean myApplyDefaultState;
|
||||
private final TreeMap<PsiElement, FoldingDescriptor> myElementsToFoldMap;
|
||||
private final boolean myForInjected;
|
||||
|
||||
UpdateFoldRegionsOperation(Editor editor, TreeMap<PsiElement, FoldingDescriptor> elementsToFoldMap, boolean applyDefaultState) {
|
||||
UpdateFoldRegionsOperation(Project project, Editor editor, TreeMap<PsiElement, FoldingDescriptor> elementsToFoldMap, boolean applyDefaultState,
|
||||
boolean forInjected) {
|
||||
myProject = project;
|
||||
myEditor = editor;
|
||||
myApplyDefaultState = applyDefaultState;
|
||||
myElementsToFoldMap = elementsToFoldMap;
|
||||
myForInjected = forInjected;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
@@ -63,14 +72,8 @@ class UpdateFoldRegionsOperation implements Runnable {
|
||||
|
||||
private static void applyExpandStatus(List<FoldRegion> newRegions, Map<FoldRegion, Boolean> shouldExpand, Map<FoldingGroup, Boolean> groupExpand) {
|
||||
for (final FoldRegion region : newRegions) {
|
||||
final Boolean expanded;
|
||||
final FoldingGroup group = region.getGroup();
|
||||
if (group != null) {
|
||||
expanded = groupExpand.get(group);
|
||||
}
|
||||
else {
|
||||
expanded = shouldExpand.get(region);
|
||||
}
|
||||
final Boolean expanded = group == null ? shouldExpand.get(region) : groupExpand.get(group);
|
||||
|
||||
if (expanded != null) {
|
||||
region.setExpanded(expanded.booleanValue());
|
||||
@@ -121,8 +124,14 @@ class UpdateFoldRegionsOperation implements Runnable {
|
||||
|
||||
private void removeInvalidRegions(EditorFoldingInfo info, FoldingModelEx foldingModel, HashMap<TextRange, Boolean> rangeToExpandStatusMap) {
|
||||
List<FoldRegion> toRemove = arrayList();
|
||||
InjectedLanguageManager injectedManager = InjectedLanguageManager.getInstance(myProject);
|
||||
for (FoldRegion region : foldingModel.getAllFoldRegions()) {
|
||||
PsiElement element = info.getPsiElement(region);
|
||||
if (element != null) {
|
||||
PsiFile containingFile = element.getContainingFile();
|
||||
boolean isInjected = injectedManager.isInjectedFragment(containingFile);
|
||||
if (isInjected != myForInjected) continue;
|
||||
}
|
||||
if (element != null && myElementsToFoldMap.containsKey(element)) {
|
||||
final FoldingDescriptor descriptor = myElementsToFoldMap.get(element);
|
||||
TextRange range = descriptor.getRange();
|
||||
@@ -141,15 +150,13 @@ class UpdateFoldRegionsOperation implements Runnable {
|
||||
myElementsToFoldMap.remove(element);
|
||||
}
|
||||
}
|
||||
else if (region.isValid() && info.isLightRegion(region)) {
|
||||
boolean isExpanded = region.isExpanded();
|
||||
rangeToExpandStatusMap.put(new TextRange(region.getStartOffset(), region.getEndOffset()),
|
||||
isExpanded ? Boolean.TRUE : Boolean.FALSE);
|
||||
}
|
||||
else {
|
||||
if (region.isValid() && info.isLightRegion(region)) {
|
||||
boolean isExpanded = region.isExpanded();
|
||||
rangeToExpandStatusMap.put(new TextRange(region.getStartOffset(), region.getEndOffset()),
|
||||
isExpanded ? Boolean.TRUE : Boolean.FALSE);
|
||||
}
|
||||
else {
|
||||
toRemove.add(region);
|
||||
}
|
||||
toRemove.add(region);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -165,10 +165,7 @@ public class AllFileTemplatesConfigurable implements SearchableConfigurable {
|
||||
}
|
||||
|
||||
public JComponent createComponent() {
|
||||
myUIDisposable = new Disposable() {
|
||||
public void dispose() {
|
||||
}
|
||||
};
|
||||
myUIDisposable = Disposer.newDisposable();
|
||||
myTemplatesList = new FileTemplateTabAsList(TEMPLATES_TITLE) {
|
||||
public void onTemplateSelected() {
|
||||
onListSelectionChanged();
|
||||
|
||||
@@ -96,7 +96,7 @@ public abstract class ChooseByNameBase{
|
||||
|
||||
private final ListUpdater myListUpdater = new ListUpdater();
|
||||
|
||||
private boolean myListIsUpToDate = false;
|
||||
private volatile boolean myListIsUpToDate = false;
|
||||
protected boolean myDisposedFlag = false;
|
||||
private ActionCallback myPosponedOkAction;
|
||||
|
||||
@@ -141,13 +141,6 @@ public abstract class ChooseByNameBase{
|
||||
myContext = new WeakReference<PsiElement>(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return get tool area
|
||||
*/
|
||||
public JComponent getToolArea() {
|
||||
return myToolArea;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set tool area. The method may be called only before invoke.
|
||||
* @param toolArea a tool area component
|
||||
@@ -167,10 +160,6 @@ public abstract class ChooseByNameBase{
|
||||
JBPopup myHint = null;
|
||||
boolean myFocusRequested = false;
|
||||
|
||||
JPanelProvider(LayoutManager mgr) {
|
||||
super(mgr);
|
||||
}
|
||||
|
||||
JPanelProvider() {
|
||||
}
|
||||
|
||||
@@ -607,11 +596,12 @@ public abstract class ChooseByNameBase{
|
||||
private final Object myRebuildMutex = new Object ();
|
||||
|
||||
protected void rebuildList(final int pos, final int delay, final Runnable postRunnable, final ModalityState modalityState) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
myListIsUpToDate = false;
|
||||
myAlarm.cancelAllRequests();
|
||||
myListUpdater.cancelAll();
|
||||
|
||||
tryToCancel();
|
||||
cancelCalcElementsThread();
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
final String text = myTextField.getText();
|
||||
@@ -643,10 +633,9 @@ public abstract class ChooseByNameBase{
|
||||
}
|
||||
};
|
||||
|
||||
tryToCancel();
|
||||
cancelCalcElementsThread();
|
||||
|
||||
myCalcElementsThread = new CalcElementsThread(text, myCheckBox.isSelected(), callback, modalityState);
|
||||
myCalcElementsThread.setCanCancel(postRunnable == null);
|
||||
myCalcElementsThread = new CalcElementsThread(text, myCheckBox.isSelected(), callback, modalityState, postRunnable == null);
|
||||
ApplicationManager.getApplication().executeOnPooledThread(myCalcElementsThread);
|
||||
}
|
||||
};
|
||||
@@ -661,7 +650,7 @@ public abstract class ChooseByNameBase{
|
||||
}, modalityState);
|
||||
}
|
||||
|
||||
private void tryToCancel() {
|
||||
private void cancelCalcElementsThread() {
|
||||
if (myCalcElementsThread != null) {
|
||||
myCalcElementsThread.cancel();
|
||||
myCalcElementsThread = null;
|
||||
@@ -743,6 +732,7 @@ public abstract class ChooseByNameBase{
|
||||
return bestPosition;
|
||||
}
|
||||
|
||||
@NonNls
|
||||
protected String statisticsContext() {
|
||||
return "choose_by_name#"+myModel.getPromptText()+"#"+ myCheckBox.isSelected() + "#" + myTextField.getText();
|
||||
}
|
||||
@@ -1053,13 +1043,14 @@ public abstract class ChooseByNameBase{
|
||||
private Set<Object> myElements = null;
|
||||
|
||||
private volatile boolean myCancelled = false;
|
||||
private boolean myCanCancel = true;
|
||||
private final boolean myCanCancel;
|
||||
|
||||
private CalcElementsThread(String pattern, boolean checkboxState, CalcElementsCallback callback, ModalityState modalityState) {
|
||||
private CalcElementsThread(String pattern, boolean checkboxState, CalcElementsCallback callback, ModalityState modalityState, boolean canCancel) {
|
||||
myPattern = pattern;
|
||||
myCheckboxState = checkboxState;
|
||||
myCallback = callback;
|
||||
myModalityState = modalityState;
|
||||
myCanCancel = canCancel;
|
||||
}
|
||||
|
||||
private final Alarm myShowCardAlarm = new Alarm();
|
||||
@@ -1073,7 +1064,9 @@ public abstract class ChooseByNameBase{
|
||||
ensureNamesLoaded(myCheckboxState);
|
||||
addElementsByPattern(elements, myPattern);
|
||||
for (Object elem : elements) {
|
||||
if (myCancelled) break;
|
||||
if (myCancelled) {
|
||||
break;
|
||||
}
|
||||
if (elem instanceof PsiElement) {
|
||||
final PsiElement psiElement = (PsiElement)elem;
|
||||
psiElement.isWritable(); // That will cache writable flag in VirtualFile. Taking the action here makes it canceleable.
|
||||
@@ -1121,10 +1114,6 @@ public abstract class ChooseByNameBase{
|
||||
}, delay, myModalityState);
|
||||
}
|
||||
|
||||
public void setCanCancel(boolean canCancel) {
|
||||
myCanCancel = canCancel;
|
||||
}
|
||||
|
||||
private void addElementsByPattern(Set<Object> elementsArray, String pattern) {
|
||||
String namePattern = getNamePattern(pattern);
|
||||
String qualifierPattern = getQualifierPattern(pattern);
|
||||
|
||||
@@ -69,18 +69,22 @@ public class EditorWindow implements EditorEx, UserDataHolderEx {
|
||||
public static Editor create(@NotNull final DocumentWindowImpl documentRange, @NotNull final EditorImpl editor, @NotNull final PsiFile injectedFile) {
|
||||
assert documentRange.isValid();
|
||||
assert injectedFile.isValid();
|
||||
for (EditorWindow editorWindow : allEditors) {
|
||||
if (editorWindow.getDocument() == documentRange && editorWindow.getDelegate() == editor) {
|
||||
editorWindow.myInjectedFile = injectedFile;
|
||||
if (editorWindow.isValid()) {
|
||||
return editorWindow;
|
||||
EditorWindow window;
|
||||
synchronized (allEditors) {
|
||||
for (EditorWindow editorWindow : allEditors) {
|
||||
if (editorWindow.getDocument() == documentRange && editorWindow.getDelegate() == editor) {
|
||||
editorWindow.myInjectedFile = injectedFile;
|
||||
if (editorWindow.isValid()) {
|
||||
return editorWindow;
|
||||
}
|
||||
}
|
||||
if (editorWindow.getDocument().areRangesEqual(documentRange)) {
|
||||
int i = 0;
|
||||
}
|
||||
}
|
||||
if (editorWindow.getDocument().areRangesEqual(documentRange)) {
|
||||
int i = 0;
|
||||
}
|
||||
window = new EditorWindow(documentRange, editor, injectedFile, documentRange.isOneLine());
|
||||
allEditors.add(window);
|
||||
}
|
||||
EditorWindow window = new EditorWindow(documentRange, editor, injectedFile, documentRange.isOneLine());
|
||||
assert window.isValid();
|
||||
return window;
|
||||
}
|
||||
@@ -94,9 +98,6 @@ public class EditorWindow implements EditorEx, UserDataHolderEx {
|
||||
mySelectionModelDelegate = new SelectionModelWindow(myDelegate, myDocumentWindow,this);
|
||||
myMarkupModelDelegate = new MarkupModelWindow((MarkupModelEx)myDelegate.getMarkupModel(), myDocumentWindow);
|
||||
myFoldingModelWindow = new FoldingModelWindow((FoldingModelEx)delegate.getFoldingModel(), documentWindow);
|
||||
|
||||
//disposeInvalidEditors();
|
||||
allEditors.add(this);
|
||||
}
|
||||
|
||||
public static void disposeInvalidEditors() {
|
||||
|
||||
@@ -200,7 +200,7 @@ public class MockPsiManager extends PsiManagerEx {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isAssertOnFileLoading(VirtualFile file) {
|
||||
public boolean isAssertOnFileLoading(@NotNull VirtualFile file) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -212,6 +212,7 @@ public class MockPsiManager extends PsiManagerEx {
|
||||
throw new UnsupportedOperationException("physicalChange is not implemented"); // TODO
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ResolveCache getResolveCache() {
|
||||
if (myResolveCache == null) {
|
||||
myResolveCache = new ResolveCache(this);
|
||||
@@ -219,19 +220,20 @@ public class MockPsiManager extends PsiManagerEx {
|
||||
return myResolveCache;
|
||||
}
|
||||
|
||||
public void registerRunnableToRunOnChange(Runnable runnable) {
|
||||
public void registerRunnableToRunOnChange(@NotNull Runnable runnable) {
|
||||
}
|
||||
|
||||
public void registerWeakRunnableToRunOnChange(Runnable runnable) {
|
||||
public void registerWeakRunnableToRunOnChange(@NotNull Runnable runnable) {
|
||||
}
|
||||
|
||||
public void registerRunnableToRunOnAnyChange(Runnable runnable) {
|
||||
public void registerRunnableToRunOnAnyChange(@NotNull Runnable runnable) {
|
||||
}
|
||||
|
||||
public void registerRunnableToRunAfterAnyChange(Runnable runnable) {
|
||||
public void registerRunnableToRunAfterAnyChange(@NotNull Runnable runnable) {
|
||||
throw new UnsupportedOperationException("Method registerRunnableToRunAfterAnyChange is not yet implemented in " + getClass().getName());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public FileManager getFileManager() {
|
||||
if (myMockFileManager == null) {
|
||||
myMockFileManager = new MockFileManager(this);
|
||||
@@ -239,12 +241,13 @@ public class MockPsiManager extends PsiManagerEx {
|
||||
return myMockFileManager;
|
||||
}
|
||||
|
||||
public void invalidateFile(final PsiFile file) {
|
||||
public void invalidateFile(@NotNull final PsiFile file) {
|
||||
}
|
||||
|
||||
public void beforeChildRemoval(final PsiTreeChangeEventImpl event) {
|
||||
public void beforeChildRemoval(@NotNull final PsiTreeChangeEventImpl event) {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public CacheManager getCacheManager() {
|
||||
return myCompositeCacheManager;
|
||||
}
|
||||
|
||||
+22
-7
@@ -16,11 +16,13 @@
|
||||
package com.intellij.openapi.module.impl;
|
||||
|
||||
import com.intellij.ProjectTopics;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModulePointer;
|
||||
import com.intellij.openapi.module.ModulePointerManager;
|
||||
import com.intellij.openapi.project.ModuleAdapter;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -38,11 +40,7 @@ public class ModulePointerManagerImpl extends ModulePointerManager {
|
||||
project.getMessageBus().connect().subscribe(ProjectTopics.MODULES, new ModuleAdapter() {
|
||||
@Override
|
||||
public void beforeModuleRemoved(Project project, Module module) {
|
||||
final ModulePointerImpl pointer = myPointers.remove(module);
|
||||
if (pointer != null) {
|
||||
pointer.moduleRemoved(module);
|
||||
myUnresolved.put(pointer.getModuleName(), pointer);
|
||||
}
|
||||
unregisterPointer(module);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,18 +48,35 @@ public class ModulePointerManagerImpl extends ModulePointerManager {
|
||||
final ModulePointerImpl pointer = myUnresolved.remove(module.getName());
|
||||
if (pointer != null) {
|
||||
pointer.moduleAdded(module);
|
||||
myPointers.put(module, pointer);
|
||||
registerPointer(module, pointer);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void registerPointer(final Module module, final ModulePointerImpl pointer) {
|
||||
myPointers.put(module, pointer);
|
||||
Disposer.register(module, new Disposable() {
|
||||
public void dispose() {
|
||||
unregisterPointer(module);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void unregisterPointer(Module module) {
|
||||
final ModulePointerImpl pointer = myPointers.remove(module);
|
||||
if (pointer != null) {
|
||||
pointer.moduleRemoved(module);
|
||||
myUnresolved.put(pointer.getModuleName(), pointer);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModulePointer create(Module module) {
|
||||
ModulePointerImpl pointer = myPointers.get(module);
|
||||
if (pointer == null) {
|
||||
pointer = new ModulePointerImpl(module);
|
||||
myPointers.put(module, pointer);
|
||||
registerPointer(module, pointer);
|
||||
}
|
||||
return pointer;
|
||||
}
|
||||
|
||||
@@ -87,10 +87,7 @@ public class RootModelImpl implements ModifiableRootModel {
|
||||
@NonNls private static final String ROOT_ELEMENT = "root";
|
||||
private final ProjectRootManagerImpl myProjectRootManager;
|
||||
// have to register all child disposables using this fake object since all clients call just ModifiableModel.dispose()
|
||||
private final Disposable myDisposable = new Disposable() {
|
||||
public void dispose() {
|
||||
}
|
||||
};
|
||||
private final Disposable myDisposable = Disposer.newDisposable();
|
||||
|
||||
RootModelImpl(ModuleRootManagerImpl moduleRootManager, ProjectRootManagerImpl projectRootManager, VirtualFilePointerManager filePointerManager) {
|
||||
myModuleRootManager = moduleRootManager;
|
||||
|
||||
@@ -43,9 +43,10 @@ import com.intellij.psi.impl.source.tree.TreeElement;
|
||||
import com.intellij.psi.impl.source.tree.TreeUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.containers.Stack;
|
||||
import com.intellij.util.lang.CompoundRuntimeException;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
+2
-2
@@ -34,6 +34,7 @@ import com.intellij.profile.codeInspection.ui.InspectionConfigTreeNode;
|
||||
import com.intellij.psi.search.scope.packageSet.NamedScope;
|
||||
import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
|
||||
import com.intellij.ui.treeStructure.Tree;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Icons;
|
||||
|
||||
import javax.swing.tree.DefaultTreeModel;
|
||||
@@ -77,8 +78,7 @@ public abstract class AddScopeAction extends AnAction {
|
||||
final InspectionProfileEntry tool = descriptor.getTool(); //copy
|
||||
final List<String> availableScopes = getAvailableScopes(descriptor, project);
|
||||
|
||||
final int idx = Messages.showChooseDialog(myTree, "Scope:", "Choose Scope",
|
||||
availableScopes.toArray(new String[availableScopes.size()]), availableScopes.get(0), Messages.getQuestionIcon());
|
||||
final int idx = Messages.showChooseDialog(myTree, "Scope:", "Choose Scope", ArrayUtil.toStringArray(availableScopes), availableScopes.get(0), Messages.getQuestionIcon());
|
||||
if (idx == -1) return;
|
||||
final NamedScope chosenScope = NamedScopesHolder.getScope(project, availableScopes.get(idx));
|
||||
final ScopeToolState scopeToolState = getSelectedProfile().addScope(tool, chosenScope,
|
||||
|
||||
@@ -32,28 +32,31 @@ import java.util.List;
|
||||
public abstract class PsiManagerEx extends PsiManager {
|
||||
public abstract boolean isBatchFilesProcessingMode();
|
||||
|
||||
public abstract boolean isAssertOnFileLoading(VirtualFile file);
|
||||
public abstract boolean isAssertOnFileLoading(@NotNull VirtualFile file);
|
||||
|
||||
public abstract void nonPhysicalChange();
|
||||
|
||||
public abstract void physicalChange();
|
||||
|
||||
@NotNull
|
||||
public abstract ResolveCache getResolveCache();
|
||||
|
||||
public abstract void registerRunnableToRunOnChange(Runnable runnable);
|
||||
public abstract void registerRunnableToRunOnChange(@NotNull Runnable runnable);
|
||||
|
||||
public abstract void registerWeakRunnableToRunOnChange(Runnable runnable);
|
||||
public abstract void registerWeakRunnableToRunOnChange(@NotNull Runnable runnable);
|
||||
|
||||
public abstract void registerRunnableToRunOnAnyChange(Runnable runnable);
|
||||
public abstract void registerRunnableToRunOnAnyChange(@NotNull Runnable runnable);
|
||||
|
||||
public abstract void registerRunnableToRunAfterAnyChange(Runnable runnable);
|
||||
public abstract void registerRunnableToRunAfterAnyChange(@NotNull Runnable runnable);
|
||||
|
||||
@NotNull
|
||||
public abstract FileManager getFileManager();
|
||||
|
||||
public abstract void invalidateFile(PsiFile file);
|
||||
public abstract void invalidateFile(@NotNull PsiFile file);
|
||||
|
||||
public abstract void beforeChildRemoval(final PsiTreeChangeEventImpl event);
|
||||
public abstract void beforeChildRemoval(@NotNull PsiTreeChangeEventImpl event);
|
||||
|
||||
@NotNull
|
||||
public abstract CacheManager getCacheManager();
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -42,7 +42,6 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileFilter;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import static com.intellij.psi.impl.PsiTreeChangeEventImpl.PsiEventType.*;
|
||||
import com.intellij.psi.impl.cache.CacheManager;
|
||||
import com.intellij.psi.impl.cache.impl.CacheUtil;
|
||||
import com.intellij.psi.impl.cache.impl.CompositeCacheManager;
|
||||
@@ -70,6 +69,8 @@ import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static com.intellij.psi.impl.PsiTreeChangeEventImpl.PsiEventType.*;
|
||||
|
||||
public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.PsiManagerImpl");
|
||||
|
||||
@@ -306,7 +307,7 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
|
||||
myAssertOnFileLoadingFilter = filter;
|
||||
}
|
||||
|
||||
public boolean isAssertOnFileLoading(VirtualFile file) {
|
||||
public boolean isAssertOnFileLoading(@NotNull VirtualFile file) {
|
||||
return myAssertOnFileLoadingFilter.accept(file);
|
||||
}
|
||||
|
||||
@@ -315,10 +316,12 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
|
||||
return myProject;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public FileManager getFileManager() {
|
||||
return myFileManager;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public CacheManager getCacheManager() {
|
||||
if (myIsDisposed) {
|
||||
LOG.error("Project is already disposed.");
|
||||
@@ -331,6 +334,7 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
|
||||
return CodeStyleManager.getInstance(myProject);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ResolveCache getResolveCache() {
|
||||
ProgressManager.checkCanceled(); // We hope this method is being called often enough to cancel daemon processes smoothly
|
||||
return myResolveCache;
|
||||
@@ -389,7 +393,7 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
|
||||
}
|
||||
|
||||
|
||||
public void invalidateFile(PsiFile file) {
|
||||
public void invalidateFile(@NotNull PsiFile file) {
|
||||
if (myIsDisposed) {
|
||||
LOG.error("Disposed PsiManager calls invalidateFile!");
|
||||
}
|
||||
@@ -431,7 +435,7 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
|
||||
fireEvent(event);
|
||||
}
|
||||
|
||||
public void beforeChildRemoval(PsiTreeChangeEventImpl event) {
|
||||
public void beforeChildRemoval(@NotNull PsiTreeChangeEventImpl event) {
|
||||
event.setCode(BEFORE_CHILD_REMOVAL);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug(
|
||||
@@ -649,19 +653,19 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
|
||||
}
|
||||
}
|
||||
|
||||
public void registerRunnableToRunOnChange(Runnable runnable) {
|
||||
public void registerRunnableToRunOnChange(@NotNull Runnable runnable) {
|
||||
myRunnablesOnChange.add(runnable);
|
||||
}
|
||||
|
||||
public void registerWeakRunnableToRunOnChange(Runnable runnable) {
|
||||
public void registerWeakRunnableToRunOnChange(@NotNull Runnable runnable) {
|
||||
myWeakRunnablesOnChange.add(new WeakReference<Runnable>(runnable));
|
||||
}
|
||||
|
||||
public void registerRunnableToRunOnAnyChange(Runnable runnable) { // includes non-physical changes
|
||||
public void registerRunnableToRunOnAnyChange(@NotNull Runnable runnable) { // includes non-physical changes
|
||||
myRunnablesOnAnyChange.add(runnable);
|
||||
}
|
||||
|
||||
public void registerRunnableToRunAfterAnyChange(Runnable runnable) { // includes non-physical changes
|
||||
public void registerRunnableToRunAfterAnyChange(@NotNull Runnable runnable) { // includes non-physical changes
|
||||
myRunnablesAfterAnyChange.add(runnable);
|
||||
}
|
||||
|
||||
|
||||
+19
-5
@@ -37,11 +37,12 @@ import java.util.List;
|
||||
* @author cdr
|
||||
*/
|
||||
class InjectedFileViewProvider extends SingleRootFileViewProvider {
|
||||
private final Object LOCK = new Object();
|
||||
private Place myShreds;
|
||||
private Project myProject;
|
||||
private final Object myLock = new Object();
|
||||
private final DocumentWindow myDocumentWindow;
|
||||
private volatile boolean physical = true;
|
||||
private boolean physical = true;
|
||||
|
||||
InjectedFileViewProvider(@NotNull PsiManager psiManager,
|
||||
@NotNull VirtualFileWindow virtualFile,
|
||||
@@ -141,15 +142,28 @@ class InjectedFileViewProvider extends SingleRootFileViewProvider {
|
||||
|
||||
@Override
|
||||
public boolean isEventSystemEnabled() {
|
||||
return physical;
|
||||
if (LOCK == null) return true; // hack to avoid NPE when this method called from super class constructor
|
||||
synchronized (LOCK) {
|
||||
return physical;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPhysical() {
|
||||
return physical;
|
||||
synchronized (LOCK) {
|
||||
return physical;
|
||||
}
|
||||
}
|
||||
|
||||
public void setPhysical(boolean physical) {
|
||||
this.physical = physical;
|
||||
public void performNonPhysically(Runnable runnable) {
|
||||
synchronized (LOCK) {
|
||||
physical = false;
|
||||
try {
|
||||
runnable.run();
|
||||
}
|
||||
finally {
|
||||
physical = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-12
@@ -366,7 +366,7 @@ public class MultiHostRegistrarImpl implements MultiHostRegistrar {
|
||||
|
||||
for (int i = injected.size()-1; i>=0; i--) {
|
||||
DocumentWindowImpl oldDocument = (DocumentWindowImpl)injected.get(i);
|
||||
PsiFileImpl oldFile = (PsiFileImpl)documentManager.getCachedPsiFile(oldDocument);
|
||||
final PsiFileImpl oldFile = (PsiFileImpl)documentManager.getCachedPsiFile(oldDocument);
|
||||
FileViewProvider viewProvider;
|
||||
|
||||
if (oldFile == null ||
|
||||
@@ -380,8 +380,8 @@ public class MultiHostRegistrarImpl implements MultiHostRegistrar {
|
||||
}
|
||||
InjectedFileViewProvider oldViewProvider = (InjectedFileViewProvider)viewProvider;
|
||||
|
||||
ASTNode injectedNode = injectedPsi.getNode();
|
||||
ASTNode oldFileNode = oldFile.getNode();
|
||||
final ASTNode injectedNode = injectedPsi.getNode();
|
||||
final ASTNode oldFileNode = oldFile.getNode();
|
||||
assert injectedNode != null : "New node is null";
|
||||
assert oldFileNode != null : "Old node is null";
|
||||
if (oldDocument.areRangesEqual(documentWindow)) {
|
||||
@@ -392,15 +392,12 @@ public class MultiHostRegistrarImpl implements MultiHostRegistrar {
|
||||
}
|
||||
oldFile.putUserData(FileContextUtil.INJECTED_IN_ELEMENT, injectedPsi.getUserData(FileContextUtil.INJECTED_IN_ELEMENT));
|
||||
|
||||
try {
|
||||
assert shreds.isValid();
|
||||
oldViewProvider.setPhysical(false); //do not fire events now
|
||||
BlockSupportImpl.mergeTrees(oldFile, oldFileNode, injectedNode);
|
||||
oldFile.subtreeChanged();
|
||||
}
|
||||
finally {
|
||||
oldViewProvider.setPhysical(true);
|
||||
}
|
||||
assert shreds.isValid();
|
||||
oldViewProvider.performNonPhysically(new Runnable() {
|
||||
public void run() {
|
||||
BlockSupportImpl.mergeTrees(oldFile, oldFileNode, injectedNode);
|
||||
}
|
||||
});
|
||||
assert shreds.isValid();
|
||||
|
||||
return oldFile;
|
||||
|
||||
@@ -28,6 +28,11 @@ import com.intellij.refactoring.lang.ElementsHandler;
|
||||
|
||||
|
||||
public class PushDownAction extends BaseRefactoringAction {
|
||||
|
||||
public PushDownAction() {
|
||||
setInjectedContext(true);
|
||||
}
|
||||
|
||||
public boolean isAvailableInEditorOnly() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.usageView.UsageViewDescriptor;
|
||||
import com.intellij.usageView.UsageViewUtil;
|
||||
import com.intellij.usages.*;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
@@ -173,7 +174,7 @@ public class SafeDeleteProcessor extends BaseRefactoringProcessor {
|
||||
throw new ConflictsInTestsException(conflicts);
|
||||
}
|
||||
else {
|
||||
UnsafeUsagesDialog dialog = new UnsafeUsagesDialog(conflicts.toArray(new String[conflicts.size()]), myProject);
|
||||
UnsafeUsagesDialog dialog = new UnsafeUsagesDialog(ArrayUtil.toStringArray(conflicts), myProject);
|
||||
dialog.show();
|
||||
if (!dialog.isOK()) {
|
||||
final int exitCode = dialog.getExitCode();
|
||||
|
||||
@@ -59,7 +59,7 @@ public class ConflictsDialog extends DialogWrapper{
|
||||
for (String conflict : conflictDescriptions.values()) {
|
||||
conflicts.add(conflict);
|
||||
}
|
||||
myConflictDescriptions = conflicts.toArray(new String[conflicts.size()]);
|
||||
myConflictDescriptions = ArrayUtil.toStringArray(conflicts);
|
||||
myElementConflictDescription = conflictDescriptions;
|
||||
setTitle(RefactoringBundle.message("problems.detected.title"));
|
||||
setOKButtonText(RefactoringBundle.message("continue.button"));
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.psi.search.scope.packageSet.NamedScope;
|
||||
import com.intellij.psi.search.scope.packageSet.NamedScopeManager;
|
||||
import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -71,7 +72,7 @@ public class FileColorConfigurationEditDialog extends DialogWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
myScopeComboBox = new JComboBox(scopeNames.toArray(new String[scopeNames.size()]));
|
||||
myScopeComboBox = new JComboBox(ArrayUtil.toStringArray(scopeNames));
|
||||
myScopeComboBox.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updateOKButton();
|
||||
|
||||
@@ -151,7 +151,7 @@ public class SearchCyclesTest extends TestCase{
|
||||
private static void checkResult(String[][] expected, Set<List<String>> cycles){
|
||||
assertEquals(expected.length, cycles.size());
|
||||
for (List<String> strings : cycles) {
|
||||
assertTrue(findInMatrix(expected, strings.toArray(new String[strings.size()])) > -1);
|
||||
assertTrue(findInMatrix(expected, ArrayUtil.toStringArray(strings)) > -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,20 @@ public class ModulePointerTest extends PlatformTestCase {
|
||||
assertEquals("xyz", pointer.getModuleName());
|
||||
}
|
||||
|
||||
public void testDisposePointerFromUncommitedModifiableModel() throws Exception {
|
||||
final ModifiableModuleModel modifiableModel = getModuleManager().getModifiableModel();
|
||||
final Module module = modifiableModel.newModule(myProject.getBaseDir().getPath() + "/xxx.iml", EmptyModuleType.getInstance());
|
||||
final ModulePointer pointer = getPointerManager().create(module);
|
||||
|
||||
assertSame(module, pointer.getModule());
|
||||
assertEquals("xxx", pointer.getModuleName());
|
||||
|
||||
modifiableModel.dispose();
|
||||
|
||||
assertNull(pointer.getModule());
|
||||
assertEquals("xxx", pointer.getModuleName());
|
||||
}
|
||||
|
||||
private ModuleManager getModuleManager() {
|
||||
return ModuleManager.getInstance(myProject);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.intellij.openapi.fileChooser;
|
||||
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -61,6 +62,6 @@ public class FileSaverDescriptor extends FileChooserDescriptor implements Clonea
|
||||
* @return accepted file extentions
|
||||
*/
|
||||
public String[] getFileExtentions() {
|
||||
return extentions.toArray(new String[extentions.size()]);
|
||||
return ArrayUtil.toStringArray(extentions);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.openapi.fileTypes;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -86,7 +87,7 @@ public class NativeFileType implements FileType {
|
||||
}
|
||||
commands.add(file.getPath());
|
||||
try {
|
||||
Runtime.getRuntime().exec(commands.toArray(new String[commands.size()]));
|
||||
Runtime.getRuntime().exec(ArrayUtil.toStringArray(commands));
|
||||
}
|
||||
catch (IOException e) {
|
||||
return false;
|
||||
|
||||
@@ -234,10 +234,7 @@ public class LoadingDecorator {
|
||||
|
||||
final JPanel content = new JPanel(new BorderLayout());
|
||||
|
||||
final LoadingDecorator loadingTree = new LoadingDecorator(new JComboBox(), new Disposable() {
|
||||
public void dispose() {
|
||||
}
|
||||
}, -1);
|
||||
final LoadingDecorator loadingTree = new LoadingDecorator(new JComboBox(), Disposer.newDisposable(), -1);
|
||||
|
||||
content.add(loadingTree.getComponent(), BorderLayout.CENTER);
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.ui.tabs.impl;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.ui.tabs.JBTabsPosition;
|
||||
@@ -43,10 +44,7 @@ public class JBTabsTest {
|
||||
final JFrame frame = new JFrame();
|
||||
frame.getContentPane().setLayout(new BorderLayout(0, 0));
|
||||
final int[] count = new int[1];
|
||||
final JBTabsImpl tabs = new JBTabsImpl(null, null, null, new Disposable() {
|
||||
public void dispose() {
|
||||
}
|
||||
});
|
||||
final JBTabsImpl tabs = new JBTabsImpl(null, null, null, Disposer.newDisposable());
|
||||
tabs.setTestMode(true);
|
||||
|
||||
|
||||
|
||||
+1
-9
@@ -195,15 +195,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
|
||||
}
|
||||
|
||||
if (!isUnitTestMode && !isHeadless) {
|
||||
Disposer.register(this, new Disposable() {
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[ui]";
|
||||
}
|
||||
}, "ui");
|
||||
Disposer.register(this, Disposer.newDisposable(), "ui");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.diff.impl.FrameWrapper;
|
||||
import com.intellij.openapi.diff.impl.incrementalMerge.ui.MergePanel2;
|
||||
import com.intellij.openapi.ui.DialogBuilder;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
|
||||
public class MergeTool implements DiffTool {
|
||||
public void show(DiffRequest data) {
|
||||
@@ -47,10 +48,7 @@ public class MergeTool implements DiffTool {
|
||||
DialogBuilder builder = new DialogBuilder(data.getProject());
|
||||
builder.setDimensionServiceKey(data.getGroupKey());
|
||||
builder.setTitle(data.getWindowTitle());
|
||||
Disposable parent = new Disposable() {
|
||||
public void dispose() {
|
||||
}
|
||||
};
|
||||
Disposable parent = Disposer.newDisposable();
|
||||
builder.addDisposable(parent);
|
||||
MergePanel2 mergePanel = createMergeComponent(data, builder, parent);
|
||||
builder.setCenterPanel(mergePanel.getComponent());
|
||||
|
||||
+1
-1
@@ -160,7 +160,7 @@ public class VirtualFilePointerContainerImpl implements VirtualFilePointerContai
|
||||
for (VirtualFilePointer smartVirtualFilePointer : myList) {
|
||||
result.add(smartVirtualFilePointer.getUrl());
|
||||
}
|
||||
return result.toArray(new String[result.size()]);
|
||||
return ArrayUtil.toStringArray(result);
|
||||
}
|
||||
|
||||
private VirtualFile[] myCachedFiles;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.openapi.vfs.impl.win32;
|
||||
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
@@ -87,7 +88,7 @@ public class Win32Kernel {
|
||||
finally {
|
||||
myKernel.FindClose(hFind);
|
||||
}
|
||||
return list.toArray(new String[list.size()]);
|
||||
return ArrayUtil.toStringArray(list);
|
||||
}
|
||||
|
||||
public boolean exists(String path) {
|
||||
|
||||
+1
-1
@@ -153,7 +153,7 @@ public class PersistentFS extends ManagingFS implements ApplicationComponent {
|
||||
Set<String> allNamesSet = new LinkedHashSet<String>((currentNames.length + delegateNames.length) * 2);
|
||||
allNamesSet.addAll(Arrays.asList(currentNames));
|
||||
allNamesSet.addAll(Arrays.asList(delegateNames));
|
||||
names = allNamesSet.toArray(new String[allNamesSet.size()]);
|
||||
names = ArrayUtil.toStringArray(allNamesSet);
|
||||
}
|
||||
|
||||
final int[] childrenIds = ArrayUtil.newIntArray(names.length);
|
||||
|
||||
@@ -40,7 +40,7 @@ choose.color.in.color.lookup=choose color...
|
||||
# color lookup
|
||||
color.name=Color name:\\ {0}
|
||||
color.rgb=Color RGB:\\ {0}
|
||||
color.preview=Color preview:\\ {0}
|
||||
color.preview=<table cellpadding=0 cellspacing=0 border=0><tr><td>Color preview:\\ </td><td style="background-color: #000000; padding: 1px">{0}</td></tr></table>
|
||||
xml.schema.validation.attr.not.allowed.with.ref=Attribute {0} is not allowed here when element reference is used
|
||||
unescaped.xml.character=Unescaped xml character
|
||||
unescaped.xml.character.fix.message=Escape {0}
|
||||
|
||||
@@ -88,6 +88,8 @@
|
||||
serviceImplementation="com.intellij.featureStatistics.ProductivityFeaturesRegistryImpl"/>
|
||||
<applicationService serviceInterface="com.intellij.util.InstanceofCheckerGenerator"
|
||||
serviceImplementation="com.intellij.util.InstanceofCheckerGeneratorImpl"/>
|
||||
<applicationService serviceInterface="com.intellij.internal.psiView.PsiViewerSettings"
|
||||
serviceImplementation="com.intellij.internal.psiView.PsiViewerSettings"/>
|
||||
|
||||
<projectService serviceInterface="com.intellij.openapi.vfs.ReadonlyStatusHandler"
|
||||
serviceImplementation="com.intellij.openapi.vcs.readOnlyHandler.ReadonlyStatusHandlerImpl"/>
|
||||
|
||||
@@ -151,6 +151,10 @@
|
||||
<implementation-class>com.intellij.codeInsight.daemon.impl.CodeFoldingPassFactory</implementation-class>
|
||||
<skipForDefaultProject/>
|
||||
</component>
|
||||
<component>
|
||||
<implementation-class>com.intellij.codeInsight.daemon.impl.InjectedCodeFoldingPassFactory</implementation-class>
|
||||
<skipForDefaultProject/>
|
||||
</component>
|
||||
<component>
|
||||
<implementation-class>com.intellij.codeInsight.daemon.impl.LocalInspectionsPassFactory</implementation-class>
|
||||
<skipForDefaultProject/>
|
||||
|
||||
@@ -55,10 +55,7 @@ import java.util.*;
|
||||
* @author peter
|
||||
*/
|
||||
public abstract class UsefulTestCase extends TestCase {
|
||||
protected final Disposable myTestRootDisposable = new Disposable() {
|
||||
public void dispose() {
|
||||
}
|
||||
};
|
||||
protected final Disposable myTestRootDisposable = Disposer.newDisposable();
|
||||
private static final String DEFAULT_SETTINGS_EXTERNALIZED;
|
||||
private static CodeStyleSettings myOldCodeStyleSettings;
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ import com.intellij.ui.content.Content;
|
||||
import com.intellij.usageView.UsageViewBundle;
|
||||
import com.intellij.usages.*;
|
||||
import com.intellij.usages.rules.PsiElementUsage;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.ui.RangeBlinker;
|
||||
import com.intellij.xml.util.XmlStringUtil;
|
||||
@@ -344,7 +345,7 @@ public class UsageViewManagerImpl extends UsageViewManager {
|
||||
}
|
||||
|
||||
int option = Messages.showDialog(myProject, message, UsageViewBundle.message("dialog.title.information"),
|
||||
titles.toArray(new String[titles.size()]), 0, Messages.getInformationIcon());
|
||||
ArrayUtil.toStringArray(titles), 0, Messages.getInformationIcon());
|
||||
|
||||
if (option > 0) {
|
||||
notFoundActions.get(option - 1).actionPerformed(new ActionEvent(this, 0, titles.get(option)));
|
||||
|
||||
@@ -75,7 +75,7 @@ public class CommonBundle {
|
||||
|
||||
value = UIUtil.replaceMnemonicAmpersand(value);
|
||||
|
||||
if (params.length > 0) {
|
||||
if (params.length > 0 && value.indexOf('{')>=0) {
|
||||
return MessageFormat.format(value, params);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class LineTokenizer {
|
||||
|
||||
if (!skipLastEmptyLine && stringEdnsWithSeparator(tokenizer)) lines.add("");
|
||||
|
||||
return lines.toArray(new String[lines.size()]);
|
||||
return ArrayUtil.toStringArray(lines);
|
||||
}
|
||||
|
||||
public static int calcLineCount(final CharSequence chars, final boolean skipLastEmptyLine) {
|
||||
|
||||
@@ -63,7 +63,7 @@ public class EnvironmentUtil {
|
||||
result.add(envName + "=" + enviromentProperties.get(envName));
|
||||
}
|
||||
}
|
||||
return result.toArray(new String[result.size()]);
|
||||
return ArrayUtil.toStringArray(result);
|
||||
}
|
||||
|
||||
private static synchronized List getProcEnvironment() {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.openapi.vcs;
|
||||
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -60,7 +61,7 @@ public class VcsException extends Exception {
|
||||
}
|
||||
|
||||
public String[] getMessages() {
|
||||
return myMessages.toArray(new String[myMessages.size()]);
|
||||
return ArrayUtil.toStringArray(myMessages);
|
||||
}
|
||||
|
||||
public VcsException setIsWarning(boolean warning) {
|
||||
|
||||
+2
-1
@@ -21,6 +21,7 @@ import com.intellij.openapi.vcs.VcsBundle;
|
||||
import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
|
||||
import com.intellij.ui.ColoredListCellRenderer;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -98,7 +99,7 @@ public class ColumnFilteringStrategy extends JPanel implements ChangeListFilteri
|
||||
values.add(myColumn.getValue(ReceivedChangeList.unwrap(changeList)).toString());
|
||||
}
|
||||
}
|
||||
final String[] valueArray = values.toArray(new String[values.size()]);
|
||||
final String[] valueArray = ArrayUtil.toStringArray(values);
|
||||
myValueList.setModel(new AbstractListModel() {
|
||||
public int getSize() {
|
||||
return valueArray.length+1;
|
||||
|
||||
+2
-1
@@ -21,6 +21,7 @@ import com.intellij.openapi.options.binding.BindControl;
|
||||
import com.intellij.openapi.options.binding.BindableConfigurable;
|
||||
import com.intellij.openapi.options.binding.ControlBinder;
|
||||
import com.intellij.openapi.vcs.changes.ChangeListManagerImpl;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
|
||||
@@ -83,7 +84,7 @@ public class ChangelistConflictConfigurable extends BindableConfigurable impleme
|
||||
public void reset() {
|
||||
super.reset();
|
||||
Collection<String> conflicts = myConflictTracker.getIgnoredConflicts();
|
||||
myIgnoredFiles.setListData(conflicts.toArray(new String[conflicts.size()]));
|
||||
myIgnoredFiles.setListData(ArrayUtil.toStringArray(conflicts));
|
||||
myClearButton.setEnabled(!conflicts.isEmpty());
|
||||
UIUtil.setEnabled(myOptionsPanel, myEnableCheckBox.isSelected(), true);
|
||||
}
|
||||
|
||||
+2
-1
@@ -27,6 +27,7 @@ import com.intellij.openapi.vcs.changes.*;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.DocumentAdapter;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -171,7 +172,7 @@ public class IgnoreUnversionedDialog extends DialogWrapper {
|
||||
}
|
||||
}
|
||||
if (extensions.size() > 0) {
|
||||
final String[] extensionArray = extensions.toArray(new String[extensions.size()]);
|
||||
final String[] extensionArray = ArrayUtil.toStringArray(extensions);
|
||||
myIgnoreMaskTextField.setText("*." + extensionArray [0]);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.openapi.vcs.ex;
|
||||
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.diff.Diff;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -67,7 +68,7 @@ public class RangesBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
Diff.Change ch = Diff.buildChanges(upToDate.toArray(new String[upToDate.size()]), current.toArray(new String[current.size()]));
|
||||
Diff.Change ch = Diff.buildChanges(ArrayUtil.toStringArray(upToDate), ArrayUtil.toStringArray(current));
|
||||
|
||||
|
||||
while (ch != null) {
|
||||
|
||||
+2
-1
@@ -18,6 +18,7 @@ package org.intellij.plugins.intelliLang.inject;
|
||||
import com.intellij.lang.*;
|
||||
import com.intellij.psi.templateLanguages.TemplateLanguage;
|
||||
import com.intellij.openapi.fileTypes.FileTypes;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -86,7 +87,7 @@ public final class InjectedLanguage {
|
||||
initLanguageCache();
|
||||
}
|
||||
final Set<String> keys = ourLanguageCache.keySet();
|
||||
return keys.toArray(new String[keys.size()]);
|
||||
return ArrayUtil.toStringArray(keys);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ public class ValueRegExpAnnotator implements Annotator {
|
||||
LanguageAnnotators.INSTANCE.addExplicitExtension(RegExpLanguage.INSTANCE, new ValueRegExpAnnotator());
|
||||
}
|
||||
|
||||
private ValueRegExpAnnotator() {
|
||||
public ValueRegExpAnnotator() {
|
||||
}
|
||||
|
||||
public void annotate(PsiElement psiElement, AnnotationHolder holder) {
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ public class PatternValidationCompiler extends AnnotationBasedInstrumentingCompi
|
||||
myAnnotations.put(patternAnnotation.first, null);
|
||||
|
||||
final Set<String> names = myAnnotations.keySet();
|
||||
return names.toArray(new String[names.size()]);
|
||||
return ArrayUtil.toStringArray(names);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.lang.ant.config.execution;
|
||||
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.StringBuilderSpinAllocator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -42,7 +43,7 @@ final class AntMessage {
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
lines.add(tokenizer.nextToken());
|
||||
}
|
||||
myTextLines = lines.toArray(new String[lines.size()]);
|
||||
myTextLines = ArrayUtil.toStringArray(lines);
|
||||
}
|
||||
|
||||
public AntMessage(AntBuildMessageView.MessageType type, int priority, String[] lines, VirtualFile file, int line, int column) {
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.lang.ant.config.impl;
|
||||
import com.intellij.lang.ant.config.ExecutionEvent;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.StringBuilderSpinAllocator;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -44,7 +45,7 @@ public final class ExecuteCompositeTargetEvent extends ExecutionEvent {
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
targetNames.add(tokenizer.nextToken().trim());
|
||||
}
|
||||
myTargetNames = targetNames.toArray(new String[targetNames.size()]);
|
||||
myTargetNames = ArrayUtil.toStringArray(targetNames);
|
||||
myPresentableName = compositeName;
|
||||
}
|
||||
|
||||
|
||||
@@ -390,7 +390,7 @@ public class AntPropertyImpl extends AntTaskImpl implements AntProperty {
|
||||
}
|
||||
}
|
||||
}
|
||||
return strings.toArray(new String[strings.size()]);
|
||||
return ArrayUtil.toStringArray(strings);
|
||||
}
|
||||
finally {
|
||||
StringSetSpinAllocator.dispose(strings);
|
||||
@@ -404,7 +404,7 @@ public class AntPropertyImpl extends AntTaskImpl implements AntProperty {
|
||||
for (final String prefix : getAntFile().getEnvironmentPrefixes()) {
|
||||
strings.add(prefix + sourceName);
|
||||
}
|
||||
return strings.toArray(new String[strings.size()]);
|
||||
return ArrayUtil.toStringArray(strings);
|
||||
}
|
||||
finally {
|
||||
StringSetSpinAllocator.dispose(strings);
|
||||
|
||||
+2
-1
@@ -33,6 +33,7 @@ import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.vcs.FileStatusManager;
|
||||
import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
|
||||
import com.intellij.openapi.vfs.*;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -353,7 +354,7 @@ public class CvsEntriesManager extends VirtualFileAdapter {
|
||||
private void ensureFilesCached() {
|
||||
String[] paths;
|
||||
synchronized (myFilesToRefresh) {
|
||||
paths = myFilesToRefresh.toArray(new String[myFilesToRefresh.size()]);
|
||||
paths = ArrayUtil.toStringArray(myFilesToRefresh);
|
||||
myFilesToRefresh.clear();
|
||||
}
|
||||
for (String path : paths) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.xml.*;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.SmartList;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -301,7 +302,7 @@ public class RegistrationProblemsInspection extends DevKitInspectionBase {
|
||||
names.add(fqn + "#" + moduleType);
|
||||
}
|
||||
}
|
||||
return names.toArray(new String[names.size()]);
|
||||
return ArrayUtil.toStringArray(names);
|
||||
}
|
||||
}
|
||||
return new String[]{ fqn };
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.idea.devkit.DevKitBundle;
|
||||
@@ -87,7 +88,7 @@ public class CreateHtmlDescriptionFix implements LocalQuickFix, Iconable {
|
||||
for (VirtualFile file : roots) {
|
||||
options.add(file.getPresentableUrl() + File.separator + DESCRIPTIONS_FOLDER + File.separator + myFilename);
|
||||
}
|
||||
final JList files = new JList(options.toArray(new String[options.size()]));
|
||||
final JList files = new JList(ArrayUtil.toStringArray(options));
|
||||
final PopupChooserBuilder builder = JBPopupFactory.getInstance().createListPopupBuilder(files);
|
||||
final JBPopup popup = builder.setTitle(DevKitBundle.message("select.target.location.of.description", myFilename)).setItemChoosenCallback(new Runnable() {
|
||||
public void run() {
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.intellij.openapi.vfs.JarFileSystem;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.cls.BytePointer;
|
||||
import com.intellij.util.cls.ClsFormatException;
|
||||
import com.intellij.util.cls.ClsUtil;
|
||||
@@ -219,8 +220,7 @@ public class IdeaJdk extends SdkType implements JavaSdkType {
|
||||
}
|
||||
|
||||
final int choice = Messages
|
||||
.showChooseDialog("Select Java SDK to be used as IDEA internal platform",
|
||||
"Select internal Java platform", javaSdks.toArray(new String[javaSdks.size()]), javaSdks.get(0), Messages.getQuestionIcon());
|
||||
.showChooseDialog("Select Java SDK to be used as IDEA internal platform", "Select internal Java platform", ArrayUtil.toStringArray(javaSdks), javaSdks.get(0), Messages.getQuestionIcon());
|
||||
|
||||
if (choice != -1) {
|
||||
final String name = javaSdks.get(choice);
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.xmlb.XmlSerializerUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
@@ -111,7 +112,7 @@ public class GitVcsSettings implements PersistentStateComponent<GitVcsSettings>
|
||||
authors.removeLast();
|
||||
}
|
||||
authors.addFirst(author);
|
||||
PREVIOUS_COMMIT_AUTHORS = authors.toArray(new String[authors.size()]);
|
||||
PREVIOUS_COMMIT_AUTHORS = ArrayUtil.toStringArray(authors);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.vcs.VcsException;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.DocumentAdapter;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import git4idea.GitRemote;
|
||||
import git4idea.GitVcs;
|
||||
import git4idea.commands.GitHandler;
|
||||
@@ -214,7 +215,7 @@ public class GitPullDialog extends DialogWrapper {
|
||||
h.addParameters("-v");
|
||||
h.addParameters(getRemote());
|
||||
final List<String> markedBranches = myBranchChooser.getMarkedElements();
|
||||
h.addParameters(markedBranches.toArray(new String[markedBranches.size()]));
|
||||
h.addParameters(ArrayUtil.toStringArray(markedBranches));
|
||||
return h;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiFileFactory;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.plugins.groovy.GroovyBundle;
|
||||
@@ -103,6 +104,6 @@ public class GroovyTemplatesFactory implements FileTemplateGroupDescriptorFactor
|
||||
}
|
||||
|
||||
public String[] getCustomTemplates() {
|
||||
return myCustomTemplates.toArray(new String[myCustomTemplates.size()]);
|
||||
return ArrayUtil.toStringArray(myCustomTemplates);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.actions.generate.constructors;
|
||||
import com.intellij.codeInsight.generation.*;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -100,7 +101,7 @@ public class ConstructorGenerateHandler extends GenerateConstructorHandler {
|
||||
parametersNames.add(parameter.getName());
|
||||
}
|
||||
|
||||
final String[] paramNames = parametersNames.toArray(new String[parametersNames.size()]);
|
||||
final String[] paramNames = ArrayUtil.toStringArray(parametersNames);
|
||||
assert constructorName != null;
|
||||
grConstructor = GroovyPsiElementFactory.getInstance(aClass.getProject()).createConstructorFromText(constructorName, null, paramNames, body);
|
||||
|
||||
|
||||
+3
-2
@@ -30,6 +30,7 @@ import com.intellij.psi.codeStyle.SuggestedNameInfo;
|
||||
import com.intellij.psi.codeStyle.VariableKind;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiTypesUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -160,7 +161,7 @@ public class QuickfixUtil {
|
||||
result.add(type);
|
||||
}
|
||||
|
||||
return result.toArray(new String[result.size()]);
|
||||
return ArrayUtil.toStringArray(result);
|
||||
}
|
||||
|
||||
public static String[] getArgumentsNames(List<MyPair> listOfPairs) {
|
||||
@@ -170,7 +171,7 @@ public class QuickfixUtil {
|
||||
result.add(name);
|
||||
}
|
||||
|
||||
return result.toArray(new String[result.size()]);
|
||||
return ArrayUtil.toStringArray(result);
|
||||
}
|
||||
|
||||
public static String shortenType(String typeText) {
|
||||
|
||||
+2
-1
@@ -26,6 +26,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
@@ -229,7 +230,7 @@ public class DynamicManagerImpl extends DynamicManager {
|
||||
result.add(propertyElement.getName());
|
||||
}
|
||||
}
|
||||
return result.toArray(new String[result.size()]);
|
||||
return ArrayUtil.toStringArray(result);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+3
-2
@@ -23,6 +23,7 @@ import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import org.jetbrains.plugins.groovy.GroovyFileType;
|
||||
import org.jetbrains.plugins.groovy.debugger.fragments.GroovyCodeFragment;
|
||||
@@ -165,8 +166,8 @@ public class GroovyCodeFragmentFactory implements CodeFragmentFactory {
|
||||
|
||||
text = toEval.getText();
|
||||
|
||||
String[] names = namesList.toArray(new String[namesList.size()]);
|
||||
String[] vals = valList.toArray(new String[valList.size()]);
|
||||
String[] names = ArrayUtil.toStringArray(namesList);
|
||||
String[] vals = ArrayUtil.toStringArray(valList);
|
||||
|
||||
PsiClass contextClass = PsiUtil.getContextClass(context);
|
||||
boolean isStatic = isStaticContext(context);
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.ui.NonFocusableCheckBox;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.doc.actions.GroovyDocAddPackageAction;
|
||||
import org.jetbrains.plugins.groovy.doc.actions.GroovyDocReducePackageAction;
|
||||
@@ -171,7 +172,7 @@ private static String[] toStringArray(final DefaultListModel model) {
|
||||
result.add((String)o);
|
||||
}
|
||||
|
||||
return result.toArray(new String[result.size()]);
|
||||
return ArrayUtil.toStringArray(result);
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@ import com.intellij.navigation.NavigationItem;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.stubs.StubIndex;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrAnnotationMethodNameIndex;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrFieldNameIndex;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrMethodNameIndex;
|
||||
@@ -40,7 +41,7 @@ public class GroovyGoToSymbolContributor implements ChooseByNameContributor {
|
||||
symbols.addAll(StubIndex.getInstance().getAllKeys(GrFieldNameIndex.KEY, project));
|
||||
symbols.addAll(StubIndex.getInstance().getAllKeys(GrMethodNameIndex.KEY, project));
|
||||
symbols.addAll(StubIndex.getInstance().getAllKeys(GrAnnotationMethodNameIndex.KEY, project));
|
||||
return symbols.toArray(new String[symbols.size()]);
|
||||
return ArrayUtil.toStringArray(symbols);
|
||||
}
|
||||
|
||||
public NavigationItem[] getItemsByName(String name, String pattern, Project project, boolean includeNonProjectItems) {
|
||||
|
||||
+2
-1
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy.lang.documentation;
|
||||
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
|
||||
@@ -79,7 +80,7 @@ public class GroovyPresentationUtil {
|
||||
|
||||
if (!structural.isEmpty()) {
|
||||
builder.append(".");
|
||||
String[] array = structural.toArray(new String[structural.size()]);
|
||||
String[] array = ArrayUtil.toStringArray(structural);
|
||||
if (array.length> 1) builder.append("[");
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (i > 0) builder.append(", ");
|
||||
|
||||
+1
-1
@@ -329,7 +329,7 @@ public class CompleteReferenceExpression {
|
||||
final PsiElement scope = PsiTreeUtil.getParentOfType(refExpr, GrMember.class, GroovyFileBase.class);
|
||||
Set<String> result = new LinkedHashSet<String>();
|
||||
addVariantsWithSameQualifier(scope, refExpr, qualifier, result);
|
||||
return result.toArray(new String[result.size()]);
|
||||
return ArrayUtil.toStringArray(result);
|
||||
}
|
||||
|
||||
private static void addVariantsWithSameQualifier(PsiElement element,
|
||||
|
||||
+2
-2
@@ -184,7 +184,7 @@ public abstract class GrTypeDefinitionImpl extends GroovyBaseElementImpl<GrTypeD
|
||||
if (name != null) implementsNames.add(name);
|
||||
}
|
||||
|
||||
return implementsNames.toArray(new String[implementsNames.size()]);
|
||||
return ArrayUtil.toStringArray(implementsNames);
|
||||
}
|
||||
|
||||
protected String[] getExtendsNames() {
|
||||
@@ -196,7 +196,7 @@ public abstract class GrTypeDefinitionImpl extends GroovyBaseElementImpl<GrTypeD
|
||||
String name = ref.getReferenceName();
|
||||
if (name != null) extendsNames.add(name);
|
||||
}
|
||||
return extendsNames.toArray(new String[extendsNames.size()]);
|
||||
return ArrayUtil.toStringArray(extendsNames);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+3
-2
@@ -27,6 +27,7 @@ import com.intellij.psi.search.ProjectScope;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.util.MethodSignature;
|
||||
import com.intellij.psi.util.MethodSignatureBackedByPsiMethod;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
import com.intellij.ui.treeStructure.treetable.ListTreeTableModelOnColumns;
|
||||
@@ -79,7 +80,7 @@ public class GrDynamicImplicitMethod extends LightElement implements PsiMethod,
|
||||
result.add(psiParameter.getTypeElement().getType().getCanonicalText());
|
||||
}
|
||||
|
||||
return result.toArray(new String[result.size()]);
|
||||
return ArrayUtil.toStringArray(result);
|
||||
}
|
||||
|
||||
public String getContainingClassName() {
|
||||
@@ -300,7 +301,7 @@ public class GrDynamicImplicitMethod extends LightElement implements PsiMethod,
|
||||
}
|
||||
|
||||
for (PsiClass aSuper : PsiUtil.iterateSupers(psiClass, true)) {
|
||||
methodElement = DynamicManager.getInstance(myProject).findConcreteDynamicMethod(aSuper.getQualifiedName(), getName(), parameterTypes.toArray(new String[parameterTypes.size()]));
|
||||
methodElement = DynamicManager.getInstance(myProject).findConcreteDynamicMethod(aSuper.getQualifiedName(), getName(), ArrayUtil.toStringArray(parameterTypes));
|
||||
|
||||
if (methodElement != null) {
|
||||
trueClass = aSuper;
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.InheritanceImplUtil;
|
||||
import com.intellij.psi.javadoc.PsiDocComment;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -85,7 +86,7 @@ public class GrTypeParameterImpl extends GroovyPsiElementImpl implements GrTypeP
|
||||
for (PsiReference type : types) {
|
||||
names.add(type.getCanonicalText());
|
||||
}
|
||||
return names.toArray(new String[names.size()]);
|
||||
return ArrayUtil.toStringArray(names);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@ import com.intellij.psi.stubs.IndexSink;
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.psi.stubs.StubInputStream;
|
||||
import com.intellij.psi.stubs.StubOutputStream;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.CollectionFactory;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -71,7 +72,7 @@ public abstract class GrTypeDefinitionElementType<TypeDef extends GrTypeDefiniti
|
||||
}
|
||||
}
|
||||
}
|
||||
return annoNames.toArray(new String[annoNames.size()]);
|
||||
return ArrayUtil.toStringArray(annoNames);
|
||||
}
|
||||
|
||||
public void serialize(GrTypeDefinitionStub stub, StubOutputStream dataStream) throws IOException {
|
||||
|
||||
+2
-2
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.resolve.noncode;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.plugins.groovy.annotator.inspections.GroovyImmutableAnnotationInspection;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.GrModifierList;
|
||||
@@ -71,8 +72,7 @@ public class ImmutableAnnotationProcessor implements NonCodeMembersProcessor {
|
||||
String name = grClass.getName();
|
||||
if (name == null) return true;
|
||||
GrMethod constructor = GroovyPsiElementFactory.getInstance(annotation.getProject())
|
||||
.createConstructorFromText(name, paramTypes.toArray(new String[paramTypes.size()]),
|
||||
paramNames.toArray(new String[paramNames.size()]), "{}");
|
||||
.createConstructorFromText(name, ArrayUtil.toStringArray(paramTypes), ArrayUtil.toStringArray(paramNames), "{}");
|
||||
GroovyResolveResultImpl result = new GroovyResolveResultImpl(new GrSyntheticConstructor(constructor, grClass), true);
|
||||
return processor.execute(result.getElement(), ResolveState.initial());
|
||||
}
|
||||
|
||||
+3
-3
@@ -119,7 +119,7 @@ public class GroovyShortNamesCache extends PsiShortNamesCache {
|
||||
final Collection<String> classNames = StubIndex.getInstance().getAllKeys(GrShortClassNameIndex.KEY, myProject);
|
||||
Collection<String> scriptNames = StubIndex.getInstance().getAllKeys(GrScriptClassNameIndex.KEY, myProject);
|
||||
classNames.addAll(scriptNames);
|
||||
return classNames.toArray(new String[classNames.size()]);
|
||||
return ArrayUtil.toStringArray(classNames);
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ public class GroovyShortNamesCache extends PsiShortNamesCache {
|
||||
public String[] getAllMethodNames() {
|
||||
Collection<String> keys = StubIndex.getInstance().getAllKeys(GrMethodNameIndex.KEY, myProject);
|
||||
keys.addAll(StubIndex.getInstance().getAllKeys(GrAnnotationMethodNameIndex.KEY, myProject));
|
||||
return keys.toArray(new String[keys.size()]);
|
||||
return ArrayUtil.toStringArray(keys);
|
||||
}
|
||||
|
||||
public void getAllMethodNames(@NotNull HashSet<String> set) {
|
||||
@@ -165,7 +165,7 @@ public class GroovyShortNamesCache extends PsiShortNamesCache {
|
||||
@NotNull
|
||||
public String[] getAllFieldNames() {
|
||||
Collection<String> fields = StubIndex.getInstance().getAllKeys(GrFieldNameIndex.KEY, myProject);
|
||||
return fields.toArray(new String[fields.size()]);
|
||||
return ArrayUtil.toStringArray(fields);
|
||||
}
|
||||
|
||||
public void getAllFieldNames(@NotNull HashSet<String> set) {
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTypesUtil;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
|
||||
@@ -62,7 +63,7 @@ public class GroovyNameSuggestionUtil {
|
||||
if (possibleNames.size() == 0) {
|
||||
possibleNames.add(validator.validateName("var", true));
|
||||
}
|
||||
return possibleNames.toArray(new String[possibleNames.size()]);
|
||||
return ArrayUtil.toStringArray(possibleNames);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -285,7 +285,7 @@ public class ExtractMethodUtil {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return params.toArray(new String[params.size()]);
|
||||
return ArrayUtil.toStringArray(params);
|
||||
}
|
||||
|
||||
static String getTypeString(ExtractMethodInfoHelper helper, boolean forPresentation) {
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.facet.*;
|
||||
import com.intellij.facet.impl.autodetecting.FacetAutodetectingManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.PathUtil;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.idea.maven.project.*;
|
||||
@@ -153,7 +154,7 @@ public abstract class FacetImporter<FACET_TYPE extends Facet, FACET_CONFIG_TYPE
|
||||
List<String> elements = new ArrayList<String>();
|
||||
elements.add(p.getBuildDirectory());
|
||||
Collections.addAll(elements, subFoldersAndFile);
|
||||
return makePath(p, elements.toArray(new String[elements.size()]));
|
||||
return makePath(p, ArrayUtil.toStringArray(elements));
|
||||
}
|
||||
|
||||
protected String makePath(MavenProject p, String... elements) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user