Merge remote-tracking branch 'origin/master'
authorDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Sun, 9 Oct 2016 10:08:39 +0000 (12:08 +0200)
committerDmitry Trofimov <dmitry.trofimov@jetbrains.com>
Sun, 9 Oct 2016 10:08:39 +0000 (12:08 +0200)
71 files changed:
java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaExportsStatementElementType.java
java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaRequiresStatementElementType.java
java/java-tests/testSrc/com/intellij/psi/JavaStubBuilderTest.java
platform/icons/src/vcs/Shelve.png [new file with mode: 0644]
platform/icons/src/vcs/Shelve@2x.png [new file with mode: 0644]
platform/icons/src/vcs/Shelve@2x_dark.png [new file with mode: 0644]
platform/icons/src/vcs/Shelve_dark.png [new file with mode: 0644]
platform/icons/src/vcs/SilentShelve.png [new file with mode: 0644]
platform/icons/src/vcs/SilentShelve@2x.png [new file with mode: 0644]
platform/icons/src/vcs/SilentShelve@2x_dark.png [new file with mode: 0644]
platform/icons/src/vcs/SilentShelve_dark.png [new file with mode: 0644]
platform/icons/src/vcs/SilentUnshelve.png [new file with mode: 0644]
platform/icons/src/vcs/SilentUnshelve@2x.png [new file with mode: 0644]
platform/icons/src/vcs/SilentUnshelve@2x_dark.png [new file with mode: 0644]
platform/icons/src/vcs/SilentUnshelve_dark.png [new file with mode: 0644]
platform/icons/src/vcs/Unshelve.png [new file with mode: 0644]
platform/icons/src/vcs/Unshelve@2x.png [new file with mode: 0644]
platform/icons/src/vcs/Unshelve@2x_dark.png [new file with mode: 0644]
platform/icons/src/vcs/Unshelve_dark.png [new file with mode: 0644]
platform/lang-api/src/com/intellij/execution/configurations/LocatableConfigurationBase.java
platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java
platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewSharedSettings.kt [new file with mode: 0644]
platform/lang-impl/src/com/intellij/ide/structureView/customRegions/CustomRegionStructureUtil.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/ide/structureView/customRegions/CustomRegionTreeElement.java [new file with mode: 0644]
platform/lang-impl/src/com/intellij/ide/util/projectWizard/AbstractNewProjectStep.java
platform/lang-impl/src/com/intellij/ide/util/projectWizard/ProjectSettingsStepBase.java
platform/platform-api/src/com/intellij/execution/configurations/GeneralCommandLine.java
platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java
platform/platform-impl/src/com/intellij/execution/process/KillableColoredProcessHandler.java
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBox.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBox@2x.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxDisabled.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxDisabled@2x.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxIndeterminateDisabled.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxIndeterminateDisabled@2x.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxIndeterminateSelected.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxIndeterminateSelected@2x.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxSelected.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxSelected@2x.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxSelectedDisabled.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxSelectedDisabled@2x.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/comboDropTriangle.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/comboDropTriangle@2x.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/comboDropTriangleDisabled.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/comboDropTriangleDisabled@2x.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radio.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radio@2x.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioDisabled.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioDisabled@2x.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioSelected.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioSelected@2x.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioSelectedDisabled.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioSelectedDisabled@2x.png [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/icons/winCheckSign.png [deleted file]
platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/MacIntelliJIconCache.java
platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJCheckBoxUI.java
platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJComboBoxUI.java
platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinIntelliJRadioButtonUI.java
platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinMenuBarBorder.java [new file with mode: 0644]
platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf_native.properties
platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressDialog.java
platform/platform-resources/src/META-INF/LangExtensions.xml
platform/platform-resources/src/idea/VcsActions.xml
platform/util/resources/misc/registry.properties
platform/util/src/com/intellij/icons/AllIcons.java
platform/util/src/com/intellij/openapi/util/io/FileUtil.java
platform/util/src/com/intellij/util/ui/UIUtil.java
python/ide/src/com/jetbrains/python/newProject/actions/PythonGenerateProjectCallback.java
python/psi-api/src/com/jetbrains/python/psi/PyStringLiteralExpression.java
python/src/com/jetbrains/python/packaging/ui/PyPackageManagementService.java
python/src/com/jetbrains/python/psi/impl/PyStringLiteralExpressionImpl.java

index e3d4c2cf3cfd45e52c1de4a6943a46b44c2d8738..ea95eef7a78854577d04efa7a9b22e98cd5b9d5e 100644 (file)
@@ -36,6 +36,8 @@ import org.jetbrains.annotations.NotNull;
 import java.io.IOException;
 import java.util.List;
 
+import static com.intellij.util.ObjectUtils.notNull;
+
 public class JavaExportsStatementElementType extends JavaStubElementType<PsiExportsStatementStub, PsiExportsStatement> {
   public JavaExportsStatementElementType() {
     super("EXPORTS_STATEMENT");
@@ -68,7 +70,7 @@ public class JavaExportsStatementElementType extends JavaStubElementType<PsiExpo
       else if (type == JavaElementType.MODULE_REFERENCE) to.add(JavaSourceUtil.getReferenceText(tree, child));
     }
 
-    return new PsiExportsStatementStubImpl(parentStub, refText, to);
+    return new PsiExportsStatementStubImpl(parentStub, notNull(refText, ""), to);
   }
 
   @Override
index 405f8f3478d70d622f195f6448bda2c2dcf74e85..43af3563fbb0211d6b87402a69715c138de5a1f6 100644 (file)
@@ -35,6 +35,8 @@ import org.jetbrains.annotations.NotNull;
 
 import java.io.IOException;
 
+import static com.intellij.util.ObjectUtils.notNull;
+
 public class JavaRequiresStatementElementType extends JavaStubElementType<PsiRequiresStatementStub, PsiRequiresStatement> {
   public JavaRequiresStatementElementType() {
     super("REQUIRES_STATEMENT");
@@ -68,7 +70,7 @@ public class JavaRequiresStatementElementType extends JavaStubElementType<PsiReq
       else if (type == JavaTokenType.STATIC_KEYWORD) isStatic = true;
     }
 
-    return new PsiRequiresStatementStubImpl(parentStub, refText, isPublic, isStatic);
+    return new PsiRequiresStatementStubImpl(parentStub, notNull(refText, ""), isPublic, isStatic);
   }
 
   @Override
index 13fca2e78688ccabe9b2b1418c631a19f57d679f..a11142396b7e8ed8db36cabe8684f9dbb98bb8cb 100644 (file)
@@ -491,10 +491,13 @@ public class JavaStubBuilderTest extends LightIdeaTestCase {
   public void testModuleInfo() {
     doTest("module M. /*ignore me*/ N {\n" +
            "  requires A.B;\n" +
+           "  exports m.n;\n" +
            "}",
 
            "PsiJavaFileStub []\n" +
-           "  MODULE:PsiJavaModuleStub:M.N\n");
+           "  MODULE:PsiJavaModuleStub:M.N\n" +
+           "    REQUIRES_STATEMENT:PsiRequiresStatementStub:0:A.B\n" +
+           "    EXPORTS_STATEMENT:PsiExportsStatementStub:m.n\n");
   }
 
   public void testSOEProof() {
diff --git a/platform/icons/src/vcs/Shelve.png b/platform/icons/src/vcs/Shelve.png
new file mode 100644 (file)
index 0000000..5c86678
Binary files /dev/null and b/platform/icons/src/vcs/Shelve.png differ
diff --git a/platform/icons/src/vcs/Shelve@2x.png b/platform/icons/src/vcs/Shelve@2x.png
new file mode 100644 (file)
index 0000000..35448ba
Binary files /dev/null and b/platform/icons/src/vcs/Shelve@2x.png differ
diff --git a/platform/icons/src/vcs/Shelve@2x_dark.png b/platform/icons/src/vcs/Shelve@2x_dark.png
new file mode 100644 (file)
index 0000000..b5e39a3
Binary files /dev/null and b/platform/icons/src/vcs/Shelve@2x_dark.png differ
diff --git a/platform/icons/src/vcs/Shelve_dark.png b/platform/icons/src/vcs/Shelve_dark.png
new file mode 100644 (file)
index 0000000..8e7bf0c
Binary files /dev/null and b/platform/icons/src/vcs/Shelve_dark.png differ
diff --git a/platform/icons/src/vcs/SilentShelve.png b/platform/icons/src/vcs/SilentShelve.png
new file mode 100644 (file)
index 0000000..dc19c29
Binary files /dev/null and b/platform/icons/src/vcs/SilentShelve.png differ
diff --git a/platform/icons/src/vcs/SilentShelve@2x.png b/platform/icons/src/vcs/SilentShelve@2x.png
new file mode 100644 (file)
index 0000000..204c359
Binary files /dev/null and b/platform/icons/src/vcs/SilentShelve@2x.png differ
diff --git a/platform/icons/src/vcs/SilentShelve@2x_dark.png b/platform/icons/src/vcs/SilentShelve@2x_dark.png
new file mode 100644 (file)
index 0000000..ff81e00
Binary files /dev/null and b/platform/icons/src/vcs/SilentShelve@2x_dark.png differ
diff --git a/platform/icons/src/vcs/SilentShelve_dark.png b/platform/icons/src/vcs/SilentShelve_dark.png
new file mode 100644 (file)
index 0000000..70c8397
Binary files /dev/null and b/platform/icons/src/vcs/SilentShelve_dark.png differ
diff --git a/platform/icons/src/vcs/SilentUnshelve.png b/platform/icons/src/vcs/SilentUnshelve.png
new file mode 100644 (file)
index 0000000..4c972b2
Binary files /dev/null and b/platform/icons/src/vcs/SilentUnshelve.png differ
diff --git a/platform/icons/src/vcs/SilentUnshelve@2x.png b/platform/icons/src/vcs/SilentUnshelve@2x.png
new file mode 100644 (file)
index 0000000..36392fb
Binary files /dev/null and b/platform/icons/src/vcs/SilentUnshelve@2x.png differ
diff --git a/platform/icons/src/vcs/SilentUnshelve@2x_dark.png b/platform/icons/src/vcs/SilentUnshelve@2x_dark.png
new file mode 100644 (file)
index 0000000..a223ff4
Binary files /dev/null and b/platform/icons/src/vcs/SilentUnshelve@2x_dark.png differ
diff --git a/platform/icons/src/vcs/SilentUnshelve_dark.png b/platform/icons/src/vcs/SilentUnshelve_dark.png
new file mode 100644 (file)
index 0000000..9408aaa
Binary files /dev/null and b/platform/icons/src/vcs/SilentUnshelve_dark.png differ
diff --git a/platform/icons/src/vcs/Unshelve.png b/platform/icons/src/vcs/Unshelve.png
new file mode 100644 (file)
index 0000000..c3da5de
Binary files /dev/null and b/platform/icons/src/vcs/Unshelve.png differ
diff --git a/platform/icons/src/vcs/Unshelve@2x.png b/platform/icons/src/vcs/Unshelve@2x.png
new file mode 100644 (file)
index 0000000..333d91c
Binary files /dev/null and b/platform/icons/src/vcs/Unshelve@2x.png differ
diff --git a/platform/icons/src/vcs/Unshelve@2x_dark.png b/platform/icons/src/vcs/Unshelve@2x_dark.png
new file mode 100644 (file)
index 0000000..1e103f0
Binary files /dev/null and b/platform/icons/src/vcs/Unshelve@2x_dark.png differ
diff --git a/platform/icons/src/vcs/Unshelve_dark.png b/platform/icons/src/vcs/Unshelve_dark.png
new file mode 100644 (file)
index 0000000..80d12d5
Binary files /dev/null and b/platform/icons/src/vcs/Unshelve_dark.png differ
index 0233ba5433a203a7e83b32b03d280b1d7eacd8bb..0d0ac49f915552e17bf16372e1a0e3b01da1c38d 100644 (file)
@@ -42,7 +42,7 @@ public abstract class LocatableConfigurationBase extends RunConfigurationBase im
   @Override
   @Attribute("nameIsGenerated")
   public boolean isGeneratedName() {
-    return suggestedName() != null && myNameIsGenerated;
+    return myNameIsGenerated && suggestedName() != null;
   }
 
   /**
index a29637f8a36a6b9c82bf6ca1844ce2f6ca2d7bf4..b5b930606efb1e26eaef9e70d49d794580ec0b49 100644 (file)
@@ -61,6 +61,7 @@ import com.intellij.openapi.ui.SimpleToolWindowPanel;
 import com.intellij.openapi.ui.SplitterProportionsData;
 import com.intellij.openapi.ui.popup.PopupChooserBuilder;
 import com.intellij.openapi.util.*;
+import com.intellij.openapi.util.registry.Registry;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.JarFileSystem;
 import com.intellij.openapi.vfs.LocalFileSystem;
@@ -1407,38 +1408,75 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
     }
   }
 
+  boolean isGlobalOptions() {
+    return Registry.is("ide.projectView.globalOptions");
+  }
+
+  ProjectViewSharedSettings getGlobalOptions() {
+    return ProjectViewSharedSettings.Companion.getInstance();
+  }
+
   @Override
   public boolean isAutoscrollToSource(String paneId) {
+    if (isGlobalOptions()) {
+      return getGlobalOptions().getAutoscrollToSource();
+    }
+
     return getPaneOptionValue(myAutoscrollToSource, paneId, UISettings.getInstance().DEFAULT_AUTOSCROLL_TO_SOURCE);
   }
 
   public void setAutoscrollToSource(boolean autoscrollMode, String paneId) {
+    if (isGlobalOptions()) {
+      getGlobalOptions().setAutoscrollToSource(autoscrollMode);
+    }
     myAutoscrollToSource.put(paneId, autoscrollMode);
   }
 
   @Override
   public boolean isAutoscrollFromSource(String paneId) {
+    if (isGlobalOptions()) {
+      return getGlobalOptions().getAutoscrollFromSource();
+    }
+
     return getPaneOptionValue(myAutoscrollFromSource, paneId, ourAutoscrollFromSourceDefaults);
   }
 
   public void setAutoscrollFromSource(boolean autoscrollMode, String paneId) {
+    if (isGlobalOptions()) {
+      getGlobalOptions().setAutoscrollFromSource(autoscrollMode);
+    }
     setPaneOption(myAutoscrollFromSource, autoscrollMode, paneId, false);
   }
 
   @Override
   public boolean isFlattenPackages(String paneId) {
+    if (isGlobalOptions()) {
+      return getGlobalOptions().getFlattenPackages();
+    }
+
     return getPaneOptionValue(myFlattenPackages, paneId, ourFlattenPackagesDefaults);
   }
 
   public void setFlattenPackages(boolean flattenPackages, String paneId) {
+    if (isGlobalOptions()) {
+      getGlobalOptions().setFlattenPackages(flattenPackages);
+    }
     setPaneOption(myFlattenPackages, flattenPackages, paneId, true);
   }
 
   public boolean isFoldersAlwaysOnTop() {
+    if (isGlobalOptions()) {
+      return getGlobalOptions().getFoldersAlwaysOnTop();
+    }
+
     return myFoldersAlwaysOnTop;
   }
 
   public void setFoldersAlwaysOnTop(boolean foldersAlwaysOnTop) {
+    if (isGlobalOptions()) {
+      getGlobalOptions().setFoldersAlwaysOnTop(foldersAlwaysOnTop);
+    }
+
     if (myFoldersAlwaysOnTop != foldersAlwaysOnTop) {
       myFoldersAlwaysOnTop = foldersAlwaysOnTop;
       for (AbstractProjectViewPane pane : myId2Pane.values()) {
@@ -1451,6 +1489,10 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
 
   @Override
   public boolean isShowMembers(String paneId) {
+    if (isGlobalOptions()) {
+      return getGlobalOptions().getShowMembers();
+    }
+
     return getPaneOptionValue(myShowMembers, paneId, ourShowMembersDefaults);
   }
 
@@ -1460,21 +1502,36 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
 
   @Override
   public boolean isHideEmptyMiddlePackages(String paneId) {
+    if (isGlobalOptions()) {
+      return getGlobalOptions().getHideEmptyPackages();
+    }
+
     return getPaneOptionValue(myHideEmptyPackages, paneId, ourHideEmptyPackagesDefaults);
   }
 
   @Override
   public boolean isAbbreviatePackageNames(String paneId) {
+    if (isGlobalOptions()) {
+      return getGlobalOptions().getAbbreviatePackages();
+    }
+
     return getPaneOptionValue(myAbbreviatePackageNames, paneId, ourAbbreviatePackagesDefaults);
   }
 
   @Override
   public boolean isShowLibraryContents(String paneId) {
+    if (isGlobalOptions()) {
+      return getGlobalOptions().getShowLibraryContents();
+    }
+
     return getPaneOptionValue(myShowLibraryContents, paneId, ourShowLibraryContentsDefaults);
   }
 
   @Override
   public void setShowLibraryContents(boolean showLibraryContents, @NotNull String paneId) {
+    if (isGlobalOptions()) {
+      getGlobalOptions().setShowLibraryContents(showLibraryContents);
+    }
     setPaneOption(myShowLibraryContents, showLibraryContents, paneId, true);
   }
 
@@ -1485,21 +1542,34 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
 
   @Override
   public boolean isShowModules(String paneId) {
+    if (isGlobalOptions()) {
+      return getGlobalOptions().getShowModules();
+    }
+
     return getPaneOptionValue(myShowModules, paneId, ourShowModulesDefaults);
   }
 
   @Override
   public void setShowModules(boolean showModules, @NotNull String paneId) {
+    if (isGlobalOptions()) {
+      getGlobalOptions().setShowModules(showModules);
+    }
     setPaneOption(myShowModules, showModules, paneId, true);
   }
 
   @Override
   public void setHideEmptyPackages(boolean hideEmptyPackages, @NotNull String paneId) {
+    if (isGlobalOptions()) {
+      getGlobalOptions().setHideEmptyPackages(hideEmptyPackages);
+    }
     setPaneOption(myHideEmptyPackages, hideEmptyPackages, paneId, true);
   }
 
   @Override
   public void setAbbreviatePackageNames(boolean abbreviatePackageNames, @NotNull String paneId) {
+    if (isGlobalOptions()) {
+      getGlobalOptions().setAbbreviatePackages(abbreviatePackageNames);
+    }
     setPaneOption(myAbbreviatePackageNames, abbreviatePackageNames, paneId, true);
   }
 
diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewSharedSettings.kt b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewSharedSettings.kt
new file mode 100644 (file)
index 0000000..62873fc
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ * 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.ide.projectView.impl
+
+import com.intellij.openapi.components.*
+import com.intellij.util.xmlb.XmlSerializerUtil
+
+/**
+ * @author Konstantin Bulenkov
+ */
+@State(name = "ProjectViewSharedSettings",
+       storages = arrayOf(Storage(value = "projectView.xml", roamingType = RoamingType.PER_OS)))
+
+class ProjectViewSharedSettings : PersistentStateComponent<ProjectViewSharedSettings> {
+  var flattenPackages = false
+  var showMembers = false
+  var sortByType = false
+  var showModules = true
+  var showLibraryContents = true
+  var hideEmptyPackages = true
+  var abbreviatePackages = false
+  var autoscrollFromSource = false
+  var autoscrollToSource = false
+  var foldersAlwaysOnTop = true
+
+  override fun getState(): ProjectViewSharedSettings? {
+    return this
+  }
+
+  override fun loadState(state: ProjectViewSharedSettings) {
+    XmlSerializerUtil.copyBean(state, this)
+  }
+
+  companion object {
+    val instance: ProjectViewSharedSettings
+      get() = ServiceManager.getService(ProjectViewSharedSettings::class.java)
+  }
+}
diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/customRegions/CustomRegionStructureUtil.java b/platform/lang-impl/src/com/intellij/ide/structureView/customRegions/CustomRegionStructureUtil.java
new file mode 100644 (file)
index 0000000..b7ec475
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * 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.
+ * 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.ide.structureView.customRegions;
+
+import com.intellij.ide.structureView.StructureViewTreeElement;
+import com.intellij.lang.folding.CustomFoldingProvider;
+import com.intellij.psi.PsiComment;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.StubBasedPsiElement;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author Rustam Vishnyakov
+ */
+public class CustomRegionStructureUtil {
+
+  public static Collection<StructureViewTreeElement> groupByCustomRegions(@NotNull PsiElement rootElement,
+                                                                          @NotNull Collection<StructureViewTreeElement> originalElements) {
+    if (rootElement instanceof StubBasedPsiElement &&
+        ((StubBasedPsiElement)rootElement).getStub() != null) {
+      return originalElements;
+    }
+    Collection<CustomRegionTreeElement> customRegions = collectCustomRegions(rootElement);
+    if (customRegions.size() > 0) {
+      List<StructureViewTreeElement> result = new ArrayList<>();
+      result.addAll(customRegions);
+      for (StructureViewTreeElement element : originalElements) {
+        boolean isInCustomRegion = false;
+        for (CustomRegionTreeElement customRegion : customRegions) {
+          if (customRegion.containsElement(element)) {
+            customRegion.addChild(element);
+            isInCustomRegion = true;
+            break;
+          }
+        }
+        if (!isInCustomRegion) result.add(element);
+      }
+      return result;
+    }
+    return originalElements;
+  }
+
+  private static Collection<CustomRegionTreeElement> collectCustomRegions(@NotNull PsiElement rootElement) {
+    List<CustomRegionTreeElement> customRegions = new ArrayList<>();
+    PsiElement child = rootElement.getFirstChild();
+    CustomRegionTreeElement currRegionElement = null;
+    CustomFoldingProvider provider = null;
+    while (child != null) {
+      if (child instanceof PsiComment && !child.textContains('\n')) {
+        if (provider == null) provider = getProvider(child);
+        if (provider != null) {
+          String commentText = child.getText();
+          if (provider.isCustomRegionStart(commentText)) {
+            if (currRegionElement == null) {
+              currRegionElement = new CustomRegionTreeElement(child, provider);
+              customRegions.add(currRegionElement);
+            }
+            else {
+              currRegionElement = currRegionElement.createNestedRegion(child);
+            }
+          }
+          else if (provider.isCustomRegionEnd(commentText) && currRegionElement != null) {
+            currRegionElement = currRegionElement.endRegion(child);
+          }
+        }
+      }
+      child = child.getNextSibling();
+    }
+    return customRegions;
+  }
+
+  @Nullable
+  static CustomFoldingProvider getProvider(@NotNull PsiElement element) {
+    for (CustomFoldingProvider provider : CustomFoldingProvider.getAllProviders()) {
+      if (provider.isCustomRegionStart(element.getNode().getText())) {
+        return provider;
+      }
+    }
+    return null;
+  }
+}
diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/customRegions/CustomRegionTreeElement.java b/platform/lang-impl/src/com/intellij/ide/structureView/customRegions/CustomRegionTreeElement.java
new file mode 100644 (file)
index 0000000..17b9409
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+ * 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.
+ * 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.ide.structureView.customRegions;
+
+import com.intellij.icons.AllIcons;
+import com.intellij.ide.structureView.StructureViewTreeElement;
+import com.intellij.ide.util.treeView.smartTree.TreeElement;
+import com.intellij.lang.folding.CustomFoldingProvider;
+import com.intellij.navigation.ItemPresentation;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.pom.Navigatable;
+import com.intellij.psi.PsiElement;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author Rustam Vishnyakov
+ */
+public class CustomRegionTreeElement implements StructureViewTreeElement {
+
+  private final PsiElement myStartElement;
+  private int myEndOffset = Integer.MAX_VALUE;
+  private Collection<StructureViewTreeElement> myChildElements = new ArrayList<>();
+  private final CustomFoldingProvider myProvider;
+  private CustomRegionTreeElement myParent;
+  private List<CustomRegionTreeElement> mySubRegions;
+
+  public CustomRegionTreeElement(@NotNull PsiElement startElement,
+                                 @NotNull CustomFoldingProvider provider,
+                                 @Nullable CustomRegionTreeElement parent) {
+    myStartElement = startElement;
+    myProvider = provider;
+    myParent = parent;
+  }
+
+  public CustomRegionTreeElement(@NotNull PsiElement startElement,
+                                 @NotNull CustomFoldingProvider provider) {
+    this(startElement, provider, null);
+  }
+
+  @Override
+  public Object getValue() {
+    return this;
+  }
+
+  @Override
+  public void navigate(boolean requestFocus) {
+    ((Navigatable)myStartElement).navigate(requestFocus);
+  }
+
+  @Override
+  public boolean canNavigate() {
+    return myStartElement instanceof Navigatable && ((Navigatable)myStartElement).canNavigate();
+  }
+
+  @Override
+  public boolean canNavigateToSource() {
+    return canNavigate();
+  }
+
+  @NotNull
+  @Override
+  public ItemPresentation getPresentation() {
+    return new ItemPresentation() {
+      @Nullable
+      @Override
+      public String getPresentableText() {
+        return myProvider.getPlaceholderText(myStartElement.getText());
+      }
+
+      @Nullable
+      @Override
+      public String getLocationString() {
+        return null;
+      }
+
+      @Nullable
+      @Override
+      public Icon getIcon(boolean unused) {
+        return AllIcons.Nodes.CustomRegion;
+      }
+    };
+  }
+
+  public void addChild(@NotNull StructureViewTreeElement childElement) {
+    if (mySubRegions != null) {
+      for (CustomRegionTreeElement subRegion : mySubRegions) {
+        if (subRegion.containsElement(childElement)) {
+          subRegion.addChild(childElement);
+          return;
+        }
+      }
+    }
+    myChildElements.add(childElement);
+  }
+
+  @NotNull
+  @Override
+  public TreeElement[] getChildren() {
+    if (mySubRegions == null || mySubRegions.isEmpty()) {
+      return myChildElements.toArray(new StructureViewTreeElement[myChildElements.size()]);
+    }
+    StructureViewTreeElement[] allElements = new StructureViewTreeElement[myChildElements.size() + mySubRegions.size()];
+    int index = 0;
+    for (StructureViewTreeElement child : myChildElements) {
+      allElements[index++] = child;
+    }
+    for (StructureViewTreeElement subRegion : mySubRegions) {
+      allElements[index++] = subRegion;
+    }
+    return allElements;
+  }
+
+  public boolean containsElement(StructureViewTreeElement element) {
+    Object o = element.getValue();
+    if (o instanceof PsiElement) {
+      TextRange elementRange = ((PsiElement)o).getTextRange();
+      if(elementRange.getStartOffset() > myStartElement.getTextRange().getStartOffset() && elementRange.getEndOffset() < myEndOffset) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  public CustomRegionTreeElement createNestedRegion(@NotNull PsiElement element) {
+    if (mySubRegions == null) mySubRegions = new ArrayList<>();
+    CustomRegionTreeElement currSubRegion = new CustomRegionTreeElement(element, myProvider, this);
+    mySubRegions.add(currSubRegion);
+    return currSubRegion;
+  }
+
+  public CustomRegionTreeElement endRegion(@NotNull PsiElement element) {
+    myEndOffset = element.getTextRange().getEndOffset();
+    return myParent;
+  }
+
+}
index 1fcabb523478c1ffebc85a6f797ff891cf1741bc..d534fdb57d73e5fccd011c3513ab2da9f2801cef 100644 (file)
@@ -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.
@@ -25,7 +25,6 @@ import com.intellij.openapi.actionSystem.DefaultActionGroup;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.extensions.Extensions;
-import com.intellij.openapi.module.Module;
 import com.intellij.openapi.progress.ProcessCanceledException;
 import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.project.Project;
@@ -179,11 +178,7 @@ public class AbstractNewProjectStep extends DefaultActionGroup implements DumbAw
       return null;
     }
 
-    final VirtualFile baseDir = ApplicationManager.getApplication().runWriteAction(new Computable<VirtualFile>() {
-      public VirtualFile compute() {
-        return LocalFileSystem.getInstance().refreshAndFindFileByIoFile(location);
-      }
-    });
+    final VirtualFile baseDir = ApplicationManager.getApplication().runWriteAction((Computable<VirtualFile>)() -> LocalFileSystem.getInstance().refreshAndFindFileByIoFile(location));
     if (baseDir == null) {
       LOG.error("Couldn't find '" + location + "' in VFS");
       return null;
@@ -218,12 +213,9 @@ public class AbstractNewProjectStep extends DefaultActionGroup implements DumbAw
       ((TemplateProjectDirectoryGenerator)generator).generateProject(baseDir.getName(), locationString);
     } else {
       final Object finalSettings = settings;
-      callback = new ProjectOpenedCallback() {
-        @Override
-        public void projectOpened(Project project, Module module) {
-          if (generator != null) {
-            generator.generateProject(project, baseDir, finalSettings, module);
-          }
+      callback = (p, module) -> {
+        if (generator != null) {
+          generator.generateProject(p, baseDir, finalSettings, module);
         }
       };
     }
index 2e938172981d9b2a33911d7bc8f2d83a514361a7..deceb958b51c839570a8d60de9e7d32df0683ed3 100644 (file)
@@ -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.
@@ -299,7 +299,8 @@ public class ProjectSettingsStepBase extends AbstractActionWithPanel implements
     return LabeledComponent.create(myLocationField, BundleBase.replaceMnemonicAmpersand("&Location"), BorderLayout.WEST);
   }
 
-  private static File findSequentNonExistingUntitled() {
+  @NotNull
+  protected File findSequentNonExistingUntitled() {
     return FileUtil.findSequentNonexistentFile(new File(ProjectUtil.getBaseDir()), "untitled", "");
   }
 }
index d5a75ed3b5fa4714692d6780585c6cba83140dde..eb767b601988531ef69f75398694b3d741045463 100644 (file)
@@ -180,12 +180,12 @@ public class GeneralCommandLine implements UserDataHolder {
     return myParentEnvironmentType != ParentEnvironmentType.NONE;
   }
 
-  /** @deprecated use {@link #withParentEnvironmentType(ParentEnvironmentType)} (to be removed in IDEA 17) */
+  /** @deprecated use {@link #withParentEnvironmentType(ParentEnvironmentType)} */
   public GeneralCommandLine withPassParentEnvironment(boolean passParentEnvironment) {
     return withParentEnvironmentType(passParentEnvironment ? ParentEnvironmentType.CONSOLE : ParentEnvironmentType.NONE);
   }
 
-  /** @deprecated use {@link #withParentEnvironmentType(ParentEnvironmentType)} (to be removed in IDEA 17) */
+  /** @deprecated use {@link #withParentEnvironmentType(ParentEnvironmentType)} */
   public void setPassParentEnvironment(boolean passParentEnvironment) {
     withParentEnvironmentType(passParentEnvironment ? ParentEnvironmentType.CONSOLE : ParentEnvironmentType.NONE);
   }
@@ -386,6 +386,13 @@ public class GeneralCommandLine implements UserDataHolder {
       environment.putAll(getParentEnvironment());
     }
 
+    if (SystemInfo.isUnix) {
+      File workDirectory = getWorkDirectory();
+      if (workDirectory != null) {
+        environment.put("PWD", FileUtil.toSystemDependentName(workDirectory.getAbsolutePath()));
+      }
+    }
+
     if (!myEnvParams.isEmpty()) {
       if (SystemInfo.isWindows) {
         THashMap<String, String> envVars = new THashMap<>(CaseInsensitiveStringHashingStrategy.INSTANCE);
@@ -398,13 +405,6 @@ public class GeneralCommandLine implements UserDataHolder {
         environment.putAll(myEnvParams);
       }
     }
-
-    if (SystemInfo.isUnix) {
-      File workDirectory = getWorkDirectory();
-      if (workDirectory != null) {
-        environment.put("PWD", FileUtil.toSystemDependentName(workDirectory.getAbsolutePath()));
-      }
-    }
   }
 
   /**
@@ -424,6 +424,7 @@ public class GeneralCommandLine implements UserDataHolder {
     return myExePath + " " + myProgramParams;
   }
 
+  @Nullable
   @Override
   public <T> T getUserData(@NotNull Key<T> key) {
     if (myUserData != null) {
@@ -436,6 +437,7 @@ public class GeneralCommandLine implements UserDataHolder {
   @Override
   public <T> void putUserData(@NotNull Key<T> key, @Nullable T value) {
     if (myUserData == null) {
+      if (value == null) return;
       myUserData = ContainerUtil.newHashMap();
     }
     myUserData.put(key, value);
index 0dac1f802ed18caa8a14d71ae28ef984f0b62998..dafbd0d2ec069b3490377a025ca7c991cec69def 100644 (file)
@@ -439,7 +439,7 @@ public abstract class DialogWrapper {
   }
 
   protected static boolean isMoveHelpButtonLeft() {
-    return UIUtil.isUnderAquaBasedLookAndFeel() || (SystemInfo.isWindows && Registry.is("ide.intellij.laf.win10.ui"));
+    return UIUtil.isUnderAquaBasedLookAndFeel() || UIUtil.isUnderDarcula() || UIUtil.isUnderWin10LookAndFeel();
   }
 
   /**
@@ -547,7 +547,7 @@ public abstract class DialogWrapper {
     }
 
     if (hasHelpToMoveToLeftSide) {
-      if (!(SystemInfo.isWindows && UIUtil.isUnderIntelliJLaF() && Registry.is("ide.intellij.laf.win10.ui"))) {
+      if (!(SystemInfo.isWindows && (UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) && Registry.is("ide.win.frame.decoration"))) {
         JButton helpButton = createHelpButton(insets);
         panel.add(helpButton, BorderLayout.WEST);
       }
@@ -585,7 +585,7 @@ public abstract class DialogWrapper {
   @NotNull
   protected JButton createHelpButton(Insets insets) {
     final JButton helpButton;
-    if ((SystemInfo.isWindows && UIUtil.isUnderIntelliJLaF() && Registry.is("ide.intellij.laf.win10.ui"))) {
+    if ((UIUtil.isUnderWin10LookAndFeel())) {
       helpButton = new JButton(getHelpAction()) {
         @Override
         public void paint(Graphics g) {
index a7b7c0c8dd36e2fadc990b46a413d1d6b6020d52..99ce8de3cff21172c4094d87faef7c2c35e48a09 100644 (file)
@@ -39,10 +39,10 @@ public class KillableColoredProcessHandler extends ColoredProcessHandler impleme
   private static final Key<Boolean> MEDIATOR_KEY = Key.create("KillableColoredProcessHandler.Mediator.Process");
 
   private boolean myShouldKillProcessSoftly = true;
-  private boolean myMediatedProcess = false;
+  private final boolean myMediatedProcess;
 
   public KillableColoredProcessHandler(@NotNull GeneralCommandLine commandLine) throws ExecutionException {
-    super(commandLine);
+    this(commandLine, false);
   }
 
   /**
@@ -58,6 +58,7 @@ public class KillableColoredProcessHandler extends ColoredProcessHandler impleme
    */
   public KillableColoredProcessHandler(@NotNull Process process, /*@NotNull*/ String commandLine) {
     super(process, commandLine);
+    myMediatedProcess = false;
   }
 
   /**
@@ -65,9 +66,11 @@ public class KillableColoredProcessHandler extends ColoredProcessHandler impleme
    */
   public KillableColoredProcessHandler(@NotNull Process process, /*@NotNull*/ String commandLine, @NotNull Charset charset) {
     super(process, commandLine, charset);
+    myMediatedProcess = false;
   }
 
-  private static GeneralCommandLine mediate(GeneralCommandLine commandLine, boolean withMediator) {
+  @NotNull
+  private static GeneralCommandLine mediate(@NotNull GeneralCommandLine commandLine, boolean withMediator) {
     if (withMediator && SystemInfo.isWindows) {
       boolean mediatorInjected = RunnerMediator.injectRunnerCommand(commandLine);
       MEDIATOR_KEY.set(commandLine, mediatorInjected);
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBox.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBox.png
new file mode 100644 (file)
index 0000000..5010d36
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBox.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBox@2x.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBox@2x.png
new file mode 100644 (file)
index 0000000..b6938ca
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBox@2x.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxDisabled.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxDisabled.png
new file mode 100644 (file)
index 0000000..43ff84e
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxDisabled.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxDisabled@2x.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxDisabled@2x.png
new file mode 100644 (file)
index 0000000..80cfe71
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxDisabled@2x.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxIndeterminateDisabled.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxIndeterminateDisabled.png
new file mode 100644 (file)
index 0000000..9ad279c
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxIndeterminateDisabled.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxIndeterminateDisabled@2x.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxIndeterminateDisabled@2x.png
new file mode 100644 (file)
index 0000000..d53a0f0
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxIndeterminateDisabled@2x.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxIndeterminateSelected.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxIndeterminateSelected.png
new file mode 100644 (file)
index 0000000..6175ff8
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxIndeterminateSelected.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxIndeterminateSelected@2x.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxIndeterminateSelected@2x.png
new file mode 100644 (file)
index 0000000..da4b541
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxIndeterminateSelected@2x.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxSelected.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxSelected.png
new file mode 100644 (file)
index 0000000..3cf4de4
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxSelected.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxSelected@2x.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxSelected@2x.png
new file mode 100644 (file)
index 0000000..5357eda
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxSelected@2x.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxSelectedDisabled.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxSelectedDisabled.png
new file mode 100644 (file)
index 0000000..a9ab7ff
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxSelectedDisabled.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxSelectedDisabled@2x.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxSelectedDisabled@2x.png
new file mode 100644 (file)
index 0000000..c2896fc
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/checkBoxSelectedDisabled@2x.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/comboDropTriangle.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/comboDropTriangle.png
new file mode 100644 (file)
index 0000000..db1bcc0
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/comboDropTriangle.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/comboDropTriangle@2x.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/comboDropTriangle@2x.png
new file mode 100644 (file)
index 0000000..652af4c
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/comboDropTriangle@2x.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/comboDropTriangleDisabled.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/comboDropTriangleDisabled.png
new file mode 100644 (file)
index 0000000..11308a8
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/comboDropTriangleDisabled.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/comboDropTriangleDisabled@2x.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/comboDropTriangleDisabled@2x.png
new file mode 100644 (file)
index 0000000..878423b
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/comboDropTriangleDisabled@2x.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radio.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radio.png
new file mode 100644 (file)
index 0000000..1f4449b
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radio.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radio@2x.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radio@2x.png
new file mode 100644 (file)
index 0000000..73ecd92
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radio@2x.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioDisabled.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioDisabled.png
new file mode 100644 (file)
index 0000000..b845633
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioDisabled.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioDisabled@2x.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioDisabled@2x.png
new file mode 100644 (file)
index 0000000..bbd3133
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioDisabled@2x.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioSelected.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioSelected.png
new file mode 100644 (file)
index 0000000..fc24170
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioSelected.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioSelected@2x.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioSelected@2x.png
new file mode 100644 (file)
index 0000000..5851cf5
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioSelected@2x.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioSelectedDisabled.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioSelectedDisabled.png
new file mode 100644 (file)
index 0000000..c53d9ea
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioSelectedDisabled.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioSelectedDisabled@2x.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioSelectedDisabled@2x.png
new file mode 100644 (file)
index 0000000..d07bcdc
Binary files /dev/null and b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/win10/radioSelectedDisabled@2x.png differ
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/winCheckSign.png b/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/winCheckSign.png
deleted file mode 100644 (file)
index fa7c291..0000000
Binary files a/platform/platform-impl/src/com/intellij/ide/ui/laf/icons/winCheckSign.png and /dev/null differ
index 1657157bd2086095e6b63dcfb62ef8941033a912..41cb311d66a485fc1a21d0d82ad66d2b1019566a 100644 (file)
@@ -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.
@@ -33,6 +33,7 @@ public class MacIntelliJIconCache {
     if (focused) key+= "Focused";
     else if (!enabled) key+="Disabled";
     if (IntelliJLaf.isGraphite()) key= "graphite/" + key;
+    if (IntelliJLaf.isWindowsNativeLook()) key = "win10/" + key;
     Icon icon = cache.get(key);
     if (icon == null) {
       icon = IconLoader.findIcon("/com/intellij/ide/ui/laf/icons/" + key + ".png", MacIntelliJIconCache.class, true);
index 8bbe1c2528048fd894855c3f9979d2f80ef4bb9b..7b2ae43993b07b14184915998d91627efd8946de 100644 (file)
@@ -36,27 +36,9 @@ public class WinIntelliJCheckBoxUI extends IntelliJCheckBoxUI {
   protected void drawCheckIcon(JComponent c, Graphics2D g, JCheckBox b, Rectangle iconRect, boolean selected, boolean enabled) {
     final Color color = enabled ? b.getForeground() : getBorderColor1(false, false);
     g.setColor(color);
-
+    final Icon icon = MacIntelliJIconCache.getIcon("checkBox", selected, false, enabled);
     Rectangle r = new Rectangle(iconRect.x + JBUI.scale(2), iconRect.y + JBUI.scale(2), iconRect.width - JBUI.scale(4), iconRect.height - JBUI.scale(4));
-    g.drawRect(r.x, r.y, r.width, r.height);
-
-    if (selected) {
-      final int x1 = r.x + JBUI.scale(3);
-      final int y1 = r.y + r.height / 2 + JBUI.scale(1);
-      final int x2 = r.x + r.height / 2 - JBUI.scale(1);
-      final int y2 = r.y + r.height - JBUI.scale(4);
-
-      final Graphics2D iconGraphics = (Graphics2D)g.create(0, 0, c.getWidth(), c.getHeight());
-      iconGraphics.setColor(color);
-      iconGraphics.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
-      iconGraphics.setStroke(new BasicStroke(JBUI.scale(1.5f), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
-
-      if (enabled) {
-        iconGraphics.drawLine(x1, y1, x2, y2);
-        iconGraphics.drawLine(x2, y2, r.x + r.width - JBUI.scale(2), r.y + JBUI.scale(4));
-      }
-      iconGraphics.dispose();
-    }
+    icon.paintIcon(c, g, r.x, r.y);
   }
 
   @Override
index e1affca32340ce71be2b3e272361fcf04378e2d6..0d46c909c57a5cb4f6e8e5ce67e2070cb4a7e968 100644 (file)
@@ -83,14 +83,14 @@ public class WinIntelliJComboBoxUI extends DarculaComboBoxUI {
     final JButton button = new BasicArrowButton(SwingConstants.SOUTH) {
       @Override
       public Dimension getPreferredSize() {
-        return JBUI.size(14, 6);
+        return JBUI.size(14, 10);
       }
 
       @Override
       public void paint(Graphics g) {
         g.setColor(getComboBackground());
         g.fillRect(0, 0, getWidth(), getHeight());
-        IconUtil.paintInCenterOf(this, g, MacIntelliJIconCache.getIcon("winCheckSign"));
+        IconUtil.paintInCenterOf(this, g, MacIntelliJIconCache.getIcon("comboDropTriangle", false, false, isEnabled()));
       }
     };
     button.setOpaque(false);
index 97feba898578008d8430a6044a567220b18d1d94..3fdf28bfb4330417b502b760f437c2e69e432847 100644 (file)
 package com.intellij.ide.ui.laf.intellij;
 
 import com.intellij.ide.ui.laf.darcula.ui.DarculaRadioButtonUI;
-import com.intellij.openapi.ui.GraphicsConfig;
-import com.intellij.ui.Gray;
-import com.intellij.util.ui.GraphicsUtil;
-import com.intellij.util.ui.JBUI;
 
 import javax.swing.*;
 import javax.swing.plaf.ComponentUI;
@@ -36,29 +32,12 @@ public class WinIntelliJRadioButtonUI extends DarculaRadioButtonUI {
 
   @Override
   protected void paintIcon(JComponent c, Graphics2D g, Rectangle viewRect, Rectangle iconRect) {
-    int rad = JBUI.scale(4);
-
-    // Paint the radio button
-    final int x = iconRect.x + (rad - (rad % 2 == 1?1:0))/2;
-    final int y = iconRect.y + (rad - (rad % 2 == 1?1:0))/2;
-    final int w = iconRect.width - rad;
-    final int h = iconRect.height - rad;
-    final boolean enabled = c.isEnabled();
-    Color color = enabled ? Gray.x50 : Gray.xD3;
-    g.translate(x, y);
-    //setup AA for lines
-    final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
-    g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
     final boolean selected = ((AbstractButton)c).isSelected();
-    g.setPaint(color);
-    g.drawOval(0, 0, w , h );
-
-    if (selected) {
-      g.setColor(color);
-      g.fillOval(JBUI.scale(3), JBUI.scale(3), w - 2*JBUI.scale(3), h - 2*JBUI.scale(3));
-    }
-    config.restore();
-    g.translate(-x, -y);
-
+    final boolean enabled = c.isEnabled();
+    final Icon icon = MacIntelliJIconCache.getIcon("radio", selected, false, enabled);
+    // Paint the radio button
+    final int x = (iconRect.width - icon.getIconWidth()) / 2;
+    final int y = (viewRect.height - icon.getIconHeight()) / 2;
+    icon.paintIcon(c, g, x, y);
   }
 }
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinMenuBarBorder.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellij/WinMenuBarBorder.java
new file mode 100644 (file)
index 0000000..6c192c4
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ * 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.ide.ui.laf.intellij;
+
+import com.intellij.ui.Gray;
+
+import javax.swing.border.Border;
+import javax.swing.plaf.UIResource;
+import java.awt.*;
+
+/**
+ * @author Konstantin Bulenkov
+ */
+public class WinMenuBarBorder implements Border, UIResource {
+  @Override
+  public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
+    g.setColor(Gray.xCD);
+    g.drawLine(x, y + height - 1, x + width, y + height - 1);
+  }
+
+  @Override
+  public Insets getBorderInsets(Component c) {
+    //noinspection UseDPIAwareInsets
+    return new Insets(0, 0, 1, 0);
+  }
+
+  @Override
+  public boolean isBorderOpaque() {
+    return true;
+  }
+}
index 208059fa3c136e2359c2f6a42a85ab73324d247e..002d8fce8b6937facbfaa7d0eb4565ee9276f8fe 100644 (file)
@@ -3,10 +3,11 @@ intellijlaf_native.background=ffffff
 intellijlaf_native.selectionBackground=1a7dc4
 intellijlaf_native.textBackground=cccccc
 intellijlaf_native.foreground=000000
+intellijlaf_native.disabledForeground=8a8a8a
 intellijlaf_native.textForeground=000000
 intellijlaf_native.caretForeground=000000
 intellijlaf_native.inactiveBackground=f2f2f2
-intellijlaf_native.inactiveForeground=777777
+intellijlaf_native.inactiveForeground=8a8a8a
 intellijlaf_native.selectionForeground=ffffff
 intellijlaf_native.acceleratorSelectionForeground=ffffff
 intellijlaf_native.selectionBackgroundInactive=27384C
@@ -34,9 +35,6 @@ EditorPaneUI=com.intellij.ide.ui.laf.darcula.ui.DarculaEditorPaneUI
 control=ffffff
 link.foreground=589df6
 ScrollBarUI=com.intellij.ui.components.JBScrollBar
-
-Label.disabledForeground=777777
-
 TableHeaderUI=com.intellij.ide.ui.laf.darcula.DarculaTableHeaderUI
 Table.gridColor=dddddd
 Table.ascendingSortIcon=AllIcons.General.SplitUp
@@ -113,7 +111,6 @@ CheckBox.darcula.focused.backgroundColor2.selected=3B98FB
 
 ComboBoxUI=com.intellij.ide.ui.laf.intellij.WinIntelliJComboBoxUI
 ComboBox.disabledBackground=e1e1e1
-ComboBox.disabledForeground=777777
 ComboBox.squareButton=false
 ComboBox.borderColor=adadad
 ComboBox.activeBorderColor=0078d7
@@ -122,6 +119,7 @@ ComboBox.darcula.arrowFillColor=457dd7
 ComboBox.darcula.arrowFocusedFillColor=2d82ed
 
 RadioButtonUI=com.intellij.ide.ui.laf.intellij.WinIntelliJRadioButtonUI
+RadioButton.disabledText=8a8a8a
 
 StatusBar.topColor=2c2c2c
 StatusBar.top2Color=2c2c2c
@@ -180,7 +178,7 @@ darcula.selectionForeground=ffffff
 
 PopupMenu.border=com.intellij.ide.ui.laf.darcula.ui.DarculaPopupMenuBorder
 
-MenuBar.border=com.intellij.ide.ui.laf.darcula.ui.DarculaMenuBarBorder
+MenuBar.border=com.intellij.ide.ui.laf.intellij.WinMenuBarBorder
 
 TabbedPaneUI=com.intellij.ide.ui.laf.darcula.ui.DarculaTabbedPaneUI
 TabbedPane.tabInsets=0,4,0,4
index 655f625469f1929caae1b8e23e6e8beeb86ffda6..f0b95ebeda5b466007770f9f4230c19b326f7a4a 100644 (file)
@@ -25,7 +25,6 @@ import com.intellij.openapi.ui.impl.DialogWrapperPeerImpl;
 import com.intellij.openapi.ui.impl.FocusTrackbackProvider;
 import com.intellij.openapi.ui.impl.GlassPaneDialogWrapperPeer;
 import com.intellij.openapi.util.SystemInfo;
-import com.intellij.openapi.util.registry.Registry;
 import com.intellij.openapi.wm.WindowManager;
 import com.intellij.openapi.wm.ex.WindowManagerEx;
 import com.intellij.ui.FocusTrackback;
@@ -404,7 +403,7 @@ class ProgressDialog implements Disposable {
       super.init();
       setUndecorated(true);
       getRootPane().setWindowDecorationStyle(JRootPane.NONE);
-      if (! (SystemInfo.isWindows && UIUtil.isUnderIntelliJLaF() && Registry.is("ide.intellij.laf.win10.ui"))) {
+      if (! UIUtil.isUnderWin10LookAndFeel()) {
         myPanel.setBorder(PopupBorder.Factory.create(true, true));
       }
     }
index ecebe7327fb404fa3cc9b3e6988bbe19a1a5203f..5d953f636fb4e91f872aeb9844c4b7e7ad9315fd 100644 (file)
                     serviceImplementation="com.intellij.codeInspection.ex.InspectionManagerEx"/>
     <projectService serviceInterface="com.intellij.usageView.UsageViewManager"
                     serviceImplementation="com.intellij.usageView.impl.UsageViewManagerImpl"/>
+    <applicationService serviceInterface="com.intellij.ide.projectView.impl.ProjectViewSharedSettings"
+                    serviceImplementation="com.intellij.ide.projectView.impl.ProjectViewSharedSettings"/>
     <projectService serviceInterface="com.intellij.ide.projectView.ProjectView"
                     serviceImplementation="com.intellij.ide.projectView.impl.ProjectViewImpl"/>
     <projectService serviceInterface="com.intellij.execution.ui.RunnerLayoutUi$Factory"
index 84bf48b485705aaf4b00516713d30724821c81aa..de67ea981552e0483d9e89765ddd182bd5375d4d 100644 (file)
@@ -65,7 +65,7 @@
         <action id="ChangesView.CreatePatch" class="com.intellij.openapi.vcs.changes.actions.CreatePatchAction"/>
         <action id="ChangesView.ApplyPatch" class="com.intellij.openapi.vcs.changes.patch.ApplyPatchAction"/>
         <action id="ChangesView.ApplyPatchFromClipboard" class="com.intellij.openapi.vcs.changes.patch.ApplyPatchFromClipboardAction"/>
-        <action id="ChangesView.Shelve" class="com.intellij.openapi.vcs.changes.shelf.ShelveChangesAction"/>
+        <action id="ChangesView.Shelve" class="com.intellij.openapi.vcs.changes.shelf.ShelveChangesAction" icon="AllIcons.Vcs.Shelve"/>
       </group>
 
       <separator/>
               icon="AllIcons.Actions.Submit1"/>
       <action id="ChangesView.Move" class="com.intellij.openapi.vcs.changes.actions.MoveChangesToAnotherListAction"
               icon="AllIcons.Actions.MoveToAnotherChangelist"/>
+      <action id="ChangesView.ShelveSilently" class="com.intellij.openapi.vcs.changes.actions.ShelveSilentlyAction"
+              text="Shelve Silently" description="Shelve changes to appropriate shelved changelists" icon="AllIcons.Vcs.SilentShelve">
+        <keyboard-shortcut first-keystroke="control alt H" keymap="$default"/>
+      </action>
       <action id="ChangesView.Diff" class="com.intellij.openapi.vcs.changes.actions.diff.ShowDiffAction"
               icon="AllIcons.Actions.Diff" use-shortcut-of="Diff.ShowDiff"/>
     </group>
 
-    <action id="ChangesView.ShelveSilently" class="com.intellij.openapi.vcs.changes.actions.ShelveSilentlyAction"
-            text="Shelve Silently" description="Shelve changes to appropriate shelved changelists">
-      <keyboard-shortcut first-keystroke="control alt H" keymap="$default"/>
-    </action>
-    <action id="ChangesView.UnshelveSilently" class="com.intellij.openapi.vcs.changes.actions.UnshelveSilentlyAction"
-            text="Unshelve Silently" description="Unshelve changes to appropriate changelists">
-      <keyboard-shortcut first-keystroke="control alt U" keymap="$default"/>
-    </action>
-
-
     <group id="AlienCommitChangesDialog.AdditionalActions"/>
 
     <group id="ChangesViewPopupMenu">
       <action id="ChangesView.Rename" class="com.intellij.openapi.vcs.changes.actions.RenameChangeListAction"/>
       <reference ref="ChangesView.CreatePatch"/>
       <reference ref="ChangesView.Shelve"/>
-      <reference ref="ChangesView.ShelveSilently"/>
       <separator/>
       <reference ref="ChangesView.Refresh"/>
       <separator/>
 
     <group id="ShelvedChangesPopupMenu" popup="true">
       <action id="ShelveChanges.UnshelveWithDialog" class="com.intellij.openapi.vcs.changes.shelf.UnshelveWithDialogAction"
-              text="Unshelve..." description="Correct paths where to apply patches and unshelve"/>
-      <reference id="ChangesView.UnshelveSilently"/>
+              text="Unshelve..." description="Correct paths where to apply patches and unshelve" icon="AllIcons.Vcs.Unshelve"/>
       <action id="ShelvedChanges.Restore" class="com.intellij.openapi.vcs.changes.shelf.RestoreShelvedChange"/>
       <action id="ShelvedChanges.Diff" class="com.intellij.openapi.vcs.changes.shelf.DiffShelvedChangesAction"
           icon="AllIcons.Actions.Diff" use-shortcut-of="Diff.ShowDiff"/>
 
     <group id="ShelvedChangesToolbar">
       <reference ref="ShelvedChanges.Diff"/>
+      <action id="ChangesView.UnshelveSilently" class="com.intellij.openapi.vcs.changes.actions.UnshelveSilentlyAction"
+              text="Unshelve Silently" description="Unshelve changes to appropriate changelists" icon="AllIcons.Vcs.SilentUnshelve">
+        <keyboard-shortcut first-keystroke="control alt U" keymap="$default"/>
+      </action>
       <reference ref="ChangesView.CreatePatchFromChanges"/>
       <reference ref="ShelvedChanges.ShowHideDeleted" />
       <reference ref="ShelvedChanges.CleanMarkedToDelete"/>
 
     <group id="ShelvedChangesToolbarGear" popup="true" icon="AllIcons.General.SecondaryGroup">
       <reference ref="ShelveChanges.UnshelveWithDialog"/>
-      <reference ref="ChangesView.UnshelveSilently"/>
       <reference ref="ShelvedChanges.Restore"/>
       <reference ref="ShelvedChanges.ImportPatches"/>
       <separator/>
index 3a1526a700267fa836088bc0da68ff04df39b1e2..79702585bd089ac9a0306915d031f7bb0faa7a4f 100644 (file)
@@ -869,3 +869,6 @@ debugger.show.values.inplace=false
 debugger.show.values.inplace.description=Show primitive values near variables inside current execution line
 show.configurables.ids.in.settings=false
 show.configurables.ids.in.settings.description=Show configurables ids in settings when user holds Shift. Works in Keymap and Settings trees
+
+ide.projectView.globalOptions=true
+ide.projectView.globalOptions.description=Make Project View options such as autoscroll to/from source, etc global per panes and per projects. For details see https://youtrack.jetbrains.com/issue/IDEA-85255
index 249ff563b2d4453ce3a235f6fe5fd8f19caffb72..60cc39a786744cc8a8710758e2a9097cb4ebf7dd 100644 (file)
@@ -1248,9 +1248,13 @@ public class AllIcons {
     public static final Icon Not_equal = IconLoader.getIcon("/vcs/not_equal.png"); // 16x16
     public static final Icon Remove = IconLoader.getIcon("/vcs/remove.png"); // 16x16
     public static final Icon ResetStrip = IconLoader.getIcon("/vcs/resetStrip.png"); // 16x16
+    public static final Icon Shelve = IconLoader.getIcon("/vcs/Shelve.png"); // 16x16
+    public static final Icon SilentShelve = IconLoader.getIcon("/vcs/SilentShelve.png"); // 16x16
+    public static final Icon SilentUnshelve = IconLoader.getIcon("/vcs/SilentUnshelve.png"); // 16x16
     public static final Icon StripDown = IconLoader.getIcon("/vcs/stripDown.png"); // 16x16
     public static final Icon StripNull = IconLoader.getIcon("/vcs/stripNull.png"); // 16x16
     public static final Icon StripUp = IconLoader.getIcon("/vcs/stripUp.png"); // 16x16
+    public static final Icon Unshelve = IconLoader.getIcon("/vcs/Unshelve.png"); // 16x16
 
   }
   
index a0b27b1bcc2ec8b1ae088eaa78f46fc74244ade3..9c5c3d4e0c18d426b416408f96a723a83478e63d 100644 (file)
@@ -625,6 +625,7 @@ public class FileUtil extends FileUtilRt {
     return findSequentNonexistentFile(aParentFolder, aFilePrefix, aExtension).getName();
   }
 
+  @NotNull
   public static File findSequentNonexistentFile(@NotNull File parentFolder, @NotNull  String filePrefix, @NotNull String extension) {
     int postfix = 0;
     String ext = extension.isEmpty() ? "" : '.' + extension;
index ce4b9fbdd875689a908156c14c8a3196c6b8e463..07f945c273516a96e73b1248d5cc192335d676b9 100644 (file)
@@ -1391,6 +1391,10 @@ public class UIUtil {
     return UIManager.getLookAndFeel().getName().contains("Darcula");
   }
 
+  public static boolean isUnderWin10LookAndFeel() {
+    return SystemInfo.isWindows && isUnderIntelliJLaF() && Registry.is("ide.intellij.laf.win10.ui");
+  }
+
   @SuppressWarnings({"HardCodedStringLiteral"})
   public static boolean isUnderIntelliJLaF() {
     return UIManager.getLookAndFeel().getName().contains("IntelliJ");
index accace38f836b366923360b32c7580308eebcad9..34c6b8ebf53dfe567c1aa58e73dfa9c4a4962998 100644 (file)
@@ -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.
@@ -20,8 +20,6 @@ import com.intellij.ide.util.projectWizard.ProjectSettingsStepBase;
 import com.intellij.ide.util.projectWizard.WebProjectTemplate;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
 import com.intellij.openapi.options.ConfigurationException;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.project.ProjectManager;
@@ -40,14 +38,13 @@ import com.intellij.util.NullableConsumer;
 import com.jetbrains.python.configuration.PyConfigurableInterpreterList;
 import com.jetbrains.python.newProject.PyNewProjectSettings;
 import com.jetbrains.python.newProject.PythonProjectGenerator;
-import com.jetbrains.python.packaging.PyPackageManager;
-import com.jetbrains.python.packaging.PyPackageManagerUI;
-import com.jetbrains.python.packaging.PyRequirement;
-import com.jetbrains.python.sdk.*;
+import com.jetbrains.python.sdk.PyDetectedSdk;
+import com.jetbrains.python.sdk.PythonSdkAdditionalData;
+import com.jetbrains.python.sdk.PythonSdkType;
+import com.jetbrains.python.sdk.PythonSdkUpdater;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import java.util.Collections;
 import java.util.List;
 
 public class PythonGenerateProjectCallback implements NullableConsumer<ProjectSettingsStepBase> {
@@ -93,29 +90,11 @@ public class PythonGenerateProjectCallback implements NullableConsumer<ProjectSe
     }
   }
 
-  private static void installRequirements(@NotNull Project project) {
-    final Module module = ModuleManager.getInstance(project).getModules()[0];
-    final Sdk sdk = PythonSdkType.findPythonSdk(module);
-    if (sdk == null) return;
-    final PyPackageManager manager = PyPackageManager.getInstance(sdk);
-    List<PyRequirement> requirements = manager.getRequirements(module);
-    if (requirements != null) {
-      final PyPackageManagerUI ui = new PyPackageManagerUI(project, sdk, null);
-      ui.install(requirements, Collections.emptyList());
-    }
-  }
-
-
   private static Sdk addDetectedSdk(ProjectSpecificSettingsStep settingsStep, Sdk sdk) {
     final Project project = ProjectManager.getInstance().getDefaultProject();
     final ProjectSdksModel model = PyConfigurableInterpreterList.getInstance(project).getModel();
     final String name = sdk.getName();
-    VirtualFile sdkHome = ApplicationManager.getApplication().runWriteAction(new Computable<VirtualFile>() {
-      @Override
-      public VirtualFile compute() {
-        return LocalFileSystem.getInstance().refreshAndFindFileByPath(name);
-      }
-    });
+    VirtualFile sdkHome = ApplicationManager.getApplication().runWriteAction((Computable<VirtualFile>)() -> LocalFileSystem.getInstance().refreshAndFindFileByPath(name));
     sdk = SdkConfigurationUtil.createAndAddSDK(sdkHome.getPath(), PythonSdkType.getInstance());
     if (sdk != null) {
       PythonSdkUpdater.updateOrShowError(sdk, null, project, null);
index 7018f4a6a640b609c56f6a3e04a34649a7158aa9..35c08d120e527ecbbc9abd2c57be82784076822b 100644 (file)
@@ -24,15 +24,62 @@ import org.jetbrains.annotations.NotNull;
 import java.util.List;
 
 public interface PyStringLiteralExpression extends PyLiteralExpression, StringLiteralExpression, PsiLanguageInjectionHost {
-  List<TextRange> getStringValueTextRanges();
-
+  @NotNull
   List<ASTNode> getStringNodes();
 
   int valueOffsetToTextOffset(int valueOffset);
 
+  /**
+   * Returns unescaped fragments of string's value together with their respective text ranges <i>relative to the element's start offset</i>.
+   * For most escape sequences the decoded character is returned and the text range that spans the sequence itself.
+   * Other "literal" fragments of the string are returned as is so that {@code pair.getFirst().length() == pair.getSecond().getLength()}.
+   * <p>
+   * For example, for the next "glued" string literal:
+   * <p>
+   * <pre><code>
+   * u"\u0066\x6F\157" '\bar' r'\baz'
+   * </code></pre>
+   * <p>
+   * this method returns:
+   * <p>
+   * <code><pre>
+   * [
+   *   ([2,8),"f"),
+   *   ([8,12),"o"),
+   *   ([12,16),"o"),
+   *   ([16,16),""),
+   *   ([19,21),"\b"),
+   *   ([21,23),"ar"),
+   *   ([27,29),"\\b"),
+   *   ([29,31),"az"),
+   * ]
+   * </code></pre>
+   */
   @NotNull
   List<Pair<TextRange, String>> getDecodedFragments();
 
+  /**
+   * Returns value ranges for all nodes that form this string literal expression <i>relative to its start offset</i>.
+   * Such range doesn't include neither node's prefix like "ur", nor its quotes.
+   * <p>
+   * For example, for the next "glued" string literal:
+   * <pre><code>
+   * u"\u0066\x6F\157" ur'' '''\t'''
+   * </code></pre>
+   * <p>
+   * this method returns:
+   * <p>
+   * <code><pre>
+   * [
+   *   [2,16),
+   *   [21,21),
+   *   [26,28),
+   * ]
+   * </code></pre>
+   */
+  @NotNull
+  List<TextRange> getStringValueTextRanges();
+  
   /**
    * @return true if this element has single string node and its type is {@link com.jetbrains.python.PyTokenTypes#DOCSTRING}
    */
index ef067f911f472485ee5594aa62a5b1f80c0bff44..64a686eec688d4755fda697cc4e938fc66febe71 100644 (file)
@@ -18,12 +18,12 @@ package com.jetbrains.python.packaging.ui;
 import com.google.common.collect.Lists;
 import com.intellij.execution.ExecutionException;
 import com.intellij.execution.RunCanceledByUserException;
-import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.util.SystemInfo;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.util.CatchingConsumer;
+import com.intellij.util.concurrency.AppExecutorUtil;
 import com.intellij.webcore.packaging.InstalledPackage;
 import com.intellij.webcore.packaging.PackageManagementServiceEx;
 import com.intellij.webcore.packaging.RepoPackage;
@@ -38,6 +38,7 @@ import org.jetbrains.annotations.Nullable;
 
 import java.io.IOException;
 import java.util.*;
+import java.util.concurrent.ExecutorService;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -57,10 +58,13 @@ public class PyPackageManagementService extends PackageManagementServiceEx {
 
   private final Project myProject;
   protected final Sdk mySdk;
+  protected final ExecutorService myExecutorService;
 
   public PyPackageManagementService(@NotNull Project project, @NotNull Sdk sdk) {
     myProject = project;
     mySdk = sdk;
+    // Dumb heuristic for the size of IO-bound tasks pool: safer than unlimited, snappier than a single thread
+    myExecutorService = AppExecutorUtil.createBoundedApplicationPoolExecutor("PyPackageManagementService pool", 4);
   }
 
   @NotNull
@@ -361,18 +365,17 @@ public class PyPackageManagementService extends PackageManagementServiceEx {
     installPackage(new RepoPackage(installedPackage.getName(), null), null, true, null, listener, false);
   }
 
+  /**
+   * @return whether the latest version should be requested independently for each package
+   */
   @Override
   public boolean shouldFetchLatestVersionsForOnlyInstalledPackages() {
-    /*
-    final List<String> repositories = PyPackageService.getInstance().additionalRepositories;
-    return repositories.size() > 1  || (repositories.size() == 1 && !repositories.get(0).equals(PyPIPackageUtil.PYPI_LIST_URL));
-    */
     return true;
   }
 
   @Override
   public void fetchLatestVersion(@NotNull InstalledPackage pkg, @NotNull CatchingConsumer<String, Exception> consumer) {
-    ApplicationManager.getApplication().executeOnPooledThread(() -> {
+    myExecutorService.submit(() -> {
       try {
         PyPIPackageUtil.INSTANCE.loadAndGetPackages();
         final String version = PyPIPackageUtil.INSTANCE.fetchLatestPackageVersion(pkg.getName());
index 3a13e7886567c523ee773eafa24b9cf9a638e64a..5f3691f095ad44f7b2323ccd5dd1ebafe2eb33bf 100644 (file)
@@ -101,6 +101,7 @@ public class PyStringLiteralExpressionImpl extends PyElementImpl implements PySt
     myDecodedFragments = null;
   }
 
+  @NotNull
   public List<TextRange> getStringValueTextRanges() {
     if (valueTextRanges == null) {
       int elStart = getTextRange().getStartOffset();
@@ -242,6 +243,7 @@ public class PyStringLiteralExpressionImpl extends PyElementImpl implements PySt
     return matcher.group(group.ordinal());
   }
 
+  @NotNull
   public List<ASTNode> getStringNodes() {
     return Arrays.asList(getNode().getChildren(PyTokenTypes.STRING_NODES));
   }