result = doTestWriteRead(DefaultLanguageHighlighterColors.INSTANCE_FIELD, USE_INHERITED_MARKER);
+ TextAttributes fallbackAttrs = result.first.getAttributes(DefaultLanguageHighlighterColors.INSTANCE_FIELD.getFallbackAttributeKey());
TextAttributes directlyDefined =
((AbstractColorsScheme)result.first).getDirectlyDefinedAttributes(DefaultLanguageHighlighterColors.INSTANCE_FIELD);
- assertTrue(directlyDefined != null && directlyDefined.isFallbackEnabled());
+ assertTrue(directlyDefined != null && directlyDefined == USE_INHERITED_MARKER);
assertSame(fallbackAttrs, result.second);
}
@@ -283,12 +279,9 @@ public class EditorColorsSchemeImplTest extends EditorColorSchemeTestCase {
EditorColorsScheme editorColorsScheme = new EditorColorsSchemeImpl(parentScheme);
editorColorsScheme.setName("test");
TextAttributes defaultAttributes = new TextAttributes(null, null, Color.BLACK, EffectType.LINE_UNDERSCORE, Font.PLAIN);
- TextAttributes attributes = new TextAttributes(null, null, null, EffectType.BOXED, Font.PLAIN);
- attributes.setEnforceEmpty(false);
- assertTrue(attributes.isFallbackEnabled());
TextAttributesKey testKey = TextAttributesKey.createTextAttributesKey("TEST_KEY", DefaultLanguageHighlighterColors.PARAMETER);
parentScheme.setAttributes(testKey, defaultAttributes);
- editorColorsScheme.setAttributes(testKey, attributes);
+ editorColorsScheme.setAttributes(testKey, USE_INHERITED_MARKER);
try {
Element root = new Element("scheme");
((AbstractColorsScheme)editorColorsScheme).writeExternal(root);
@@ -299,7 +292,7 @@ public class EditorColorsSchemeImplTest extends EditorColorSchemeTestCase {
}
}
TextAttributes targetAttributes = ((AbstractColorsScheme)targetScheme).getDirectlyDefinedAttributes(testKey);
- assertTrue(targetAttributes != null && targetAttributes.isFallbackEnabled());
+ assertTrue(targetAttributes != null && targetAttributes == USE_INHERITED_MARKER);
}
finally {
TextAttributesKey.removeTextAttributesKey(testKey.getExternalName());
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/colors/impl/TextAttributesReaderTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/colors/impl/TextAttributesReaderTest.java
index 7e12efb1702d..a5866deabb4a 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/colors/impl/TextAttributesReaderTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/colors/impl/TextAttributesReaderTest.java
@@ -172,7 +172,6 @@ public final class TextAttributesReaderTest extends LightPlatformTestCase {
assertEquals(expected, actual);
// EditorColorsSchemeImplTest.testWriteInheritedFromDefault
// EditorColorsSchemeImplTest.testWriteInheritedFromDarcula
- assertEquals(expected.isEnforceEmpty(), actual.isEnforceEmpty());
}
@NotNull
diff --git a/platform/projectModel-api/src/com/intellij/openapi/roots/FileIndex.java b/platform/projectModel-api/src/com/intellij/openapi/roots/FileIndex.java
index d2182f033471..0d8def9d6273 100644
--- a/platform/projectModel-api/src/com/intellij/openapi/roots/FileIndex.java
+++ b/platform/projectModel-api/src/com/intellij/openapi/roots/FileIndex.java
@@ -30,7 +30,7 @@ import java.util.Set;
*/
public interface FileIndex {
/**
- * Iterates all files and directories in the content.
+ * Iterates all files and directories under content roots skipping excluded and ignored files and directories.
*
* @param iterator the iterator receiving the files.
* @return false if files processing was stopped ({@link ContentIterator#processFile(VirtualFile)} returned false)
@@ -38,8 +38,8 @@ public interface FileIndex {
boolean iterateContent(@NotNull ContentIterator iterator);
/**
- * Iterates all files and directories in the content under directory dir (including the directory itself).
- * Does not iterate anything if dir is not in the content.
+ * Iterates all files and directories in the content under directory dir (including the directory itself) skipping excluded
+ * and ignored files and directories. Does not iterate anything if dir is not in the content.
*
* @param dir the directory the contents of which is iterated.
* @param iterator the iterator receiving the files.
@@ -48,17 +48,14 @@ public interface FileIndex {
boolean iterateContentUnderDirectory(@NotNull VirtualFile dir, @NotNull ContentIterator iterator);
/**
- * Returns true if fileOrDir is a file or directory under a content root of this
- * project or module.
- *
- * @param fileOrDir the file or directory to check.
- * @return true if the file or directory belongs to a content root, false otherwise.
+ * Returns {@code true} if {@code fileOrDir} is a file or directory under a content root of this project or module and not excluded or
+ * ignored.
*/
boolean isInContent(@NotNull VirtualFile fileOrDir);
/**
- * Returns true if file is a source file which belongs to sources of the content.
- * (Returns true for both source and test source).
+ * Returns {@code true} if {@code fileOrDir} is a file located under a sources, tests or resources root and not excluded or ignored.
+ *
* Note that sometimes a file can belong to the content and be a source file but not belong to sources of the content.
* This happens if sources of some library are located under the content (so they belong to the project content but not as sources).
*
@@ -68,16 +65,12 @@ public interface FileIndex {
boolean isContentSourceFile(@NotNull VirtualFile file);
/**
- * Returns true if fileOrDir is a file or directory from the content source.
- * (Returns true for both source and test source).
- *
- * @param fileOrDir the file or directory to check.
- * @return true if the file or directory belongs to a source or test source root, false otherwise.
+ * Returns {@code true} if {@code fileOrDir} is a file or directory located under a sources, tests or resources root and not excluded or ignored.
*/
boolean isInSourceContent(@NotNull VirtualFile fileOrDir);
/**
- * Returns true if fileOrDir is a file or directory from the test content source
+ * Returns true if {@code fileOrDir} is a file or directory located under a test sources or resources root and not excluded or ignored.
*
* Use this method when you really need to check whether the file is under test roots according to project configuration.
*
@@ -92,10 +85,7 @@ public interface FileIndex {
boolean isInTestSourceContent(@NotNull VirtualFile fileOrDir);
/**
- * Returns true if fileOrDir is a file or directory from the source root which have
- *
- * @param fileOrDir the file or directory to check.
- * @return true if the file or directory belongs to a source root of one of specified types, false otherwise
+ * Returns {@code true} if {@code fileOrDir} is a file or directory located under a source root of type from {@code rootTypes} set and not excluded or ignored
*/
boolean isUnderSourceRootOfType(@NotNull VirtualFile fileOrDir, @NotNull Set extends JpsModuleSourceRootType>> rootTypes);
}
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/FileIndexBase.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/FileIndexBase.java
index c0ca9d99a3bd..25be05c4013f 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/FileIndexBase.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/FileIndexBase.java
@@ -2,8 +2,10 @@ package com.intellij.openapi.roots.impl;
import com.intellij.injected.editor.VirtualFileWindow;
import com.intellij.openapi.fileTypes.FileTypeRegistry;
+import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.FileIndex;
+import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
@@ -33,4 +35,9 @@ public abstract class FileIndexBase implements FileIndex {
!myFileTypeRegistry.isFileIgnored(file) &&
isInSourceContent(file);
}
+
+ @NotNull
+ protected static VirtualFile[][] getModuleContentAndSourceRoots(Module module) {
+ return new VirtualFile[][]{ModuleRootManager.getInstance(module).getContentRoots(), ModuleRootManager.getInstance(module).getSourceRoots()};
+ }
}
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleFileIndexImpl.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleFileIndexImpl.java
index 1ea6a212a9c5..829c77a7420a 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleFileIndexImpl.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleFileIndexImpl.java
@@ -45,23 +45,23 @@ public class ModuleFileIndexImpl extends FileIndexBase implements ModuleFileInde
@Override
public boolean iterateContent(@NotNull ContentIterator iterator) {
- final List contentRoots = ApplicationManager.getApplication().runReadAction(new Computable>() {
- @Override
- public List compute() {
- if (myModule.isDisposed()) return Collections.emptyList();
-
- List result = ContainerUtil.newArrayList();
- for (VirtualFile contentRoot : ModuleRootManager.getInstance(myModule).getContentRoots()) {
- VirtualFile parent = contentRoot.getParent();
+ final Set contentRoots = ApplicationManager.getApplication().runReadAction((Computable>)() -> {
+ if (myModule.isDisposed()) return Collections.emptySet();
+
+ Set result = new LinkedHashSet<>();
+ VirtualFile[][] allRoots = getModuleContentAndSourceRoots(myModule);
+ for (VirtualFile[] roots : allRoots) {
+ for (VirtualFile root : roots) {
+ VirtualFile parent = root.getParent();
if (parent != null) {
DirectoryInfo parentInfo = myDirectoryIndex.getInfoForFile(parent);
if (parentInfo.isInProject() && myModule.equals(parentInfo.getModule())) continue; // inner content - skip it
}
- result.add(contentRoot);
+ result.add(root);
}
-
- return result;
}
+
+ return result;
});
for (VirtualFile contentRoot : contentRoots) {
boolean finished = VfsUtilCore.iterateChildrenRecursively(contentRoot, myContentFilter, iterator);
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java
index 1fadbde8a58e..f477dc6c04c8 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java
@@ -38,6 +38,7 @@ import org.jetbrains.jps.model.java.JavaModuleSourceRootTypes;
import org.jetbrains.jps.model.module.JpsModuleSourceRootType;
import java.util.Collections;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
@@ -54,12 +55,7 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
@Override
public boolean iterateContent(@NotNull ContentIterator iterator) {
- Module[] modules = ApplicationManager.getApplication().runReadAction(new Computable() {
- @Override
- public Module[] compute() {
- return ModuleManager.getInstance(myProject).getModules();
- }
- });
+ Module[] modules = ApplicationManager.getApplication().runReadAction((Computable)() -> ModuleManager.getInstance(myProject).getModules());
for (final Module module : modules) {
for (VirtualFile contentRoot : getRootsToIterate(module)) {
boolean finished = VfsUtilCore.iterateChildrenRecursively(contentRoot, myContentFilter, iterator);
@@ -70,28 +66,27 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
return true;
}
- private List getRootsToIterate(final Module module) {
- return ApplicationManager.getApplication().runReadAction(new Computable>() {
- @Override
- public List compute() {
- if (module.isDisposed()) return Collections.emptyList();
+ private Set getRootsToIterate(final Module module) {
+ return ApplicationManager.getApplication().runReadAction((Computable>)() -> {
+ if (module.isDisposed()) return Collections.emptySet();
- List result = ContainerUtil.newArrayList();
- for (VirtualFile contentRoot : ModuleRootManager.getInstance(module).getContentRoots()) {
- DirectoryInfo info = getInfoForFileOrDirectory(contentRoot);
+ Set result = new LinkedHashSet<>();
+ for (VirtualFile[] roots : getModuleContentAndSourceRoots(module)) {
+ for (VirtualFile root : roots) {
+ DirectoryInfo info = getInfoForFileOrDirectory(root);
if (!info.isInProject()) continue; // is excluded or ignored
if (!module.equals(info.getModule())) continue; // maybe 2 modules have the same content root?
- VirtualFile parent = contentRoot.getParent();
+ VirtualFile parent = root.getParent();
if (parent != null) {
DirectoryInfo parentInfo = getInfoForFileOrDirectory(parent);
if (parentInfo.isInProject() && parentInfo.getModule() != null) continue;
}
- result.add(contentRoot);
+ result.add(root);
}
-
- return result;
}
+
+ return result;
});
}
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/RootIndex.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/RootIndex.java
index 31831cc1b52e..de0ea2adcf33 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/RootIndex.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/RootIndex.java
@@ -367,7 +367,7 @@ public class RootIndex {
@Nullable VirtualFile librarySourceRoot = myRootInfo.findLibraryRootInfo(roots, true);
result.addAll(myRootInfo.getLibraryOrderEntries(roots, libraryClassRoot, librarySourceRoot, myLibClassRootEntries, myLibSourceRootEntries));
- VirtualFile moduleContentRoot = myRootInfo.findModuleRootInfo(roots);
+ VirtualFile moduleContentRoot = myRootInfo.findNearestContentRoot(roots);
if (moduleContentRoot != null) {
ContainerUtil.addIfNotNull(result, myRootInfo.getModuleSourceEntry(roots, moduleContentRoot, myLibClassRootEntries));
}
@@ -541,16 +541,39 @@ public class RootIndex {
return result;
}
+ /**
+ * Returns nearest content root for a file by its parent directories hierarchy. If the file is excluded (i.e. located under an excluded
+ * root and there are no source roots on the path to the excluded root) returns {@code null}.
+ */
@Nullable
- private VirtualFile findModuleRootInfo(@NotNull List hierarchy) {
+ private VirtualFile findNearestContentRoot(@NotNull List hierarchy) {
+ Collection sourceRootOwners = null;
+ boolean underExcludedSourceRoot = false;
for (VirtualFile root : hierarchy) {
Module module = contentRootOf.get(root);
Module excludedFrom = excludedFromModule.get(root);
- if (module != null && excludedFrom != module) {
+ if (module != null && (excludedFrom != module || underExcludedSourceRoot && sourceRootOwners.contains(module))) {
return root;
}
if (excludedFrom != null || excludedFromProject.contains(root)) {
- return null;
+ if (sourceRootOwners != null) {
+ underExcludedSourceRoot = true;
+ }
+ else {
+ return null;
+ }
+ }
+
+ if (!underExcludedSourceRoot && sourceRootOf.containsKey(root)) {
+ Collection modulesForSourceRoot = sourceRootOf.get(root);
+ if (!modulesForSourceRoot.isEmpty()) {
+ if (sourceRootOwners == null) {
+ sourceRootOwners = modulesForSourceRoot;
+ }
+ else {
+ sourceRootOwners = ContainerUtil.union(sourceRootOwners, modulesForSourceRoot);
+ }
+ }
}
}
return null;
@@ -662,7 +685,7 @@ public class RootIndex {
private static Pair calcDirectoryInfo(@NotNull final VirtualFile root,
@NotNull final List hierarchy,
@NotNull RootInfo info) {
- VirtualFile moduleContentRoot = info.findModuleRootInfo(hierarchy);
+ VirtualFile moduleContentRoot = info.findNearestContentRoot(hierarchy);
VirtualFile libraryClassRoot = info.findLibraryRootInfo(hierarchy, false);
VirtualFile librarySourceRoot = info.findLibraryRootInfo(hierarchy, true);
boolean inProject = moduleContentRoot != null || libraryClassRoot != null || librarySourceRoot != null;
diff --git a/platform/remote-servers/api/src/com/intellij/remoteServer/configuration/ServerConfiguration.java b/platform/remote-servers/api/src/com/intellij/remoteServer/configuration/ServerConfiguration.java
index 255bdb834480..cd4c661c0f38 100644
--- a/platform/remote-servers/api/src/com/intellij/remoteServer/configuration/ServerConfiguration.java
+++ b/platform/remote-servers/api/src/com/intellij/remoteServer/configuration/ServerConfiguration.java
@@ -1,10 +1,16 @@
package com.intellij.remoteServer.configuration;
import com.intellij.openapi.components.PersistentStateComponent;
+import org.jetbrains.annotations.Nullable;
/**
* @author nik
*/
public abstract class ServerConfiguration {
public abstract PersistentStateComponent> getSerializer();
+
+ @Nullable
+ public String getCustomToolWindowId() {
+ return null;
+ }
}
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/DefaultRemoteServersViewContribution.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/DefaultRemoteServersViewContribution.java
index f3c44c154990..a2ea8089463e 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/DefaultRemoteServersViewContribution.java
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/DefaultRemoteServersViewContribution.java
@@ -17,12 +17,9 @@ package com.intellij.remoteServer.impl.runtime.ui;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Condition;
import com.intellij.remoteServer.configuration.RemoteServer;
-import com.intellij.remoteServer.configuration.RemoteServersManager;
import com.intellij.remoteServer.impl.runtime.ui.tree.TreeBuilderBase;
import com.intellij.ui.treeStructure.Tree;
-import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -82,6 +79,6 @@ public class DefaultRemoteServersViewContribution extends RemoteServersViewContr
@Override
public List> getRemoteServers() {
- return ContainerUtil.filter(RemoteServersManager.getInstance().getServers(), server -> server.getType().getCustomToolWindowId() == null);
+ return getRemoteServersByToolWindowId(null);
}
}
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/RemoteServersViewContribution.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/RemoteServersViewContribution.java
index 72f6768cba32..5a59656748d7 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/RemoteServersViewContribution.java
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/RemoteServersViewContribution.java
@@ -18,10 +18,13 @@ package com.intellij.remoteServer.impl.runtime.ui;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.openapi.project.Project;
import com.intellij.remoteServer.configuration.RemoteServer;
+import com.intellij.remoteServer.configuration.RemoteServersManager;
import com.intellij.remoteServer.impl.runtime.ui.tree.ServersTreeNodeSelector;
import com.intellij.remoteServer.impl.runtime.ui.tree.ServersTreeStructure;
import com.intellij.remoteServer.runtime.ServerConnection;
+import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.List;
@@ -58,4 +61,14 @@ public abstract class RemoteServersViewContribution extends RemoteServersViewCon
}
};
}
+
+ public static String getRemoteServerToolWindowId(RemoteServer> server) {
+ String serverToolWindowId = server.getConfiguration().getCustomToolWindowId();
+ return serverToolWindowId != null ? serverToolWindowId : server.getType().getCustomToolWindowId();
+ }
+
+ protected static List> getRemoteServersByToolWindowId(@Nullable String toolWindowId) {
+ return ContainerUtil.filter(RemoteServersManager.getInstance().getServers(),
+ server -> getRemoteServerToolWindowId(server) == toolWindowId);
+ }
}
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/RemoteServersViewImpl.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/RemoteServersViewImpl.java
index e4bd3b0f7cd8..df77826516ae 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/RemoteServersViewImpl.java
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ui/RemoteServersViewImpl.java
@@ -52,7 +52,7 @@ public class RemoteServersViewImpl extends RemoteServersView {
}
private static String getToolWindowId(ServerConnection> connection) {
- String customToolWindowId = connection.getServer().getType().getCustomToolWindowId();
+ String customToolWindowId = RemoteServersViewContribution.getRemoteServerToolWindowId(connection.getServer());
return StringUtil.notNullize(customToolWindowId, DefaultServersToolWindowManager.WINDOW_ID);
}
}
diff --git a/platform/testFramework/src/com/intellij/projectView/TestProjectTreeStructure.java b/platform/testFramework/src/com/intellij/projectView/TestProjectTreeStructure.java
index a1bd02b83d5c..eee966b1386b 100644
--- a/platform/testFramework/src/com/intellij/projectView/TestProjectTreeStructure.java
+++ b/platform/testFramework/src/com/intellij/projectView/TestProjectTreeStructure.java
@@ -15,6 +15,7 @@
*/
package com.intellij.projectView;
+import com.intellij.ide.projectView.ProjectViewSettings;
import com.intellij.ide.projectView.impl.AbstractProjectTreeStructure;
import com.intellij.ide.projectView.impl.AbstractProjectViewPSIPane;
import com.intellij.openapi.Disposable;
@@ -25,7 +26,8 @@ import com.intellij.psi.PsiElement;
import com.intellij.testFramework.ProjectViewTestUtil;
import org.junit.Assert;
-public class TestProjectTreeStructure extends AbstractProjectTreeStructure implements Disposable {
+public class TestProjectTreeStructure extends AbstractProjectTreeStructure implements Disposable, ProjectViewSettings {
+ private boolean myShowExcludedFiles = true;
protected boolean myShowMembers = false;
protected boolean myHideEmptyMiddlePackages;
protected boolean myFlattenPackages;
@@ -74,6 +76,11 @@ public class TestProjectTreeStructure extends AbstractProjectTreeStructure imple
return myShowLibraryContents;
}
+ @Override
+ public boolean isShowExcludedFiles() {
+ return myShowExcludedFiles;
+ }
+
@Override
public boolean isShowModules() {
return true;
@@ -91,6 +98,10 @@ public class TestProjectTreeStructure extends AbstractProjectTreeStructure imple
myFlattenPackages = flattenPackages;
}
+ public void hideExcludedFiles() {
+ myShowExcludedFiles = false;
+ }
+
public void setShowLibraryContents(boolean showLibraryContents) {
myShowLibraryContents = showLibraryContents;
}
diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties
index 03d437856f27..3a1526a70026 100644
--- a/platform/util/resources/misc/registry.properties
+++ b/platform/util/resources/misc/registry.properties
@@ -830,6 +830,8 @@ ide.text.effect.new=true
ide.text.effect.new.description=Enables new effect painter for text
ide.text.effect.new.scale=true
ide.text.effect.new.scale.description=Enables scalable effect painter for text
+ide.text.effect.new.metrics=true
+ide.text.effect.new.metrics.description=Use line metrics to calculate text offset in the effect painter
ide.intellij.laf.win10.ui=false
ide.intellij.laf.win10.ui.description=Enables Windows 10 look
diff --git a/platform/util/src/com/intellij/icons/AllIcons.java b/platform/util/src/com/intellij/icons/AllIcons.java
index 8f2be85a9d4d..249ff563b2d4 100644
--- a/platform/util/src/com/intellij/icons/AllIcons.java
+++ b/platform/util/src/com/intellij/icons/AllIcons.java
@@ -783,7 +783,7 @@ public class AllIcons {
public static final Icon DeleteContentFolderRollover = IconLoader.getIcon("/modules/deleteContentFolderRollover.png"); // 9x9
public static final Icon DeleteContentRoot = IconLoader.getIcon("/modules/deleteContentRoot.png"); // 9x9
public static final Icon DeleteContentRootRollover = IconLoader.getIcon("/modules/deleteContentRootRollover.png"); // 9x9
- public static final Icon Edit = IconLoader.getIcon("/modules/edit.png"); // 14x14
+ public static final Icon Edit = IconLoader.getIcon("/modules/edit.png"); // 16x16
public static final Icon EditFolder = IconLoader.getIcon("/modules/editFolder.png"); // 16x16
public static final Icon ExcludedGeneratedRoot = IconLoader.getIcon("/modules/excludedGeneratedRoot.png"); // 16x16
public static final Icon ExcludeRoot = IconLoader.getIcon("/modules/excludeRoot.png"); // 16x16
@@ -828,7 +828,7 @@ public class AllIcons {
public static final Icon Annotationtype = IconLoader.getIcon("/nodes/annotationtype.png"); // 16x16
public static final Icon AnonymousClass = IconLoader.getIcon("/nodes/anonymousClass.png"); // 16x16
public static final Icon Artifact = IconLoader.getIcon("/nodes/artifact.png"); // 16x16
- public static final Icon Aspect = IconLoader.getIcon("/nodes/aspect.png"); // 14x14
+ public static final Icon Aspect = IconLoader.getIcon("/nodes/aspect.png"); // 16x16
public static final Icon C_plocal = IconLoader.getIcon("/nodes/c_plocal.png"); // 16x16
public static final Icon C_private = IconLoader.getIcon("/nodes/c_private.png"); // 16x16
public static final Icon C_protected = IconLoader.getIcon("/nodes/c_protected.png"); // 16x16
@@ -887,9 +887,9 @@ public class AllIcons {
public static final Icon Component = IconLoader.getIcon("/nodes/jsf/component.png"); // 16x16
public static final Icon Converter = IconLoader.getIcon("/nodes/jsf/converter.png"); // 16x16
public static final Icon General = IconLoader.getIcon("/nodes/jsf/general.png"); // 16x16
- public static final Icon GenericValue = IconLoader.getIcon("/nodes/jsf/genericValue.png"); // 18x18
+ public static final Icon GenericValue = IconLoader.getIcon("/nodes/jsf/genericValue.png"); // 16x16
public static final Icon ManagedBean = IconLoader.getIcon("/nodes/jsf/managedBean.png"); // 16x16
- public static final Icon NavigationCase = IconLoader.getIcon("/nodes/jsf/navigationCase.png"); // 18x18
+ public static final Icon NavigationCase = IconLoader.getIcon("/nodes/jsf/navigationCase.png"); // 16x16
public static final Icon NavigationRule = IconLoader.getIcon("/nodes/jsf/navigationRule.png"); // 16x16
public static final Icon Renderer = IconLoader.getIcon("/nodes/jsf/renderer.png"); // 16x16
public static final Icon RenderKit = IconLoader.getIcon("/nodes/jsf/renderKit.png"); // 16x16
@@ -909,9 +909,9 @@ public class AllIcons {
public static final Icon Module = IconLoader.getIcon("/nodes/Module.png"); // 16x16
public static final Icon ModuleGroup = IconLoader.getIcon("/nodes/moduleGroup.png"); // 16x16
public static final Icon NativeLibrariesFolder = IconLoader.getIcon("/nodes/nativeLibrariesFolder.png"); // 16x16
- public static final Icon NewException = IconLoader.getIcon("/nodes/newException.png"); // 14x14
+ public static final Icon NewException = IconLoader.getIcon("/nodes/newException.png"); // 16x16
public static final Icon NewFolder = IconLoader.getIcon("/nodes/newFolder.png"); // 16x16
- public static final Icon NewParameter = IconLoader.getIcon("/nodes/newParameter.png"); // 14x14
+ public static final Icon NewParameter = IconLoader.getIcon("/nodes/newParameter.png"); // 16x16
public static final Icon NodePlaceholder = IconLoader.getIcon("/nodes/nodePlaceholder.png"); // 16x16
public static final Icon Package = IconLoader.getIcon("/nodes/package.png"); // 16x16
public static final Icon Padlock = IconLoader.getIcon("/nodes/padlock.png"); // 16x16
diff --git a/platform/util/src/com/intellij/util/containers/ContainerUtil.java b/platform/util/src/com/intellij/util/containers/ContainerUtil.java
index 8e40d738099b..1fed757d77e8 100644
--- a/platform/util/src/com/intellij/util/containers/ContainerUtil.java
+++ b/platform/util/src/com/intellij/util/containers/ContainerUtil.java
@@ -450,6 +450,12 @@ public class ContainerUtil extends ContainerUtilRt {
@NotNull
@Contract(pure=true)
public static Set union(@NotNull Set set, @NotNull Set set2) {
+ return union((Collection)set, set2);
+ }
+
+ @NotNull
+ @Contract(pure=true)
+ public static Set union(@NotNull Collection set, @NotNull Collection set2) {
Set result = new THashSet(set.size() + set2.size());
result.addAll(set);
result.addAll(set2);
diff --git a/platform/util/src/com/intellij/util/containers/JBIterable.java b/platform/util/src/com/intellij/util/containers/JBIterable.java
index 89b2c156c3b8..7e36e16c9780 100644
--- a/platform/util/src/com/intellij/util/containers/JBIterable.java
+++ b/platform/util/src/com/intellij/util/containers/JBIterable.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 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.
@@ -161,7 +161,7 @@ public abstract class JBIterable implements Iterable {
*/
@NotNull
public static JBIterable of(@Nullable E... elements) {
- return elements == null ? JBIterable.empty() : from(ContainerUtilRt.newArrayList(elements));
+ return elements == null || elements.length == 0 ? JBIterable.empty() : from(ContainerUtilRt.newArrayList(elements));
}
private static final JBIterable EMPTY = new JBIterable() {
@@ -363,7 +363,7 @@ public abstract class JBIterable implements Iterable {
/**
* Returns a {@code JBIterable} that applies {@code function} to each element of this
- * iterable and concats the produced iterables in one.
+ * iterable and concatenates the produced iterables in one.
*
* The returned iterable's iterator supports {@code remove()} if an underlying iterable's
* iterator does. After a successful {@code remove()} call, this iterable no longer
diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java
index 7d19d9138691..4390e42ba525 100644
--- a/platform/util/src/com/intellij/util/ui/UIUtil.java
+++ b/platform/util/src/com/intellij/util/ui/UIUtil.java
@@ -2360,7 +2360,7 @@ public class UIUtil {
public static HTMLEditorKit getHTMLEditorKit(boolean noGapsBetweenParagraphs) {
Font font = getLabelFont();
@NonNls String family = !SystemInfo.isWindows && font != null ? font.getFamily() : "Tahoma";
- int size = font != null ? font.getSize() : JBUI.scale(11);
+ final int size = font != null ? font.getSize() : JBUI.scale(11);
String customCss = String.format("body, div, p { font-family: %s; font-size: %s; }", family, size);
if (noGapsBetweenParagraphs) {
@@ -2370,7 +2370,7 @@ public class UIUtil {
final StyleSheet style = new StyleSheet();
style.addStyleSheet(isUnderDarcula() ? (StyleSheet)UIManager.getDefaults().get("StyledEditorKit.JBDefaultStyle") : DEFAULT_HTML_KIT_CSS);
style.addRule(customCss);
- scaleStyleSheetFontSize(style);
+ scaleStyleSheetFontSize(style, size);
return new HTMLEditorKit() {
@@ -2378,7 +2378,7 @@ public class UIUtil {
public Document createDefaultDocument() {
Document document = super.createDefaultDocument();
if (document instanceof HTMLDocument) {
- scaleStyleSheetFontSize(((HTMLDocument)document).getStyleSheet());
+ scaleStyleSheetFontSize(((HTMLDocument)document).getStyleSheet(), size);
}
return document;
}
@@ -2390,17 +2390,11 @@ public class UIUtil {
};
}
- private static void scaleStyleSheetFontSize(@Nullable StyleSheet styleSheet) {
- if (styleSheet == null) {
- return;
- }
- // 'baseFontSize' equals to javax.swing.text.html.StyleSheet.sizeMapDefault[3],
- // where '3' == javax.swing.text.html.CSS.baseFontSizeIndex
- // See javax.swing.text.html.StyleSheet.rebaseSizeMap()
- int baseFontSize = 14;
- int scaledBaseFontSize = JBUI.scaleFontSize(baseFontSize);
- if (baseFontSize != scaledBaseFontSize) {
- styleSheet.addRule("BASE_SIZE " + scaledBaseFontSize);
+ private static void scaleStyleSheetFontSize(@Nullable StyleSheet styleSheet, int bodyFontSize) {
+ // In compliance with javax.swing.text.html.StyleSheet logic, where 14pt font size is specified in
+ // javax/swing/text/html/default.css and javax.swing.text.html.StyleSheet.sizeMapDefault[3].
+ if (styleSheet != null) {
+ styleSheet.addRule("BASE_SIZE " + bodyFontSize);
}
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java
index b75d14bb19aa..7613749fa73f 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java
@@ -1010,7 +1010,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
JScrollPane optionsPane = ScrollPaneFactory.createScrollPane(myAdditionalOptionsPanel, true);
JPanel infoPanel = JBUI.Panels.simplePanel(optionsPane).withBorder(JBUI.Borders.emptyLeft(10));
- mainPanel = new JPanel(new MyOptionsLayout(mySplitter, infoPanel, JBUI.scale(250)));
+ mainPanel = new JPanel(new MyOptionsLayout(mySplitter, infoPanel, JBUI.scale(150), JBUI.scale(400)));
mainPanel.add(mySplitter);
mainPanel.add(infoPanel);
} else {
@@ -1348,11 +1348,13 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
private final JComponent myPanel;
private final JComponent myOptions;
private final int myMinOptionsWidth;
+ private final int myMaxOptionsWidth;
- public MyOptionsLayout(@NotNull JComponent panel, @NotNull JComponent options, int minOptionsWidth) {
+ public MyOptionsLayout(@NotNull JComponent panel, @NotNull JComponent options, int minOptionsWidth, int maxOptionsWidth) {
myPanel = panel;
myOptions = options;
myMinOptionsWidth = minOptionsWidth;
+ myMaxOptionsWidth = maxOptionsWidth;
}
@Override
@@ -1365,9 +1367,8 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
@Override
public void layoutContainer(Container parent) {
Rectangle bounds = parent.getBounds();
- int availableWidth = bounds.width - myPanel.getPreferredSize().width;
int preferredWidth = myOptions.getPreferredSize().width;
- int optionsWidth = Math.max(Math.min(availableWidth, preferredWidth), myMinOptionsWidth);
+ int optionsWidth = Math.max(Math.min(myMaxOptionsWidth, preferredWidth), myMinOptionsWidth);
myPanel.setBounds(new Rectangle(0, 0, bounds.width - optionsWidth, bounds.height));
myOptions.setBounds(new Rectangle(bounds.width - optionsWidth, 0, optionsWidth, bounds.height));
}
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java
index 6cd606885e80..3533019d82b6 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java
@@ -17,15 +17,12 @@ package com.intellij.vcs.log.ui.frame;
import com.google.common.primitives.Ints;
import com.intellij.ide.CopyProvider;
-import com.intellij.ide.IdeTooltip;
-import com.intellij.ide.IdeTooltipManager;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.DataProvider;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.ide.CopyPasteManager;
import com.intellij.openapi.ui.LoadingDecorator;
-import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Couple;
import com.intellij.openapi.util.Pair;
@@ -33,7 +30,6 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.*;
import com.intellij.ui.components.JBLabel;
-import com.intellij.ui.components.panels.Wrapper;
import com.intellij.ui.table.JBTable;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.text.DateFormatUtil;
@@ -59,7 +55,6 @@ import com.intellij.vcs.log.ui.VcsLogUiImpl;
import com.intellij.vcs.log.ui.render.GraphCommitCell;
import com.intellij.vcs.log.ui.render.GraphCommitCellRenderer;
import com.intellij.vcs.log.ui.tables.GraphTableModel;
-import com.intellij.vcs.log.util.VcsUserUtil;
import gnu.trove.TIntHashSet;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -74,7 +69,9 @@ import java.awt.datatransfer.StringSelection;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseEvent;
-import java.util.*;
+import java.util.Collection;
+import java.util.Date;
+import java.util.EventObject;
import java.util.List;
public class VcsLogGraphTable extends TableWithProgress implements DataProvider, CopyProvider {
@@ -94,6 +91,7 @@ public class VcsLogGraphTable extends TableWithProgress implements DataProvider,
@NotNull private final TableCellRenderer myDummyRenderer = new DefaultTableCellRenderer();
@NotNull private final GraphCommitCellRenderer myGraphCommitCellRenderer;
@NotNull private final GraphTableController myController;
+ private final StringCellRenderer myStringCellRenderer;
private boolean myColumnsSizeInitialized = false;
@Nullable private Selection mySelection = null;
@@ -113,12 +111,13 @@ public class VcsLogGraphTable extends TableWithProgress implements DataProvider,
myUi = ui;
myLogData = logData;
myGraphCommitCellRenderer = new GraphCommitCellRenderer(logData, myGraphCellPainter, this);
+ myStringCellRenderer = new StringCellRenderer();
myLogData.getProgress().addProgressIndicatorListener(new MyProgressListener(), ui);
setDefaultRenderer(VirtualFile.class, new RootCellRenderer(myUi));
setDefaultRenderer(GraphCommitCell.class, myGraphCommitCellRenderer);
- setDefaultRenderer(String.class, new StringCellRenderer());
+ setDefaultRenderer(String.class, myStringCellRenderer);
setShowHorizontalLines(false);
setIntercellSpacing(JBUI.emptySize());
@@ -187,11 +186,13 @@ public class VcsLogGraphTable extends TableWithProgress implements DataProvider,
maxWidth = Math.max(getFontMetrics(tableFont.deriveFont(Font.BOLD)).stringWidth(value), maxWidth);
if (!value.isEmpty()) sizeCalculated = true;
}
- int min = Math.min(maxWidth + UIUtil.DEFAULT_HGAP, MAX_DEFAULT_AUTHOR_COLUMN_WIDTH);
+ int min =
+ Math.min(maxWidth + UIUtil.DEFAULT_HGAP, MAX_DEFAULT_AUTHOR_COLUMN_WIDTH + myStringCellRenderer.getHorizontalTextPadding());
column.setPreferredWidth(min);
}
else if (i == GraphTableModel.DATE_COLUMN) { // all dates have nearly equal sizes
- int min = getFontMetrics(tableFont.deriveFont(Font.BOLD)).stringWidth("mm" + DateFormatUtil.formatDateTime(new Date()));
+ int min = getFontMetrics(tableFont.deriveFont(Font.BOLD)).stringWidth(DateFormatUtil.formatDateTime(new Date())) +
+ myStringCellRenderer.getHorizontalTextPadding();
column.setPreferredWidth(min);
}
}
@@ -645,7 +646,12 @@ public class VcsLogGraphTable extends TableWithProgress implements DataProvider,
return;
}
append(value.toString(), applyHighlighters(this, row, column, value.toString(), hasFocus, selected));
- setBorder(null);
+ }
+
+ public int getHorizontalTextPadding() {
+ Insets borderInsets = getMyBorder().getBorderInsets(this);
+ Insets ipad = getIpad();
+ return borderInsets.left + borderInsets.right + ipad.left + ipad.right;
}
}
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/CyclicClassDependencyInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/CyclicClassDependencyInspection.java
index c7d2cbf70388..3f774dbbc813 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/CyclicClassDependencyInspection.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/CyclicClassDependencyInspection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2015 Dave Griffith, Bas Leijdekkers
+ * Copyright 2006-2016 Dave Griffith, Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@ import com.intellij.codeInspection.*;
import com.intellij.codeInspection.reference.RefClass;
import com.intellij.codeInspection.reference.RefEntity;
import com.intellij.codeInspection.util.RefEntityAlphabeticalComparator;
-import com.intellij.psi.PsiAnonymousClass;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.siyeh.InspectionGadgetsBundle;
@@ -51,8 +50,7 @@ public class CyclicClassDependencyInspection extends BaseGlobalInspection {
return null;
}
final RefClass refClass = (RefClass)refEntity;
- final PsiClass aClass = refClass.getElement();
- if (aClass == null || aClass.getContainingClass() != null || aClass instanceof PsiAnonymousClass) {
+ if (refClass.isAnonymous() || refClass.isLocalClass() || refClass.isSyntheticJSP()) {
return null;
}
final Set dependencies = DependencyUtils.calculateTransitiveDependenciesForClass(refClass);
@@ -79,6 +77,10 @@ public class CyclicClassDependencyInspection extends BaseGlobalInspection {
errorString = InspectionGadgetsBundle.message("cyclic.class.dependency.problem.descriptor",
refEntity.getName(), Integer.valueOf(numMutualDependents));
}
+ final PsiClass aClass = refClass.getElement();
+ if (aClass == null) {
+ return null;
+ }
final PsiElement anchor = aClass.getNameIdentifier();
if (anchor == null) return null;
return new CommonProblemDescriptor[]{
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/DependencyUtils.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/DependencyUtils.java
index 302574bd4b03..c539cd96b92d 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/DependencyUtils.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/DependencyUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2013 Dave Griffith, Bas Leijdekkers
+ * Copyright 2006-2016 Dave Griffith, Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,10 +43,8 @@ public class DependencyUtils {
private DependencyUtils() {
}
- public static Set calculateDependenciesForClass(
- RefClass refClass) {
- final Set dependencies =
- refClass.getUserData(DEPENDENCY_CLASSES_KEY);
+ public static Set calculateDependenciesForClass(RefClass refClass) {
+ final Set dependencies = refClass.getUserData(DEPENDENCY_CLASSES_KEY);
if (dependencies != null) {
return dependencies;
}
@@ -57,40 +55,32 @@ public class DependencyUtils {
return newDependencies;
}
- @SuppressWarnings({"MethodWithMultipleLoops"})
- static void tabulateDependencyClasses(RefJavaElement element,
- Set dependencies) {
- final Collection references = element.getOutReferences();
- final RefJavaUtil refUtil = RefJavaUtil.getInstance();
- for (RefElement reference : references) {
- final RefClass refClass = refUtil.getTopLevelClass(reference);
- if (refClass != null) {
- dependencies.add(refClass);
- }
- }
- final Collection typeReferences =
- element.getOutTypeReferences();
- for (RefElement reference : typeReferences) {
- final RefClass refClass = refUtil.getTopLevelClass(reference);
- if (refClass != null) {
- dependencies.add(refClass);
- }
- }
+ private static void tabulateDependencyClasses(RefJavaElement element, Set dependencies) {
+ addOwnerClassesToSet(element.getOutReferences(), dependencies);
+ addOwnerClassesToSet(element.getOutTypeReferences(), dependencies);
final List children = element.getChildren();
if (children == null) {
return;
}
for (RefEntity child : children) {
- if (child instanceof RefJavaElement) {
+ if (child instanceof RefJavaElement && !(child instanceof RefClass)) {
tabulateDependencyClasses((RefJavaElement)child, dependencies);
}
}
}
- public static Set calculateTransitiveDependenciesForClass(
- RefClass refClass) {
- final Set