Merge remote-tracking branch 'origin/master'
@@ -33,6 +33,7 @@
|
||||
<module name="javac2" target="1.5" />
|
||||
<module name="jps-launcher" target="1.6" />
|
||||
<module name="junit_rt" target="1.3" />
|
||||
<module name="testng_rt" target="1.5" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
<component name="EclipseCompilerSettings">
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
<root url="jar://$PROJECT_DIR$/lib/asm4-all.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/asm4-src.zip!/"/>
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
@@ -40,6 +40,7 @@ import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.refactoring.PackageWrapper;
|
||||
@@ -215,13 +216,40 @@ public class CreateTestDialog extends DialogWrapper {
|
||||
updateMethodsTable();
|
||||
}
|
||||
|
||||
private boolean isSuperclassSelectedManually() {
|
||||
String superClass = mySuperClassField.getText();
|
||||
if (StringUtil.isEmptyOrSpaces(superClass)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (TestFramework framework : TestFramework.EXTENSION_NAME.getExtensions()) {
|
||||
if (superClass.equals(framework.getDefaultSuperClass())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void onLibrarySelected(TestFramework descriptor) {
|
||||
String text = CodeInsightBundle.message("intention.create.test.dialog.library.not.found", descriptor.getName());
|
||||
myFixLibraryLabel.setText(text);
|
||||
myFixLibraryPanel.setVisible(!descriptor.isLibraryAttached(myTargetModule));
|
||||
|
||||
String superClass = descriptor.getDefaultSuperClass();
|
||||
mySuperClassField.appendItem(superClass == null ? "" : superClass);
|
||||
|
||||
if (isSuperclassSelectedManually()) {
|
||||
if (superClass != null) {
|
||||
String currentSuperClass = mySuperClassField.getText();
|
||||
mySuperClassField.appendItem(superClass);
|
||||
mySuperClassField.setText(currentSuperClass);
|
||||
}
|
||||
}
|
||||
else {
|
||||
mySuperClassField.appendItem(StringUtil.notNullize(superClass));
|
||||
mySuperClassField.getChildComponent().setSelectedItem(StringUtil.notNullize(superClass));
|
||||
}
|
||||
|
||||
mySelectedFramework = descriptor;
|
||||
}
|
||||
|
||||
@@ -524,7 +552,10 @@ public class CreateTestDialog extends DialogWrapper {
|
||||
dialog.showDialog();
|
||||
PsiClass aClass = dialog.getSelected();
|
||||
if (aClass != null) {
|
||||
mySuperClassField.setText(aClass.getQualifiedName());
|
||||
String superClass = aClass.getQualifiedName();
|
||||
|
||||
mySuperClassField.appendItem(superClass);
|
||||
mySuperClassField.getChildComponent().setSelectedItem(superClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,12 +20,14 @@
|
||||
package com.intellij.openapi.fileTypes;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.KeyedFactoryEPBean;
|
||||
import com.intellij.openapi.util.KeyedExtensionFactory;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class FileTypeExtensionFactory<T> extends KeyedExtensionFactory<T, FileType> {
|
||||
public FileTypeExtensionFactory(@NotNull final Class<T> interfaceClass, @NonNls @NotNull final String epName) {
|
||||
public FileTypeExtensionFactory(@NotNull final Class<T> interfaceClass, @NonNls @NotNull final ExtensionPointName<KeyedFactoryEPBean> epName) {
|
||||
super(interfaceClass, epName, ApplicationManager.getApplication().getPicoContainer());
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public class PsiParserFacadeImpl implements PsiParserFacade {
|
||||
public PsiComment createLineOrBlockCommentFromText(@NotNull Language lang, @NotNull String text)
|
||||
throws IncorrectOperationException {
|
||||
Commenter commenter = LanguageCommenters.INSTANCE.forLanguage(lang);
|
||||
assert commenter != null;
|
||||
assert commenter != null:lang;
|
||||
String prefix = commenter.getLineCommentPrefix();
|
||||
final String blockCommentPrefix = commenter.getBlockCommentPrefix();
|
||||
final String blockCommentSuffix = commenter.getBlockCommentSuffix();
|
||||
|
||||
@@ -17,6 +17,8 @@ package com.intellij.openapi.fileTypes;
|
||||
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.KeyedFactoryEPBean;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -27,13 +29,15 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @see SyntaxHighlighterFactory#getSyntaxHighlighter(com.intellij.lang.Language, com.intellij.openapi.project.Project, com.intellij.openapi.vfs.VirtualFile)
|
||||
*/
|
||||
public interface SyntaxHighlighter {
|
||||
ExtensionPointName<KeyedFactoryEPBean> EP_NAME = ExtensionPointName.create("com.intellij.syntaxHighlighter");
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see SyntaxHighlighterFactory#getSyntaxHighlighter(com.intellij.openapi.project.Project, com.intellij.openapi.vfs.VirtualFile)
|
||||
* @see SyntaxHighlighterFactory#getSyntaxHighlighter(com.intellij.lang.Language, com.intellij.openapi.project.Project, com.intellij.openapi.vfs.VirtualFile)
|
||||
*/
|
||||
SyntaxHighlighterProvider PROVIDER =
|
||||
new FileTypeExtensionFactory<SyntaxHighlighterProvider>(SyntaxHighlighterProvider.class, "com.intellij.syntaxHighlighter").get();
|
||||
new FileTypeExtensionFactory<SyntaxHighlighterProvider>(SyntaxHighlighterProvider.class, EP_NAME).get();
|
||||
|
||||
/**
|
||||
* Returns the lexer used for highlighting the file. The lexer is invoked incrementally when the file is changed, so it must be
|
||||
|
||||
@@ -34,9 +34,10 @@ public abstract class KeyedExtensionFactory<T, KeyT> {
|
||||
private final ExtensionPointName<KeyedFactoryEPBean> myEpName;
|
||||
private final PicoContainer myPicoContainer;
|
||||
|
||||
public KeyedExtensionFactory(@NotNull final Class<T> interfaceClass, @NonNls @NotNull final String epName, @NotNull PicoContainer picoContainer) {
|
||||
public KeyedExtensionFactory(@NotNull final Class<T> interfaceClass, @NonNls @NotNull final ExtensionPointName<KeyedFactoryEPBean> epName,
|
||||
@NotNull PicoContainer picoContainer) {
|
||||
myInterfaceClass = interfaceClass;
|
||||
myEpName = new ExtensionPointName<KeyedFactoryEPBean>(epName);
|
||||
myEpName = epName;
|
||||
myPicoContainer = picoContainer;
|
||||
}
|
||||
|
||||
|
||||
@@ -167,12 +167,7 @@ public class ContentRootDataService implements ProjectDataService<ContentRootDat
|
||||
}
|
||||
|
||||
private static void createExcludedRootIfAbsent(@NotNull ContentEntry entry, @NotNull String path, @NotNull String moduleName) {
|
||||
ExcludeFolder[] folders = entry.getExcludeFolders();
|
||||
for (ExcludeFolder folder : folders) {
|
||||
VirtualFile file = folder.getFile();
|
||||
if (file == null) {
|
||||
continue;
|
||||
}
|
||||
for (VirtualFile file : entry.getExcludeFolderFiles()) {
|
||||
if (ExternalSystemApiUtil.getLocalFileSystemPath(file).equals(path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.util.indexing;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.search.EverythingGlobalScope;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.ProjectScope;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -60,6 +61,7 @@ public class FindSymbolParameters {
|
||||
}
|
||||
|
||||
public static GlobalSearchScope searchScopeFor(Project project, boolean searchInLibraries) {
|
||||
if (project == null) return new EverythingGlobalScope();
|
||||
return searchInLibraries? ProjectScope.getAllScope(project) : ProjectScope.getProjectScope(project);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,21 +29,4 @@ public interface ExtendWordSelectionHandler {
|
||||
boolean canSelect(PsiElement e);
|
||||
|
||||
List<TextRange> select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor);
|
||||
|
||||
/**
|
||||
* Returns minimal selection length for given element.
|
||||
*
|
||||
* Sometimes the length of word selection should be bounded below.
|
||||
* E.g. it is useful in languages that requires prefixes for variable (php, less, etc.).
|
||||
* By default this kind of variables will be selected without prefix: @<selection>variable</selection>,
|
||||
* but it make sense to exclude this range from selection list.
|
||||
* So if this method returns 9 as a minimal length of selection
|
||||
* then first selection range for @variable will be: <selection>@variable</selection>.
|
||||
*
|
||||
* @param element element at caret
|
||||
* @param text text in editor
|
||||
* @param cursorOffset current caret offset in editor
|
||||
* @return minimal selection length for given element
|
||||
*/
|
||||
int getMinimalTextRangeLength(@NotNull PsiElement element, @NotNull CharSequence text, int cursorOffset);
|
||||
}
|
||||
@@ -21,6 +21,8 @@
|
||||
package com.intellij.openapi.roots.ui;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.KeyedFactoryEPBean;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.ui.SdkPathEditor;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
@@ -30,7 +32,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import javax.swing.*;
|
||||
|
||||
public interface OrderRootTypeUIFactory {
|
||||
KeyedExtensionFactory<OrderRootTypeUIFactory, OrderRootType> FACTORY = new KeyedExtensionFactory<OrderRootTypeUIFactory, OrderRootType>(OrderRootTypeUIFactory.class, "com.intellij.OrderRootTypeUI",
|
||||
ExtensionPointName<KeyedFactoryEPBean> EP_NAME = ExtensionPointName.create("com.intellij.OrderRootTypeUI");
|
||||
KeyedExtensionFactory<OrderRootTypeUIFactory, OrderRootType> FACTORY = new KeyedExtensionFactory<OrderRootTypeUIFactory, OrderRootType>(OrderRootTypeUIFactory.class, EP_NAME,
|
||||
ApplicationManager
|
||||
.getApplication().getPicoContainer()) {
|
||||
@Override
|
||||
|
||||
@@ -51,7 +51,21 @@ public abstract class ExtendWordSelectionHandlerBase implements ExtendWordSelect
|
||||
return ranges;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns minimal selection length for given element.
|
||||
*
|
||||
* Sometimes the length of word selection should be bounded below.
|
||||
* E.g. it is useful in languages that requires prefixes for variable (php, less, etc.).
|
||||
* By default this kind of variables will be selected without prefix: @<selection>variable</selection>,
|
||||
* but it make sense to exclude this range from selection list.
|
||||
* So if this method returns 9 as a minimal length of selection
|
||||
* then first selection range for @variable will be: <selection>@variable</selection>.
|
||||
*
|
||||
* @param element element at caret
|
||||
* @param text text in editor
|
||||
* @param cursorOffset current caret offset in editor
|
||||
* @return minimal selection length for given element
|
||||
*/
|
||||
public int getMinimalTextRangeLength(@NotNull PsiElement element, @NotNull CharSequence text, int cursorOffset) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -211,7 +211,9 @@ public class SelectWordUtil {
|
||||
List<ExtendWordSelectionHandler> availableSelectioners = ContainerUtil.newLinkedList();
|
||||
for (ExtendWordSelectionHandler selectioner : extendWordSelectionHandlers) {
|
||||
if (selectioner.canSelect(element)) {
|
||||
int selectionerMinimalTextRange = selectioner.getMinimalTextRangeLength(element, text, cursorOffset);
|
||||
int selectionerMinimalTextRange = selectioner instanceof ExtendWordSelectionHandlerBase
|
||||
? ((ExtendWordSelectionHandlerBase)selectioner).getMinimalTextRangeLength(element, text, cursorOffset)
|
||||
: 0;
|
||||
minimalTextRangeLength = Math.max(minimalTextRangeLength, selectionerMinimalTextRange);
|
||||
availableSelectioners.add(selectioner);
|
||||
}
|
||||
|
||||
@@ -117,6 +117,7 @@ public class LivePreviewController implements LivePreview.Delegate, FindUtil.Rep
|
||||
Runnable request = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (myDisposed) return;
|
||||
mySearchResults.updateThreadSafe(copy, allowedToChangedEditorSelection, null, stamp);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.ide.DataManager;
|
||||
import com.intellij.ide.IdeEventQueue;
|
||||
import com.intellij.ide.IdeTooltipManager;
|
||||
import com.intellij.ide.SearchTopHitProvider;
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.ide.ui.search.BooleanOptionDescription;
|
||||
import com.intellij.ide.ui.search.OptionDescription;
|
||||
import com.intellij.ide.ui.search.SearchableOptionsRegistrarImpl;
|
||||
@@ -58,6 +59,7 @@ import com.intellij.openapi.vfs.VirtualFilePathWrapper;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.openapi.wm.impl.IdeFrameImpl;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -74,6 +76,7 @@ import com.intellij.ui.components.JBList;
|
||||
import com.intellij.ui.components.JBScrollPane;
|
||||
import com.intellij.ui.components.OnOffButton;
|
||||
import com.intellij.ui.popup.AbstractPopup;
|
||||
import com.intellij.ui.popup.PopupPositionManager;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.indexing.FindSymbolParameters;
|
||||
import com.intellij.util.ui.EmptyIcon;
|
||||
@@ -372,30 +375,6 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
onFocusLost();
|
||||
}
|
||||
});
|
||||
|
||||
editor.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
switch (e.getKeyCode()) {
|
||||
case KeyEvent.VK_ESCAPE:
|
||||
if (myBalloon != null && myBalloon.isVisible()) {
|
||||
myBalloon.cancel();
|
||||
}
|
||||
if (myPopup != null && myPopup.isVisible()) {
|
||||
myPopup.cancel();
|
||||
}
|
||||
IdeFocusManager focusManager = IdeFocusManager.findInstanceByComponent(editor);
|
||||
focusManager.requestDefaultFocus(true);
|
||||
break;
|
||||
case KeyEvent.VK_ENTER:
|
||||
doNavigate(myList.getSelectedIndex());
|
||||
break;
|
||||
case KeyEvent.VK_TAB:
|
||||
jumpNextGroup(!e.isShiftDown());
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void jumpNextGroup(boolean forward) {
|
||||
@@ -403,7 +382,12 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
if (index >= 0) {
|
||||
final int newIndex = forward ? myTitleIndexes.next(index) : myTitleIndexes.prev(index);
|
||||
myList.setSelectedIndex(newIndex);
|
||||
ListScrollingUtil.ensureIndexIsVisible(myList, myList.getSelectedIndex(), forward ? 1 : -1);
|
||||
int more = myTitleIndexes.next(newIndex) - 1;
|
||||
if (more < newIndex) {
|
||||
more = myList.getItemsCount() - 1;
|
||||
}
|
||||
ListScrollingUtil.ensureIndexIsVisible(myList, more, forward ? 1 : -1);
|
||||
ListScrollingUtil.ensureIndexIsVisible(myList, newIndex, forward ? 1 : -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -592,7 +576,11 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
showPoint = new RelativePoint(button, new Point(button.getWidth() - panel.getPreferredSize().width, button.getHeight()));
|
||||
} else {
|
||||
if (parent != null) {
|
||||
showPoint = new RelativePoint(parent, new Point((parent.getSize().width - panel.getPreferredSize().width)/ 2, parent.getHeight()/4));
|
||||
int height = UISettings.getInstance().SHOW_MAIN_TOOLBAR ? 95 : 75;
|
||||
if (parent instanceof IdeFrameImpl && ((IdeFrameImpl)parent).isInFullScreen()) {
|
||||
height -= 20;
|
||||
}
|
||||
showPoint = new RelativePoint(parent, new Point((parent.getSize().width - panel.getPreferredSize().width)/ 2, height));
|
||||
} else {
|
||||
showPoint = JBPopupFactory.getInstance().guessBestPopupLocation(e.getDataContext());
|
||||
}
|
||||
@@ -605,18 +593,39 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
}
|
||||
|
||||
private void initSearchActions(JBPopup balloon, MySearchTextField searchTextField) {
|
||||
final JTextField editor = searchTextField.getTextEditor();
|
||||
new AnAction(){
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
jumpNextGroup(true);
|
||||
}
|
||||
}.registerCustomShortcutSet(CustomShortcutSet.fromString("TAB"), searchTextField.getTextEditor(), balloon);
|
||||
}.registerCustomShortcutSet(CustomShortcutSet.fromString("TAB"), editor, balloon);
|
||||
new AnAction(){
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
jumpNextGroup(false);
|
||||
}
|
||||
}.registerCustomShortcutSet(CustomShortcutSet.fromString("shift TAB"), searchTextField.getTextEditor(), balloon);
|
||||
}.registerCustomShortcutSet(CustomShortcutSet.fromString("shift TAB"), editor, balloon);
|
||||
new AnAction(){
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
if (myBalloon != null && myBalloon.isVisible()) {
|
||||
myBalloon.cancel();
|
||||
}
|
||||
if (myPopup != null && myPopup.isVisible()) {
|
||||
myPopup.cancel();
|
||||
}
|
||||
}
|
||||
}.registerCustomShortcutSet(CustomShortcutSet.fromString("ESCAPE"), editor, balloon);
|
||||
new AnAction(){
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final int index = myList.getSelectedIndex();
|
||||
if (index != -1) {
|
||||
doNavigate(index);
|
||||
}
|
||||
}
|
||||
}.registerCustomShortcutSet(CustomShortcutSet.fromString("ENTER"), editor, balloon);
|
||||
}
|
||||
|
||||
private static class MySearchTextField extends SearchTextField implements DataProvider, Disposable {
|
||||
@@ -1462,15 +1471,15 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
return;
|
||||
}
|
||||
final Container parent = getField().getParent();
|
||||
final Dimension size = myList.getPreferredSize();
|
||||
final Dimension size = myList.getParent().getParent().getPreferredSize();
|
||||
if (size.width < parent.getWidth()) {
|
||||
size.width = parent.getWidth();
|
||||
}
|
||||
if (myList.getItemsCount() == 0) {
|
||||
size.height = 70;
|
||||
}
|
||||
Dimension sz = new Dimension(size.width, size.height);
|
||||
if (sz.width > 1000 || sz.height > 800) {
|
||||
Dimension sz = new Dimension(size.width, myList.getPreferredSize().height);
|
||||
if (sz.width > 1200 || sz.height > 800) {
|
||||
final JBScrollPane pane = new JBScrollPane();
|
||||
final int extraWidth = pane.getVerticalScrollBar().getWidth() + 1;
|
||||
final int extraHeight = pane.getHorizontalScrollBar().getHeight() + 1;
|
||||
@@ -1497,7 +1506,36 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
}
|
||||
|
||||
private void adjustPopup() {
|
||||
// new PopupPositionManager.PositionAdjuster(getField().getParent()).adjust(myPopup, BOTTOM, RIGHT, LEFT, TOP);
|
||||
// new PopupPositionManager.PositionAdjuster(getField().getParent(), 0).adjust(myPopup, PopupPositionManager.Position.BOTTOM);
|
||||
final Dimension d = PopupPositionManager.PositionAdjuster.getPopupSize(myPopup);
|
||||
final JComponent myRelativeTo = myBalloon.getContent();
|
||||
Point myRelativeOnScreen = myRelativeTo.getLocationOnScreen();
|
||||
Rectangle screen = ScreenUtil.getScreenRectangle(myRelativeOnScreen);
|
||||
Rectangle popupRect = null;
|
||||
Rectangle r = new Rectangle(myRelativeOnScreen.x, myRelativeOnScreen.y + myRelativeTo.getHeight(), d.width, d.height);
|
||||
|
||||
if (screen.contains(r)) {
|
||||
popupRect = r;
|
||||
}
|
||||
|
||||
if (popupRect != null) {
|
||||
myPopup.setLocation(new Point(r.x, r.y));
|
||||
}
|
||||
else {
|
||||
if (r.y + d.height > screen.y + screen.height) {
|
||||
r.height = screen.y + screen.height - r.y - 2;
|
||||
}
|
||||
if (r.width > screen.width) {
|
||||
r.width = screen.width - 50;
|
||||
}
|
||||
if (r.x + r.width > screen.x + screen.width) {
|
||||
r.x = screen.x + screen.width - r.width - 2;
|
||||
}
|
||||
|
||||
myPopup.setSize(r.getSize());
|
||||
myPopup.setLocation(r.getLocation());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static boolean isToolWindowAction(Object o) {
|
||||
|
||||
@@ -293,12 +293,7 @@ public abstract class ContentEntryEditor implements ContentRootPanel.ActionCallb
|
||||
if (contentEntry == null) {
|
||||
return false;
|
||||
}
|
||||
final ExcludeFolder[] excludeFolders = contentEntry.getExcludeFolders();
|
||||
for (ExcludeFolder excludeFolder : excludeFolders) {
|
||||
final VirtualFile excludedDir = excludeFolder.getFile();
|
||||
if (excludedDir == null) {
|
||||
continue;
|
||||
}
|
||||
for (VirtualFile excludedDir : contentEntry.getExcludeFolderFiles()) {
|
||||
if (VfsUtilCore.isAncestor(excludedDir, file, true)) {
|
||||
return true;
|
||||
}
|
||||
@@ -312,8 +307,7 @@ public abstract class ContentEntryEditor implements ContentRootPanel.ActionCallb
|
||||
if (contentEntry == null) {
|
||||
return null;
|
||||
}
|
||||
final ExcludeFolder[] excludeFolders = contentEntry.getExcludeFolders();
|
||||
for (final ExcludeFolder excludeFolder : excludeFolders) {
|
||||
for (final ExcludeFolder excludeFolder : contentEntry.getExcludeFolders()) {
|
||||
final VirtualFile f = excludeFolder.getFile();
|
||||
if (f == null) {
|
||||
continue;
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.intellij.ide.util.treeView.NodeDescriptor;
|
||||
import com.intellij.ide.util.treeView.NodeRenderer;
|
||||
import com.intellij.openapi.fileChooser.FileElement;
|
||||
import com.intellij.openapi.roots.ContentEntry;
|
||||
import com.intellij.openapi.roots.ExcludeFolder;
|
||||
import com.intellij.openapi.roots.SourceFolder;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -81,9 +80,8 @@ public class ContentEntryTreeCellRenderer extends NodeRenderer {
|
||||
}
|
||||
|
||||
protected Icon updateIcon(final ContentEntry entry, final VirtualFile file, Icon originalIcon) {
|
||||
for (ExcludeFolder excludeFolder : entry.getExcludeFolders()) {
|
||||
final VirtualFile excludePath = excludeFolder.getFile();
|
||||
if (excludePath != null && VfsUtilCore.isAncestor(excludePath, file, false)) {
|
||||
for (VirtualFile excludePath : entry.getExcludeFolderFiles()) {
|
||||
if (VfsUtilCore.isAncestor(excludePath, file, false)) {
|
||||
return AllIcons.Modules.ExcludeRoot;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,8 +114,7 @@ public abstract class ContentRootPanel extends JPanel {
|
||||
folderByType.putValue(folder.getRootType(), folder);
|
||||
}
|
||||
|
||||
final ExcludeFolder[] excludeFolders = getContentEntry().getExcludeFolders();
|
||||
for (final ExcludeFolder excludeFolder : excludeFolders) {
|
||||
for (final ExcludeFolder excludeFolder : getContentEntry().getExcludeFolders()) {
|
||||
if (!excludeFolder.isSynthetic()) {
|
||||
excluded.add(excludeFolder);
|
||||
}
|
||||
@@ -272,12 +271,7 @@ public abstract class ContentRootPanel extends JPanel {
|
||||
if (contentEntry == null) {
|
||||
return false;
|
||||
}
|
||||
final ExcludeFolder[] excludeFolders = contentEntry.getExcludeFolders();
|
||||
for (ExcludeFolder excludeFolder : excludeFolders) {
|
||||
final VirtualFile excludedDir = excludeFolder.getFile();
|
||||
if (excludedDir == null) {
|
||||
continue;
|
||||
}
|
||||
for (VirtualFile excludedDir : contentEntry.getExcludeFolderFiles()) {
|
||||
if (VfsUtilCore.isAncestor(excludedDir, file, true)) {
|
||||
return true;
|
||||
}
|
||||
@@ -291,8 +285,7 @@ public abstract class ContentRootPanel extends JPanel {
|
||||
if (contentEntry == null) {
|
||||
return null;
|
||||
}
|
||||
final ExcludeFolder[] excludeFolders = contentEntry.getExcludeFolders();
|
||||
for (final ExcludeFolder excludeFolder : excludeFolders) {
|
||||
for (final ExcludeFolder excludeFolder : contentEntry.getExcludeFolders()) {
|
||||
final VirtualFile f = excludeFolder.getFile();
|
||||
if (f == null) {
|
||||
continue;
|
||||
|
||||
@@ -375,6 +375,7 @@ public class PostprocessReformattingAspect implements PomModelAspect {
|
||||
final PostprocessFormattingTask currentTask = iterator.next();
|
||||
if (accumulatedTask == null) {
|
||||
accumulatedTask = currentTask;
|
||||
iterator.remove();
|
||||
}
|
||||
else if (accumulatedTask.getStartOffset() > currentTask.getEndOffset() ||
|
||||
accumulatedTask.getStartOffset() == currentTask.getEndOffset() &&
|
||||
@@ -388,6 +389,7 @@ public class PostprocessReformattingAspect implements PomModelAspect {
|
||||
}
|
||||
|
||||
accumulatedTask = currentTask;
|
||||
iterator.remove();
|
||||
}
|
||||
else if (accumulatedTask instanceof ReformatTask && currentTask instanceof ReindentTask) {
|
||||
// split accumulated reformat range into two
|
||||
@@ -403,93 +405,49 @@ public class PostprocessReformattingAspect implements PomModelAspect {
|
||||
final RangeMarker rangeToProcess = document.createRangeMarker(currentTask.getEndOffset(), accumulatedTask.getEndOffset());
|
||||
freeFormattingActions.add(new ReformatWithHeadingWhitespaceTask(rangeToProcess));
|
||||
accumulatedTask = currentTask;
|
||||
}
|
||||
else if (!(accumulatedTask instanceof ReindentTask)) {
|
||||
boolean withLeadingWhitespace = accumulatedTask instanceof ReformatWithHeadingWhitespaceTask;
|
||||
if (accumulatedTask instanceof ReformatTask &&
|
||||
currentTask instanceof ReformatWithHeadingWhitespaceTask &&
|
||||
accumulatedTask.getStartOffset() == currentTask.getStartOffset()) {
|
||||
withLeadingWhitespace = true;
|
||||
}
|
||||
else if (accumulatedTask instanceof ReformatWithHeadingWhitespaceTask &&
|
||||
currentTask instanceof ReformatTask &&
|
||||
accumulatedTask.getStartOffset() < currentTask.getStartOffset()) {
|
||||
withLeadingWhitespace = false;
|
||||
}
|
||||
int newStart = Math.min(accumulatedTask.getStartOffset(), currentTask.getStartOffset());
|
||||
int newEnd = Math.max(accumulatedTask.getEndOffset(), currentTask.getEndOffset());
|
||||
RangeMarker rangeMarker;
|
||||
|
||||
if (accumulatedTask.getStartOffset() == newStart && accumulatedTask.getEndOffset() == newEnd) {
|
||||
rangeMarker = accumulatedTask.getRange();
|
||||
}
|
||||
else if (currentTask.getStartOffset() == newStart && currentTask.getEndOffset() == newEnd) {
|
||||
rangeMarker = currentTask.getRange();
|
||||
}
|
||||
else {
|
||||
rangeMarker = document.createRangeMarker(newStart, newEnd);
|
||||
}
|
||||
|
||||
if (withLeadingWhitespace) {
|
||||
accumulatedTask = new ReformatWithHeadingWhitespaceTask(rangeMarker);
|
||||
}
|
||||
else {
|
||||
accumulatedTask = new ReformatTask(rangeMarker);
|
||||
}
|
||||
}
|
||||
// accumulatedTask is an instance of ReindentTask
|
||||
else if (currentTask instanceof ReindentTask) {
|
||||
// child indent is different from parent, the child condition
|
||||
// accumulatedTask.getStartOffset() <= currentTask.getStartOffset()
|
||||
// && accumulatedTask.getEndOffset() >= currentTask.getEndOffset()
|
||||
// is always true here (ordered-by-end + up "if" in the method):
|
||||
|
||||
final CharSequence charsSequence = document.getCharsSequence();
|
||||
int curEndOffset = currentTask.getEndOffset();
|
||||
int curStartOffset = currentTask.getStartOffset();
|
||||
|
||||
// don't process ranges that have no new lines:
|
||||
// optimization: the case is covered by formatting task, or does not need the indent (fragment-in-the-middle-of-line).
|
||||
// compatibility: inline blocks have wrong indent due to historical reasons (always for inline function calls).
|
||||
if (charsSequence.subSequence(curStartOffset, curEndOffset).toString().indexOf('\n') != -1) {
|
||||
if (accumulatedTask.getEndOffset() > curEndOffset) {
|
||||
// tail of parent indent (the order is from-end-to-start)
|
||||
// restore "canonical" indent for calibration of the indent
|
||||
freeFormattingActions.add(new ReformatWithHeadingWhitespaceTask(document.createRangeMarker(curEndOffset, curEndOffset)));
|
||||
|
||||
// add the indent,
|
||||
// push indent task directly, that is in correct from-end-to-start order.
|
||||
indentActions.add(new ReindentTask(
|
||||
document.createRangeMarker(curEndOffset, accumulatedTask.getEndOffset()),
|
||||
((ReindentTask)accumulatedTask).getOldIndent()));
|
||||
}
|
||||
|
||||
if (accumulatedTask.getStartOffset() < curStartOffset) {
|
||||
// head of parent indent (the order is from-end-to-start)
|
||||
// the "canonical" indent for calibration of the indent should be prepared by previous tasks
|
||||
// here don't care about.
|
||||
// cannot push indent task directly, some child range task could be found.
|
||||
rangesToProcess.add(new ReindentTask(
|
||||
document.createRangeMarker(accumulatedTask.getStartOffset(), curStartOffset - 1),
|
||||
((ReindentTask)accumulatedTask).getOldIndent()));
|
||||
|
||||
//restore position
|
||||
iterator = rangesToProcess.iterator();
|
||||
//noinspection StatementWithEmptyBody
|
||||
while (iterator.next().getRange() != currentTask.getRange()) ;
|
||||
}
|
||||
|
||||
//body
|
||||
final RangeMarker rangeToProcess = document.createRangeMarker(curStartOffset, curStartOffset);
|
||||
freeFormattingActions.add(new ReformatWithHeadingWhitespaceTask(rangeToProcess));
|
||||
accumulatedTask = currentTask;
|
||||
}
|
||||
//else do nothing, just drop unused ReindentTask [currentTask]
|
||||
iterator.remove();
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
if (!(accumulatedTask instanceof ReindentTask)) {
|
||||
iterator.remove();
|
||||
|
||||
boolean withLeadingWhitespace = accumulatedTask instanceof ReformatWithHeadingWhitespaceTask;
|
||||
if (accumulatedTask instanceof ReformatTask &&
|
||||
currentTask instanceof ReformatWithHeadingWhitespaceTask &&
|
||||
accumulatedTask.getStartOffset() == currentTask.getStartOffset()) {
|
||||
withLeadingWhitespace = true;
|
||||
}
|
||||
else if (accumulatedTask instanceof ReformatWithHeadingWhitespaceTask &&
|
||||
currentTask instanceof ReformatTask &&
|
||||
accumulatedTask.getStartOffset() < currentTask.getStartOffset()) {
|
||||
withLeadingWhitespace = false;
|
||||
}
|
||||
int newStart = Math.min(accumulatedTask.getStartOffset(), currentTask.getStartOffset());
|
||||
int newEnd = Math.max(accumulatedTask.getEndOffset(), currentTask.getEndOffset());
|
||||
RangeMarker rangeMarker;
|
||||
|
||||
if (accumulatedTask.getStartOffset() == newStart && accumulatedTask.getEndOffset() == newEnd) {
|
||||
rangeMarker = accumulatedTask.getRange();
|
||||
}
|
||||
else if (currentTask.getStartOffset() == newStart && currentTask.getEndOffset() == newEnd) {
|
||||
rangeMarker = currentTask.getRange();
|
||||
}
|
||||
else {
|
||||
rangeMarker = document.createRangeMarker(newStart, newEnd);
|
||||
}
|
||||
|
||||
if (withLeadingWhitespace) {
|
||||
accumulatedTask = new ReformatWithHeadingWhitespaceTask(rangeMarker);
|
||||
}
|
||||
else {
|
||||
accumulatedTask = new ReformatTask(rangeMarker);
|
||||
|
||||
}
|
||||
}
|
||||
else if (currentTask instanceof ReindentTask) {
|
||||
iterator.remove();
|
||||
} // TODO[ik]: need to be fixed to correctly process indent inside indent
|
||||
}
|
||||
iterator.remove();
|
||||
}
|
||||
if (accumulatedTask != null) {
|
||||
if (accumulatedTask instanceof ReindentTask) {
|
||||
|
||||
@@ -135,33 +135,38 @@ public class PopupPositionManager {
|
||||
}
|
||||
|
||||
public static class PositionAdjuster {
|
||||
private static final int GAP = 5;
|
||||
private final int myGap;
|
||||
|
||||
private final Component myRelativeTo;
|
||||
private final Point myRelativeOnScreen;
|
||||
private final Rectangle myScreenRect;
|
||||
|
||||
public PositionAdjuster(final Component relativeTo) {
|
||||
public PositionAdjuster(final Component relativeTo, int gap) {
|
||||
myRelativeTo = relativeTo;
|
||||
myRelativeOnScreen = relativeTo.getLocationOnScreen();
|
||||
myScreenRect = ScreenUtil.getScreenRectangle(myRelativeOnScreen);
|
||||
myGap = gap;
|
||||
}
|
||||
|
||||
public PositionAdjuster(final Component relativeTo) {
|
||||
this(relativeTo, 5);
|
||||
}
|
||||
|
||||
protected Rectangle positionRight(final Dimension d) {
|
||||
return new Rectangle(myRelativeOnScreen.x + myRelativeTo.getWidth() + GAP, myRelativeOnScreen.y, d.width,
|
||||
return new Rectangle(myRelativeOnScreen.x + myRelativeTo.getWidth() + myGap, myRelativeOnScreen.y, d.width,
|
||||
d.height);
|
||||
}
|
||||
|
||||
protected Rectangle positionLeft(final Dimension d) {
|
||||
return new Rectangle(myRelativeOnScreen.x - GAP - d.width, myRelativeOnScreen.y, d.width, d.height);
|
||||
return new Rectangle(myRelativeOnScreen.x - myGap - d.width, myRelativeOnScreen.y, d.width, d.height);
|
||||
}
|
||||
|
||||
protected Rectangle positionAbove(final Dimension d) {
|
||||
return new Rectangle(myRelativeOnScreen.x, getYForTopPositioning() - GAP - d.height, d.width, d.height);
|
||||
return new Rectangle(myRelativeOnScreen.x, getYForTopPositioning() - myGap - d.height, d.width, d.height);
|
||||
}
|
||||
|
||||
protected Rectangle positionUnder(final Dimension d) {
|
||||
return new Rectangle(myRelativeOnScreen.x, myRelativeOnScreen.y + GAP + myRelativeTo.getHeight(), d.width, d.height);
|
||||
return new Rectangle(myRelativeOnScreen.x, myRelativeOnScreen.y + myGap + myRelativeTo.getHeight(), d.width, d.height);
|
||||
}
|
||||
|
||||
protected int getYForTopPositioning() {
|
||||
@@ -213,19 +218,19 @@ public class PopupPositionManager {
|
||||
// ok, popup does not fit, will try to resize it
|
||||
final java.util.List<Rectangle> boxes = new ArrayList<Rectangle>();
|
||||
// right
|
||||
boxes.add(crop(myScreenRect, new Rectangle(myRelativeOnScreen.x + myRelativeTo.getWidth() + GAP, myRelativeOnScreen.y,
|
||||
boxes.add(crop(myScreenRect, new Rectangle(myRelativeOnScreen.x + myRelativeTo.getWidth() + myGap, myRelativeOnScreen.y,
|
||||
myScreenRect.width, myScreenRect.height)));
|
||||
|
||||
// left
|
||||
boxes.add(crop(myScreenRect, new Rectangle(myScreenRect.x, myRelativeOnScreen.y, myRelativeOnScreen.x - myScreenRect.x - GAP,
|
||||
boxes.add(crop(myScreenRect, new Rectangle(myScreenRect.x, myRelativeOnScreen.y, myRelativeOnScreen.x - myScreenRect.x - myGap,
|
||||
myScreenRect.height)));
|
||||
|
||||
// top
|
||||
boxes.add(crop(myScreenRect, new Rectangle(myRelativeOnScreen.x, myScreenRect.y,
|
||||
myScreenRect.width, getYForTopPositioning() - myScreenRect.y - GAP)));
|
||||
myScreenRect.width, getYForTopPositioning() - myScreenRect.y - myGap)));
|
||||
|
||||
// bottom
|
||||
boxes.add(crop(myScreenRect, new Rectangle(myRelativeOnScreen.x, myRelativeOnScreen.y + myRelativeTo.getHeight() + GAP,
|
||||
boxes.add(crop(myScreenRect, new Rectangle(myRelativeOnScreen.x, myRelativeOnScreen.y + myRelativeTo.getHeight() + myGap,
|
||||
myScreenRect.width, myScreenRect.height)));
|
||||
|
||||
Collections.sort(boxes, new Comparator<Rectangle>() {
|
||||
@@ -278,7 +283,7 @@ public class PopupPositionManager {
|
||||
return result;
|
||||
}
|
||||
|
||||
protected static Dimension getPopupSize(final JBPopup popup) {
|
||||
public static Dimension getPopupSize(final JBPopup popup) {
|
||||
Dimension size = null;
|
||||
if (popup instanceof AbstractPopup) {
|
||||
final String dimensionKey = ((AbstractPopup)popup).getDimensionServiceKey();
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.intellij.ide.structureView;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.KeyedFactoryEPBean;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileTypes.FileTypeExtensionFactory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -32,8 +34,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
|
||||
public interface StructureViewBuilder {
|
||||
ExtensionPointName<KeyedFactoryEPBean> EP_NAME = ExtensionPointName.create("com.intellij.structureViewBuilder");
|
||||
|
||||
StructureViewBuilderProvider PROVIDER =
|
||||
new FileTypeExtensionFactory<StructureViewBuilderProvider>(StructureViewBuilderProvider.class, "com.intellij.structureViewBuilder").get();
|
||||
new FileTypeExtensionFactory<StructureViewBuilderProvider>(StructureViewBuilderProvider.class, EP_NAME).get();
|
||||
|
||||
/**
|
||||
* Returns the structure view implementation for the file displayed in the specified
|
||||
|
||||
@@ -80,7 +80,7 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil {
|
||||
|
||||
Project actualProject = project != null ? project : ProjectManager.getInstance().getDefaultProject();
|
||||
Configurable config = findByClass(new IdeConfigurablesGroup().getConfigurables(), configurableClass);
|
||||
if (config == null) {
|
||||
if (config == null && project != null) {
|
||||
config = findByClass(new ProjectConfigurablesGroup(project).getConfigurables(), configurableClass);
|
||||
}
|
||||
|
||||
@@ -103,23 +103,24 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil {
|
||||
public void showSettingsDialog(@Nullable final Project project, @NotNull final String nameToSelect) {
|
||||
ConfigurableGroup[] group;
|
||||
if (project == null) {
|
||||
group = new ConfigurableGroup[] {new IdeConfigurablesGroup()};
|
||||
} else {
|
||||
group = new ConfigurableGroup[] {new ProjectConfigurablesGroup(project), new IdeConfigurablesGroup()};
|
||||
group = new ConfigurableGroup[]{new IdeConfigurablesGroup()};
|
||||
}
|
||||
else {
|
||||
group = new ConfigurableGroup[]{new ProjectConfigurablesGroup(project), new IdeConfigurablesGroup()};
|
||||
}
|
||||
|
||||
Project actualProject = project != null ? project : ProjectManager.getInstance().getDefaultProject();
|
||||
Project actualProject = project != null ? project : ProjectManager.getInstance().getDefaultProject();
|
||||
|
||||
group = filterEmptyGroups(group);
|
||||
|
||||
OptionsEditorDialog dialog;
|
||||
if (Registry.is("ide.perProjectModality")) {
|
||||
dialog = new OptionsEditorDialog(actualProject, group, nameToSelect, true);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
dialog = new OptionsEditorDialog(actualProject, group, nameToSelect);
|
||||
}
|
||||
dialog.show();
|
||||
|
||||
}
|
||||
|
||||
public static void showSettingsDialog(@Nullable Project project, final String id2Select, final String filter) {
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurableGroup;
|
||||
import com.intellij.openapi.options.OptionsBundle;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
@@ -26,7 +27,7 @@ import com.intellij.openapi.project.Project;
|
||||
public class ProjectConfigurablesGroup extends ConfigurablesGroupBase implements ConfigurableGroup {
|
||||
private final Project myProject;
|
||||
|
||||
public ProjectConfigurablesGroup(Project project) {
|
||||
public ProjectConfigurablesGroup(@NotNull Project project) {
|
||||
super(project, Configurable.PROJECT_CONFIGURABLE, true);
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -86,7 +86,7 @@ public class FinderRecursivePanelTest extends PlatformTestCase {
|
||||
}
|
||||
|
||||
public void testUpdate() throws InterruptedException {
|
||||
StringFinderRecursivePanel panel_0 = new StringFinderRecursivePanel() {
|
||||
StringFinderRecursivePanel panel_0 = new StringFinderRecursivePanel(getProject()) {
|
||||
@NotNull
|
||||
@Override
|
||||
protected JComponent createRightComponent(String s) {
|
||||
@@ -105,7 +105,8 @@ public class FinderRecursivePanelTest extends PlatformTestCase {
|
||||
};
|
||||
}
|
||||
};
|
||||
Disposer.register(myTestRootDisposable, panel_0);
|
||||
disposeOnTearDown(panel_0);
|
||||
|
||||
panel_0.setTestSelectedIndex(0);
|
||||
//panel_0.updateRightComponent(true);
|
||||
|
||||
@@ -131,8 +132,8 @@ public class FinderRecursivePanelTest extends PlatformTestCase {
|
||||
|
||||
private JBList myList;
|
||||
|
||||
private StringFinderRecursivePanel() {
|
||||
super(FinderRecursivePanelTest.this.myProject, "fooPanel");
|
||||
private StringFinderRecursivePanel(Project project) {
|
||||
super(project, "fooPanel");
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
@@ -179,5 +179,12 @@ public interface ContentEntry extends Synthetic {
|
||||
*/
|
||||
void removeExcludeFolder(@NotNull ExcludeFolder excludeFolder);
|
||||
|
||||
/**
|
||||
* Removes an exclude root from this content root.
|
||||
* @param url url of the exclude root
|
||||
* @return {@code true} if the exclude root was removed
|
||||
*/
|
||||
boolean removeExcludeFolder(@NotNull String url);
|
||||
|
||||
void clearExcludeFolders();
|
||||
}
|
||||
|
||||
@@ -292,6 +292,18 @@ public class ContentEntryImpl extends RootModelComponentBase implements ContentE
|
||||
Disposer.dispose((Disposable)excludeFolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeExcludeFolder(@NotNull String url) {
|
||||
for (ExcludeFolder folder : myExcludeFolders) {
|
||||
if (folder.getUrl().equals(url)) {
|
||||
myExcludeFolders.remove(folder);
|
||||
Disposer.dispose((Disposable)folder);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearExcludeFolders() {
|
||||
assert !isDisposed();
|
||||
|
||||
@@ -255,6 +255,19 @@ public class JpsContentEntry implements ContentEntry, Disposable {
|
||||
Disposer.dispose(folder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeExcludeFolder(@NotNull String url) {
|
||||
for (JpsExcludeFolder folder : myExcludeFolders) {
|
||||
if (folder.getUrl().equals(url)) {
|
||||
myExcludeFolders.remove(folder);
|
||||
myModule.getExcludeRootsList().removeUrl(url);
|
||||
Disposer.dispose(folder);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearExcludeFolders() {
|
||||
List<String> toRemove = new ArrayList<String>();
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public interface LoggingHandler {
|
||||
void print(@NotNull String s);
|
||||
void printHyperlink(@NotNull String url);
|
||||
|
||||
void attachToProcess(@NotNull ProcessHandler handler);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.intellij.remoteServer.impl.runtime.log;
|
||||
|
||||
import com.intellij.execution.filters.BrowserHyperlinkInfo;
|
||||
import com.intellij.execution.filters.TextConsoleBuilderFactory;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.execution.ui.ConsoleView;
|
||||
@@ -28,6 +29,11 @@ public class LoggingHandlerImpl implements LoggingHandler {
|
||||
myConsole.print(s, ConsoleViewContentType.NORMAL_OUTPUT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHyperlink(@NotNull String url) {
|
||||
myConsole.printHyperlink(url, new BrowserHyperlinkInfo(url));
|
||||
}
|
||||
|
||||
public void printlnSystemMessage(@NotNull String s) {
|
||||
myConsole.print(s + "\n", ConsoleViewContentType.SYSTEM_OUTPUT);
|
||||
}
|
||||
|
||||
@@ -236,11 +236,7 @@ public class PsiTestUtil {
|
||||
@Override
|
||||
public void consume(ModifiableRootModel model) {
|
||||
ContentEntry entry = findContentEntryWithAssertion(model, root);
|
||||
for (ExcludeFolder excludeFolder : entry.getExcludeFolders()) {
|
||||
if (root.equals(excludeFolder.getFile())) {
|
||||
entry.removeExcludeFolder(excludeFolder);
|
||||
}
|
||||
}
|
||||
entry.removeExcludeFolder(root.getUrl());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.intellij.codeInspection.InspectionToolProvider;
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.ex.InspectionToolWrapper;
|
||||
import com.intellij.ide.structureView.newStructureView.StructureViewComponent;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
@@ -285,6 +286,9 @@ public interface CodeInsightTestFixture extends IdeaProjectTestFixture {
|
||||
@NotNull
|
||||
List<HighlightInfo> doHighlighting();
|
||||
|
||||
@NotNull
|
||||
List<HighlightInfo> doHighlighting(HighlightSeverity minimalSeverity);
|
||||
|
||||
/**
|
||||
* Finds the reference in position marked by {@link #CARET_MARKER}.
|
||||
*
|
||||
|
||||
@@ -51,6 +51,7 @@ import com.intellij.injected.editor.DocumentWindow;
|
||||
import com.intellij.injected.editor.EditorWindow;
|
||||
import com.intellij.internal.DumpLookupElementWeights;
|
||||
import com.intellij.lang.LanguageStructureViewBuilder;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
|
||||
@@ -1491,6 +1492,17 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
return instantiateAndRun(file, editor, ArrayUtil.EMPTY_INT_ARRAY, myAllowDirt);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<HighlightInfo> doHighlighting(final HighlightSeverity minimalSeverity) {
|
||||
return ContainerUtil.filter(doHighlighting(), new Condition<HighlightInfo>() {
|
||||
@Override
|
||||
public boolean value(HighlightInfo info) {
|
||||
return info.getSeverity().compareTo(minimalSeverity) >= 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<HighlightInfo> instantiateAndRun(@NotNull PsiFile file,
|
||||
@NotNull Editor editor,
|
||||
|
||||
|
After Width: | Height: | Size: 337 B |
|
After Width: | Height: | Size: 615 B |
|
After Width: | Height: | Size: 597 B |
|
After Width: | Height: | Size: 353 B |
|
After Width: | Height: | Size: 339 B |
|
After Width: | Height: | Size: 611 B |
|
After Width: | Height: | Size: 587 B |
|
After Width: | Height: | Size: 337 B |
|
After Width: | Height: | Size: 305 B |
|
After Width: | Height: | Size: 516 B |
|
After Width: | Height: | Size: 507 B |
|
After Width: | Height: | Size: 302 B |
@@ -80,7 +80,7 @@ public abstract class DataGetter<T extends VcsShortCommitDetails> implements Dis
|
||||
@NotNull
|
||||
private T loadingDetails(Node node, Hash hash) {
|
||||
TaskDescriptor descriptor = runLoadAroundCommitData(node);
|
||||
T loadingDetails = (T)new LoadingDetails(hash, descriptor.getTaskNum());
|
||||
T loadingDetails = (T)new LoadingDetails(hash, descriptor.getTaskNum(), node.getBranch().getRepositoryRoot());
|
||||
return loadingDetails;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public abstract class DataGetter<T extends VcsShortCommitDetails> implements Dis
|
||||
// fill the cache with temporary "Loading" values to avoid producing queries for each commit that has not been cached yet,
|
||||
// even if it will be loaded within a previous query
|
||||
if (!myCache.isKeyCached(hash)) {
|
||||
myCache.put(hash, (T)new LoadingDetails(hash, taskNumber));
|
||||
myCache.put(hash, (T)new LoadingDetails(hash, taskNumber, commitNode.getBranch().getRepositoryRoot()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.intellij.vcs.log.data;
|
||||
|
||||
import com.intellij.openapi.vcs.changes.Change;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.vcs.log.Hash;
|
||||
import com.intellij.vcs.log.impl.VcsFullCommitDetailsImpl;
|
||||
import com.intellij.vcs.log.ui.tables.AbstractVcsLogTableModel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -18,9 +18,8 @@ public class LoadingDetails extends VcsFullCommitDetailsImpl {
|
||||
|
||||
private final long myLoadingTaskIndex;
|
||||
|
||||
public LoadingDetails(@NotNull Hash hash, long loadingTaskIndex) {
|
||||
super(hash, Collections.<Hash>emptyList(), -1, AbstractVcsLogTableModel.UNKNOWN_ROOT,
|
||||
"Loading...", "", "", "", "", "", -1, Collections.<Change>emptyList());
|
||||
public LoadingDetails(@NotNull Hash hash, long loadingTaskIndex, @NotNull VirtualFile root) {
|
||||
super(hash, Collections.<Hash>emptyList(), -1, root, "Loading...", "", "", "", "", "", -1, Collections.<Change>emptyList());
|
||||
myLoadingTaskIndex = loadingTaskIndex;
|
||||
}
|
||||
|
||||
|
||||
@@ -704,6 +704,7 @@ public class VcsLogDataHolder implements Disposable {
|
||||
@NotNull
|
||||
public Collection<VcsFullCommitDetails> getTopCommitDetails() {
|
||||
final Collection<TimedVcsCommit> topCommits = getTopCommits();
|
||||
final AtomicBoolean errorDetailsAttached = new AtomicBoolean();
|
||||
return ContainerUtil.mapNotNull(topCommits, new Function<TimedVcsCommit, VcsFullCommitDetails>() {
|
||||
@Nullable
|
||||
@Override
|
||||
@@ -715,9 +716,14 @@ public class VcsLogDataHolder implements Disposable {
|
||||
}
|
||||
|
||||
// shouldn't happen
|
||||
LOG.error("No details were stored for commit " + hash,
|
||||
new Attachment("details_cache.txt", myTopCommitsDetailsCache.toString()),
|
||||
new Attachment("top_commits.txt", topCommits.toString()));
|
||||
String errorMessage = "No details were stored for commit " + hash;
|
||||
// log the error only once for the getTopCommitDetails request
|
||||
if (!errorDetailsAttached.get()) {
|
||||
errorDetailsAttached.set(true);
|
||||
LOG.error(errorMessage,
|
||||
new Attachment("details_cache.txt", myTopCommitsDetailsCache.toString()),
|
||||
new Attachment("top_commits.txt", topCommits.toString()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.vcs.log.VcsFullCommitDetails;
|
||||
import com.intellij.vcs.log.VcsLogFilter;
|
||||
import com.intellij.vcs.log.graph.elements.Node;
|
||||
@@ -35,7 +36,7 @@ public class VcsLogFilterer {
|
||||
}
|
||||
|
||||
public void applyFiltersAndUpdateUi(@NotNull Collection<VcsLogFilter> filters) {
|
||||
GraphModel graphModel = myLogDataHolder.getDataPack().getGraphModel();
|
||||
final GraphModel graphModel = myLogDataHolder.getDataPack().getGraphModel();
|
||||
List<VcsLogGraphFilter> graphFilters = ContainerUtil.findAll(filters, VcsLogGraphFilter.class);
|
||||
List<VcsLogDetailsFilter> detailsFilters = ContainerUtil.findAll(filters, VcsLogDetailsFilter.class);
|
||||
|
||||
@@ -48,11 +49,16 @@ public class VcsLogFilterer {
|
||||
applyGraphFilters(graphModel, graphFilters);
|
||||
}
|
||||
else {
|
||||
graphModel.setVisibleBranchesNodes(ALL_NODES_VISIBLE);
|
||||
myUI.getTable().executeWithoutRepaint(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
graphModel.setVisibleBranchesNodes(ALL_NODES_VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// apply details filters, and use simple table without graph (we can't filter by details and keep the graph yet).
|
||||
AbstractVcsLogTableModel model;
|
||||
final AbstractVcsLogTableModel model;
|
||||
if (!detailsFilters.isEmpty()) {
|
||||
List<VcsFullCommitDetails> filteredCommits = filterByDetails(graphModel, detailsFilters);
|
||||
model = new NoGraphTableModel(myUI, filteredCommits, myLogDataHolder.getDataPack().getRefsModel(), true);
|
||||
@@ -61,12 +67,21 @@ public class VcsLogFilterer {
|
||||
model = new GraphTableModel(myLogDataHolder, myUI);
|
||||
}
|
||||
|
||||
myUI.setModel(model);
|
||||
myUI.updateUI();
|
||||
updateUi(model);
|
||||
}
|
||||
|
||||
if (model.getRowCount() == 0) {
|
||||
model.requestToLoadMore();
|
||||
}
|
||||
private void updateUi(final AbstractVcsLogTableModel model) {
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myUI.setModel(model);
|
||||
myUI.updateUI();
|
||||
|
||||
if (model.getRowCount() == 0) {
|
||||
model.requestToLoadMore();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void requestVcs(@NotNull Collection<VcsLogFilter> filters, final Runnable onSuccess) {
|
||||
@@ -80,14 +95,19 @@ public class VcsLogFilterer {
|
||||
});
|
||||
}
|
||||
|
||||
private static void applyGraphFilters(GraphModel graphModel, final List<VcsLogGraphFilter> onGraphFilters) {
|
||||
graphModel.setVisibleBranchesNodes(new Function<Node, Boolean>() {
|
||||
private void applyGraphFilters(final GraphModel graphModel, final List<VcsLogGraphFilter> onGraphFilters) {
|
||||
myUI.getTable().executeWithoutRepaint(new Runnable() {
|
||||
@Override
|
||||
public Boolean fun(final Node node) {
|
||||
return !ContainerUtil.exists(onGraphFilters, new Condition<VcsLogGraphFilter>() {
|
||||
public void run() {
|
||||
graphModel.setVisibleBranchesNodes(new Function<Node, Boolean>() {
|
||||
@Override
|
||||
public boolean value(VcsLogGraphFilter filter) {
|
||||
return !filter.matches(node.getCommitHash());
|
||||
public Boolean fun(final Node node) {
|
||||
return !ContainerUtil.exists(onGraphFilters, new Condition<VcsLogGraphFilter>() {
|
||||
@Override
|
||||
public boolean value(VcsLogGraphFilter filter) {
|
||||
return !filter.matches(node.getCommitHash());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -61,4 +61,9 @@ public class VcsShortCommitDetailsImpl implements VcsShortCommitDetails {
|
||||
return myAuthorName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getHash().toShortString() + "(" + getSubject() + ")";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.vcs.log.ui.tables.AbstractVcsLogTableModel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -51,6 +52,9 @@ public class VcsLogColorManagerImpl implements VcsLogColorManager {
|
||||
@NotNull
|
||||
@Override
|
||||
public Color getRootColor(@NotNull VirtualFile root) {
|
||||
if (root == AbstractVcsLogTableModel.FAKE_ROOT) {
|
||||
return UIUtil.getTableBackground();
|
||||
}
|
||||
Color color = myRoots2Colors.get(root);
|
||||
if (color == null) {
|
||||
LOG.error("No color record for root " + root + ". All roots: " + myRoots2Colors);
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.intellij.vcs.log.ui;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.ui.table.JBTable;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.vcs.log.Hash;
|
||||
import com.intellij.vcs.log.VcsLogFilter;
|
||||
@@ -19,11 +18,13 @@ import com.intellij.vcs.log.graphmodel.FragmentManager;
|
||||
import com.intellij.vcs.log.graphmodel.GraphFragment;
|
||||
import com.intellij.vcs.log.printmodel.SelectController;
|
||||
import com.intellij.vcs.log.ui.frame.MainFrame;
|
||||
import com.intellij.vcs.log.ui.frame.VcsLogGraphTable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.table.TableModel;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
/**
|
||||
* @author erokhins
|
||||
@@ -68,7 +69,7 @@ public class VcsLogUI {
|
||||
}
|
||||
|
||||
public void jumpToRow(final int rowIndex) {
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myMainFrame.getGraphTable().jumpToRow(rowIndex);
|
||||
@@ -93,7 +94,7 @@ public class VcsLogUI {
|
||||
}
|
||||
|
||||
public void addToSelection(final Hash hash) {
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int row = myLogDataHolder.getDataPack().getRowByHash(hash);
|
||||
@@ -103,15 +104,25 @@ public class VcsLogUI {
|
||||
}
|
||||
|
||||
public void showAll() {
|
||||
myLogDataHolder.getDataPack().getGraphModel().getFragmentManager().showAll();
|
||||
updateUI();
|
||||
jumpToRow(0);
|
||||
runUnderModalProgress("Expanding linear branches...", new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myLogDataHolder.getDataPack().getGraphModel().getFragmentManager().showAll();
|
||||
updateUI();
|
||||
jumpToRow(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void hideAll() {
|
||||
myLogDataHolder.getDataPack().getGraphModel().getFragmentManager().hideAll();
|
||||
updateUI();
|
||||
jumpToRow(0);
|
||||
runUnderModalProgress("Collapsing linear branches...", new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myLogDataHolder.getDataPack().getGraphModel().getFragmentManager().hideAll();
|
||||
updateUI();
|
||||
jumpToRow(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setLongEdgeVisibility(boolean visibility) {
|
||||
@@ -145,18 +156,24 @@ public class VcsLogUI {
|
||||
|
||||
public void click(@Nullable GraphElement graphElement) {
|
||||
SelectController selectController = myLogDataHolder.getDataPack().getPrintCellModel().getSelectController();
|
||||
FragmentManager fragmentController = myLogDataHolder.getDataPack().getGraphModel().getFragmentManager();
|
||||
final FragmentManager fragmentController = myLogDataHolder.getDataPack().getGraphModel().getFragmentManager();
|
||||
selectController.deselectAll();
|
||||
if (graphElement == null) {
|
||||
return;
|
||||
}
|
||||
GraphFragment fragment = fragmentController.relateFragment(graphElement);
|
||||
final GraphFragment fragment = fragmentController.relateFragment(graphElement);
|
||||
if (fragment == null) {
|
||||
return;
|
||||
}
|
||||
UpdateRequest updateRequest = fragmentController.changeVisibility(fragment);
|
||||
|
||||
myMainFrame.getGraphTable().executeWithoutRepaint(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
UpdateRequest updateRequest = fragmentController.changeVisibility(fragment);
|
||||
jumpToRow(updateRequest.from());
|
||||
}
|
||||
});
|
||||
updateUI();
|
||||
jumpToRow(updateRequest.from());
|
||||
}
|
||||
|
||||
public void click(int rowIndex) {
|
||||
@@ -176,10 +193,23 @@ public class VcsLogUI {
|
||||
jumpToRow(row);
|
||||
}
|
||||
else {
|
||||
myLogDataHolder.showFullLog(new Runnable() {
|
||||
runUnderModalProgress("Building graph...", new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
jumpToCommit(commitHash);
|
||||
final CountDownLatch waiter = new CountDownLatch(1);
|
||||
myLogDataHolder.showFullLog(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
waiter.countDown();
|
||||
jumpToCommit(commitHash);
|
||||
}
|
||||
});
|
||||
try {
|
||||
waiter.await();
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -201,7 +231,11 @@ public class VcsLogUI {
|
||||
}
|
||||
|
||||
public void applyFiltersAndUpdateUi() {
|
||||
myFilterer.applyFiltersAndUpdateUi(collectFilters());
|
||||
runUnderModalProgress("Applying filters...", new Runnable() {
|
||||
public void run() {
|
||||
myFilterer.applyFiltersAndUpdateUi(collectFilters());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -209,7 +243,7 @@ public class VcsLogUI {
|
||||
return myMainFrame.getFilterUi().getFilters();
|
||||
}
|
||||
|
||||
public JBTable getTable() {
|
||||
public VcsLogGraphTable getTable() {
|
||||
return myMainFrame.getGraphTable();
|
||||
}
|
||||
|
||||
@@ -222,4 +256,9 @@ public class VcsLogUI {
|
||||
public Project getProject() {
|
||||
return myProject;
|
||||
}
|
||||
|
||||
public void runUnderModalProgress(@NotNull String task, @NotNull Runnable runnable) {
|
||||
ProgressManager.getInstance().runProcessWithProgressSynchronously(runnable, task, false, null, this.getMainFrame().getMainComponent());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.vcs.log.VcsLogFilter;
|
||||
import com.intellij.vcs.log.data.VcsLogFilterer;
|
||||
import com.intellij.vcs.log.ui.VcsLogUI;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -36,13 +35,13 @@ import java.util.List;
|
||||
*/
|
||||
public class VcsLogClassicFilterUi implements VcsLogFilterUi {
|
||||
|
||||
@NotNull private final VcsLogFilterer myFilterer;
|
||||
@NotNull private final JComponent myRootPanel;
|
||||
@NotNull private final List<FilterPopupComponent> myFilterPopupComponents;
|
||||
@NotNull private final SearchTextField myTextFilter;
|
||||
@NotNull private final VcsLogUI myUi;
|
||||
|
||||
public VcsLogClassicFilterUi(@NotNull VcsLogUI ui) {
|
||||
myFilterer = ui.getFilterer();
|
||||
myUi = ui;
|
||||
|
||||
JLabel filterCaption = new JLabel("Filter:");
|
||||
filterCaption.setForeground(UIUtil.isUnderDarcula() ? UIUtil.getLabelForeground() : UIUtil.getInactiveTextColor());
|
||||
@@ -97,7 +96,7 @@ public class VcsLogClassicFilterUi implements VcsLogFilterUi {
|
||||
}
|
||||
|
||||
void applyFilters() {
|
||||
myFilterer.applyFiltersAndUpdateUi(getFilters());
|
||||
myUi.applyFiltersAndUpdateUi();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -232,10 +232,10 @@ public class BranchesPanel extends JPanel {
|
||||
}
|
||||
|
||||
private void jumpToSelectedRef() {
|
||||
myPopup.cancel(); // close the popup immediately not to stay at the front if jumping to a commits takes long time.
|
||||
VcsRef selectedRef = (VcsRef)myList.getSelectedValue();
|
||||
if (selectedRef != null) {
|
||||
myUi.jumpToCommit(selectedRef.getCommitHash());
|
||||
myPopup.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.intellij.vcs.log.data.VcsLogUiProperties;
|
||||
import com.intellij.vcs.log.ui.VcsLogUI;
|
||||
import com.intellij.vcs.log.ui.filter.VcsLogClassicFilterUi;
|
||||
import com.intellij.vcs.log.ui.filter.VcsLogFilterUi;
|
||||
import icons.VcsLogIcons;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -63,14 +64,14 @@ public class MainFrame {
|
||||
}
|
||||
|
||||
private JComponent createActionsToolbar() {
|
||||
AnAction hideBranchesAction = new DumbAwareAction("Collapse linear branches", "Collapse linear branches", AllIcons.Actions.Collapseall) {
|
||||
AnAction hideBranchesAction = new DumbAwareAction("Collapse linear branches", "Collapse linear branches", VcsLogIcons.CollapseBranches) {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
myUI.hideAll();
|
||||
}
|
||||
};
|
||||
|
||||
AnAction showBranchesAction = new DumbAwareAction("Expand all branches", "Expand all branches", AllIcons.Actions.Expandall) {
|
||||
AnAction showBranchesAction = new DumbAwareAction("Expand all branches", "Expand all branches", VcsLogIcons.ExpandBranches) {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
myUI.showAll();
|
||||
@@ -91,7 +92,7 @@ public class MainFrame {
|
||||
|
||||
AnAction showFullPatchAction = new ToggleAction("Show long edges",
|
||||
"Show long branch edges even if commits are invisible in the current view.",
|
||||
AllIcons.Ide.UpDown) {
|
||||
VcsLogIcons.ShowHideLongEdges) {
|
||||
@Override
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
return !myUI.areLongEdgesHidden();
|
||||
|
||||
@@ -53,6 +53,8 @@ public class VcsLogGraphTable extends JBTable implements TypeSafeDataProvider, C
|
||||
@NotNull private final VcsLogUI myUI;
|
||||
@NotNull private final GraphCellPainter myGraphPainter = new SimpleGraphCellPainter();
|
||||
|
||||
private volatile boolean myRepaintFreezed;
|
||||
|
||||
public VcsLogGraphTable(@NotNull VcsLogUI UI, final VcsLogDataHolder logDataHolder) {
|
||||
super();
|
||||
myUI = UI;
|
||||
@@ -103,6 +105,27 @@ public class VcsLogGraphTable extends JBTable implements TypeSafeDataProvider, C
|
||||
scrollRectToVisible(getCellRect(rowIndex, 0, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
if (myRepaintFreezed) {
|
||||
return;
|
||||
}
|
||||
super.paintComponent(g);
|
||||
}
|
||||
|
||||
/**
|
||||
* Freeze repaint to avoid repainting during changing the Graph.
|
||||
*/
|
||||
public void executeWithoutRepaint(@NotNull Runnable action) {
|
||||
myRepaintFreezed = true;
|
||||
try {
|
||||
action.run();
|
||||
}
|
||||
finally {
|
||||
myRepaintFreezed = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public GraphPrintCell getGraphPrintCellForRow(TableModel model, int rowIndex) {
|
||||
if (rowIndex >= model.getRowCount()) {
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
*/
|
||||
public abstract class AbstractVcsLogTableModel<T> extends AbstractTableModel {
|
||||
|
||||
public static final VirtualFile UNKNOWN_ROOT = NullVirtualFile.INSTANCE;
|
||||
public static final VirtualFile FAKE_ROOT = NullVirtualFile.INSTANCE;
|
||||
|
||||
public static final int ROOT_COLUMN = 0;
|
||||
public static final int COMMIT_COLUMN = 1;
|
||||
|
||||
@@ -100,13 +100,7 @@ public class GraphTableModel extends AbstractVcsLogTableModel<GraphCommitCell> {
|
||||
@Override
|
||||
protected VirtualFile getRoot(int rowIndex) {
|
||||
Node commitNode = myDataPack.getGraphModel().getGraph().getCommitNodeInRow(rowIndex);
|
||||
if (commitNode != null) {
|
||||
return commitNode.getBranch().getRepositoryRoot();
|
||||
}
|
||||
else {
|
||||
LOG.error("Couldn't identify commit node at " + rowIndex);
|
||||
return UNKNOWN_ROOT;
|
||||
}
|
||||
return commitNode != null ? commitNode.getBranch().getRepositoryRoot() : FAKE_ROOT;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -84,7 +84,7 @@ public class NoGraphTableModel extends AbstractVcsLogTableModel<CommitCell> {
|
||||
}
|
||||
else {
|
||||
LOG.error("Couldn't identify root for commit at " + rowIndex, new Attachment("loaded_commits", myCommits.toString()));
|
||||
return UNKNOWN_ROOT;
|
||||
return FAKE_ROOT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package icons;
|
||||
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
*/
|
||||
public class VcsLogIcons {
|
||||
|
||||
private static Icon load(String path) {
|
||||
return IconLoader.getIcon(path, VcsLogIcons.class);
|
||||
}
|
||||
|
||||
public static final Icon CollapseBranches = load("/icons/CollapseBranches.png"); // 16x16
|
||||
public static final Icon ExpandBranches = load("/icons/ExpandBranches.png"); // 16x16
|
||||
public static final Icon ShowHideLongEdges = load("/icons/ShowHideLongEdges.png"); // 16x16
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/icons" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
||||
@@ -132,6 +132,7 @@ public class GitLogProvider implements VcsLogProvider {
|
||||
// TODO this is to be removed when tags will be supported by the GitRepositoryReader
|
||||
private Collection<? extends VcsRef> readTags(@NotNull VirtualFile root) throws VcsException {
|
||||
GitSimpleHandler tagHandler = new GitSimpleHandler(myProject, root, GitCommand.LOG);
|
||||
tagHandler.setSilent(true);
|
||||
tagHandler.addParameters("--tags", "--no-walk", "--format=%H%d" + GitLogParser.RECORD_START_GIT, "--decorate=full");
|
||||
String out = tagHandler.run();
|
||||
Collection<VcsRef> refs = new ArrayList<VcsRef>();
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
void setup() {
|
||||
${BODY}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<html>
|
||||
<body>
|
||||
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
|
||||
<tr>
|
||||
<td colspan="3"><font face="verdana" size="-1">
|
||||
This is a template used to create a setup() method in Spock test class.
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
|
||||
<tr>
|
||||
<td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
|
||||
<td width="10"> </td>
|
||||
<td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
|
||||
<td width="10"> </td>
|
||||
<td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,3 @@
|
||||
def "${NAME}"() {
|
||||
${BODY}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<html>
|
||||
<body>
|
||||
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
|
||||
<tr>
|
||||
<td colspan="3"><font face="verdana" size="-1">
|
||||
This is a template used to create a test method in Spock test class.
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
|
||||
<tr>
|
||||
<td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
|
||||
<td width="10"> </td>
|
||||
<td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
|
||||
<td width="10"> </td>
|
||||
<td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,3 @@
|
||||
void cleanup() {
|
||||
${BODY}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<html>
|
||||
<body>
|
||||
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
|
||||
<tr>
|
||||
<td colspan="3"><font face="verdana" size="-1">
|
||||
This is a template used to create a cleanup() method in Spock test class.
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
|
||||
<tr>
|
||||
<td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${NAME}</i></b></font></nobr></td>
|
||||
<td width="10"> </td>
|
||||
<td valign="top"><font face="verdana" size="-1">name of the created method.</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><nobr><font face="verdana" size="-2" color="#7F0000"><b><i>${BODY}</i></b></font></nobr></td>
|
||||
<td width="10"> </td>
|
||||
<td valign="top"><font face="verdana" size="-1">generated method body.</font></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -209,6 +209,8 @@
|
||||
implementationClass="org.jetbrains.plugins.groovy.findUsages.GrFileItemPresentationProvider"/>
|
||||
|
||||
<testFramework implementation="org.jetbrains.plugins.groovy.testIntegration.GroovyTestFramework" order="first"/>
|
||||
<testFramework implementation="org.jetbrains.plugins.groovy.spock.SpockTestFramework" order="first"/>
|
||||
|
||||
<testCreator language="Groovy" implementationClass="com.intellij.testIntegration.JavaTestCreator"/>
|
||||
<testGenerator language="Groovy" implementationClass="org.jetbrains.plugins.groovy.testIntegration.GroovyTestGenerator"/>
|
||||
<constructorBodyGenerator language="Groovy"
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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 org.jetbrains.plugins.groovy.spock;
|
||||
|
||||
import com.intellij.execution.junit.JUnitUtil;
|
||||
import com.intellij.ide.fileTemplates.FileTemplateDescriptor;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.util.PathUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.GroovyFileType;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiManager;
|
||||
import org.jetbrains.plugins.groovy.testIntegration.GroovyTestFramework;
|
||||
|
||||
/**
|
||||
* @author Sergey Evdokimov
|
||||
*/
|
||||
public class SpockTestFramework extends GroovyTestFramework {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Spock";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getLibraryPath() {
|
||||
try {
|
||||
return PathUtil.getJarPathForClass(Class.forName(getMarkerClassFQName()));
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getDefaultSuperClass() {
|
||||
return SpockUtils.SPEC_CLASS_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileTemplateDescriptor getSetUpMethodFileTemplateDescriptor() {
|
||||
return new FileTemplateDescriptor("Spock SetUp Method.groovy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileTemplateDescriptor getTearDownMethodFileTemplateDescriptor() {
|
||||
return new FileTemplateDescriptor("Spock cleanup Method.groovy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileTemplateDescriptor getTestMethodFileTemplateDescriptor() {
|
||||
return new FileTemplateDescriptor("Spock Test Method.groovy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTestMethod(PsiElement element) {
|
||||
if (!(element instanceof PsiMethod)) return false;
|
||||
|
||||
return GroovyPsiManager.isInheritorCached(((PsiMethod)element).getContainingClass(), SpockUtils.SPEC_CLASS_NAME)
|
||||
&& JUnitUtil.getTestMethod(element) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getMarkerClassFQName() {
|
||||
return SpockUtils.SPEC_CLASS_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTestClass(PsiClass clazz, boolean canBePotential) {
|
||||
return clazz.getLanguage() == GroovyFileType.GROOVY_LANGUAGE
|
||||
&& GroovyPsiManager.isInheritorCached(clazz, SpockUtils.SPEC_CLASS_NAME);
|
||||
}
|
||||
|
||||
private PsiMethod findSpecificMethod(@NotNull PsiClass clazz, String methodName) {
|
||||
if (!isTestClass(clazz, false)) return null;
|
||||
|
||||
for (PsiMethod method : clazz.findMethodsByName(methodName, false)) {
|
||||
if (method.getParameterList().getParametersCount() == 0) return method;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected PsiMethod findSetUpMethod(@NotNull PsiClass clazz) {
|
||||
return findSpecificMethod(clazz, "setup");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected PsiMethod findTearDownMethod(@NotNull PsiClass clazz) {
|
||||
return findSpecificMethod(clazz, "cleanup");
|
||||
}
|
||||
|
||||
@Override
|
||||
public char getMnemonic() {
|
||||
return 'S';
|
||||
}
|
||||
}
|
||||
@@ -171,10 +171,8 @@ public class MavenRootModelAdapter {
|
||||
|
||||
public boolean isAlreadyExcluded(File f) {
|
||||
String url = toUrl(f.getPath()).getUrl();
|
||||
for (ContentEntry eachEntry : myRootModel.getContentEntries()) {
|
||||
for (ExcludeFolder eachFolder : eachEntry.getExcludeFolders()) {
|
||||
if (VfsUtilCore.isEqualOrAncestor(eachFolder.getUrl(), url)) return true;
|
||||
}
|
||||
for (String excludedUrl : myRootModel.getExcludeRootUrls()) {
|
||||
if (VfsUtilCore.isEqualOrAncestor(excludedUrl, url)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,921 +0,0 @@
|
||||
# Python stdlib
|
||||
|
||||
|
||||
## 9.4. decimal
|
||||
|
||||
decimal.Decimal.as_tuple = \
|
||||
:rtype: decimal.DecimalTuple \n\
|
||||
|
||||
decimal.Decimal.__new__ = \
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
decimal.Decimal.__add__ = \
|
||||
:type other: decimal.Decimal or int or long or float or complex \n\
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
decimal.Decimal.__sub__ = \
|
||||
:type other: decimal.Decimal or int or long or float or complex \n\
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
decimal.Decimal.__mul__ = \
|
||||
:type other: decimal.Decimal or int or long or float or complex \n\
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
decimal.Decimal.__floordiv__ = \
|
||||
:type other: decimal.Decimal or int or long or float or complex \n\
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
decimal.Decimal.__mod__ = \
|
||||
:type other: decimal.Decimal or int or long or float or complex \n\
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
decimal.Decimal.__pow__ = \
|
||||
:type other: decimal.Decimal or int or long or float or complex \n\
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
decimal.Decimal.__div__ = \
|
||||
:type other: decimal.Decimal or int or long or float or complex \n\
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
decimal.Decimal.__truediv__ = \
|
||||
:type other: decimal.Decimal or int or long or float or complex \n\
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
decimal.Decimal.__radd__ = \
|
||||
:type other: decimal.Decimal or int or long or float or complex \n\
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
decimal.Decimal.__rsub__ = \
|
||||
:type other: decimal.Decimal or int or long or float or complex \n\
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
decimal.Decimal.__rmul__ = \
|
||||
:type other: decimal.Decimal or int or long or float or complex \n\
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
decimal.Decimal.__rfloordiv__ = \
|
||||
:type other: decimal.Decimal or int or long or float or complex \n\
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
decimal.Decimal.__rmod__ = \
|
||||
:type other: decimal.Decimal or int or long or float or complex \n\
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
decimal.Decimal.__rpow__ = \
|
||||
:type other: decimal.Decimal or int or long or float or complex \n\
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
decimal.Decimal.__rdiv__ = \
|
||||
:type other: decimal.Decimal or int or long or float or complex \n\
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
decimal.Decimal.__rtruediv__ = \
|
||||
:type other: decimal.Decimal or int or long or float or complex \n\
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
decimal.Decimal.__pos__ = \
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
decimal.Decimal.__neg__ = \
|
||||
:rtype: decimal.Decimal \n\
|
||||
|
||||
|
||||
# 10.1. os.path
|
||||
|
||||
os.path.abspath = \
|
||||
:type path: T <= bytes or unicode \n\
|
||||
:rtype: T \n\
|
||||
|
||||
os.path.basename = \
|
||||
:type p: T <= bytes or unicode \n\
|
||||
:rtype: T \n\
|
||||
|
||||
os.path.commonprefix = \
|
||||
:type m: collections.Iterable of T <= bytes or unicode \n\
|
||||
:rtype: T \n\
|
||||
|
||||
os.path.dirname = \
|
||||
:type p: T <= bytes or unicode \n\
|
||||
:rtype: T \n\
|
||||
|
||||
os.path.exists = \
|
||||
:type path: bytes or unicode \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.path.lexists = \
|
||||
:type path: bytes or unicode \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.path.expanduser = \
|
||||
:type path: T <= bytes or unicode \n\
|
||||
:rtype: T \n\
|
||||
|
||||
os.path.expandvars = \
|
||||
:type path: T <= bytes or unicode \n\
|
||||
:rtype: T \n\
|
||||
|
||||
os.path.getatime = \
|
||||
:type filename: bytes or unicode \n\
|
||||
:rtype: int or float \n\
|
||||
|
||||
os.path.getmtime = \
|
||||
:type filename: bytes or unicode \n\
|
||||
:rtype: int or float \n\
|
||||
|
||||
os.path.getctime = \
|
||||
:type filename: bytes or unicode \n\
|
||||
:rtype: int or float \n\
|
||||
|
||||
os.path.getsize = \
|
||||
:type filename: bytes or unicode \n\
|
||||
:rtype: int or long \n\
|
||||
|
||||
os.path.isabs = \
|
||||
:type s: bytes or unicode \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.path.isfile = \
|
||||
:type path: bytes or unicode \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.path.isdir = \
|
||||
:type s: bytes or unicode \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.path.islink = \
|
||||
:type path: bytes or unicode \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.path.ismount = \
|
||||
:type path: bytes or unicode \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.path.join = \
|
||||
:type a: T <= bytes or unicode \n\
|
||||
:rtype: T \n\
|
||||
|
||||
os.path.normcase = \
|
||||
:type s: T <= bytes or unicode \n\
|
||||
:rtype: T \n\
|
||||
|
||||
os.path.normpath = \
|
||||
:type path: T <= bytes or unicode \n\
|
||||
:rtype: T \n\
|
||||
|
||||
os.path.realpath = \
|
||||
:type filename: T <= bytes or unicode \n\
|
||||
:rtype: bytes or unicode \n\
|
||||
|
||||
os.path.relpath = \
|
||||
:type path: T <= bytes or unicode \n\
|
||||
:type start: bytes or unicode \n\
|
||||
:rtype: T \n\
|
||||
|
||||
os.path.samefile = \
|
||||
:type f1: bytes or unicode \n\
|
||||
:type f2: bytes or unicode \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.path.sameopenfile = \
|
||||
:type fp1: int \n\
|
||||
:type fp2: int \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.path.samestat = \
|
||||
:type s1: os.stat_result or tuple \n\
|
||||
:type s2: os.stat_result or tuple \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.path.split = \
|
||||
:type p: T <= bytes or unicode \n\
|
||||
:rtype: (T, T) \n\
|
||||
|
||||
os.path.splitdrive = \
|
||||
:type p: T <= bytes or unicode \n\
|
||||
:rtype: (T, T) \n\
|
||||
|
||||
os.path.splitext = \
|
||||
:type p: T <= bytes or unicode \n\
|
||||
:rtype: (T, T) \n\
|
||||
|
||||
os.path.splitunc = \
|
||||
:type p: T <= bytes or unicode \n\
|
||||
:rtype: (T, T) \n\
|
||||
|
||||
os.path.walk = \
|
||||
:type top: bytes or unicode \n\
|
||||
:rtype: None \n\
|
||||
|
||||
|
||||
## 10.10. shutil
|
||||
|
||||
shutil.copyfile = \
|
||||
:type src: bytes or unicode \n\
|
||||
:type dst: bytes or unicode \n\
|
||||
:rtype None \n\
|
||||
|
||||
shutil.copymode = \
|
||||
:type src: bytes or unicode \n\
|
||||
:type dst: bytes or unicode \n\
|
||||
:rtype None \n\
|
||||
|
||||
shutil.copystat = \
|
||||
:type src: bytes or unicode \n\
|
||||
:type dst: bytes or unicode \n\
|
||||
:rtype None \n\
|
||||
|
||||
shutil.copy = \
|
||||
:type src: bytes or unicode \n\
|
||||
:type dst: bytes or unicode \n\
|
||||
:rtype None \n\
|
||||
|
||||
shutil.copy2 = \
|
||||
:type src: bytes or unicode \n\
|
||||
:type dst: bytes or unicode \n\
|
||||
:rtype None \n\
|
||||
|
||||
shutil.copytree = \
|
||||
:type src: bytes or unicode \n\
|
||||
:type dst: bytes or unicode \n\
|
||||
:type symlinks: bool \n\
|
||||
:type ignore: collections.Callable or None \n\
|
||||
:rtype None \n\
|
||||
|
||||
shutil.rmtree = \
|
||||
:type path: bytes or unicode \n\
|
||||
:type ignore_errors: bool\n\
|
||||
:type onerror: collections.Callable or None \n\
|
||||
:rtype None \n\
|
||||
|
||||
shutil.move = \
|
||||
:type src: bytes or unicode \n\
|
||||
:type dst: bytes or unicode \n\
|
||||
:rtype None \n\
|
||||
|
||||
shutil.make_archive = \
|
||||
:type base_name: bytes or unicode \n\
|
||||
:type format: bytes or unicode \n\
|
||||
:type root_dir: bytes or unicode or None \n\
|
||||
:type base_dir: bytes or unicode or None \n\
|
||||
:type verbose: bool or int \n\
|
||||
:type dry_run: bool or int \n\
|
||||
:type owner: bytes or unicode or int or None \n\
|
||||
:type group: bytes or unicode or int or None \n\
|
||||
:rtype: bytes or unicode \n\
|
||||
|
||||
shutil.get_archive_formats = \
|
||||
:rtype: list of (string, string) \n\
|
||||
|
||||
shutil.register_archive_format = \
|
||||
:type name: bytes or unicode \n\
|
||||
:type function: collections.Callable \n\
|
||||
:type extra_args: None or collections.Sequence of (string, object) \n\
|
||||
:type description: bytes or unicode \n\
|
||||
:rtype: None
|
||||
|
||||
shutil.unregister_archive_format = \
|
||||
:type name: bytes or unicode \n\
|
||||
:rtype: None \n\
|
||||
|
||||
|
||||
## 11.13 sqlite3
|
||||
|
||||
_sqlite3.connect = \
|
||||
:type database: bytes or unicode \n\
|
||||
:rtype: _sqlite3.Connection
|
||||
|
||||
_sqlite3.Connection.cursor = \
|
||||
:rtype: _sqlite3.Cursor
|
||||
|
||||
## 15.1. os
|
||||
|
||||
os.ctermid = \
|
||||
:rtype: unicode \n\
|
||||
|
||||
os.getegid = \
|
||||
:rtype: int \n\
|
||||
|
||||
os.geteuid = \
|
||||
:rtype: int \n\
|
||||
|
||||
os.getgid = \
|
||||
:rtype: int \n\
|
||||
|
||||
os.getgroups = \
|
||||
:rtype: list of int \n\
|
||||
|
||||
os.initgroups = \
|
||||
:type username: string \n\
|
||||
:type gid: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.getlogin = \
|
||||
:rtype: unicode \n\
|
||||
|
||||
os.getpgid = \
|
||||
:type pid: int \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.getpgrp = \
|
||||
:rtype: int \n\
|
||||
|
||||
os.getpid = \
|
||||
:rtype: int \n\
|
||||
|
||||
os.getresuid = \
|
||||
:rtype: (int, int, int) \n\
|
||||
|
||||
os.getuid = \
|
||||
:rtype: int \n\
|
||||
|
||||
os.getenv = \
|
||||
:type key: string \n\
|
||||
:type default: object \n\
|
||||
:rtype: string \n\
|
||||
|
||||
os.putenv = \
|
||||
:type key: bytes or unicode \n\
|
||||
:type value: bytes or unicode \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.setegid = \
|
||||
:type gid: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.seteuid = \
|
||||
:type uid: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.setgid = \
|
||||
:type gid: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.setgroups = \
|
||||
:type p_list: list of int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.setpgrp = \
|
||||
:rtype: None \n\
|
||||
|
||||
os.setpgid = \
|
||||
:type pid: int \n\
|
||||
:type pgrp: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.setregid = \
|
||||
:type rgid: int \n\
|
||||
:type egid: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.setresgid = \
|
||||
:type rgid: int \n\
|
||||
:type egid: int \n\
|
||||
:type sgid: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.setresuid = \
|
||||
:type ruid: int \n\
|
||||
:type euid: int \n\
|
||||
:type suid: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.setreuid = \
|
||||
:type ruid: int \n\
|
||||
:type euid: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.getsid = \
|
||||
:type pid: int \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.setsid = \
|
||||
:rtype: None \n\
|
||||
|
||||
os.setuid = \
|
||||
:type uid: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.strerror = \
|
||||
:type code: int \n\
|
||||
:rtype: unicode \n\
|
||||
|
||||
os.umask = \
|
||||
:type new_mask: int \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.uname = \
|
||||
:rtype: (unicode, unicode, unicode, unicode, unicode) \n\
|
||||
|
||||
os.unsetenv = \
|
||||
:type key: string \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.fdopen = \
|
||||
:type fd: int \n\
|
||||
:type mode: string \n\
|
||||
:type bufsize: int \n\
|
||||
:rtype: file \n\
|
||||
|
||||
os.popen = \
|
||||
:type command: string \n\
|
||||
:type mode: string \n\
|
||||
:type bufsize: int \n\
|
||||
:rtype: io.FileIO \n\
|
||||
|
||||
os.tmpfile = \
|
||||
:rtype: io.FileIO \n\
|
||||
|
||||
os.popen2 = \
|
||||
:type cmd: string \n\
|
||||
:type mode: string \n\
|
||||
:type bufsize: int \n\
|
||||
:rtype: (io.FileIO, io.FileIO) \n\
|
||||
|
||||
os.popen3 = \
|
||||
:type cmd: string \n\
|
||||
:type mode: string \n\
|
||||
:type bufsize: int \n\
|
||||
:rtype: (io.FileIO, io.FileIO, io.FileIO) \n\
|
||||
|
||||
os.popen4 = \
|
||||
:type cmd: string \n\
|
||||
:type mode: string \n\
|
||||
:type bufsize: int \n\
|
||||
:rtype: (io.FileIO, io.FileIO) \n\
|
||||
|
||||
os.close = \
|
||||
:type fd: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.closerange = \
|
||||
:type fd_low: int \n\
|
||||
:type fd_high: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.dup = \
|
||||
:type fd: int \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.dup2 = \
|
||||
:type old_fd: int \n\
|
||||
:type new_fd: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.fchmod = \
|
||||
:type fd: int \n\
|
||||
:type mode: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.fchown = \
|
||||
:type fd: int \n\
|
||||
:type uid: int \n\
|
||||
:type gid: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.fdatasync = \
|
||||
:type fildes: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.fpathconf = \
|
||||
:type fd: int \n\
|
||||
:type name: int or string \n\
|
||||
|
||||
os.fstat = \
|
||||
:type fd: int \n\
|
||||
:rtype: os.stat_result \n\
|
||||
|
||||
os.fstatvfs = \
|
||||
:type fd: int \n\
|
||||
:rtype: os.statvfs_result \n\
|
||||
|
||||
os.fsync = \
|
||||
:type filedes: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.ftruncate = \
|
||||
:type fd: int \n\
|
||||
:type length: int or long \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.isatty = \
|
||||
:type fd: int \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.lseek = \
|
||||
:type fd: int \n\
|
||||
:type pos: int or long \n\
|
||||
:type how: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.open = \
|
||||
:type filename: string \n\
|
||||
:type mode: string \n\
|
||||
:type bufsize: int \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.openpty = \
|
||||
:rtype: (int, int) \n\
|
||||
|
||||
os.pipe = \
|
||||
:rtype: (int, int) \n\
|
||||
|
||||
os.read = \
|
||||
:type fd: int \b\
|
||||
:type buffersize: int or long \n\
|
||||
:rtype: bytes \n\
|
||||
|
||||
os.tcgetpgrp = \
|
||||
:type fd: int \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.tcsetpgrp = \
|
||||
:type fd: int \n\
|
||||
:type pgid: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.ttyname = \
|
||||
:type fd: int \n\
|
||||
:rtype: unicode \n\
|
||||
|
||||
os.write = \
|
||||
:type fd: int \n\
|
||||
:type string: bytes \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.access = \
|
||||
:type path: bytes or unicode \n\
|
||||
:type mode: int \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.chdir = \
|
||||
:type path: bytes or unicode \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.fchdir = \
|
||||
:type filedes: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.getcwd = \
|
||||
:rtype: str \n\
|
||||
|
||||
os.getcwdu = \
|
||||
:rtype: unicode \n\
|
||||
|
||||
os.chroot = \
|
||||
:type path: bytes or unicode \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.chmod = \
|
||||
:type path: bytes or unicode \n\
|
||||
:type mode: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.chown = \
|
||||
:type path: bytes or unicode \n\
|
||||
:type uid: int \n\
|
||||
:type gid: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.lchown = \
|
||||
:type path: bytes or unicode \n\
|
||||
:type uid: int \n\
|
||||
:type gid: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.link = \
|
||||
:type src: bytes or unicode \n\
|
||||
:type dst: bytes or unicode \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.listdir = \
|
||||
:type path: T <= bytes or unicode \n\
|
||||
:rtype: list of T \n\
|
||||
|
||||
os.lstat = \
|
||||
:type path: bytes or unicode \n\
|
||||
:rtype: os.stat_result \n\
|
||||
|
||||
os.mkfifo = \
|
||||
:type filename: bytes or unicode \n\
|
||||
:type mode: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.mknod = \
|
||||
:type filename: bytes or unicode \n\
|
||||
:type mode: int \n\
|
||||
:type device: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.major = \
|
||||
:type device: int \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.minor = \
|
||||
:type device: int \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.makedev = \
|
||||
:type major: int \n\
|
||||
:type minor: int \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.mkdir = \
|
||||
:type path: bytes or unicode \n\
|
||||
:type mode: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.makedirs = \
|
||||
:type name: bytes or unicode \n\
|
||||
:type mode: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.pathconf = \
|
||||
:type path: bytes or unicode \n\
|
||||
:type name: int or string \n\
|
||||
|
||||
os.readlink = \
|
||||
:type path: T <= bytes or unicode \n\
|
||||
:rtype: T \n\
|
||||
|
||||
os.remove = \
|
||||
:type path: bytes or unicode \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.removedirs = \
|
||||
:type name: bytes or unicode \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.rename = \
|
||||
:type old: bytes or unicode \n\
|
||||
:type new: bytes or unicode \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.renames = \
|
||||
:type old: bytes or unicode \n\
|
||||
:type new: bytes or unicode \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.rmdir = \
|
||||
:type path: bytes or unicode \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.stat = \
|
||||
:type path: bytes or unicode \n\
|
||||
:rtype: os.stat_result \n\
|
||||
|
||||
os.stat_float_times = \
|
||||
:type newval: bool or None \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.statvfs = \
|
||||
:type path: bytes or unicode \n\
|
||||
:rtype: os.statvfs_result \n\
|
||||
|
||||
os.symlink = \
|
||||
:type src: bytes or unicode \n\
|
||||
:type dst: bytes or unicode \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.tempnam = \
|
||||
:type dir: bytes or unicode \n\
|
||||
:type prefix: bytes or unicode \n\
|
||||
:rtype: string \n\
|
||||
|
||||
os.tmpnam = \
|
||||
:rtype: string \n\
|
||||
|
||||
os.unlink = \
|
||||
:type path: bytes or unicode \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.utime = \
|
||||
:type path: bytes or unicode \n\
|
||||
:type atime: int or float \n\
|
||||
:type mtime: int or float \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.walk = \
|
||||
:type top: T <= bytes or unicode \n\
|
||||
:type topdown: bool \n\
|
||||
:type followlinks: bool \n\
|
||||
:rtype: collections.Iterable of (T, list of T, list of T) \n\
|
||||
|
||||
os.execl = \
|
||||
:type file: bytes or unicode \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.execle = \
|
||||
:type file: bytes or unicode \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.execlp = \
|
||||
:type file: bytes or unicode \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.execlpe = \
|
||||
:type file: bytes or unicode \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.execv = \
|
||||
:type path: bytes or unicode \n\
|
||||
:type args: collections.Iterable of string \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.execve = \
|
||||
:type path: bytes or unicode \n\
|
||||
:type args: collections.Iterable of string \n\
|
||||
:type env: collections.Mapping of (string, string) \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.execvp = \
|
||||
:type file: bytes or unicode \n\
|
||||
:type args: collections.Iterable of string \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.execvpe = \
|
||||
:type file: bytes or unicode \n\
|
||||
:type args: collections.Iterable of string \n\
|
||||
:type env: collections.Mapping of (string, string) \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os._exit = \
|
||||
:type status: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.fork = \
|
||||
:rtype: int \n\
|
||||
|
||||
os.forkpty = \
|
||||
:rtype: (int, int) \n\
|
||||
|
||||
os.kill = \
|
||||
:type pid: int \n\
|
||||
:type sig: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.killpg = \
|
||||
:type pgid: int \n\
|
||||
:type sig: int \n\
|
||||
:rtype: None \n\
|
||||
|
||||
os.nice = \
|
||||
:type inc: int \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.spawnl = \
|
||||
:type mode: int \n\
|
||||
:type file: bytes or unicode \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.spawnle = \
|
||||
:type mode: int \n\
|
||||
:type file: bytes or unicode \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.spawnlp = \
|
||||
:type mode: int \n\
|
||||
:type file: bytes or unicode \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.spawnlpe = \
|
||||
:type mode: int \n\
|
||||
:type file: bytes or unicode \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.spawnv = \
|
||||
:type mode: int \n\
|
||||
:type file: bytes or unicode \n\
|
||||
:type args: collections.Iterable of string \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.spawnve = \
|
||||
:type mode: int \n\
|
||||
:type file: bytes or unicode \n\
|
||||
:type args: collections.Iterable of string \n\
|
||||
:type env: collections.Mapping of (string, string) \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.spawnvp = \
|
||||
:type mode: int \n\
|
||||
:type file: bytes or unicode \n\
|
||||
:type args: collections.Iterable of string \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.spawnvpe = \
|
||||
:type mode: int \n\
|
||||
:type file: bytes or unicode \n\
|
||||
:type args: collections.Iterable of string \n\
|
||||
:type env: collections.Mapping of (string, string) \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.system = \
|
||||
:type command: bytes or unicode \n\
|
||||
:rtype: int \n\
|
||||
|
||||
os.times = \
|
||||
:rtype: (float, float, float, float, float) \n\
|
||||
|
||||
os.wait = \
|
||||
:rtype: (int, int) \n\
|
||||
|
||||
os.waitpid = \
|
||||
:type pid: int \n\
|
||||
:type options: int \n\
|
||||
:rtype: (int, int) \n\
|
||||
|
||||
os.wait3 = \
|
||||
:type options: int \n\
|
||||
:rtype: (int, int, resource.struct_rusage) \n\
|
||||
|
||||
os.wait4 = \
|
||||
:type pid: int \n\
|
||||
:type options: int \n\
|
||||
:rtype: (int, int, resource.struct_rusage) \n\
|
||||
|
||||
os.WCOREDUMP = \
|
||||
:type status: int \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.WIFCONTINUED = \
|
||||
:type status: int \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.WIFSTOPPED = \
|
||||
:type status: int \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.WIFSIGNALED = \
|
||||
:type status: int \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.WIFEXITED = \
|
||||
:type status: int \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.WEXITSTATUS = \
|
||||
:type status: int \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.WSTOPSIG = \
|
||||
:type status: int \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.WTERMSIG = \
|
||||
:type status: int \n\
|
||||
:rtype: bool \n\
|
||||
|
||||
os.urandom = \
|
||||
:type n: int \n\
|
||||
:rtype: bytes \n\
|
||||
|
||||
|
||||
## 17.1. subprocess
|
||||
|
||||
subprocess.Popen.__init__ = \
|
||||
:type args: string or collections.Sequence of string \n\
|
||||
:type executable: string or None \n\
|
||||
:type preexec_fn: collections.Callable or None \n\
|
||||
:type close_fds: bool or int \n\
|
||||
:type shell: bool or int \n\
|
||||
:type cwd: string or None \n\
|
||||
:type env: collections.Mapping of (string, string) \n\
|
||||
:type universal_newlines: bool or int \n\
|
||||
|
||||
subprocess.Popen.poll = \
|
||||
:rtype: int \n\
|
||||
|
||||
subprocess.Popen.wait = \
|
||||
:rtype: int \n\
|
||||
|
||||
subprocess.Popen.communicate = \
|
||||
:type intput: string or None \n\
|
||||
:rtype: (bytes, bytes) \n\
|
||||
|
||||
subprocess.Popen.send_signal = \
|
||||
:type sig: int \n\
|
||||
|
||||
|
||||
## 18.2. json
|
||||
|
||||
json.loads = \
|
||||
:type s: string \n\
|
||||
:type encoding: string \n\
|
||||
:rtype: object or unknown \n\
|
||||
|
||||
|
||||
## 18.12. base64
|
||||
|
||||
base64.b64encode = \
|
||||
:type s: bytes \n\
|
||||
:rtype: bytes \n\
|
||||
|
||||
base64.b64decode = \
|
||||
:type s: bytes \n\
|
||||
:rtype: bytes \n\
|
||||
|
||||
|
||||
## 27.1. sys
|
||||
|
||||
sys.exit = \
|
||||
:type status: int or object \n\
|
||||
:rtype: None \n\
|
||||
@@ -106,10 +106,11 @@ public class PyNames {
|
||||
public static final String SEQUENCE = "Sequence";
|
||||
public static final String MAPPING = "Mapping";
|
||||
|
||||
public static final String COMPLEX = "Complex";
|
||||
public static final String REAL = "Real";
|
||||
public static final String RATIONAL = "Rational";
|
||||
public static final String INTEGRAL = "Integral";
|
||||
public static final String ABC_NUMBER = "Number";
|
||||
public static final String ABC_COMPLEX = "Complex";
|
||||
public static final String ABC_REAL = "Real";
|
||||
public static final String ABC_RATIONAL = "Rational";
|
||||
public static final String ABC_INTEGRAL = "Integral";
|
||||
|
||||
public static final String CONTAINS = "__contains__";
|
||||
public static final String HASH = "__hash__";
|
||||
@@ -386,7 +387,8 @@ public class PyNames {
|
||||
);
|
||||
|
||||
public static Set<String> BuiltinInterfaces = ImmutableSet.of(
|
||||
CALLABLE, HASHABLE, ITERABLE, ITERATOR, SIZED, CONTAINER, SEQUENCE, MAPPING, COMPLEX, REAL, RATIONAL, INTEGRAL
|
||||
CALLABLE, HASHABLE, ITERABLE, ITERATOR, SIZED, CONTAINER, SEQUENCE, MAPPING, ABC_COMPLEX, ABC_REAL, ABC_RATIONAL, ABC_INTEGRAL,
|
||||
ABC_NUMBER
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -69,6 +69,10 @@ public class PyStdlibCanonicalPathProvider implements PyCanonicalPathProvider {
|
||||
result.addAll(components);
|
||||
return QualifiedName.fromComponents(result);
|
||||
}
|
||||
else if (head.equals("_sqlite3")) {
|
||||
components.set(0, "sqlite3");
|
||||
return QualifiedName.fromComponents(components);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -17,10 +17,9 @@ package com.jetbrains.python.codeInsight.stdlib;
|
||||
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.util.QualifiedName;
|
||||
import com.jetbrains.python.codeInsight.PyDynamicMember;
|
||||
import com.jetbrains.python.psi.PyFile;
|
||||
import com.jetbrains.python.psi.impl.PyBuiltinCache;
|
||||
import com.intellij.psi.util.QualifiedName;
|
||||
import com.jetbrains.python.psi.resolve.ResolveImportUtil;
|
||||
import com.jetbrains.python.psi.types.PyModuleMembersProvider;
|
||||
|
||||
@@ -38,15 +37,10 @@ public class PyStdlibModuleMembersProvider extends PyModuleMembersProvider {
|
||||
if (qName.equals("os")) {
|
||||
final List<PyDynamicMember> results = new ArrayList<PyDynamicMember>();
|
||||
PsiElement path = null;
|
||||
PsiElement osError = null;
|
||||
if (module != null) {
|
||||
final PyBuiltinCache builtinCache = PyBuiltinCache.getInstance(module);
|
||||
osError = builtinCache.getByName("OSError");
|
||||
|
||||
final String pathModuleName = SystemInfo.isWindows ? "ntpath" : "posixpath";
|
||||
path = ResolveImportUtil.resolveModuleInRoots(QualifiedName.fromDottedString(pathModuleName), module);
|
||||
}
|
||||
results.add(new PyDynamicMember("error", osError));
|
||||
results.add(new PyDynamicMember("path", path));
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -17,16 +17,12 @@ package com.jetbrains.python.codeInsight.stdlib;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.util.QualifiedName;
|
||||
import com.jetbrains.python.PyNames;
|
||||
import com.jetbrains.python.PythonHelpersLocator;
|
||||
import com.jetbrains.python.documentation.DocStringUtil;
|
||||
import com.jetbrains.python.psi.StructuredDocString;
|
||||
import com.jetbrains.python.psi.*;
|
||||
import com.jetbrains.python.psi.impl.PyBuiltinCache;
|
||||
import com.intellij.psi.util.QualifiedName;
|
||||
import com.jetbrains.python.psi.impl.PyTypeProvider;
|
||||
import com.jetbrains.python.psi.resolve.PyResolveContext;
|
||||
import com.jetbrains.python.psi.resolve.QualifiedNameFinder;
|
||||
@@ -34,19 +30,13 @@ import com.jetbrains.python.psi.types.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class PyStdlibTypeProvider extends PyTypeProviderBase {
|
||||
@NotNull private Properties myStdlibTypes = new Properties();
|
||||
|
||||
private static final Set<String> OPEN_FUNCTIONS = ImmutableSet.of("__builtin__.open", "io.open", "os.fdopen");
|
||||
private static final String BINARY_FILE_TYPE = "io.FileIO[bytes]";
|
||||
private static final String TEXT_FILE_TYPE = "io.TextIOWrapper[unicode]";
|
||||
@@ -104,54 +94,6 @@ public class PyStdlibTypeProvider extends PyTypeProviderBase {
|
||||
}
|
||||
}
|
||||
}
|
||||
return getReturnTypeByQName(qname, function, context);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PyType getConstructorType(@NotNull PyClass cls, @NotNull TypeEvalContext context) {
|
||||
final String classQName = cls.getQualifiedName();
|
||||
if (classQName != null) {
|
||||
final QualifiedName
|
||||
canonicalQName = PyStdlibCanonicalPathProvider.restoreStdlibCanonicalPath(QualifiedName.fromDottedString(classQName));
|
||||
if (canonicalQName != null) {
|
||||
final QualifiedName qname = canonicalQName.append(PyNames.INIT);
|
||||
return getReturnTypeByQName(qname.toString(), cls, context);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private PyType getReturnTypeByQName(@NotNull String qname, @NotNull PsiElement anchor, @NotNull TypeEvalContext context) {
|
||||
final LanguageLevel level = LanguageLevel.forElement(anchor);
|
||||
final String key = String.format("Python%d/%s.return", level.getVersion(), qname);
|
||||
final PyBuiltinCache cache = PyBuiltinCache.getInstance(anchor);
|
||||
final Ref<PyType> cached = cache.getStdlibType(key, context);
|
||||
if (cached != null) {
|
||||
return cached.get();
|
||||
}
|
||||
final StructuredDocString docString = getStructuredDocString(qname);
|
||||
if (docString == null) {
|
||||
return null;
|
||||
}
|
||||
final String s = docString.getReturnType();
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
final PyType result = PyTypeParser.getTypeByName(anchor, s);
|
||||
cache.storeStdlibType(key, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public PyType getParameterType(@NotNull PyNamedParameter param, @NotNull PyFunction func, @NotNull TypeEvalContext context) {
|
||||
final String name = param.getName();
|
||||
final String qname = getQualifiedName(func, param);
|
||||
if (qname != null && name != null) {
|
||||
return getParameterTypeByQName(qname, name, func, context);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -215,38 +157,6 @@ public class PyStdlibTypeProvider extends PyTypeProviderBase {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private PyType getParameterTypeByQName(@NotNull String functionQName,
|
||||
@NotNull String name,
|
||||
@NotNull PsiElement anchor,
|
||||
@NotNull TypeEvalContext context) {
|
||||
final LanguageLevel level = LanguageLevel.forElement(anchor);
|
||||
final String key = String.format("Python%d/%s.%s", level.getVersion(), functionQName, name);
|
||||
final PyBuiltinCache cache = PyBuiltinCache.getInstance(anchor);
|
||||
final Ref<PyType> cached = cache.getStdlibType(key, context);
|
||||
if (cached != null) {
|
||||
return cached.get();
|
||||
}
|
||||
final StructuredDocString docString = getStructuredDocString(functionQName);
|
||||
if (docString == null) {
|
||||
return null;
|
||||
}
|
||||
final String s = docString.getParamType(name);
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
final PyType result = PyTypeParser.getTypeByName(anchor, s);
|
||||
cache.storeStdlibType(key, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private StructuredDocString getStructuredDocString(@NotNull String qualifiedName) {
|
||||
final Properties db = getStdlibTypes();
|
||||
final String docString = db.getProperty(qualifiedName);
|
||||
return DocStringUtil.parse(docString);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String getQualifiedName(@NotNull PyFunction f, @Nullable PsiElement callSite) {
|
||||
if (!f.isValid()) {
|
||||
@@ -271,21 +181,4 @@ public class PyStdlibTypeProvider extends PyTypeProviderBase {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Properties getStdlibTypes() {
|
||||
if (myStdlibTypes.isEmpty()) {
|
||||
try {
|
||||
final InputStream s = new FileInputStream(PythonHelpersLocator.getHelperFile("StdlibTypes.properties"));
|
||||
try {
|
||||
myStdlibTypes.load(s);
|
||||
}
|
||||
finally {
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
catch (IOException ignored) {}
|
||||
}
|
||||
return myStdlibTypes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.jetbrains.python.PyElementTypes;
|
||||
import com.jetbrains.python.PyNames;
|
||||
import com.jetbrains.python.PyTokenTypes;
|
||||
import com.jetbrains.python.PythonDialectsTokenSetProvider;
|
||||
import com.jetbrains.python.codeInsight.stdlib.PyStdlibTypeProvider;
|
||||
import com.jetbrains.python.psi.*;
|
||||
import com.jetbrains.python.psi.resolve.PyResolveContext;
|
||||
import com.jetbrains.python.psi.stubs.PyNamedParameterStub;
|
||||
@@ -215,12 +214,6 @@ public class PyNamedParameterImpl extends PyPresentableElementImpl<PyNamedParame
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
final PyStdlibTypeProvider stdlib = PyStdlibTypeProvider.getInstance();
|
||||
if (stdlib != null) {
|
||||
initType = stdlib.getConstructorType(containingClass, context);
|
||||
}
|
||||
}
|
||||
if (initType != null && !(initType instanceof PyNoneType)) {
|
||||
return initType;
|
||||
}
|
||||
|
||||
@@ -68,15 +68,18 @@ public class PyABCUtil {
|
||||
if (PyNames.MAPPING.equals(superClassName)) {
|
||||
return isSized && hasIter && isContainer && hasGetItem && hasMethod(subClass, PyNames.KEYS, inherited);
|
||||
}
|
||||
if (PyNames.COMPLEX.equals(superClassName)) {
|
||||
if (PyNames.ABC_COMPLEX.equals(superClassName)) {
|
||||
return hasMethod(subClass, "__complex__", inherited);
|
||||
}
|
||||
if (PyNames.REAL.equals(superClassName)) {
|
||||
if (PyNames.ABC_REAL.equals(superClassName)) {
|
||||
return hasMethod(subClass, "__float__", inherited);
|
||||
}
|
||||
if (PyNames.INTEGRAL.equals(superClassName)) {
|
||||
if (PyNames.ABC_INTEGRAL.equals(superClassName)) {
|
||||
return hasMethod(subClass, "__int__", inherited);
|
||||
}
|
||||
if (PyNames.ABC_NUMBER.equals(superClassName) && "Decimal".equals(subClass.getName())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -193,10 +193,10 @@ public class PyTypeChecker {
|
||||
if (superName == null || subName == null ||
|
||||
superName.equals(subName) ||
|
||||
("int".equals(superName) && subIsBool) ||
|
||||
(("long".equals(superName) || "Integral".equals(superName)) && (subIsBool || subIsInt)) ||
|
||||
(("float".equals(superName) || "Real".equals(superName)) && (subIsBool || subIsInt || subIsLong)) ||
|
||||
(("complex".equals(superName) || "Complex".equals(superName)) && (subIsBool || subIsInt || subIsLong || subIsFloat)) ||
|
||||
("Number".equals(superName) && (subIsBool || subIsInt || subIsLong || subIsFloat || subIsComplex))) {
|
||||
(("long".equals(superName) || PyNames.ABC_INTEGRAL.equals(superName)) && (subIsBool || subIsInt)) ||
|
||||
(("float".equals(superName) || PyNames.ABC_REAL.equals(superName)) && (subIsBool || subIsInt || subIsLong)) ||
|
||||
(("complex".equals(superName) || PyNames.ABC_COMPLEX.equals(superName)) && (subIsBool || subIsInt || subIsLong || subIsFloat)) ||
|
||||
(PyNames.ABC_NUMBER.equals(superName) && (subIsBool || subIsInt || subIsLong || subIsFloat || subIsComplex))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -357,16 +357,6 @@ public class PyTypeChecker {
|
||||
match(initType, qualifierType, context, substitutions);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Unify generics in stdlib pseudo-constructor
|
||||
final PyStdlibTypeProvider stdlib = PyStdlibTypeProvider.getInstance();
|
||||
if (stdlib != null) {
|
||||
final PyType initType = stdlib.getConstructorType(cls, context);
|
||||
if (initType != null) {
|
||||
match(initType, qualifierType, context, substitutions);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return substitutions;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="247ce" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="247ce" layout-manager="GridLayoutManager" row-count="6" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/>
|
||||
@@ -54,12 +54,20 @@
|
||||
</component>
|
||||
<component id="49db6" class="com.intellij.ui.components.JBCheckBox" binding="mySelectWholeSelectorOnDoubleClick">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Select whole CSS selector suffix on double click"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="8169b" class="com.intellij.ui.components.JBCheckBox" binding="myAddQuotasForAttributeValue">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Automatically add quotas for attribute value"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<vspacer id="e0bcf">
|
||||
|
||||
@@ -32,6 +32,7 @@ public class WebEditorOptionsProvider implements EditorOptionsProvider {
|
||||
private JCheckBox myAutomaticallyInsertRequiredSubTagsCheckBox;
|
||||
private JCheckBox myAutomaticallyStartAttributeAfterCheckBox;
|
||||
private JBCheckBox mySelectWholeSelectorOnDoubleClick;
|
||||
private JBCheckBox myAddQuotasForAttributeValue;
|
||||
|
||||
|
||||
public String getDisplayName() {
|
||||
@@ -46,15 +47,14 @@ public class WebEditorOptionsProvider implements EditorOptionsProvider {
|
||||
return myWholePanel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean isModified() {
|
||||
final WebEditorOptions xmlEditorOptions = WebEditorOptions.getInstance();
|
||||
return xmlEditorOptions.isAutomaticallyInsertClosingTag() != myAutomaticallyInsertClosingTagCheckBox.isSelected() ||
|
||||
xmlEditorOptions.isAutomaticallyInsertRequiredAttributes() != myAutomaticallyInsertRequiredAttributesCheckBox.isSelected() ||
|
||||
xmlEditorOptions.isAutomaticallyStartAttribute() != myAutomaticallyStartAttributeAfterCheckBox.isSelected() ||
|
||||
xmlEditorOptions.isSelectWholeCssSelectorSuffixOnDoubleClick() != mySelectWholeSelectorOnDoubleClick.isSelected() ||
|
||||
xmlEditorOptions.isAutomaticallyInsertRequiredSubTags() != myAutomaticallyInsertRequiredSubTagsCheckBox.isSelected();
|
||||
xmlEditorOptions.isAutomaticallyInsertRequiredSubTags() != myAutomaticallyInsertRequiredSubTagsCheckBox.isSelected() ||
|
||||
xmlEditorOptions.isInsertQuotesForAttributeValue() != myAddQuotasForAttributeValue.isSelected();
|
||||
}
|
||||
|
||||
public void apply() throws ConfigurationException {
|
||||
@@ -64,6 +64,7 @@ public class WebEditorOptionsProvider implements EditorOptionsProvider {
|
||||
xmlEditorOptions.setAutomaticallyInsertRequiredSubTags(myAutomaticallyInsertRequiredSubTagsCheckBox.isSelected());
|
||||
xmlEditorOptions.setAutomaticallyStartAttribute(myAutomaticallyStartAttributeAfterCheckBox.isSelected());
|
||||
xmlEditorOptions.setSelectWholeCssSelectorSuffixOnDoubleClick(mySelectWholeSelectorOnDoubleClick.isSelected());
|
||||
xmlEditorOptions.setInsertQuotesForAttributeValue(myAddQuotasForAttributeValue.isSelected());
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
@@ -73,6 +74,7 @@ public class WebEditorOptionsProvider implements EditorOptionsProvider {
|
||||
myAutomaticallyInsertRequiredSubTagsCheckBox.setSelected(xmlEditorOptions.isAutomaticallyInsertRequiredSubTags());
|
||||
myAutomaticallyStartAttributeAfterCheckBox.setSelected(xmlEditorOptions.isAutomaticallyStartAttribute());
|
||||
mySelectWholeSelectorOnDoubleClick.setSelected(xmlEditorOptions.isSelectWholeCssSelectorSuffixOnDoubleClick());
|
||||
myAddQuotasForAttributeValue.setSelected(xmlEditorOptions.isInsertQuotesForAttributeValue());
|
||||
}
|
||||
|
||||
public void disposeUIResources() {
|
||||
|
||||
@@ -30,12 +30,10 @@ import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.patterns.XmlPatterns;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.xml.XmlAttributeValue;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.psi.xml.XmlTokenType;
|
||||
import com.intellij.psi.xml.*;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
import com.intellij.xml.XmlBundle;
|
||||
@@ -199,9 +197,15 @@ public class XmlCompletionContributor extends CompletionContributor {
|
||||
|
||||
public void beforeCompletion(@NotNull final CompletionInitializationContext context) {
|
||||
final int offset = context.getStartOffset();
|
||||
final XmlAttributeValue attributeValue = PsiTreeUtil.findElementOfClassAtOffset(context.getFile(), offset, XmlAttributeValue.class, true);
|
||||
final PsiFile file = context.getFile();
|
||||
final XmlAttributeValue attributeValue = PsiTreeUtil.findElementOfClassAtOffset(file, offset, XmlAttributeValue.class, true);
|
||||
if (attributeValue != null && offset == attributeValue.getTextRange().getStartOffset()) {
|
||||
context.setDummyIdentifier("");
|
||||
}
|
||||
|
||||
final PsiElement at = file.findElementAt(offset);
|
||||
if (at != null && at.getNode().getElementType() == XmlTokenType.XML_NAME && at.getParent() instanceof XmlAttribute) {
|
||||
context.getOffsetMap().addOffset(CompletionInitializationContext.IDENTIFIER_END_OFFSET, at.getTextRange().getEndOffset());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.editorActions;
|
||||
|
||||
import com.intellij.application.options.editor.WebEditorOptions;
|
||||
import com.intellij.codeInsight.AutoPopupController;
|
||||
import com.intellij.lang.xml.XMLLanguage;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -34,12 +35,15 @@ public class XmlEqTypedHandler extends TypedHandlerDelegate {
|
||||
Editor editor,
|
||||
PsiFile file,
|
||||
FileType fileType) {
|
||||
boolean inXml = file.getLanguage() instanceof XMLLanguage || file.getViewProvider().getBaseLanguage() instanceof XMLLanguage;
|
||||
if (c == '=' && inXml) {
|
||||
int offset = editor.getCaretModel().getOffset();
|
||||
PsiElement at = file.findElementAt(offset - 1);
|
||||
PsiElement atParent = at != null ? at.getParent() : null;
|
||||
needToInsertQuotes = atParent instanceof XmlAttribute && ((XmlAttribute)atParent).getValueElement() == null;
|
||||
|
||||
if (WebEditorOptions.getInstance().isInsertQuotesForAttributeValue()) {
|
||||
boolean inXml = file.getLanguage() instanceof XMLLanguage || file.getViewProvider().getBaseLanguage() instanceof XMLLanguage;
|
||||
if (c == '=' && inXml) {
|
||||
int offset = editor.getCaretModel().getOffset();
|
||||
PsiElement at = file.findElementAt(offset - 1);
|
||||
PsiElement atParent = at != null ? at.getParent() : null;
|
||||
needToInsertQuotes = atParent instanceof XmlAttribute && ((XmlAttribute)atParent).getValueElement() == null;
|
||||
}
|
||||
}
|
||||
|
||||
return super.beforeCharTyped(c, project, editor, file, fileType);
|
||||
|
||||
@@ -100,6 +100,9 @@ public class XmlEmmetParser extends EmmetParser {
|
||||
final String text = ((StringLiteralToken)token).getText();
|
||||
return text.substring(1, text.length() - 1);
|
||||
}
|
||||
else if (token instanceof TextToken) {
|
||||
return ((TextToken)token).getText();
|
||||
}
|
||||
else if (token instanceof IdentifierToken) {
|
||||
return ((IdentifierToken)token).getText();
|
||||
}
|
||||
|
||||
@@ -279,10 +279,10 @@ public class GenerationNode extends UserDataHolderBase {
|
||||
if (tag != null) {
|
||||
for (Pair<String, String> pair : attr2value) {
|
||||
if (Strings.isNullOrEmpty(pair.second)) {
|
||||
template.addVariable(pair.first, "", "", true);
|
||||
template.addVariable(prepareVariableName(pair.first), "", "", true);
|
||||
}
|
||||
}
|
||||
XmlTag tag1 = hasChildren ? expandEmptyTagIfNeccessary(tag) : tag;
|
||||
XmlTag tag1 = hasChildren ? expandEmptyTagIfNecessary(tag) : tag;
|
||||
setAttributeValues(tag1, attr2value);
|
||||
XmlFile physicalFile = (XmlFile)fileFactory.createFileFromText("dummy.xml", StdFileTypes.XML, tag1.getContainingFile().getText(),
|
||||
LocalTimeCounter.currentTime(), true);
|
||||
@@ -298,6 +298,10 @@ public class GenerationNode extends UserDataHolderBase {
|
||||
return template;
|
||||
}
|
||||
|
||||
private static String prepareVariableName(@NotNull String attributeName) {
|
||||
return StringUtil.replaceChar(attributeName, '-', '_');
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static TemplateImpl expandTemplate(@NotNull TemplateImpl template,
|
||||
Map<String, String> predefinedVarValues,
|
||||
@@ -317,7 +321,7 @@ public class GenerationNode extends UserDataHolderBase {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static XmlTag expandEmptyTagIfNeccessary(@NotNull XmlTag tag) {
|
||||
private static XmlTag expandEmptyTagIfNecessary(@NotNull XmlTag tag) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
boolean flag = false;
|
||||
|
||||
@@ -411,7 +415,7 @@ public class GenerationNode extends UserDataHolderBase {
|
||||
}
|
||||
tag.setAttribute(pair.first,
|
||||
Strings.isNullOrEmpty(pair.second)
|
||||
? "$" + pair.first + "$"
|
||||
? "$" + prepareVariableName(pair.first) + "$"
|
||||
: ZenCodingUtil.getValue(pair.second, myNumberInIteration, myTotalIterations, mySurroundedText));
|
||||
iterator.remove();
|
||||
}
|
||||
|
||||
@@ -16,8 +16,13 @@
|
||||
|
||||
package com.intellij.codeInspection.htmlInspections;
|
||||
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.DocumentAdapter;
|
||||
import com.intellij.ui.FieldPanel;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -29,6 +34,7 @@ import javax.swing.text.Document;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author spleaner
|
||||
@@ -56,7 +62,27 @@ public class HtmlUnknownTagInspection extends HtmlUnknownTagInspectionBase {
|
||||
final JPanel internalPanel = new JPanel(new BorderLayout());
|
||||
result.add(internalPanel, BorderLayout.NORTH);
|
||||
|
||||
final FieldPanel additionalAttributesPanel = new FieldPanel(null, inspection.getPanelTitle(), null, null);
|
||||
final Ref<FieldPanel> panelRef = new Ref<FieldPanel>();
|
||||
final FieldPanel additionalAttributesPanel = new FieldPanel(null, null, new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
Messages.showTextAreaDialog(panelRef.get().getTextField(), inspection.getPanelTitle(), "HtmlUnknownTagInspection",
|
||||
new Function<String, List<String>>() {
|
||||
@Override
|
||||
public List<String> fun(String s) {
|
||||
return reparseProperties(s);
|
||||
}
|
||||
}, new Function<List<String>, String>() {
|
||||
@Override
|
||||
public String fun(List<String> strings) {
|
||||
return StringUtil.join(strings, ",");
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}, null);
|
||||
((JButton)additionalAttributesPanel.getComponent(1)).setIcon(PlatformIcons.OPEN_EDIT_DIALOG_ICON);
|
||||
panelRef.set(additionalAttributesPanel);
|
||||
additionalAttributesPanel.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
|
||||
@Override
|
||||
protected void textChanged(DocumentEvent e) {
|
||||
|
||||
@@ -23,6 +23,10 @@ public final class UrlImpl implements Url {
|
||||
|
||||
private String externalFormWithoutParameters;
|
||||
|
||||
public UrlImpl(@NotNull String scheme, @Nullable String authority, @Nullable String path) {
|
||||
this(null, scheme, authority, path, null);
|
||||
}
|
||||
|
||||
public UrlImpl(@Nullable String raw, @NotNull String scheme, @Nullable String authority, @Nullable String path, @Nullable String parameters) {
|
||||
this.raw = raw;
|
||||
this.scheme = scheme;
|
||||
|
||||
@@ -32,6 +32,11 @@ public final class Urls {
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Url newHttpUrl(@Nullable String authority, @Nullable String path) {
|
||||
return new UrlImpl("http", authority, path);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Url parse(@NotNull String url, boolean asLocalIfNoScheme) {
|
||||
if (asLocalIfNoScheme && !URLUtil.containsScheme(url)) {
|
||||
@@ -101,7 +106,7 @@ public final class Urls {
|
||||
public static Url newFromVirtualFile(@NotNull VirtualFile file) {
|
||||
String path = file.getPath();
|
||||
if (file.isInLocalFileSystem()) {
|
||||
return new UrlImpl(null, file.getFileSystem().getProtocol(), null, path, null);
|
||||
return new UrlImpl(file.getFileSystem().getProtocol(), null, path);
|
||||
}
|
||||
else {
|
||||
return parseUrl(file.getUrl(), false);
|
||||
|
||||
@@ -332,6 +332,12 @@ public class XmlCompletionTest extends LightCodeInsightFixtureTestCase {
|
||||
checkResultByFile(getTestName(true) + ".xml");
|
||||
}
|
||||
|
||||
public void testBeforeAttributeNameWithPrefix() throws Exception {
|
||||
configureByFile(getTestName(true) + ".xml");
|
||||
selectItem(myFixture.getLookupElements()[0], '\t');
|
||||
checkResultByFile(getTestName(true) + "_after.xml");
|
||||
}
|
||||
|
||||
public void testUrlCompletionInDtd() throws Exception {
|
||||
configureByFile("20.xml");
|
||||
final PsiReference referenceAt = myFixture.getFile().findReferenceAt(myFixture.getEditor().getCaretModel().getOffset() - 1);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.application.options.editor.WebEditorOptions;
|
||||
import com.intellij.ide.highlighter.XmlFileType;
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
|
||||
|
||||
@@ -25,14 +26,27 @@ import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCa
|
||||
public class XmlTypedHandlersTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
|
||||
public void testClosingTag() throws Exception {
|
||||
myFixture.configureByText(XmlFileType.INSTANCE, "<foo><<caret>");
|
||||
myFixture.type('/');
|
||||
myFixture.checkResult("<foo></foo>");
|
||||
doTest("<foo><<caret>", '/', "<foo></foo>");
|
||||
}
|
||||
|
||||
public void testGreedyClosing() {
|
||||
myFixture.configureByText(XmlFileType.INSTANCE, "<foo><<caret>foo>");
|
||||
myFixture.type('/');
|
||||
myFixture.checkResult("<foo></foo>");
|
||||
doTest("<foo><<caret>foo>", '/', "<foo></foo>");
|
||||
}
|
||||
|
||||
public void testValueQuotas() throws Exception {
|
||||
doTest("<foo bar<caret>", '=', "<foo bar=\"<caret>\"");
|
||||
WebEditorOptions.getInstance().setInsertQuotesForAttributeValue(false);
|
||||
try {
|
||||
doTest("<foo bar<caret>", '=', "<foo bar=<caret>");
|
||||
}
|
||||
finally {
|
||||
WebEditorOptions.getInstance().setInsertQuotesForAttributeValue(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void doTest(String text, char c, String result) {
|
||||
myFixture.configureByText(XmlFileType.INSTANCE, text);
|
||||
myFixture.type(c);
|
||||
myFixture.checkResult(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<a>
|
||||
<include file="" value=""/>
|
||||
<include <caret>aaa:bbb="" value=""/>
|
||||
</a>
|
||||
@@ -0,0 +1,4 @@
|
||||
<a>
|
||||
<include file="" value=""/>
|
||||
<include file="" value=""/>
|
||||
</a>
|
||||
@@ -45,6 +45,7 @@ public class WebEditorOptions implements PersistentStateComponent<WebEditorOptio
|
||||
private boolean myAutomaticallyInsertRequiredAttributes = true;
|
||||
private boolean myAutomaticallyInsertRequiredSubTags = true;
|
||||
private boolean myAutomaticallyStartAttribute = true;
|
||||
private boolean myInsertQuotesForAttributeValue = true;
|
||||
|
||||
private boolean myTagTreeHighlightingEnabled = true;
|
||||
private int myTagTreeHighlightingLevelCount = 6;
|
||||
@@ -98,9 +99,7 @@ public class WebEditorOptions implements PersistentStateComponent<WebEditorOptio
|
||||
myAutomaticallyInsertClosingTag = automaticallyInsertClosingTag;
|
||||
}
|
||||
|
||||
public boolean isAutomaticallyInsertRequiredAttributes() {
|
||||
return myAutomaticallyInsertRequiredAttributes;
|
||||
}
|
||||
public boolean isAutomaticallyInsertRequiredAttributes() { return myAutomaticallyInsertRequiredAttributes; }
|
||||
|
||||
public void setAutomaticallyInsertRequiredAttributes(final boolean automaticallyInsertRequiredAttributes) {
|
||||
myAutomaticallyInsertRequiredAttributes = automaticallyInsertRequiredAttributes;
|
||||
@@ -186,4 +185,12 @@ public class WebEditorOptions implements PersistentStateComponent<WebEditorOptio
|
||||
public void setSelectWholeCssSelectorSuffixOnDoubleClick(boolean selectWholeCssSelectorSuffixOnDoubleClick) {
|
||||
mySelectWholeCssSelectorSuffixOnDoubleClick = selectWholeCssSelectorSuffixOnDoubleClick;
|
||||
}
|
||||
|
||||
public boolean isInsertQuotesForAttributeValue() {
|
||||
return myInsertQuotesForAttributeValue;
|
||||
}
|
||||
|
||||
public void setInsertQuotesForAttributeValue(boolean insertQuotesForAttributeValue) {
|
||||
myInsertQuotesForAttributeValue = insertQuotesForAttributeValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.intellij.lexer.Lexer;
|
||||
import com.intellij.openapi.editor.HighlighterColors;
|
||||
import com.intellij.openapi.editor.XmlHighlighterColors;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.fileTypes.FileTypeRegistry;
|
||||
import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.xml.XmlTokenType;
|
||||
@@ -84,13 +84,13 @@ public class HtmlFileHighlighter extends SyntaxHighlighterBase {
|
||||
@Override
|
||||
@NotNull
|
||||
public Lexer getHighlightingLexer() {
|
||||
return new HtmlHighlightingLexer(FileTypeManager.getInstance().getStdFileType("CSS"));
|
||||
return new HtmlHighlightingLexer(FileTypeRegistry.getInstance().findFileTypeByName("CSS"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
|
||||
return pack(XmlHighlighterColors.HTML_CODE, pack(keys1.get(tokenType), keys2.get(tokenType)));
|
||||
return SyntaxHighlighterBase.pack(XmlHighlighterColors.HTML_CODE, pack(keys1.get(tokenType), keys2.get(tokenType)));
|
||||
}
|
||||
|
||||
public static final void registerEmbeddedTokenAttributes(Map<IElementType, TextAttributesKey> _keys1,
|
||||