Merge remote-tracking branch 'origin/master'

This commit is contained in:
Maxim.Mossienko
2015-02-23 11:17:56 +01:00
8 changed files with 86 additions and 52 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -29,13 +29,11 @@ import com.intellij.lang.annotation.AnnotationSession;
import com.intellij.lang.annotation.ExternalAnnotator;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.application.ReadActionProcessor;
import com.intellij.openapi.application.Result;
import com.intellij.openapi.compiler.*;
import com.intellij.openapi.compiler.options.ExcludesConfiguration;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.vfs.VirtualFile;
@@ -143,41 +141,41 @@ public class InspectionValidatorWrapper implements Validator {
return ProcessingItem.EMPTY_ARRAY;
}
final ExcludesConfiguration excludesConfiguration = ValidationConfiguration.getExcludedEntriesConfiguration(project);
final List<ProcessingItem> items = new ReadAction<List<ProcessingItem>>() {
@Override
protected void run(final Result<List<ProcessingItem>> result) {
final CompileScope compileScope = context.getCompileScope();
if (!myValidator.isAvailableOnScope(compileScope)) return;
final List<ProcessingItem> items =
DumbService.getInstance(project).runReadActionInSmartMode(new Computable<List<ProcessingItem>>() {
@Override
public List<ProcessingItem> compute() {
final CompileScope compileScope = context.getCompileScope();
if (!myValidator.isAvailableOnScope(compileScope)) return null;
final ArrayList<ProcessingItem> items = new ArrayList<ProcessingItem>();
final ArrayList<ProcessingItem> items = new ArrayList<ProcessingItem>();
final Processor<VirtualFile> processor = new ReadActionProcessor<VirtualFile>() {
@Override
public boolean processInReadAction(VirtualFile file) {
if (!file.isValid()) {
return true;
}
if (myCompilerManager.isExcludedFromCompilation(file) ||
excludesConfiguration.isExcluded(file)) {
return true;
}
final Module module = context.getModuleByFile(file);
if (module != null) {
final PsiFile psiFile = myPsiManager.findFile(file);
if (psiFile != null) {
items.add(new MyValidatorProcessingItem(psiFile));
final Processor<VirtualFile> processor = new Processor<VirtualFile>() {
@Override
public boolean process(VirtualFile file) {
if (!file.isValid()) {
return true;
}
}
return true;
}
};
ContainerUtil.process(myValidator.getFilesToProcess(myPsiManager.getProject(), context), processor);
result.setResult(items);
}
}.execute().getResultObject();
if (myCompilerManager.isExcludedFromCompilation(file) ||
excludesConfiguration.isExcluded(file)) {
return true;
}
final Module module = context.getModuleByFile(file);
if (module != null) {
final PsiFile psiFile = myPsiManager.findFile(file);
if (psiFile != null) {
items.add(new MyValidatorProcessingItem(psiFile));
}
}
return true;
}
};
ContainerUtil.process(myValidator.getFilesToProcess(myPsiManager.getProject(), context), processor);
return items;
}
});
if (items == null) return ProcessingItem.EMPTY_ARRAY;
return items.toArray(new ProcessingItem[items.size()]);
@@ -1,19 +1,35 @@
/*
* Copyright 2000-2015 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.resolve.reference.impl.providers;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiPackage;
import com.intellij.psi.impl.source.resolve.reference.impl.providers.PackageReferenceSet;
import com.intellij.util.PatternUtil;
import com.intellij.util.Processor;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.regex.Pattern;
public class PatternPackageReferenceSet extends PackageReferenceSet {
public PatternPackageReferenceSet(String packageName, PsiElement element, int startInElement) {
super(packageName, element, startInElement);
}
@@ -24,7 +40,7 @@ public class PatternPackageReferenceSet extends PackageReferenceSet {
if (packageName.contains("*")) {
final Pattern pattern = PatternUtil.fromMask(packageName);
final Set<PsiPackage> packages = new HashSet<PsiPackage>();
final Set<PsiPackage> packages = new LinkedHashSet<PsiPackage>();
processSubPackages(context, new Processor<PsiPackage>() {
@Override
@@ -39,16 +55,13 @@ public class PatternPackageReferenceSet extends PackageReferenceSet {
return packages;
}
else {
return super.resolvePackageName(context, packageName);
}
return super.resolvePackageName(context, packageName);
}
protected static boolean processSubPackages(final PsiPackage pkg, final Processor<PsiPackage> processor) {
protected static boolean processSubPackages(final PsiPackage pkg, final Processor<PsiPackage> processor) {
if (!processor.process(pkg)) return false;
for (final PsiPackage aPackage : pkg.getSubPackages()) {
if (!processSubPackages(aPackage, processor)) return false;
}
return true;
return ContainerUtil.process(pkg.getSubPackages(), processor);
}
}
@@ -452,12 +452,10 @@ public class TemplateSettings implements PersistentStateComponent<TemplateSettin
}
}
private void readDefTemplate(DefaultLiveTemplatesProvider provider, String defTemplate, boolean registerTemplate)
throws JDOMException, InvalidDataException, IOException {
String templateName = getDefaultTemplateName(defTemplate);
private void readDefTemplate(DefaultLiveTemplatesProvider provider, String defTemplate, boolean registerTemplate) throws JDOMException, InvalidDataException, IOException {
InputStream inputStream = DecodeDefaultsUtil.getDefaultsInputStream(provider, defTemplate);
if (inputStream != null) {
TemplateGroup group = readTemplateFile(JDOMUtil.load(inputStream), templateName, true, registerTemplate, provider.getClass().getClassLoader());
TemplateGroup group = readTemplateFile(JDOMUtil.load(inputStream), getDefaultTemplateName(defTemplate), true, registerTemplate, provider.getClass().getClassLoader());
if (group != null && group.getReplace() != null) {
for (TemplateImpl template : myTemplates.get(group.getReplace())) {
removeTemplate(template);
@@ -281,6 +281,11 @@ public abstract class ComponentStoreImpl implements IComponentStore.Reloadable {
}
Class<T> stateClass = ComponentSerializationUtil.getStateClass(component.getClass());
// todo remove assert before last EAP
if (!stateSpec.defaultStateAsResource() && getDefaultState(component, name, stateClass) != null) {
LOG.error(name + " has default state, but not marked to load it");
}
T state = stateSpec.defaultStateAsResource() ? getDefaultState(component, name, stateClass) : null;
Storage[] storageSpecs = getComponentStorageSpecs(component, stateSpec, StateStorageOperation.READ);
for (Storage storageSpec : storageSpecs) {
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2015 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 org.jetbrains.debugger.sourcemap;
import com.google.gson.stream.JsonToken;
@@ -98,7 +113,7 @@ public final class SourceMapDecoder {
else if (propertyName.equals("sourceRoot")) {
sourceRoot = readSourcePath(reader);
if (sourceRoot != null) {
sourceRoot = UriUtil.trimLeadingSlashes(sourceRoot);
sourceRoot = UriUtil.trimTrailingSlashes(sourceRoot);
}
}
else if (propertyName.equals("sources")) {
@@ -99,7 +99,8 @@ public class SMTRunnerNotificationsHandler extends SMTRunnerEventsAdapter {
type = null;
}
TestStatusListener.notifySuiteFinished(testsRoot, myConsoleProperties.getProject());
// todo: need to provide default implementation before notifying test status listeners to avoid IAE
//TestStatusListener.notifySuiteFinished(testsRoot, myConsoleProperties.getProject());
if (msg != null) {
notify(msg, type, testsRoot);
@@ -76,6 +76,7 @@ public class Configuration extends SimpleModificationTracker implements Persiste
@State(
name = Configuration.COMPONENT_NAME,
defaultStateAsResource = true,
storages = {@Storage(file = StoragePathMacros.APP_CONFIG + "/IntelliLang.xml", scheme = StorageScheme.DIRECTORY_BASED)})
public static class App extends Configuration {
@@ -110,8 +111,10 @@ public class Configuration extends SimpleModificationTracker implements Persiste
return getState(element);
}
}
@State(
name = Configuration.COMPONENT_NAME,
defaultStateAsResource = true,
storages = {
@Storage(file = StoragePathMacros.PROJECT_FILE),
@Storage(file = StoragePathMacros.PROJECT_CONFIG_DIR + "/IntelliLang.xml", scheme = StorageScheme.DIRECTORY_BASED)
@@ -65,6 +65,7 @@ import java.util.Map;
*/
@State(
name = "Palette2",
defaultStateAsResource = true,
storages = {
@Storage(file = StoragePathMacros.PROJECT_FILE),
@Storage(file = StoragePathMacros.PROJECT_CONFIG_DIR + "/uiDesigner.xml", scheme = StorageScheme.DIRECTORY_BASED)