Skip to content

Commit

Permalink
Merge branch 'master' into develar/pwd
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Jul 27, 2016
2 parents 2e886ac + 1b8bfdc commit ddf92b1
Show file tree
Hide file tree
Showing 69 changed files with 779 additions and 629 deletions.
4 changes: 2 additions & 2 deletions .idea/libraries/Guava.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions .idea/libraries/guava_tools.xml

This file was deleted.

10 changes: 10 additions & 0 deletions bin/scripts/win/format.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@ECHO OFF

::----------------------------------------------------------------------
:: @@product_full@@ formatting script.
::----------------------------------------------------------------------

SET DEFAULT_PROJECT_PATH=%CD%

SET IDE_BIN_DIR=%~dp0
CALL "%IDE_BIN_DIR%\@@script_name@@" format %*
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");,
* 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
*
Expand Down Expand Up @@ -123,9 +123,7 @@ class CommunityLibraryLicenses {
licenseUrl: "http://www.gnu.org/licenses/lgpl-2.1.txt"),
libraryLicense(name: "Groovy", version: "2.4.6", license: "Apache 2.0", url: "http://groovy-lang.org/"),
libraryLicense(name: "Gson", version: "2.2.4", libraryName: "gson", license: "Apache 2.0", url: "http://code.google.com/p/google-gson/"),
libraryLicense(name: "Guava", libraryName: "guava-tools", version: "14.0.1", license: "Apache 2.0",
url: "http://code.google.com/p/guava-libraries/", licenseUrl: "http://ant.apache.org/license.html"),
libraryLicense(name: "Guava", version: "17.0", license: "Apache 2.0", url: "http://code.google.com/p/guava-libraries/",
libraryLicense(name: "Guava", version: "19.0", license: "Apache 2.0", url: "http://code.google.com/p/guava-libraries/",
licenseUrl: "http://ant.apache.org/license.html"),
libraryLicense(name: "hamcrest", version: "1.3", license: "BSD", url: "http://hamcrest.org/",
licenseUrl: "http://opensource.org/licenses/BSD-3-Clause"),
Expand Down
Binary file modified build/lib/launcher-generator.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions build/scripts/layouts.gant
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/


import org.jetbrains.intellij.build.BuildContext
import org.jetbrains.intellij.build.BuildOptions
import org.jetbrains.intellij.build.BuildTasks
import org.jetbrains.intellij.build.IdeaCommunityProperties
import org.jetbrains.jps.model.module.JpsModule
import org.jetbrains.jps.util.JpsPathUtil

import static org.jetbrains.jps.idea.IdeaProjectLoader.guessHome
Expand Down Expand Up @@ -952,7 +952,7 @@ def layout_core(String home, String target) {
}

fileset(dir: "$home/lib") {
include(name: "guava-17.0.jar")
include(name: "guava-19.0.jar")
include(name: "picocontainer.jar")
include(name: "trove4j.jar")
include(name: "cli-parser-1.1.jar")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1971,12 +1971,16 @@ protected void action() {
}
}
else {
ProcessHandler processHandler = getProcessHandler();
boolean terminated =
processHandler != null && (processHandler.isProcessTerminating() || processHandler.isProcessTerminated());

fail();
DebuggerInvocationUtil.swingInvokeLater(myProject, () -> {
// propagate exception only in case we succeeded to obtain execution result,
// otherwise if the error is induced by the fact that there is nothing to debug, and there is no need to show
// this problem to the user
if (myExecutionResult != null || !connectorIsReady.get()) {
if ((myExecutionResult != null && !terminated) || !connectorIsReady.get()) {
ExecutionUtil.handleExecutionError(myProject, ToolWindowId.DEBUG, sessionName, e);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ public static boolean methodMatches(@NotNull PsiMethod psiMethod,
DebugProcessImpl process) {
PsiClass containingClass = psiMethod.getContainingClass();
try {
return containingClass != null && Objects.equals(containingClass.getQualifiedName(), className) &&
return containingClass != null && Objects.equals(JVMNameUtil.getClassVMName(containingClass), className) &&
JVMNameUtil.getJVMMethodName(psiMethod).equals(name) &&
JVMNameUtil.getJVMSignature(psiMethod).getName(process).equals(signature);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ protected Cache initEvaluatorAndChildrenExpression(final Project project) {
}
else {
contextClass = DebuggerUtils.findClass(className, project, GlobalSearchScope.allScope(project));
if (contextClass != null) {
contextClass = (PsiClass)contextClass.getNavigationElement();
}
if (contextClass instanceof PsiCompiledElement) {
contextClass = (PsiClass)((PsiCompiledElement)contextClass).getMirror();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 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.
Expand All @@ -20,16 +20,10 @@
import com.intellij.codeInspection.ex.QuickFixWrapper;
import com.intellij.codeInspection.java18StreamApi.StaticPseudoFunctionalStyleMethodInspection;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
import com.intellij.util.PathUtil;
import com.intellij.util.Processor;

import java.io.File;

Expand All @@ -45,10 +39,10 @@ protected String getTestDataPath() {
@Override
protected void tuneFixture(JavaModuleFixtureBuilder moduleBuilder) throws Exception {
moduleBuilder.setLanguageLevel(LanguageLevel.JDK_1_8);
moduleBuilder.addLibraryJars("guava-17.0.jar", PathManager.getHomePath().replace(File.separatorChar, '/') + "/community/lib/",
"guava-17.0.jar");
moduleBuilder.addLibraryJars("guava-17.0.jar-2", PathManager.getHomePath().replace(File.separatorChar, '/') + "/lib/",
"guava-17.0.jar");
moduleBuilder.addLibraryJars("guava-19.0.jar", PathManager.getHomePath().replace(File.separatorChar, '/') + "/community/lib/",
"guava-19.0.jar");
moduleBuilder.addLibraryJars("guava-19.0.jar-2", PathManager.getHomePath().replace(File.separatorChar, '/') + "/lib/",
"guava-19.0.jar");
moduleBuilder.addJdk(IdeaTestUtil.getMockJdk18Path().getPath());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 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.
Expand Down Expand Up @@ -56,7 +56,7 @@ protected String getTestDataPath() {
@Override
protected void tuneFixture(JavaModuleFixtureBuilder moduleBuilder) throws Exception {
moduleBuilder.setLanguageLevel(LanguageLevel.JDK_1_8);
moduleBuilder.addLibraryJars("guava", PathManager.getHomePathFor(Assert.class) + "/lib/", "guava-17.0.jar");
moduleBuilder.addLibraryJars("guava", PathManager.getHomePathFor(Assert.class) + "/lib/", "guava-19.0.jar");
moduleBuilder.addLibraryJars("jsr305", PathManager.getHomePathFor(Assert.class) + "/lib/", "jsr305.jar");
moduleBuilder.addJdk(IdeaTestUtil.getMockJdk18Path().getPath());
}
Expand Down Expand Up @@ -121,7 +121,6 @@ public void testRemoveMethodReferenceForFunctionalInterfaces() {
doTest();
}

//needs Guava 18.0 as dependency
public void _testChainedFluentIterableWithOf() {
doTest();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
public class JsonSchemaFileTypeFactory extends FileTypeFactory {
@Override
public void createFileTypes(@NotNull FileTypeConsumer consumer) {
consumer.consume(JsonSchemaFileType.INSTANCE);
consumer.consume(JsonSchemaFileType.INSTANCE, (String) null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,13 @@ public void testJsonSchemaRefsCrossResolve() throws Exception {

instance.addSchema(inherited);

testIsSchemaFile(moduleFile, "localRefSchema.json");
testIsSchemaFile(moduleFile, "referencingSchema.json");

try {
ApplicationManager.getApplication().runWriteAction(() -> myFileTypeManager.associatePattern(JsonSchemaFileType.INSTANCE, "*Schema.json"));
JsonSchemaService.Impl.get(getProject()).reset();

testIsSchemaFile(moduleFile, "localRefSchema.json");
testIsSchemaFile(moduleFile, "referencingSchema.json");

int offset = myEditor.getCaretModel().getPrimaryCaret().getOffset();
final PsiReference referenceAt = myFile.findReferenceAt(offset);
Assert.assertNotNull(referenceAt);
Expand Down Expand Up @@ -316,24 +316,30 @@ public void testJson2SchemaPropertyResolve() throws Exception {
instance.addSchema(inherited);
JsonSchemaService.Impl.get(getProject()).reset();

int offset = myEditor.getCaretModel().getPrimaryCaret().getOffset();
PsiElement element = myFile.findElementAt(offset);
boolean found = false;
while (element.getTextRange().contains(offset)) {
if (JsonBySchemaObjectReferenceContributor.REF_PATTERN.accepts(element)) {
found = true;
break;
ApplicationManager.getApplication().runWriteAction(() -> myFileTypeManager.associatePattern(JsonSchemaFileType.INSTANCE, "*Schema.json"));
try {

int offset = myEditor.getCaretModel().getPrimaryCaret().getOffset();
PsiElement element = myFile.findElementAt(offset);
boolean found = false;
while (element.getTextRange().contains(offset)) {
if (JsonBySchemaObjectReferenceContributor.REF_PATTERN.accepts(element)) {
found = true;
break;
}
element = element.getParent();
}
element = element.getParent();
}
Assert.assertTrue(found);
final PsiReference referenceAt = myFile.findReferenceAt(offset);
Assert.assertNotNull(referenceAt);
final PsiElement resolve = referenceAt.resolve();
Assert.assertNotNull(resolve);
Assert.assertEquals("\"baseEnum\"", resolve.getText());
Assert.assertEquals("baseProperties.json", resolve.getContainingFile().getName());
Assert.assertTrue(found);
final PsiReference referenceAt = myFile.findReferenceAt(offset);
Assert.assertNotNull(referenceAt);
final PsiElement resolve = referenceAt.resolve();
Assert.assertNotNull(resolve);
Assert.assertEquals("\"baseEnum\"", resolve.getText());
Assert.assertEquals("baseProperties.json", resolve.getContainingFile().getName());

instance.removeSchema(inherited);
} finally {
instance.removeSchema(inherited);
ApplicationManager.getApplication().runWriteAction(() -> myFileTypeManager.removeAssociatedExtension(JsonSchemaFileType.INSTANCE, "*Schema.json"));
}
}
}
Binary file removed lib/guava-17.0.jar
Binary file not shown.
Binary file added lib/guava-19.0.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/required_for_dist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ httpmime-4.4.1.jar
ecj-4.5.2.jar
groovy-all-2.4.6.jar
gson-2.5.jar
guava-17.0.jar
guava-19.0.jar
hamcrest-core-1.3.jar
imgscalr-lib-4.2.jar
batik-all.jar
Expand Down
Binary file removed lib/src/guava-17.0-sources.jar
Binary file not shown.
Binary file added lib/src/guava-19.0-sources.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public static PsiFile getTemplateFile(PsiFile file) {
}
}

public static PsiFile getBaseFile(@NotNull PsiFile file) {
FileViewProvider viewProvider = file.getViewProvider();
return viewProvider.getPsi(viewProvider.getBaseLanguage());
}

public static boolean isInsideTemplateFile(@NotNull PsiElement element) {
return element.getContainingFile().getViewProvider() instanceof TemplateLanguageFileViewProvider;
}
Expand Down
1 change: 0 additions & 1 deletion platform/core-impl/core-impl.iml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@
<orderEntry type="module" module-name="core-api" exported="" />
<orderEntry type="library" name="picocontainer" level="project" />
<orderEntry type="library" name="Guava" level="project" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
</component>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -1155,4 +1155,8 @@ final AstPathPsiMap getRefToPsi() {
public boolean useStrongRefs() {
return myUseStrongRefs;
}

public boolean mayCacheAst() {
return myFileElementBeingLoaded.get() == null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ private static class MilestoneChildPath extends ChildPath {
public CompositeElement getNode() {
CompositeElement node = SoftReference.dereference(myNode);
if (node == null) {
myNode = new WeakReference<CompositeElement>(node = super.getNode());
node = super.getNode();
if (myFile.mayCacheAst()) {
myNode = new WeakReference<CompositeElement>(node);
}
}
return node;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.intellij.ide.ui;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.util.ui.UIUtil;
import sun.swing.SwingUtilities2;

Expand All @@ -26,7 +27,7 @@ public enum AntialiasingType {
OFF("No antialiasing", RenderingHints.VALUE_TEXT_ANTIALIAS_OFF, false);

public static Object getAAHintForSwingComponent() {
UISettings uiSettings = UISettings.getInstance();
UISettings uiSettings = ApplicationManager.getApplication() == null ? null : UISettings.getInstance();
if (uiSettings != null) {
AntialiasingType type = uiSettings.IDE_AA_TYPE;
if (type != null) return type.getTextInfo();
Expand All @@ -35,7 +36,7 @@ public static Object getAAHintForSwingComponent() {
}

public static Object getKeyForCurrentScope(boolean inEditor) {
UISettings uiSettings = UISettings.getInstance();
UISettings uiSettings = ApplicationManager.getApplication() == null ? null : UISettings.getInstance();
if (uiSettings != null) {
AntialiasingType type = inEditor ? uiSettings.EDITOR_AA_TYPE : uiSettings.IDE_AA_TYPE;
if (type != null) return type.myHint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import com.intellij.util.xmlb.annotations.Transient;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import sun.swing.SwingUtilities2;

import javax.swing.*;
Expand All @@ -57,6 +58,7 @@ public class UISettings extends SimpleModificationTracker implements PersistentS

private static UISettings ourSettings;

@Nullable
public static UISettings getInstance() {
return ourSettings = ServiceManager.getService(UISettings.class);
}
Expand All @@ -65,6 +67,7 @@ public static UISettings getInstance() {
* Use this method if you are not sure whether the application is initialized.
* @return persisted UISettings instance or default values.
*/
@NotNull
public static UISettings getShadowInstance() {
Application application = ApplicationManager.getApplication();
UISettings settings = application == null ? null : getInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -818,13 +818,14 @@ public void setInherited(boolean isInherited) {
private static class GetSetColor {
private final ColorKey myKey;
private final EditorColorsScheme myScheme;
private boolean isModified = false;
private final Color myInitialColor;
private Color myColor;

private GetSetColor(ColorKey key, EditorColorsScheme scheme) {
myKey = key;
myScheme = scheme;
myColor = myScheme.getColor(myKey);
myInitialColor = myColor;
}

public Color getColor() {
Expand All @@ -833,7 +834,6 @@ public Color getColor() {

public void setColor(Color col) {
if (getColor() == null || !getColor().equals(col)) {
isModified = true;
myColor = col;
}
}
Expand All @@ -844,7 +844,7 @@ public void apply(EditorColorsScheme scheme) {
}

public boolean isModified() {
return isModified;
return !Comparing.equal(myColor, myInitialColor);
}
}

Expand Down
Loading

0 comments on commit ddf92b1

Please sign in to comment.