mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -24,7 +24,7 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.ex.FileChooserDialogImpl;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDialog;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
@@ -59,21 +59,21 @@ public class OpenProjectAction extends AnAction implements DumbAware {
|
||||
descriptor.setDescription(IdeBundle.message("filter.project.files", StringUtil.join(extensions, ", ")));
|
||||
|
||||
VirtualFile userHomeDir = null;
|
||||
if (SystemInfo.isMac || SystemInfo.isLinux) {
|
||||
if (SystemInfo.isUnix) {
|
||||
final String home = SystemProperties.getUserHome();
|
||||
if (home != null) {
|
||||
userHomeDir = LocalFileSystem.getInstance().findFileByIoFile(new File(home));
|
||||
}
|
||||
}
|
||||
|
||||
descriptor.putUserData(FileChooserDialogImpl.PREFER_LAST_OVER_TO_SELECT, Boolean.TRUE);
|
||||
descriptor.putUserData(FileChooserDialog.PREFER_LAST_OVER_TO_SELECT, Boolean.TRUE);
|
||||
|
||||
FileChooser.chooseFilesWithSlideEffect(descriptor, project, userHomeDir,new Consumer<VirtualFile[]>() {
|
||||
FileChooser.chooseFilesWithSlideEffect(descriptor, project, userHomeDir, new Consumer<VirtualFile[]>() {
|
||||
@Override
|
||||
public void consume(final VirtualFile[] files) {
|
||||
if (files.length == 0 || files[0] == null) return;
|
||||
|
||||
ProjectUtil.openOrImport(files[0].getPath(), project, false);
|
||||
if (files.length == 1 && files[0] != null) {
|
||||
ProjectUtil.openOrImport(files[0].getPath(), project, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -740,7 +740,7 @@ public class JavaCompletionUtil {
|
||||
newElement = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(newElement);
|
||||
if (newElement != null) {
|
||||
newEndOffset = newElement.getTextRange().getEndOffset();
|
||||
if (newElement instanceof PsiJavaCodeReferenceElement) {
|
||||
if (newElement instanceof PsiJavaCodeReferenceElement && !(newElement instanceof PsiReferenceExpression)) {
|
||||
PsiReferenceParameterList parameterList = ((PsiJavaCodeReferenceElement)newElement).getParameterList();
|
||||
if (parameterList != null) {
|
||||
newEndOffset = parameterList.getTextRange().getStartOffset();
|
||||
|
||||
+14
@@ -51,6 +51,14 @@ public class IterateOverIterableIntention implements IntentionAction {
|
||||
final int selEnd = editor.getSelectionModel().getSelectionEnd();
|
||||
startOffset = (offset == selStart) ? selEnd : selStart;
|
||||
}
|
||||
PsiElement element = file.findElementAt(startOffset);
|
||||
while (element instanceof PsiWhiteSpace) {
|
||||
element = element.getPrevSibling();
|
||||
}
|
||||
PsiStatement psiStatement = PsiTreeUtil.getParentOfType(element, PsiStatement.class, false);
|
||||
if (psiStatement != null) {
|
||||
startOffset = psiStatement.getTextRange().getStartOffset();
|
||||
}
|
||||
if (!template.isDeactivated() &&
|
||||
(TemplateManagerImpl.isApplicable(file, offset, template) ||
|
||||
(TemplateManagerImpl.isApplicable(file, startOffset, template)))) {
|
||||
@@ -97,6 +105,12 @@ public class IterateOverIterableIntention implements IntentionAction {
|
||||
}
|
||||
|
||||
PsiElement element = file.findElementAt(editor.getCaretModel().getOffset());
|
||||
while (element instanceof PsiWhiteSpace) {
|
||||
element = element.getPrevSibling();
|
||||
}
|
||||
if (element instanceof PsiExpressionStatement) {
|
||||
element = ((PsiExpressionStatement)element).getExpression().getLastChild();
|
||||
}
|
||||
while ((element = PsiTreeUtil.getParentOfType(element, PsiExpression.class, true)) != null) {
|
||||
if (element.getParent() instanceof PsiMethodCallExpression) continue;
|
||||
final PsiType type = ((PsiExpression)element).getType();
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
{
|
||||
FIStr<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import java.io.FileInputStream;
|
||||
|
||||
class Foo {
|
||||
{
|
||||
FileInputStream.<caret>
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
// "Iterate" "true"
|
||||
class Test {
|
||||
void foo() {
|
||||
for (Annotation annotation : getClass().getAnnotations()) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
// "Iterate" "true"
|
||||
class Test {
|
||||
void foo() {
|
||||
for (Annotation annotation : getClass().getAnnotations()) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Iterate" "true"
|
||||
class Test {
|
||||
void foo() {
|
||||
getClass().getAnnotatio<caret>ns()
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Iterate" "true"
|
||||
class Test {
|
||||
void foo() {
|
||||
getClass().getAnnotations()<caret>
|
||||
}
|
||||
}
|
||||
@@ -1203,4 +1203,17 @@ class Foo {{
|
||||
assert myFixture.file.text.contains('FIS:')
|
||||
}
|
||||
|
||||
public void testSoutvTemplate() {
|
||||
((TemplateManagerImpl)TemplateManager.getInstance(getProject())).setTemplateTesting(true);
|
||||
try {
|
||||
myFixture.configureByText 'a.java', 'class Foo {{ <caret> }}'
|
||||
type 'soutv\tgetcl.'
|
||||
myFixture.checkResult '''class Foo {{
|
||||
System.out.println("getClass(). = " + getClass().<caret>); }}'''
|
||||
}
|
||||
finally {
|
||||
((TemplateManagerImpl)TemplateManager.getInstance(getProject())).setTemplateTesting(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
@@ -1264,4 +1264,6 @@ public class ListUtils {
|
||||
|
||||
public void testPackageInMemberType() { doTest() }
|
||||
|
||||
public void testClassNameDot() { doTest('.') }
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon.quickFix;
|
||||
|
||||
|
||||
|
||||
public class IterateOverTest extends LightQuickFix15TestCase {
|
||||
|
||||
public void test() throws Exception { doAllTests(); }
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return "/codeInsight/daemonCodeAnalyzer/quickFix/iterateOver";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user