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:
@@ -290,6 +290,7 @@ libraryLicense(name: "EditorConfig Java Core", libraryName: "editorconfig-core-j
|
||||
libraryLicense(name: "Fest", libraryName: "fest", version: "", license: "Apache 2.0", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://code.google.com/p/fest/")
|
||||
libraryLicense(name: "Gherkin", libraryName: "Gherkin", version: "2.12.2", license: "MIT", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://github.com/cucumber/gherkin")
|
||||
libraryLicense(name: "imgscalr", libraryName: "imgscalr", version: "4.2", license: "Apache 2.0", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://github.com/thebuzzmedia/imgscalr")
|
||||
libraryLicense(name: "Spantable", libraryName: "spantable.jar", version: "unknown", license: "LGPL 2.1", licenseUrl: "http://www.gnu.org/licenses/lgpl.html", url: "http://code.google.com/p/spantable/")
|
||||
libraryLicense(name: "JGit", libraryName: "jgit", version: "4.0", license: "Eclipse Distribution License 1.0", licenseUrl: "http://www.eclipse.org/org/documents/edl-v10.php", url: "https://eclipse.org/jgit/")
|
||||
libraryLicense(name: "JGit", libraryName: "jackson", version: "2.5.1", license: "Apache 2.0", licenseUrl: "http://www.eclipse.org/org/documents/edl-v10.php", url: "https://github.com/FasterXML/jackson")
|
||||
jetbrainsLibrary("Coverage")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -45,7 +45,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import static com.intellij.openapi.util.Conditions.*;
|
||||
import static com.intellij.openapi.util.Conditions.not;
|
||||
import static com.intellij.openapi.util.Conditions.notNull;
|
||||
|
||||
/**
|
||||
* @author ignatov
|
||||
@@ -143,16 +144,6 @@ public class ScratchFileActions {
|
||||
return file.getLanguage();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Function<VirtualFile, RootType> ROOT_TYPE(final ScratchFileService service) {
|
||||
return new Function<VirtualFile, RootType>() {
|
||||
@Override
|
||||
public RootType fun(VirtualFile virtualFile) {
|
||||
return service.getRootType(virtualFile);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Function<VirtualFile, Language> SCRATCH_LANG(final ScratchFileService service, final Project project) {
|
||||
return new Function<VirtualFile, Language>() {
|
||||
@@ -167,6 +158,16 @@ public class ScratchFileActions {
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Condition<VirtualFile> isScratch() {
|
||||
return new Condition<VirtualFile>() {
|
||||
@Override
|
||||
public boolean value(@NotNull VirtualFile file) {
|
||||
return ScratchRootType.getInstance().isScratchFile(file);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static class LanguageAction extends DumbAwareAction {
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
@@ -178,7 +179,7 @@ public class ScratchFileActions {
|
||||
}
|
||||
|
||||
ScratchFileService fileService = ScratchFileService.getInstance();
|
||||
Condition<VirtualFile> isScratch = compose(ROOT_TYPE(fileService), instanceOf(ScratchRootType.class));
|
||||
Condition<VirtualFile> isScratch = isScratch();
|
||||
if (!files.filter(not(isScratch)).isEmpty()) {
|
||||
e.getPresentation().setEnabledAndVisible(false);
|
||||
return;
|
||||
@@ -194,12 +195,10 @@ public class ScratchFileActions {
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = e.getProject();
|
||||
ScratchFileService fileService = ScratchFileService.getInstance();
|
||||
JBIterable<VirtualFile> files = JBIterable.of(e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY)).
|
||||
filter(compose(ROOT_TYPE(fileService), instanceOf(ScratchRootType.class)));
|
||||
JBIterable<VirtualFile> files = JBIterable.of(e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY)).filter(isScratch());
|
||||
if (project == null || files.isEmpty()) return;
|
||||
PerFileMappings<Language> mapping = fileService.getScratchesMapping();
|
||||
LRUPopupBuilder.forFileLanguages(project, files, mapping).showInBestPositionFor(e.getDataContext());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,7 +37,6 @@ import javax.swing.*;
|
||||
* @author gregsh
|
||||
*/
|
||||
public final class ScratchRootType extends RootType {
|
||||
|
||||
@NotNull
|
||||
public static ScratchRootType getInstance() {
|
||||
return findByClass(ScratchRootType.class);
|
||||
@@ -47,6 +46,12 @@ public final class ScratchRootType extends RootType {
|
||||
super("scratches", "Scratches");
|
||||
}
|
||||
|
||||
public boolean isScratchFile(@Nullable VirtualFile file) {
|
||||
if (file == null) return false;
|
||||
ScratchFileService service = ScratchFileService.getInstance();
|
||||
return service != null && service.getRootType(file) == this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Language substituteLanguage(@NotNull Project project, @NotNull VirtualFile file) {
|
||||
Language language = ScratchFileService.getInstance().getScratchesMapping().getMapping(file);
|
||||
|
||||
+6
-3
@@ -369,10 +369,13 @@ public class EditorActionUtil {
|
||||
}
|
||||
else {
|
||||
int line = logLineEndVis.line;
|
||||
if (currentVisCaret.column == 0 && editorSettings.isSmartHome()) {
|
||||
findSmartIndentColumn(editor, line);
|
||||
}
|
||||
int column = 0;
|
||||
if (currentVisCaret.column > 0) {
|
||||
int firstNonSpaceColumnOnTheLine = findFirstNonSpaceColumnOnTheLine(editor, currentVisCaret.line);
|
||||
if (firstNonSpaceColumnOnTheLine < currentVisCaret.column) {
|
||||
column = firstNonSpaceColumnOnTheLine;
|
||||
}
|
||||
}
|
||||
caretModel.moveToVisualPosition(new VisualPosition(line, column));
|
||||
}
|
||||
}
|
||||
|
||||
+8
@@ -214,4 +214,12 @@ public class EditorActionTest extends AbstractEditorTest {
|
||||
executeAction(IdeActions.ACTION_EDITOR_DUPLICATE_LINES);
|
||||
checkResultByText("a\nb\n<selection>b\n</selection>c");
|
||||
}
|
||||
|
||||
public void testSmartHomeAfterFoldedRegion() throws IOException {
|
||||
initText(" text with [multiline\nfold region]<caret>");
|
||||
foldOccurrences("(?s)\\[.*\\]", "...");
|
||||
myEditor.getSettings().setSmartHome(true);
|
||||
home();
|
||||
checkResultByText(" <caret>text with [multiline\nfold region]");
|
||||
}
|
||||
}
|
||||
@@ -608,6 +608,9 @@ cidr.cygwin.cmakePermissionsFix=true
|
||||
cidr.cygwin.cmakePermissionsFix.description=Update permissions for the bin/ folder inside the installed IDE so that the bundled CMake could run
|
||||
cidr.lldb.enableXcodeLLDB=false
|
||||
cidr.lldb.enableXcodeLLDB.description=Enable LLDB from Xcode
|
||||
cidr.max.intellisense.filesize=512
|
||||
cidr.max.intellisense.filesize.description=Maximum size of C/C++ file (in kilobytes) IDE should provide code assistance for.
|
||||
|
||||
ide.win.frame.decoration=false
|
||||
ide.win.frame.decoration.description=Enables Frame and Dialog decorations for IntelliJ and Darcula LaFs on Windows
|
||||
darcula.fix.native.flickering=false
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -23,7 +23,7 @@ import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.ide.fileTemplates.FileTemplate;
|
||||
import com.intellij.ide.fileTemplates.FileTemplateManager;
|
||||
import com.intellij.ide.scratch.ScratchFileService;
|
||||
import com.intellij.ide.scratch.ScratchRootType;
|
||||
import com.intellij.injected.editor.VirtualFileWindow;
|
||||
import com.intellij.lang.ASTFactory;
|
||||
import com.intellij.lang.ASTNode;
|
||||
@@ -933,11 +933,11 @@ public class PyUtil {
|
||||
/**
|
||||
* If directory is a PsiDirectory, that is also a valid Python package, return PsiFile that points to __init__.py,
|
||||
* if such file exists, or directory itself (i.e. namespace package). Otherwise, return {@code null}.
|
||||
* Unlike {@link #turnDirIntoInit(com.intellij.psi.PsiElement)} this function handles namespace packages and
|
||||
* Unlike {@link #turnDirIntoInit(PsiElement)} this function handles namespace packages and
|
||||
* accepts only PsiDirectories as target.
|
||||
*
|
||||
* @param directory directory to check
|
||||
* @param anchor optional PSI element to determine language level as for {@link #isPackage(com.intellij.psi.PsiDirectory, com.intellij.psi.PsiElement)}
|
||||
* @param anchor optional PSI element to determine language level as for {@link #isPackage(PsiDirectory, PsiElement)}
|
||||
* @return PsiFile or PsiDirectory, if target is a Python package and {@code null} null otherwise
|
||||
*/
|
||||
@Nullable
|
||||
@@ -1688,7 +1688,7 @@ public class PyUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters out {@link com.jetbrains.python.refactoring.classes.membersManager.PyMemberInfo}
|
||||
* Filters out {@link PyMemberInfo}
|
||||
* that should not be displayed in this refactoring (like object)
|
||||
*
|
||||
* @param pyMemberInfos collection to sort
|
||||
@@ -1756,10 +1756,10 @@ public class PyUtil {
|
||||
|
||||
/**
|
||||
* Checks that given class is the root of class hierarchy, i.e. it's either {@code object} or
|
||||
* special {@link com.jetbrains.python.PyNames#FAKE_OLD_BASE} class for old-style classes.
|
||||
* special {@link PyNames#FAKE_OLD_BASE} class for old-style classes.
|
||||
*
|
||||
* @param cls Python class to check
|
||||
* @see com.jetbrains.python.psi.impl.PyBuiltinCache
|
||||
* @see PyBuiltinCache
|
||||
* @see PyNames#FAKE_OLD_BASE
|
||||
*/
|
||||
public static boolean isObjectClass(@NotNull PyClass cls) {
|
||||
@@ -1769,11 +1769,11 @@ public class PyUtil {
|
||||
|
||||
/**
|
||||
* Checks that given type is the root of type hierarchy, i.e. it's type of either {@code object} or special
|
||||
* {@link com.jetbrains.python.PyNames#FAKE_OLD_BASE} class for old-style classes.
|
||||
* {@link PyNames#FAKE_OLD_BASE} class for old-style classes.
|
||||
*
|
||||
* @param type Python class to check
|
||||
* @param anchor arbitrary PSI element to find appropriate SDK
|
||||
* @see com.jetbrains.python.psi.impl.PyBuiltinCache
|
||||
* @see PyBuiltinCache
|
||||
* @see PyNames#FAKE_OLD_BASE
|
||||
*/
|
||||
public static boolean isObjectType(@NotNull PyType type, @NotNull PsiElement anchor) {
|
||||
@@ -1782,13 +1782,7 @@ public class PyUtil {
|
||||
}
|
||||
|
||||
public static boolean isInScratchFile(@NotNull PsiElement element) {
|
||||
final ScratchFileService service = ScratchFileService.getInstance();
|
||||
final PsiFile file = element.getContainingFile();
|
||||
if (file != null) {
|
||||
final VirtualFile virtualFile = file.getVirtualFile();
|
||||
return service != null && virtualFile != null && service.getRootType(virtualFile) != null;
|
||||
}
|
||||
return false;
|
||||
return ScratchRootType.getInstance().isScratchFile(element.getContainingFile().getVirtualFile());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user