Merge branch 'master' of git@git.labs.intellij.net:idea/community

This commit is contained in:
Eugene Kudelevsky
2011-03-25 21:22:47 +03:00
54 changed files with 180 additions and 199 deletions
+6 -6
View File
@@ -35,7 +35,7 @@ public class MainParseTest extends BaseParseTestcase {
enum Result {
OK, ERR
}
class Test {
static class Test {
boolean showWarnings = true;
boolean showInfo = false;
Result expectedResult;
@@ -158,8 +158,9 @@ public class MainParseTest extends BaseParseTestcase {
}
private void doTest(String prefix) throws IOException {
int n = 0, failed = 0;
for (String name : myMap.keySet()) {
int n = 0;
int failed = 0;
for (String name : myMap.keySet()) {
if (prefix == null && name.contains("/")) {
continue;
}
@@ -174,8 +175,7 @@ public class MainParseTest extends BaseParseTestcase {
myFixture.testHighlighting(test.showWarnings, true, test.showInfo, name);
if (test.expectedResult == Result.ERR) {
System.out.println(" FAILED. Expression incorrectly parsed OK: " + FileUtil.loadTextAndClose(new FileReader(new File(
getTestDataPath(), name))));
System.out.println(" FAILED. Expression incorrectly parsed OK: " + FileUtil.loadFile(new File(getTestDataPath(), name)));
failed++;
} else {
System.out.println(" OK");
@@ -185,7 +185,7 @@ public class MainParseTest extends BaseParseTestcase {
System.out.println(" OK");
} else {
e.printStackTrace();
System.out.println(" FAILED. Expression = " + FileUtil.loadTextAndClose(new FileReader(new File(getTestDataPath(), name))));
System.out.println(" FAILED. Expression = " + FileUtil.loadFile(new File(getTestDataPath(), name)));
if (myOut.size() > 0) {
String line;
final BufferedReader reader = new BufferedReader(new StringReader(myOut.toString()));
@@ -34,7 +34,7 @@ class JavaIoFile extends SimpleJavaFileObject {
@Override
public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
return new String(FileUtil.loadFileText(myFile));
return FileUtil.loadFile(myFile);
}
@Override
@@ -57,7 +57,7 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase {
private void verifyJavaDoc(final PsiElement field) throws IOException {
final File htmlPath = new File(JavaTestUtil.getJavaTestDataPath() + "/codeInsight/javadocIG/" + getTestName(true) + ".html");
String htmlText = new String(FileUtil.loadFileText(htmlPath));
String htmlText = FileUtil.loadFile(htmlPath);
String docInfo = new JavaDocInfoGenerator(getProject(), field).generateDocInfo(null);
assertEquals(StringUtil.convertLineSeparators(htmlText.trim()), StringUtil.convertLineSeparators(docInfo.trim()));
}
@@ -68,7 +68,7 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase {
PsiTestUtil.createTestProjectStructure(myProject, myModule, path, myFilesToDelete);
final String info =
new JavaDocInfoGenerator(getProject(), JavaPsiFacade.getInstance(getProject()).findPackage(getTestName(true))).generateDocInfo(null);
String htmlText = new String(FileUtil.loadFileText(new File(packageInfo + File.separator + "packageInfo.html")));
String htmlText = FileUtil.loadFile(new File(packageInfo + File.separator + "packageInfo.html"));
assertEquals(StringUtil.convertLineSeparators(htmlText.trim()), StringUtil.convertLineSeparators(info.trim()));
}
@@ -43,8 +43,8 @@ public class FileTemplatesTest extends IdeaTestCase {
File propFile = new File(resultFile.getParent(), base + ".prop" + txt);
File inFile = new File(resultFile.getParent(), base + txt);
String inputText = new String(FileUtil.loadFileText(inFile, FileTemplate.ourEncoding));
String outputText = new String(FileUtil.loadFileText(resultFile, FileTemplate.ourEncoding));
String inputText = FileUtil.loadFile(inFile, FileTemplate.ourEncoding);
String outputText = FileUtil.loadFile(resultFile, FileTemplate.ourEncoding);
EncodingAwareProperties properties = new EncodingAwareProperties();
@@ -80,7 +80,7 @@ public class ClsBuilderTest extends LightIdeaTestCase {
final String goldFilePath = JavaTestUtil.getJavaTestDataPath() + "/psi/cls/stubBuilder/" + goldFile;
String expected = "";
try {
expected = new String(FileUtil.loadFileText(new File(goldFilePath)));
expected = FileUtil.loadFile(new File(goldFilePath));
expected = StringUtil.convertLineSeparators(expected);
}
catch (FileNotFoundException e) {
@@ -359,10 +359,10 @@ public class JavaStubBuilderTest extends LightIdeaTestCase {
public void testPerformance() throws Exception {
final String path = PathManagerEx.getTestDataPath() + "/psi/stub/StubPerformanceTest.java";
final char[] source = FileUtil.loadFileText(new File(path));
final PsiJavaFile file = (PsiJavaFile)createLightFile("test.java", new String(source));
String text = FileUtil.loadFile(new File(path));
final PsiJavaFile file = (PsiJavaFile)createLightFile("test.java", text);
IdeaTestUtil.assertTiming("Source file size: " + source.length, 2000, new Runnable() {
IdeaTestUtil.assertTiming("Source file size: " + text.length(), 2000, new Runnable() {
@Override
public void run() {
NEW_BUILDER.buildStubTree(file);
@@ -39,7 +39,7 @@ public class NormalizeDeclarationTest extends PsiTestCase{
private static String loadFile(String name) throws Exception {
String fullName = BASE_PATH + File.separatorChar + name;
String text = new String(FileUtil.loadFileText(new File(fullName)));
String text = FileUtil.loadFile(new File(fullName));
text = StringUtil.convertLineSeparators(text);
return text;
}
@@ -80,7 +80,7 @@ public class OptimizeImportsTest extends PsiTestCase{
private static String loadFile(String name) throws Exception {
String fullName = BASE_PATH + File.separatorChar + name;
String text = new String(FileUtil.loadFileText(new File(fullName)));
String text = FileUtil.loadFile(new File(fullName));
text = StringUtil.convertLineSeparators(text);
return text;
}
@@ -207,7 +207,7 @@ public abstract class AbstractJavaFormatterTest extends LightIdeaTestCase {
private static String loadFile(String name) throws Exception {
String fullName = BASE_PATH + File.separatorChar + name;
String text = new String(FileUtil.loadFileText(new File(fullName)));
String text = FileUtil.loadFile(new File(fullName));
text = StringUtil.convertLineSeparators(text);
return text;
}
@@ -74,7 +74,7 @@ public class ShortenClassReferencesTest extends PsiTestCase {
private String loadFile(String name) throws Exception {
String fullName = BASE_PATH + File.separatorChar + name;
String text = new String(FileUtil.loadFileText(new File(fullName)));
String text = FileUtil.loadFile(new File(fullName));
text = StringUtil.convertLineSeparators(text);
return text;
}
@@ -65,7 +65,7 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase
@Override
public void run() {
try {
String contents = StringUtil.convertLineSeparators(new String(FileUtil.loadFileText(testFile, CharsetToolkit.UTF8)));
String contents = StringUtil.convertLineSeparators(FileUtil.loadFile(testFile, CharsetToolkit.UTF8));
quickFixTestCase.configureFromFileText(testFile.getName(), contents);
quickFixTestCase.bringRealEditorBack();
final Pair<String, Boolean> pair = quickFixTestCase.parseActionHintImpl(quickFixTestCase.getFile(), contents);
@@ -141,8 +141,8 @@ public class IdeaTestUtil extends PlatformTestUtil {
jarFile2 = new JarFile(file2);
}
catch (IOException e) {
String textAfter = String.valueOf(FileUtil.loadFileText(file1));
String textBefore = String.valueOf(FileUtil.loadFileText(file2));
String textAfter = FileUtil.loadFile(file1);
String textBefore = FileUtil.loadFile(file2);
textAfter = StringUtil.convertLineSeparators(textAfter);
textBefore = StringUtil.convertLineSeparators(textBefore);
Assert.assertEquals(file1.getPath(), textAfter, textBefore);
@@ -43,7 +43,7 @@ public class PsiTestData implements JDOMExternalizable {
public void loadText(String root) throws IOException{
String fileName = root + "/" + TEXT_FILE;
myText = new String(FileUtil.loadFileText(new File(fileName)));
myText = FileUtil.loadFile(new File(fileName));
myText = StringUtil.convertLineSeparators(myText);
}
@@ -27,6 +27,7 @@ import com.intellij.codeInsight.lookup.Lookup;
import com.intellij.codeInsight.lookup.impl.LookupManagerImpl;
import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
import com.intellij.codeInsight.template.impl.TemplateState;
import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.diagnostic.Logger;
@@ -135,6 +136,7 @@ public class ShowIntentionActionsHandler implements CodeInsightActionHandler {
public static boolean chooseActionAndInvoke(PsiFile hostFile, final Editor hostEditor, final IntentionAction action, final String text) {
final Project project = hostFile.getProject();
FeatureUsageTracker.getInstance().triggerFeatureUsed("codeassists.quickFix");
Pair<PsiFile, Editor> pair = chooseBetweenHostAndInjected(hostFile, hostEditor, new PairProcessor<PsiFile, Editor>() {
public boolean process(PsiFile psiFile, Editor editor) {
@@ -23,6 +23,7 @@ import com.intellij.codeInsight.hint.HintManager;
import com.intellij.codeInsight.lookup.*;
import com.intellij.codeInsight.lookup.impl.LookupImpl;
import com.intellij.codeInsight.template.TemplateManager;
import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.openapi.application.Result;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.editor.Document;
@@ -135,6 +136,7 @@ public class ListTemplatesHandler implements CodeInsightActionHandler {
}
public void itemSelected(LookupEvent event) {
FeatureUsageTracker.getInstance().triggerFeatureUsed("codeassists.liveTemplates");
LookupElement item = event.getItem();
if (item != null) {
final TemplateImpl template = (TemplateImpl)item.getObject();
@@ -23,6 +23,7 @@ import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiFile;
import com.intellij.psi.codeStyle.CodeStyleSettings;
@@ -38,6 +39,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
public class FormatterImpl extends FormatterEx
implements ApplicationComponent,
@@ -51,7 +53,7 @@ public class FormatterImpl extends FormatterEx
private FormattingProgressIndicatorImpl myProgressIndicator;
private int myIsDisabledCount = 0;
private final AtomicInteger myIsDisabledCount = new AtomicInteger();
private final IndentImpl NONE_INDENT = new IndentImpl(Indent.Type.NONE, false, false);
private final IndentImpl myAbsoluteNoneIndent = new IndentImpl(Indent.Type.NONE, true, false);
private final IndentImpl myLabelIndent = new IndentImpl(Indent.Type.LABEL, false, false);
@@ -263,10 +265,10 @@ public class FormatterImpl extends FormatterEx
whiteSpace.setReadOnly(false);
processor.formatWithoutRealModifications();
return new IndentInfo(whiteSpace.getLineFeeds(), whiteSpace.getIndentOffset(), whiteSpace.getSpaces());
} finally {
}
finally {
enableFormatting();
}
}
public void adjustLineIndentsForRange(final FormattingModel model,
@@ -295,7 +297,6 @@ public class FormatterImpl extends FormatterEx
finally {
enableFormatting();
}
}
public void formatAroundRange(final FormattingModel model,
@@ -329,8 +330,8 @@ public class FormatterImpl extends FormatterEx
}
processor.formatWithoutRealModifications();
processor.performModifications(model);
} finally{
}
finally{
enableFormatting();
}
}
@@ -357,12 +358,10 @@ public class FormatterImpl extends FormatterEx
return offset;
}
if (blockAfterOffset != null) {
return adjustLineIndent(offset, documentModel, processor, indentOptions, model, blockAfterOffset.getWhiteSpace());
} else {
return adjustLineIndent(offset, documentModel, processor, indentOptions, model, processor.getLastWhiteSpace());
}
} finally {
WhiteSpace whiteSpace = blockAfterOffset != null ? blockAfterOffset.getWhiteSpace() : processor.getLastWhiteSpace();
return adjustLineIndent(offset, documentModel, processor, indentOptions, model, whiteSpace);
}
finally {
enableFormatting();
}
}
@@ -549,13 +548,16 @@ public class FormatterImpl extends FormatterEx
if (whiteSpace.containsLineFeeds() && indentInfoStorage != null) {
whiteSpace.setLineFeedsAreReadOnly(true);
current.setIndentFromParent(indentInfoStorage.getIndentInfo(current.getStartOffset()));
} else {
}
else {
whiteSpace.setReadOnly(true);
}
} else {
}
else {
if (!changeWSBeforeFirstElement) {
whiteSpace.setReadOnly(true);
} else {
}
else {
if (!changeLineFeedsBeforeFirstElement) {
whiteSpace.setLineFeedsAreReadOnly(true);
}
@@ -578,7 +580,8 @@ public class FormatterImpl extends FormatterEx
assert !(spaceProperty instanceof DependantSpacingImpl);
current.setSpaceProperty(
getSpacingImpl(
spaceProperty.getMinSpaces(), spaceProperty.getMaxSpaces(), spaceProperty.getMinLineFeeds(), spaceProperty.isReadOnly(),
spaceProperty.getMinSpaces(), spaceProperty.getMaxSpaces(), spaceProperty.getMinLineFeeds(),
spaceProperty.isReadOnly(),
spaceProperty.isSafe(), newKeepLineBreaksFlag, newKeepLineBreaks, false, spaceProperty.getPrefLineFeeds()
)
);
@@ -590,10 +593,10 @@ public class FormatterImpl extends FormatterEx
current = current.getNextBlock();
}
processor.format(model);
} finally {
}
finally {
enableFormatting();
}
}
public void adjustTextRange(final FormattingModel model,
@@ -612,17 +615,18 @@ public class FormatterImpl extends FormatterEx
if (!whiteSpace.isReadOnly()) {
if (whiteSpace.getStartOffset() > affectedRange.getStartOffset()) {
whiteSpace.setReadOnly(true);
} else {
}
else {
whiteSpace.setReadOnly(false);
}
}
current = current.getNextBlock();
}
processor.format(model);
} finally {
}
finally {
enableFormatting();
}
}
public void saveIndents(final FormattingModel model, final TextRange affectedRange,
@@ -722,36 +726,37 @@ public class FormatterImpl extends FormatterEx
return relative ? myContinuationIndentRelativeToDirectParent : myContinuationIndentNotRelativeToDirectParent;
}
public Indent getContinuationWithoutFirstIndent(boolean relative)//is default
{
//is default
public Indent getContinuationWithoutFirstIndent(boolean relative) {
return relative ? myContinuationWithoutFirstIndentRelativeToDirectParent : myContinuationWithoutFirstIndentNotRelativeToDirectParent;
}
private final Object DISABLING_LOCK = new Object();
public boolean isDisabled() {
synchronized (DISABLING_LOCK) {
return myIsDisabledCount > 0;
return myIsDisabledCount.get() > 0;
}
private void disableFormatting() {
myIsDisabledCount.incrementAndGet();
}
private void enableFormatting() {
int old = myIsDisabledCount.getAndDecrement();
if (old <= 0) {
LOG.error("enableFormatting()/disableFormatting() not paired. DisabledLevel = " + old);
}
}
public void disableFormatting() {
synchronized (DISABLING_LOCK) {
myIsDisabledCount++;
public <T> T runWithFormattingDisabled(@NotNull Computable<T> runnable) {
disableFormatting();
try {
return runnable.compute();
}
}
public void enableFormatting() {
synchronized (DISABLING_LOCK) {
if (myIsDisabledCount <= 0) {
LOG.error("enableFormatting()/disableFormatting() not paired. DisabledLevel = " + myIsDisabledCount);
}
myIsDisabledCount--;
finally {
enableFormatting();
}
}
private abstract static class MyFormattingTask implements SequentialTask {
private FormatProcessor myProcessor;
private boolean myDone;
@@ -185,7 +185,7 @@ public class FileTemplateImpl implements FileTemplate, Cloneable{
/** Read template from file. */
private static String readExternal(File file) throws IOException{
return new String(FileUtil.loadFileText(file, ourEncoding));
return FileUtil.loadFile(file, ourEncoding);
}
/** Read template from URL. */
@@ -148,7 +148,7 @@ public class TodoCheckinHandler extends CheckinHandler {
worker.execute();
}
};
final boolean completed = ProgressManager.getInstance().runProcessWithProgressSynchronously(runnable, "", true, myProject);
final boolean completed = ProgressManager.getInstance().runProcessWithProgressSynchronously(runnable, "Looking for new and edited TODO items...", true, myProject);
if (! completed || (worker.getAddedOrEditedTodos().isEmpty() && worker.getInChangedTodos().isEmpty() &&
worker.getSkipped().isEmpty())) return ReturnResult.COMMIT;
@@ -72,8 +72,6 @@ import java.io.IOException;
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");
@@ -113,7 +111,8 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
StartupManager startupManager,
FileTypeManager fileTypeManager,
FileDocumentManager fileDocumentManager,
PsiBuilderFactory psiBuilderFactory, MessageBus messageBus) {
PsiBuilderFactory psiBuilderFactory,
MessageBus messageBus) {
myProject = project;
myMessageBus = messageBus;
@@ -208,56 +207,45 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
}
public void performActionWithFormatterDisabled(final Runnable r) {
final PostprocessReformattingAspect component = getProject().getComponent(PostprocessReformattingAspect.class);
try {
((FormatterImpl)FormatterEx.getInstance()).disableFormatting();
component.disablePostprocessFormattingInside(new Computable<Object>() {
public Object compute() {
r.run();
return null;
}
});
}
finally {
((FormatterImpl)FormatterEx.getInstance()).enableFormatting();
}
performActionWithFormatterDisabled(new Computable<Object>() {
@Override
public Object compute() {
r.run();
return null;
}
});
}
public <T extends Throwable> void performActionWithFormatterDisabled(final ThrowableRunnable<T> r) throws T {
final Throwable[] throwable = new Throwable[1];
final PostprocessReformattingAspect component = getProject().getComponent(PostprocessReformattingAspect.class);
try {
((FormatterImpl)FormatterEx.getInstance()).disableFormatting();
component.disablePostprocessFormattingInside(new Computable<Object>() {
public Object compute() {
try {
r.run();
}
catch (Throwable t) {
throwable[0] = t;
}
return null;
performActionWithFormatterDisabled(new Computable<Object>() {
@Override
public Object compute() {
try {
r.run();
}
});
}
finally {
((FormatterImpl)FormatterEx.getInstance()).enableFormatting();
}
catch (Throwable t) {
throwable[0] = t;
}
return null;
}
});
if (throwable[0] != null) //noinspection unchecked
if (throwable[0] != null) {
//noinspection unchecked
throw (T)throwable[0];
}
}
public <T> T performActionWithFormatterDisabled(Computable<T> r) {
try {
final PostprocessReformattingAspect component = PostprocessReformattingAspect.getInstance(getProject());
((FormatterImpl)FormatterEx.getInstance()).disableFormatting();
return component.disablePostprocessFormattingInside(r);
}
finally {
((FormatterImpl)FormatterEx.getInstance()).enableFormatting();
}
public <T> T performActionWithFormatterDisabled(final Computable<T> r) {
return ((FormatterImpl)FormatterEx.getInstance()).runWithFormattingDisabled(new Computable<T>() {
@Override
public T compute() {
final PostprocessReformattingAspect component = PostprocessReformattingAspect.getInstance(getProject());
return component.disablePostprocessFormattingInside(r);
}
});
}
@NotNull
@@ -436,7 +424,7 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
}
public void beforeChildAddition(PsiTreeChangeEventImpl event) {
event.setCode(BEFORE_CHILD_ADDITION);
event.setCode(PsiTreeChangeEventImpl.PsiEventType.BEFORE_CHILD_ADDITION);
if (LOG.isDebugEnabled()) {
LOG.debug(
"beforeChildAddition: parent = " + event.getParent()
@@ -446,7 +434,7 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
}
public void beforeChildRemoval(@NotNull PsiTreeChangeEventImpl event) {
event.setCode(BEFORE_CHILD_REMOVAL);
event.setCode(PsiTreeChangeEventImpl.PsiEventType.BEFORE_CHILD_REMOVAL);
if (LOG.isDebugEnabled()) {
LOG.debug(
"beforeChildRemoval: child = " + event.getChild()
@@ -457,7 +445,7 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
}
public void beforeChildReplacement(@NotNull PsiTreeChangeEventImpl event) {
event.setCode(BEFORE_CHILD_REPLACEMENT);
event.setCode(PsiTreeChangeEventImpl.PsiEventType.BEFORE_CHILD_REPLACEMENT);
if (LOG.isDebugEnabled()) {
LOG.debug(
"beforeChildReplacement: oldChild = " + event.getOldChild()
@@ -468,7 +456,7 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
}
public void beforeChildrenChange(PsiTreeChangeEventImpl event) {
event.setCode(BEFORE_CHILDREN_CHANGE);
event.setCode(PsiTreeChangeEventImpl.PsiEventType.BEFORE_CHILDREN_CHANGE);
if (LOG.isDebugEnabled()) {
LOG.debug("beforeChildrenChange: parent = " + event.getParent());
}
@@ -476,7 +464,7 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
}
public void beforeChildMovement(PsiTreeChangeEventImpl event) {
event.setCode(BEFORE_CHILD_MOVEMENT);
event.setCode(PsiTreeChangeEventImpl.PsiEventType.BEFORE_CHILD_MOVEMENT);
if (LOG.isDebugEnabled()) {
LOG.debug(
"beforeChildMovement: child = " + event.getChild()
@@ -488,7 +476,7 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
}
public void beforePropertyChange(PsiTreeChangeEventImpl event) {
event.setCode(BEFORE_PROPERTY_CHANGE);
event.setCode(PsiTreeChangeEventImpl.PsiEventType.BEFORE_PROPERTY_CHANGE);
if (LOG.isDebugEnabled()) {
LOG.debug(
"beforePropertyChange: element = " + event.getElement()
@@ -501,7 +489,7 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
public void childAdded(PsiTreeChangeEventImpl event) {
beforeChange(true);
event.setCode(CHILD_ADDED);
event.setCode(PsiTreeChangeEventImpl.PsiEventType.CHILD_ADDED);
if (LOG.isDebugEnabled()) {
LOG.debug(
"childAdded: child = " + event.getChild()
@@ -514,7 +502,7 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
public void childRemoved(PsiTreeChangeEventImpl event) {
beforeChange(true);
event.setCode(CHILD_REMOVED);
event.setCode(PsiTreeChangeEventImpl.PsiEventType.CHILD_REMOVED);
if (LOG.isDebugEnabled()) {
LOG.debug(
"childRemoved: child = " + event.getChild() + ", parent = " + event.getParent()
@@ -526,7 +514,7 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
public void childReplaced(PsiTreeChangeEventImpl event) {
beforeChange(true);
event.setCode(CHILD_REPLACED);
event.setCode(PsiTreeChangeEventImpl.PsiEventType.CHILD_REPLACED);
if (LOG.isDebugEnabled()) {
LOG.debug(
"childReplaced: oldChild = " + event.getOldChild()
@@ -540,7 +528,7 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
public void childMoved(PsiTreeChangeEventImpl event) {
beforeChange(true);
event.setCode(CHILD_MOVED);
event.setCode(PsiTreeChangeEventImpl.PsiEventType.CHILD_MOVED);
if (LOG.isDebugEnabled()) {
LOG.debug(
"childMoved: child = " + event.getChild()
@@ -554,7 +542,7 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
public void childrenChanged(PsiTreeChangeEventImpl event) {
beforeChange(true);
event.setCode(CHILDREN_CHANGED);
event.setCode(PsiTreeChangeEventImpl.PsiEventType.CHILDREN_CHANGED);
if (LOG.isDebugEnabled()) {
LOG.debug(
"childrenChanged: parent = " + event.getParent()
@@ -566,7 +554,7 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
public void propertyChanged(PsiTreeChangeEventImpl event) {
beforeChange(true);
event.setCode(PROPERTY_CHANGED);
event.setCode(PsiTreeChangeEventImpl.PsiEventType.PROPERTY_CHANGED);
if (LOG.isDebugEnabled()) {
LOG.debug(
"propertyChanged: element = " + event.getElement()
@@ -584,7 +572,8 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent {
}
private void fireEvent(PsiTreeChangeEventImpl event) {
boolean isRealTreeChange = event.getCode() != PROPERTY_CHANGED && event.getCode() != BEFORE_PROPERTY_CHANGE;
boolean isRealTreeChange = event.getCode() != PsiTreeChangeEventImpl.PsiEventType.PROPERTY_CHANGED
&& event.getCode() != PsiTreeChangeEventImpl.PsiEventType.BEFORE_PROPERTY_CHANGE;
PsiFile file = event.getFile();
if (file == null || file.isPhysical()) {
@@ -1,31 +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.psi.impl.source.tree.injected;
import com.intellij.util.SmartList;
/**
* @author cdr
*/
class Places extends SmartList<Place> {
public boolean isValid() {
for (Place place : this) {
if (!place.isValid()) return false;
}
return true;
}
}
@@ -249,7 +249,7 @@ public class BrowserUtil {
String previousTimestamp = null;
if (timestampFile.exists()) {
previousTimestamp = new String(FileUtil.loadFileText(timestampFile));
previousTimestamp = FileUtil.loadFile(timestampFile);
}
if (!currentTimestamp.equals(previousTimestamp)) {
@@ -757,7 +757,7 @@ public class PluginManager {
FileUtil.findFirstThatExist(PathManager.getHomePath() + "/build.txt", PathManager.getHomePath() + "/community/build.txt");
if (buildTxtFile != null) {
ourBuildNumber = BuildNumber.fromString(new String(FileUtil.loadFileText(buildTxtFile)).trim());
ourBuildNumber = BuildNumber.fromString(FileUtil.loadFile(buildTxtFile).trim());
}
else {
ourBuildNumber = BuildNumber.fromString("106.SNAPSHOT");
@@ -76,7 +76,7 @@ public class VMOptions {
private static int readOption(Pattern pattern) {
try {
String content = new String(FileUtil.loadFileText(getFile()));
String content = FileUtil.loadFile(getFile());
if (isMacOs()) {
content = extractMacOsVMOptionsSection(content);
@@ -115,7 +115,7 @@ public class VMOptions {
private static void writeOption(String option, int value, Pattern pattern) {
try {
String optionValue = option + value + "m";
String content = new String(FileUtil.loadFileText(getFile()));
String content = FileUtil.loadFile(getFile());
String vmOptions;
if (isMacOs()) {
@@ -76,7 +76,7 @@ public class LoggerFactory implements Logger.Factory {
throw new RuntimeException("log.xml file does not exist! Path: [ $home/bin/log.xml]");
}
String text = new String(FileUtil.loadFileText(logXmlFile));
String text = FileUtil.loadFile(logXmlFile);
text = StringUtil.replace(text, SYSTEM_MACRO, StringUtil.replace(PathManager.getSystemPath(), "\\", "\\\\"));
text = StringUtil.replace(text, APPLICATION_MACRO, StringUtil.replace(PathManager.getHomePath(), "\\", "\\\\"));
text = StringUtil.replace(text, LOGDIR_MACRO, StringUtil.replace(PathManager.getLogPath(), "\\", "\\\\"));
@@ -521,7 +521,7 @@ public final class UpdateChecker {
try {
final File file = new File(PathManager.getConfigPath(), DISABLED_UPDATE);
if (file.isFile()) {
final String[] ids = new String(FileUtil.loadFileText(file)).split("[\\s]");
final String[] ids = FileUtil.loadFile(file).split("[\\s]");
for (String id : ids) {
if (id != null && id.trim().length() > 0) {
ourDisabledToUpdatePlugins.add(id.trim());
@@ -110,7 +110,7 @@ public abstract class FileSetTestCase extends TestSuite {
@Override
protected void runTest() throws Throwable {
String content = new String(FileUtil.loadFileText(myTestFile));
String content = FileUtil.loadFile(myTestFile);
assertNotNull(content);
List<String> input = new ArrayList<String>();
@@ -93,7 +93,7 @@ public abstract class LexerTestCase extends UsefulTestCase {
String fileName = PathManager.getHomePath() + "/" + getDirPath() + "/" + getTestName(true) + "." + fileExt;
String text = "";
try {
text = StringUtil.convertLineSeparators(new String(FileUtil.loadFileText(new File(fileName))).trim());
text = StringUtil.convertLineSeparators(FileUtil.loadFile(new File(fileName)).trim());
}
catch (IOException e) {
fail("can't load file " + fileName + ": " + e.getMessage());
@@ -105,7 +105,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest
String fullPath = getTestDataPath() + filePath;
final File ioFile = new File(fullPath);
String fileText = new String(FileUtil.loadFileText(ioFile, CharsetToolkit.UTF8));
String fileText = FileUtil.loadFile(ioFile, CharsetToolkit.UTF8);
fileText = StringUtil.convertLineSeparators(fileText);
configureFromFileText(ioFile.getName(), fileText);
@@ -280,7 +280,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest
assertTrue(getMessage("Cannot find file " + fullPath, message), ioFile.exists());
String fileText = null;
try {
fileText = new String(FileUtil.loadFileText(ioFile, CharsetToolkit.UTF8));
fileText = FileUtil.loadFile(ioFile, CharsetToolkit.UTF8);
} catch (IOException e) {
LOG.error(e);
}
@@ -135,7 +135,7 @@ public abstract class ParsingTestCase extends LightPlatformTestCase {
private static String doLoadFile(String myFullDataPath, String name) throws IOException {
String fullName = myFullDataPath + File.separatorChar + name;
String text = new String(FileUtil.loadFileText(new File(fullName))).trim();
String text = FileUtil.loadFile(new File(fullName)).trim();
text = StringUtil.convertLineSeparators(text);
return text;
}
@@ -60,7 +60,7 @@ public class TestLoggerFactory implements Logger.Factory {
}
final String logDir = PathManager.getSystemPath() + "/" + LOG_DIR;
String text = new String(FileUtil.loadFileText(logXmlFile));
String text = FileUtil.loadFile(logXmlFile);
text = StringUtil.replace(text, SYSTEM_MACRO, StringUtil.replace(PathManager.getSystemPath(), "\\", "\\\\"));
text = StringUtil.replace(text, APPLICATION_MACRO, StringUtil.replace(PathManager.getHomePath(), "\\", "\\\\"));
text = StringUtil.replace(text, LOG_DIR_MACRO, StringUtil.replace(logDir, "\\", "\\\\"));
@@ -506,8 +506,7 @@ public abstract class UsefulTestCase extends TestCase {
protected static void assertSameLinesWithFile(final String filePath, final String actualText) {
String fileText;
try {
final FileReader reader = new FileReader(filePath);
fileText = FileUtil.loadTextAndClose(reader);
fileText = FileUtil.loadFile(new File(filePath));
}
catch (IOException e) {
throw new RuntimeException(e);
@@ -168,12 +168,20 @@ public class FileUtil {
}
@NotNull
public static char[] loadFileText(File file) throws IOException {
public static String loadFile(@NotNull File file) throws IOException {
return loadFile(file, null);
}
@NotNull
public static String loadFile(@NotNull File file, String encoding) throws IOException {
return new String(loadFileText(file, encoding));
}
@NotNull
public static char[] loadFileText(@NotNull File file) throws IOException {
return loadFileText(file, null);
}
@NotNull
public static char[] loadFileText(File file, @NonNls String encoding) throws IOException{
public static char[] loadFileText(@NotNull File file, @NonNls String encoding) throws IOException{
InputStream stream = new FileInputStream(file);
Reader reader = encoding == null ? new InputStreamReader(stream) : new InputStreamReader(stream, encoding);
try{
@@ -91,13 +91,13 @@ public class ReorderJarsMain {
private static Set<String> loadIgnoredJars(String libPath) throws IOException {
final File ignoredJarsFile = new File(libPath, "required_for_dist.txt");
final Set<String> ignoredJars = new HashSet<String>();
ContainerUtil.addAll(ignoredJars, new String(FileUtil.loadFileText(ignoredJarsFile)).split("\r\n"));
ContainerUtil.addAll(ignoredJars, FileUtil.loadFile(ignoredJarsFile).split("\r\n"));
return ignoredJars;
}
private static Map<String, List<String>> getOrder(final File loadingFile) throws IOException {
final Map<String, List<String>> entriesOrder = new HashMap<String, List<String>>();
final String[] lines = new String(FileUtil.loadFileText(loadingFile)).split("\r\n");
final String[] lines = FileUtil.loadFile(loadingFile).split("\r\n");
for (String line : lines) {
final int i = line.indexOf(":");
if (i != -1) {
@@ -29,7 +29,7 @@ import java.io.IOException;
*/
public class EncodingAwareProperties extends java.util.Properties{
public void load(File file, String encoding) throws IOException{
String propText = new String(FileUtil.loadFileText(file, encoding));
String propText = FileUtil.loadFile(file, encoding);
propText = StringUtil.convertLineSeparators(propText);
StringTokenizer stringTokenizer = new StringTokenizer(propText, "\n");
while (stringTokenizer.hasMoreElements()){
@@ -80,7 +80,7 @@ public class CustomTypesTest extends ParsingTestCase {
@Override
protected String loadFile(String name) throws IOException {
String fullName = getTestDataPath() + File.separatorChar + name;
String text = new String(FileUtil.loadFileText(new File(fullName))).trim();
String text = FileUtil.loadFile(new File(fullName)).trim();
text = StringUtil.convertLineSeparators(text);
final String root = PathUtil.getJarPathForClass(this.getClass());
final String placeholder = "<_classpath_>";
@@ -279,7 +279,7 @@ public class CvsUtil {
File file = getFileInTheAdminDir(directory, fileName);
if (!file.isFile()) return null;
try {
String result = new String(FileUtil.loadFileText(file));
String result = FileUtil.loadFile(file);
if (trimContent) {
return result.trim();
}
+1 -1
View File
@@ -162,7 +162,7 @@ public class IdeaJdk extends SdkType implements JavaSdkType {
private static String getBuildNumber(String ideaHome) {
try {
@NonNls final String buildTxt = "/build.txt";
return new String(FileUtil.loadFileText(new File(ideaHome + buildTxt))).trim();
return FileUtil.loadFile(new File(ideaHome + buildTxt)).trim();
}
catch (IOException e) {
return null;
@@ -74,7 +74,7 @@ public class EclipseClasspathTest extends IdeaTestCase {
static Module setUpModule(final String path, final Project project) throws IOException, JDOMException, ConversionException {
final File classpathFile = new File(path, EclipseXml.DOT_CLASSPATH_EXT);
String fileText = new String(FileUtil.loadFileText(classpathFile)).replaceAll("\\$ROOT\\$", project.getBaseDir().getPath());
String fileText = FileUtil.loadFile(classpathFile).replaceAll("\\$ROOT\\$", project.getBaseDir().getPath());
if (!SystemInfo.isWindows) {
fileText = fileText.replaceAll(EclipseXml.FILE_PROTOCOL + "/", EclipseXml.FILE_PROTOCOL);
}
@@ -104,7 +104,7 @@ public class EclipseClasspathTest extends IdeaTestCase {
static void checkModule(String path, Module module) throws IOException, JDOMException, ConversionException {
final File classpathFile1 = new File(path, EclipseXml.DOT_CLASSPATH_EXT);
if (!classpathFile1.exists()) return;
String fileText1 = new String(FileUtil.loadFileText(classpathFile1)).replaceAll("\\$ROOT\\$", module.getProject().getBaseDir().getPath());
String fileText1 = FileUtil.loadFile(classpathFile1).replaceAll("\\$ROOT\\$", module.getProject().getBaseDir().getPath());
if (!SystemInfo.isWindows) {
fileText1 = fileText1.replaceAll(EclipseXml.FILE_PROTOCOL + "/", EclipseXml.FILE_PROTOCOL);
}
@@ -80,7 +80,7 @@ public class EclipseEmlTest extends IdeaTestCase {
new EclipseClasspathStorageProvider.EclipseClasspathConverter(module);
final ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel();
final Element classpathElement = JDOMUtil.loadDocument(new String(FileUtil.loadFileText(new File(path, EclipseXml.DOT_CLASSPATH_EXT)))).getRootElement();
final Element classpathElement = JDOMUtil.loadDocument(FileUtil.loadFile(new File(path, EclipseXml.DOT_CLASSPATH_EXT))).getRootElement();
converter.getClasspath(rootModel, classpathElement);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
@@ -103,12 +103,12 @@ public class EclipseEmlTest extends IdeaTestCase {
final File emlFile = new File(path, module.getName() + EclipseXml.IDEA_SETTINGS_POSTFIX);
Assert.assertTrue(resulted.replaceAll(StringUtil.escapeToRegexp(module.getProject().getBaseDir().getPath()), "\\$ROOT\\$"),
JDOMUtil.areElementsEqual(root, JDOMUtil.loadDocument(new String(FileUtil.loadFileText(emlFile))).getRootElement()));
JDOMUtil.areElementsEqual(root, JDOMUtil.loadDocument(FileUtil.loadFile(emlFile)).getRootElement()));
}
private static void replaceRoot(String path, final String child, final Project project) throws IOException, JDOMException {
final File emlFile = new File(path, child);
String fileText = new String(FileUtil.loadFileText(emlFile)).replaceAll("\\$ROOT\\$", project.getBaseDir().getPath());
String fileText = FileUtil.loadFile(emlFile).replaceAll("\\$ROOT\\$", project.getBaseDir().getPath());
if (!SystemInfo.isWindows) {
fileText = fileText.replaceAll(EclipseXml.FILE_PROTOCOL + "/", EclipseXml.FILE_PROTOCOL);
}
@@ -73,7 +73,7 @@ public class EclipseImlTest extends IdeaTestCase {
final String path = project.getBaseDir().getPath() + relativePath;
final File classpathFile = new File(path, EclipseXml.DOT_CLASSPATH_EXT);
String fileText = new String(FileUtil.loadFileText(classpathFile)).replaceAll("\\$ROOT\\$", project.getBaseDir().getPath());
String fileText = FileUtil.loadFile(classpathFile).replaceAll("\\$ROOT\\$", project.getBaseDir().getPath());
if (!SystemInfo.isWindows) {
fileText = fileText.replaceAll(EclipseXml.FILE_PROTOCOL + "/", EclipseXml.FILE_PROTOCOL);
}
+1 -1
View File
@@ -158,7 +158,7 @@ public class GitBranch extends GitReference {
// the case after git init and before first commit - there is no branch and no output, and we'll take refs/heads/master
String head;
try {
head = new String(FileUtil.loadFileText(new File(root.getPath(), ".git/HEAD"), GitUtil.UTF8_ENCODING)).trim();
head = FileUtil.loadFile(new File(root.getPath(), ".git/HEAD"), GitUtil.UTF8_ENCODING).trim();
final String prefix = "ref: refs/heads/";
return head.startsWith(prefix) ? new GitBranch(head.substring(prefix.length()), true, false) : null;
} catch (IOException e) {
+1 -3
View File
@@ -31,9 +31,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -363,7 +361,7 @@ public final class GitRemote {
// try remotes file
try {
//noinspection IOResourceOpenedButNotSafelyClosed
String text = FileUtil.loadTextAndClose(new InputStreamReader(new FileInputStream(remotesFile), US_ASCII_ENCODING));
String text = FileUtil.loadFile(remotesFile, US_ASCII_ENCODING);
@NonNls String pullPrefix = "Pull:";
for (StringScanner s = new StringScanner(text); s.hasMoreData();) {
String line = s.line();
@@ -198,7 +198,7 @@ public class GitPushRebaseProcess extends GitBaseRebaseProcess {
}
try {
TreeMap<String, String> pickLines = new TreeMap<String, String>();
StringScanner s = new StringScanner(new String(FileUtil.loadFileText(new File(path), GitUtil.UTF8_ENCODING)));
StringScanner s = new StringScanner(FileUtil.loadFile(new File(path), GitUtil.UTF8_ENCODING));
while (s.hasMoreData()) {
if (!s.tryConsume("pick ")) {
s.line();
@@ -476,7 +476,7 @@ public class GitSwitchBranchesDialog extends DialogWrapper {
String newRef;
try {
final String refText =
new String(FileUtil.loadFileText(new File(rootPath, ".git/refs/" + value), GitUtil.UTF8_ENCODING)).trim();
FileUtil.loadFile(new File(rootPath, ".git/refs/" + value), GitUtil.UTF8_ENCODING).trim();
String refsPrefix = "ref: refs/";
if (refText.endsWith("/HEAD") || !refText.startsWith(refsPrefix)) {
newRef = null;
@@ -116,7 +116,7 @@ public class MergeChangeCollector {
File mergeHeadsFile = new File(root, ".git/MERGE_HEAD");
try {
if (mergeHeadsFile.exists()) {
String mergeHeads = new String(FileUtil.loadFileText(mergeHeadsFile, GitUtil.UTF8_ENCODING));
String mergeHeads = FileUtil.loadFile(mergeHeadsFile, GitUtil.UTF8_ENCODING);
for (StringScanner s = new StringScanner(mergeHeads); s.hasMoreData();) {
String head = s.line();
if (head.length() == 0) {
@@ -338,7 +338,7 @@ public class GitRebaseEditor extends DialogWrapper {
*/
public void load(final String file) throws IOException {
String encoding = GitConfigUtil.getLogEncoding(myProject, myGitRoot);
final StringScanner s = new StringScanner(new String(FileUtil.loadFileText(new File(file), encoding)));
final StringScanner s = new StringScanner(FileUtil.loadFile(new File(file), encoding));
while (s.hasMoreData()) {
if (s.isEol() || s.startsWith('#') || s.startsWith("noop")) {
s.nextLine();
@@ -66,7 +66,7 @@ public class GitRebaseUnstructuredEditor extends DialogWrapper {
myGitRootLabel.setText(root.getPresentableUrl());
encoding = GitConfigUtil.getCommitEncoding(project, root);
myFile = new File(path);
myTextArea.setText(new String(FileUtil.loadFileText(myFile, encoding)));
myTextArea.setText(FileUtil.loadFile(myFile, encoding));
init();
}
@@ -91,7 +91,7 @@ public class GitRebaseUtils {
File nextFile = new File(rebaseDir, "next");
int next;
try {
next = Integer.parseInt(new String(FileUtil.loadFileText(nextFile, GitUtil.UTF8_ENCODING)).trim());
next = Integer.parseInt(FileUtil.loadFile(nextFile, GitUtil.UTF8_ENCODING).trim());
}
catch (Exception e) {
if (LOG.isDebugEnabled()) {
@@ -17,6 +17,7 @@ package org.jetbrains.plugins.groovy.extensions;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.util.Condition;
import com.intellij.psi.CommonClassNames;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiType;
import com.intellij.psi.util.InheritanceUtil;
@@ -48,6 +49,12 @@ public abstract class GroovyNamedArgumentProvider {
return namedArguments;
}
public static final StringTypeCondition TYPE_STRING = new StringTypeCondition(CommonClassNames.JAVA_LANG_STRING);
public static final StringTypeCondition TYPE_MAP = new StringTypeCondition(CommonClassNames.JAVA_UTIL_MAP);
public static final StringTypeCondition TYPE_BOOL = new StringTypeCondition(CommonClassNames.JAVA_LANG_BOOLEAN);
public static final StringTypeCondition TYPE_INTEGER = new StringTypeCondition(CommonClassNames.JAVA_LANG_INTEGER);
public static final Condition<PsiType> TYPE_ANY = Condition.TRUE;
protected static class StringTypeCondition implements Condition<PsiType> {
private final String myTypeName;
@@ -18,7 +18,6 @@ package org.jetbrains.plugins.groovy.lang;
import com.intellij.openapi.util.Condition;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiType;
import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.extensions.GroovyNamedArgumentProvider;
@@ -35,7 +34,7 @@ public class GroovySourceCodeNamedArgumentProvider extends GroovyNamedArgumentPr
public void getNamedArguments(@Nullable GrCall call, @NotNull PsiMethod method, Map<String, Condition<PsiType>> result) {
if (method instanceof GrMethod) {
for (String parameter : ((GrMethod)method).getNamedParametersArray()) {
result.put(parameter, Condition.TRUE);
result.put(parameter, TYPE_ANY);
}
}
}
@@ -105,7 +105,7 @@ public abstract class TestUtils {
public static List<String> readInput(String filePath) {
String content;
try {
content = new String(FileUtil.loadFileText(new File(filePath)));
content = FileUtil.loadFile(new File(filePath));
}
catch (IOException e) {
throw new RuntimeException(e);
@@ -310,8 +310,7 @@ public class SvnAuthenticationTest extends PlatformTestCase {
myAuthenticationManager.addListener(savedOnceListener);
final File config = new File(myConfiguration.getConfigurationDirectory(), "config");
final char[] chars = FileUtil.loadFileText(config);
final String contents = String.valueOf(chars);
final String contents = FileUtil.loadFile(config);
final String auth = "[auth]";
final int idx = contents.indexOf(auth);
Assert.assertTrue(idx != -1);
@@ -439,8 +438,7 @@ public class SvnAuthenticationTest extends PlatformTestCase {
myAuthenticationManager.addListener(savedOnceListener);
final File config = new File(myConfiguration.getConfigurationDirectory(), "config");
final char[] chars = FileUtil.loadFileText(config);
final String contents = String.valueOf(chars);
final String contents = FileUtil.loadFile(config);
final String auth = "[auth]";
final int idx = contents.indexOf(auth);
Assert.assertTrue(idx != -1);
@@ -572,8 +570,7 @@ public class SvnAuthenticationTest extends PlatformTestCase {
myAuthenticationManager.addListener(savedOnceListener);
final File servers = new File(myConfiguration.getConfigurationDirectory(), "servers");
final char[] chars = FileUtil.loadFileText(servers);
final String contents = String.valueOf(chars);
final String contents = FileUtil.loadFile(servers);
final String groups = "[groups]";
final int idx = contents.indexOf(groups);
Assert.assertTrue(idx != -1);
@@ -93,7 +93,7 @@ public class AsmCodeGeneratorTest extends TestCase {
}
private LwRootContainer loadFormData(final String formPath) throws Exception {
String formData = new String(FileUtil.loadFileText(new File(formPath)));
String formData = FileUtil.loadFile(new File(formPath));
final CompiledClassPropertiesProvider provider = new CompiledClassPropertiesProvider(getClass().getClassLoader());
return Utils.getRootContainer(formData, provider);
}
@@ -16,7 +16,9 @@
package com.intellij.application.options.editor;
import com.intellij.codeInsight.template.impl.TemplateSettings;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.components.*;
import com.intellij.util.xmlb.XmlSerializerUtil;
import com.intellij.xml.XmlBundle;
@@ -55,6 +57,10 @@ public class WebEditorOptions implements PersistentStateComponent<WebEditorOptio
return ServiceManager.getService(WebEditorOptions.class);
}
public WebEditorOptions() {
setTagTreeHighlightingEnabled(!ApplicationManager.getApplication().isUnitTestMode());
}
public void setBreadcrumbsEnabled(boolean b) {
myBreadcrumbsEnabled = b;
}