Merge remote-tracking branch 'origin/master'

This commit is contained in:
Vladimir Orlov
2014-07-01 00:01:12 +04:00
15 changed files with 61 additions and 148 deletions
@@ -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();
@@ -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();
@@ -0,0 +1,10 @@
class Outer {
static void foo() {}
static class Inner {
}
{
Runnable r = Outer::foo;
}
}
@@ -0,0 +1,9 @@
class Outer {
static class Inner {
static void foo() {}
}
{
Runnable r = Inner::foo;
}
}
@@ -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() {
Binary file not shown.
+1
View File
@@ -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
@@ -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<Boolean>() {
@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;
}
}
);
@@ -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 {
@@ -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;
}
}
}
@@ -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);
}
});
}
});
}
}
@@ -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.
@@ -809,6 +809,7 @@
<extensionPoint name="sdkResolveScopeProvider" interface="com.intellij.psi.SdkResolveScopeProvider"/>
<extensionPoint name="goto.nonProjectScopeDisabler" beanClass="com.intellij.ide.actions.NonProjectScopeDisablerEP"/>
<extensionPoint qualifiedName="com.intellij.equivalenceDescriptorProvider" interface="com.intellij.dupLocator.equivalence.EquivalenceDescriptorProvider"/>
</extensionPoints>
</idea-plugin>
@@ -48,8 +48,7 @@
serviceImplementation="com.intellij.openapi.wm.impl.PlatformFrameTitleBuilder"/>
<projectService serviceInterface="com.intellij.platform.ProjectBaseDirectory"
serviceImplementation="com.intellij.platform.ProjectBaseDirectory"/>
<postStartupActivity implementation="com.intellij.platform.FilesystemToolwindowOpener"/>
<projectOpenProcessor implementation="com.intellij.platform.PlatformProjectOpenProcessor"/>
</extensions>
@@ -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\""));
}
}