diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveJavaMemberHandler.java b/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveJavaMemberHandler.java index e24c40dbfe32..5bd1c20a0b1e 100644 --- a/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveJavaMemberHandler.java +++ b/java/java-impl/src/com/intellij/refactoring/move/moveMembers/MoveJavaMemberHandler.java @@ -180,7 +180,7 @@ public class MoveJavaMemberHandler implements MoveMemberHandler { } else { final PsiReferenceParameterList parameterList = refExpr.getParameterList(); - if (parameterList != null && parameterList.getTypeArguments().length == 0){ + if (parameterList != null && parameterList.getTypeArguments().length == 0 && !(refExpr instanceof PsiMethodReferenceExpression)){ refExpr.setQualifierExpression(null); } else { final Project project = element.getProject(); diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java index 94cce501d521..2209efe4141b 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java @@ -22,7 +22,6 @@ import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.TextRange; import com.intellij.psi.*; import com.intellij.psi.impl.PsiManagerEx; -import com.intellij.psi.impl.source.resolve.JavaResolveUtil; import com.intellij.psi.impl.source.resolve.ResolveCache; import com.intellij.psi.impl.source.resolve.graphInference.FunctionalInterfaceParameterizationUtil; import com.intellij.psi.impl.source.resolve.graphInference.InferenceSession; @@ -45,7 +44,6 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.util.ArrayList; -import java.util.Collection; import java.util.List; import java.util.Map; @@ -228,7 +226,7 @@ public class PsiMethodReferenceExpressionImpl extends PsiReferenceExpressionBase @Override public void setQualifierExpression(@Nullable PsiExpression newQualifier) throws IncorrectOperationException { if (newQualifier == null) { - super.setQualifierExpression(newQualifier); + LOG.error("Forbidden null qualifier"); return; } final PsiExpression expression = getQualifierExpression(); diff --git a/java/java-tests/testData/refactoring/moveMembers/fromNestedToOuterMethodRef/after/Outer.java b/java/java-tests/testData/refactoring/moveMembers/fromNestedToOuterMethodRef/after/Outer.java new file mode 100644 index 000000000000..aafb683292a0 --- /dev/null +++ b/java/java-tests/testData/refactoring/moveMembers/fromNestedToOuterMethodRef/after/Outer.java @@ -0,0 +1,10 @@ +class Outer { + static void foo() {} + + static class Inner { + } + + { + Runnable r = Outer::foo; + } +} diff --git a/java/java-tests/testData/refactoring/moveMembers/fromNestedToOuterMethodRef/before/Outer.java b/java/java-tests/testData/refactoring/moveMembers/fromNestedToOuterMethodRef/before/Outer.java new file mode 100644 index 000000000000..ae82c7498fff --- /dev/null +++ b/java/java-tests/testData/refactoring/moveMembers/fromNestedToOuterMethodRef/before/Outer.java @@ -0,0 +1,9 @@ +class Outer { + static class Inner { + static void foo() {} + } + + { + Runnable r = Inner::foo; + } +} diff --git a/java/java-tests/testSrc/com/intellij/refactoring/MoveMembersTest.java b/java/java-tests/testSrc/com/intellij/refactoring/MoveMembersTest.java index 83e8fa10aed9..b34486fcf110 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/MoveMembersTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/MoveMembersTest.java @@ -187,6 +187,18 @@ public class MoveMembersTest extends MultiFileTestCase { doTest("Outer.Inner", "Outer", true, VisibilityUtil.ESCALATE_VISIBILITY, 0); } + public void testFromNestedToOuterMethodRef() throws Exception { + final LanguageLevelProjectExtension projectExtension = LanguageLevelProjectExtension.getInstance(getProject()); + final LanguageLevel oldLevel = projectExtension.getLanguageLevel(); + try { + projectExtension.setLanguageLevel(LanguageLevel.HIGHEST); + doTest("Outer.Inner", "Outer", true, VisibilityUtil.ESCALATE_VISIBILITY, 0); + } + finally { + projectExtension.setLanguageLevel(oldLevel); + } + } + @NotNull @Override protected String getTestRoot() { diff --git a/lib/freemarker.jar b/lib/freemarker.jar new file mode 100644 index 000000000000..8b93b176e309 Binary files /dev/null and b/lib/freemarker.jar differ diff --git a/lib/required_for_dist.txt b/lib/required_for_dist.txt index 92b9434f6f34..1c30e0538d46 100644 --- a/lib/required_for_dist.txt +++ b/lib/required_for_dist.txt @@ -12,6 +12,7 @@ commons-net-3.1.jar httpcore-4.3.1.jar httpclient-4.3.2.jar fluent-hc-4.3.2.jar +freemarker.jar httpmime-4.3.2.jar ecj-4.3.2.jar groovy-all-2.2.1.jar diff --git a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/DefaultNavBarExtension.java b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/DefaultNavBarExtension.java index 487b8f2dfeb1..9bfd75e0b4f9 100644 --- a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/DefaultNavBarExtension.java +++ b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/DefaultNavBarExtension.java @@ -22,8 +22,10 @@ package com.intellij.ide.navigationToolbar; import com.intellij.analysis.AnalysisScopeBundle; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.module.InternalModuleType; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleManager; +import com.intellij.openapi.module.ModuleType; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.*; import com.intellij.openapi.util.Computable; @@ -33,7 +35,6 @@ import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.search.PsiFileSystemItemProcessor; import com.intellij.psi.util.PsiUtilCore; import com.intellij.util.Processor; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -113,7 +114,10 @@ public class DefaultNavBarExtension extends AbstractNavBarModelExtension { new Computable() { @Override public Boolean compute() { - return ContainerUtil.process(ModuleManager.getInstance(object).getModules(), processor); + for (Module module : ModuleManager.getInstance(object).getModules()) { + if (!(ModuleType.get(module) instanceof InternalModuleType) && !processor.process(module)) return false; + } + return true; } } ); diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/beans/ConvertUsagesUtil.java b/platform/platform-impl/src/com/intellij/internal/statistic/beans/ConvertUsagesUtil.java index 9dd0bf6a8794..6be8a543e48a 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/beans/ConvertUsagesUtil.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/beans/ConvertUsagesUtil.java @@ -160,7 +160,12 @@ public class ConvertUsagesUtil { */ @NotNull public static String escapeDescriptorName(@NotNull final String name) { - return name.replace(" ", "_").replace(GROUP_SEPARATOR, '_').replace(GROUPS_SEPARATOR, '_').replace(GROUP_VALUE_SEPARATOR, '_'); + return name.replace(" ", "_"). + replace(GROUP_SEPARATOR, '_'). + replace(GROUPS_SEPARATOR, '_'). + replace(GROUP_VALUE_SEPARATOR, '_') + .replace("'", " ") + .replace("\"", " "); } private static class StringPair { diff --git a/platform/platform-impl/src/com/intellij/platform/FilesystemToolwindow.java b/platform/platform-impl/src/com/intellij/platform/FilesystemToolwindow.java deleted file mode 100644 index ce707e3ba2bb..000000000000 --- a/platform/platform-impl/src/com/intellij/platform/FilesystemToolwindow.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2000-2012 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. - */ - -/* - * @author max - */ -package com.intellij.platform; - -import com.intellij.openapi.actionSystem.CommonDataKeys; -import com.intellij.openapi.actionSystem.DataProvider; -import com.intellij.openapi.actionSystem.PlatformDataKeys; -import com.intellij.openapi.fileChooser.FileChooserDescriptor; -import com.intellij.openapi.fileChooser.FileSystemTree; -import com.intellij.openapi.fileChooser.ex.FileSystemTreeImpl; -import com.intellij.openapi.fileEditor.OpenFileDescriptor; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.wm.ToolWindow; -import com.intellij.openapi.wm.ToolWindowAnchor; -import com.intellij.openapi.wm.ToolWindowManager; -import com.intellij.ui.ScrollPaneFactory; -import com.intellij.ui.content.Content; -import com.intellij.ui.content.ContentFactory; -import com.intellij.ui.content.ContentFactoryImpl; -import com.intellij.util.EditSourceOnDoubleClickHandler; -import com.intellij.util.EditSourceOnEnterKeyHandler; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.Nullable; - -import javax.swing.*; -import java.awt.*; - -public class FilesystemToolwindow { - private final VirtualFile myRoot; - private final Project myProject; - private final ToolWindow myToolWindow; - private final JPanel myContent; - private final FileSystemTree myFsTree; - - public FilesystemToolwindow(final VirtualFile root, Project project) { - myRoot = root; - myProject = project; - - myToolWindow = ToolWindowManager.getInstance(project).registerToolWindow("File System", false, ToolWindowAnchor.LEFT); - myContent = new MyContent(); - - final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, true, false, true, true); - descriptor.setRoots(myRoot); - - myFsTree = new FileSystemTreeImpl(project, descriptor); - myContent.add(ScrollPaneFactory.createScrollPane(myFsTree.getTree()), BorderLayout.CENTER); - EditSourceOnDoubleClickHandler.install(myFsTree.getTree()); - EditSourceOnEnterKeyHandler.install(myFsTree.getTree()); - - final ContentFactory contentFactory = new ContentFactoryImpl(); - final Content content = contentFactory.createContent(myContent, null, false); - myToolWindow.getContentManager().addContent(content); - } - - - private class MyContent extends JPanel implements DataProvider { - public MyContent() { - super(new BorderLayout()); - } - - @Nullable - public Object getData(@NonNls final String dataId) { - if (CommonDataKeys.NAVIGATABLE.is(dataId)) { - final VirtualFile file = myFsTree.getSelectedFile(); - if (file != null) { - return new OpenFileDescriptor(myProject, file); - } - } - else if (CommonDataKeys.VIRTUAL_FILE.is(dataId)) { - return myFsTree.getSelectedFile(); - } - return null; - } - } - -} diff --git a/platform/platform-impl/src/com/intellij/platform/FilesystemToolwindowOpener.java b/platform/platform-impl/src/com/intellij/platform/FilesystemToolwindowOpener.java deleted file mode 100644 index c1f1717c49d6..000000000000 --- a/platform/platform-impl/src/com/intellij/platform/FilesystemToolwindowOpener.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.platform; - -import com.intellij.openapi.project.DumbAware; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.startup.StartupActivity; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.wm.ToolWindowManager; -import org.jetbrains.annotations.NotNull; - -/** - * @author yole - */ -public class FilesystemToolwindowOpener implements StartupActivity, DumbAware { - - @Override - public void runActivity(@NotNull final Project project) { - final VirtualFile baseDir = ProjectBaseDirectory.getInstance(project).getBaseDir(); - if (baseDir == null || !baseDir.isDirectory()) return; - ToolWindowManager.getInstance(project).invokeLater(new Runnable() { - public void run() { - ToolWindowManager.getInstance(project).invokeLater(new Runnable() { - public void run() { - new FilesystemToolwindow(baseDir, project); - } - }); - } - }); - } -} diff --git a/platform/platform-resources-en/src/messages/IdeBundle.properties b/platform/platform-resources-en/src/messages/IdeBundle.properties index 1d8ac1ae2a7a..9db26b467133 100644 --- a/platform/platform-resources-en/src/messages/IdeBundle.properties +++ b/platform/platform-resources-en/src/messages/IdeBundle.properties @@ -706,7 +706,7 @@ label.please.enter.project.name=Please enter a name to create a new {0} {1}. prompt.please.select.project.jdk=Please select project SDK.\nThis SDK will be used by default by all project modules. label.project.jdk=Project SDK: button.configure=&Configure... -prompt.confirm.project.no.jdk=Do you want to create a project with no SDK assigned?\nSDK is required for compiling, debugging and running applications\nas well as for standard SDK classes resolution. +prompt.confirm.project.no.jdk=Do you want to create a project with no SDK assigned?\nAn SDK is required for compiling, debugging and running applications\n, as well as for the standard SDK classes resolution. title.no.jdk.specified=No SDK Specified prompt.please.specify.module.name=Please specify module name prompt.please.specify.module.name.and.content.root=Please specify module name and module content root.\nA module content root is a directory where the files that belong to the module are stored. diff --git a/platform/platform-resources/src/META-INF/LangExtensionPoints.xml b/platform/platform-resources/src/META-INF/LangExtensionPoints.xml index 609fb81d4523..dcdc0e2d983c 100644 --- a/platform/platform-resources/src/META-INF/LangExtensionPoints.xml +++ b/platform/platform-resources/src/META-INF/LangExtensionPoints.xml @@ -809,6 +809,7 @@ + diff --git a/platform/platform-resources/src/META-INF/PlatformPlugin.xml b/platform/platform-resources/src/META-INF/PlatformPlugin.xml index 3ad57625810c..db1cae3e76aa 100644 --- a/platform/platform-resources/src/META-INF/PlatformPlugin.xml +++ b/platform/platform-resources/src/META-INF/PlatformPlugin.xml @@ -48,8 +48,7 @@ serviceImplementation="com.intellij.openapi.wm.impl.PlatformFrameTitleBuilder"/> - - + diff --git a/platform/smRunner/testSrc/com/intellij/internal/statistic/beans/ConvertUsagesUtilTest.java b/platform/smRunner/testSrc/com/intellij/internal/statistic/beans/ConvertUsagesUtilTest.java new file mode 100644 index 000000000000..976fb293fcaa --- /dev/null +++ b/platform/smRunner/testSrc/com/intellij/internal/statistic/beans/ConvertUsagesUtilTest.java @@ -0,0 +1,12 @@ +package com.intellij.internal.statistic.beans; + +import junit.framework.TestCase; + +public class ConvertUsagesUtilTest extends TestCase { + + public void testEscapeDescriptorName() throws Exception { + ConvertUsagesUtil.assertDescriptorName(ConvertUsagesUtil.escapeDescriptorName("'Copy'_on_Steroids")); + ConvertUsagesUtil.assertDescriptorName(ConvertUsagesUtil.escapeDescriptorName("Some config name")); + ConvertUsagesUtil.assertDescriptorName(ConvertUsagesUtil.escapeDescriptorName("\"config\"")); + } +} \ No newline at end of file