Merge remote-tracking branch 'origin/master'
@@ -1,33 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2004 JetBrains s.r.o. All Rights Reserved.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 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
|
||||
*
|
||||
* -Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* -Redistribution in binary form must reproduct the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of JetBrains or IntelliJ IDEA
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* This software is provided "AS IS," without a warranty of any kind. ALL
|
||||
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
|
||||
* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
|
||||
* OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. JETBRAINS AND ITS LICENSORS SHALL NOT
|
||||
* BE LIABLE FOR ANY DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT
|
||||
* OF OR RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR ITS
|
||||
* DERIVATIVES. IN NO EVENT WILL JETBRAINS OR ITS LICENSORS BE LIABLE FOR ANY LOST
|
||||
* REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
|
||||
* INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY
|
||||
* OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN
|
||||
* IF JETBRAINS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.projectView;
|
||||
|
||||
@@ -35,21 +19,21 @@ import com.intellij.ide.projectView.ProjectView;
|
||||
import com.intellij.ide.projectView.impl.AbstractProjectTreeStructure;
|
||||
import com.intellij.ide.projectView.impl.PackageViewPane;
|
||||
import com.intellij.ide.projectView.impl.ProjectViewImpl;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.lang.properties.projectView.ResourceBundleGrouper;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.module.impl.ModuleManagerImpl;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.TestSourceBasedTestCase;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
import com.intellij.lang.properties.projectView.ResourceBundleGrouper;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.IOException;
|
||||
|
||||
public class PackagesTreeStructureTest extends TestSourceBasedTestCase {
|
||||
public void testPackageView() throws IOException {
|
||||
public void testPackageView() throws IOException, InterruptedException {
|
||||
ModuleManagerImpl.getInstanceImpl(myProject).setModuleGroupPath(myModule, new String[]{"Group"});
|
||||
final VirtualFile srcFile = getSrcDirectory().getVirtualFile();
|
||||
if (srcFile.findChild("empty") == null){
|
||||
@@ -180,6 +164,21 @@ public class PackagesTreeStructureTest extends TestSourceBasedTestCase {
|
||||
" -PsiPackage: javax.servlet\n" +
|
||||
" Class1.java\n", 4);
|
||||
|
||||
doTest(false, false, true, true, "-Project\n" +
|
||||
" -PsiPackage: com.package1\n" +
|
||||
" Class1.java\n" +
|
||||
" Class2.java\n" +
|
||||
" Class4.java\n" +
|
||||
" emptyClassFile.class\n" +
|
||||
" Form1.form\n" +
|
||||
" Form1.java\n" +
|
||||
" Form2.form\n" +
|
||||
" PsiPackage: empty\n" +
|
||||
" -PsiPackage: java\n" +
|
||||
" Class1.java\n" +
|
||||
" -PsiPackage: j.servlet\n" +
|
||||
" Class1.java\n", 3);
|
||||
|
||||
doTest(false, false, "-Project\n" +
|
||||
" -PsiPackage: com.package1\n" +
|
||||
" Class1.java\n" +
|
||||
@@ -194,17 +193,23 @@ public class PackagesTreeStructureTest extends TestSourceBasedTestCase {
|
||||
" Class1.java\n" +
|
||||
" -PsiPackage: javax.servlet\n" +
|
||||
" Class1.java\n", 3);
|
||||
|
||||
}
|
||||
|
||||
private void doTest(final boolean showModules, final boolean showLibraryContents, @NonNls final String expected, final int levels) {
|
||||
private void doTest(final boolean showModules, final boolean showLibraryContents, @NonNls final String expected, final int levels)
|
||||
throws InterruptedException {
|
||||
doTest(showModules, showLibraryContents, false, false, expected, levels);
|
||||
}
|
||||
|
||||
private void doTest(final boolean showModules, final boolean showLibraryContents, boolean flattenPackages, boolean abbreviatePackageNames, @NonNls final String expected, final int levels)
|
||||
throws InterruptedException {
|
||||
final ProjectViewImpl projectView = (ProjectViewImpl)ProjectView.getInstance(myProject);
|
||||
|
||||
projectView.setShowModules(showModules, PackageViewPane.ID);
|
||||
|
||||
projectView.setShowLibraryContents(showLibraryContents, PackageViewPane.ID);
|
||||
|
||||
projectView.setFlattenPackages(false, PackageViewPane.ID);
|
||||
projectView.setFlattenPackages(flattenPackages, PackageViewPane.ID);
|
||||
projectView.setAbbreviatePackageNames(abbreviatePackageNames, PackageViewPane.ID);
|
||||
projectView.setHideEmptyPackages(true, PackageViewPane.ID);
|
||||
|
||||
PackageViewPane packageViewPane = new PackageViewPane(myProject);
|
||||
@@ -213,7 +218,7 @@ public class PackagesTreeStructureTest extends TestSourceBasedTestCase {
|
||||
packageViewPane.updateFromRoot(true);
|
||||
JTree tree = packageViewPane.getTree();
|
||||
TreeUtil.expand(tree, levels);
|
||||
IdeaTestUtil.assertTreeEqual(tree, expected);
|
||||
PlatformTestUtil.assertTreeEqual(tree, expected);
|
||||
BaseProjectViewTestCase.checkContainsMethod(packageViewPane.getTreeStructure().getRootElement(), packageViewPane.getTreeStructure());
|
||||
Disposer.dispose(packageViewPane);
|
||||
}
|
||||
|
||||
@@ -26,10 +26,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileTypes.BinaryFileTypeDecompilers;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.FileTypes;
|
||||
import com.intellij.openapi.fileTypes.PlainTextFileType;
|
||||
import com.intellij.openapi.fileTypes.*;
|
||||
import com.intellij.openapi.ide.CopyPasteManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
@@ -250,7 +247,7 @@ public class DiffContentFactoryImpl extends DiffContentFactoryEx {
|
||||
public DiffContent createFromBytes(@Nullable Project project,
|
||||
@NotNull byte[] content,
|
||||
@NotNull FilePath filePath) throws IOException {
|
||||
if (filePath.getFileType().isBinary()) {
|
||||
if (isBinaryContent(content, filePath.getFileType())) {
|
||||
return createBinaryImpl(project, content, filePath.getFileType(), filePath.getName(), filePath.getVirtualFile());
|
||||
}
|
||||
|
||||
@@ -262,8 +259,7 @@ public class DiffContentFactoryImpl extends DiffContentFactoryEx {
|
||||
public DiffContent createFromBytes(@Nullable Project project,
|
||||
@NotNull byte[] content,
|
||||
@NotNull VirtualFile highlightFile) throws IOException {
|
||||
// TODO: check if FileType.UNKNOWN is actually a text ?
|
||||
if (highlightFile.getFileType().isBinary()) {
|
||||
if (isBinaryContent(content, highlightFile.getFileType())) {
|
||||
return createBinaryImpl(project, content, highlightFile.getFileType(), highlightFile.getName(), highlightFile);
|
||||
}
|
||||
|
||||
@@ -356,6 +352,13 @@ public class DiffContentFactoryImpl extends DiffContentFactoryEx {
|
||||
@NotNull String fileName,
|
||||
@Nullable VirtualFile highlightFile,
|
||||
@NotNull Charset charset) {
|
||||
if (fileType.isBinary()) {
|
||||
fileType = PlainTextFileType.INSTANCE;
|
||||
|
||||
Charset guessedCharset = guessCharsetFromContent(content);
|
||||
if (guessedCharset != null) charset = guessedCharset;
|
||||
}
|
||||
|
||||
Charset bomCharset = CharsetToolkit.guessFromBOM(content);
|
||||
boolean isBOM = bomCharset != null;
|
||||
if (isBOM) charset = bomCharset;
|
||||
@@ -442,4 +445,30 @@ public class DiffContentFactoryImpl extends DiffContentFactoryEx {
|
||||
return document;
|
||||
});
|
||||
}
|
||||
|
||||
private static boolean isBinaryContent(@NotNull byte[] content, @NotNull FileType fileType) {
|
||||
if (UnknownFileType.INSTANCE.equals(fileType)) {
|
||||
return guessCharsetFromContent(content) == null;
|
||||
}
|
||||
return fileType.isBinary();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Charset guessCharsetFromContent(@NotNull byte[] content) {
|
||||
// can't use CharsetToolkit.guessEncoding here because of false-positive INVALID_UTF8
|
||||
CharsetToolkit toolkit = new CharsetToolkit(content);
|
||||
|
||||
Charset fromBOM = toolkit.guessFromBOM();
|
||||
if (fromBOM != null) return fromBOM;
|
||||
|
||||
CharsetToolkit.GuessedEncoding guessedEncoding = toolkit.guessFromContent(content.length);
|
||||
switch (guessedEncoding) {
|
||||
case SEVEN_BIT:
|
||||
return Charset.forName("US-ASCII");
|
||||
case VALID_UTF8:
|
||||
return CharsetToolkit.UTF8_CHARSET;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 310 B After Width: | Height: | Size: 268 B |
|
Before Width: | Height: | Size: 665 B After Width: | Height: | Size: 627 B |
|
After Width: | Height: | Size: 346 B |
|
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 132 B |
|
Before Width: | Height: | Size: 184 B After Width: | Height: | Size: 185 B |
|
Before Width: | Height: | Size: 122 B After Width: | Height: | Size: 109 B |
|
Before Width: | Height: | Size: 158 B After Width: | Height: | Size: 145 B |
|
Before Width: | Height: | Size: 94 B After Width: | Height: | Size: 94 B |
|
Before Width: | Height: | Size: 127 B After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 94 B After Width: | Height: | Size: 94 B |
|
Before Width: | Height: | Size: 127 B After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 221 B After Width: | Height: | Size: 221 B |
|
Before Width: | Height: | Size: 335 B After Width: | Height: | Size: 338 B |
|
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 125 B |
|
Before Width: | Height: | Size: 184 B After Width: | Height: | Size: 184 B |
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 364 B After Width: | Height: | Size: 371 B |
|
Before Width: | Height: | Size: 241 B After Width: | Height: | Size: 242 B |
|
Before Width: | Height: | Size: 434 B After Width: | Height: | Size: 442 B |
|
Before Width: | Height: | Size: 177 B After Width: | Height: | Size: 173 B |
|
Before Width: | Height: | Size: 251 B After Width: | Height: | Size: 250 B |
|
Before Width: | Height: | Size: 94 B After Width: | Height: | Size: 94 B |
|
Before Width: | Height: | Size: 127 B After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 195 B After Width: | Height: | Size: 194 B |
|
Before Width: | Height: | Size: 292 B After Width: | Height: | Size: 292 B |
|
Before Width: | Height: | Size: 133 B After Width: | Height: | Size: 133 B |
|
Before Width: | Height: | Size: 175 B After Width: | Height: | Size: 175 B |
|
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 117 B |
|
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 154 B |
|
Before Width: | Height: | Size: 115 B After Width: | Height: | Size: 116 B |
|
Before Width: | Height: | Size: 152 B After Width: | Height: | Size: 152 B |
|
Before Width: | Height: | Size: 111 B After Width: | Height: | Size: 111 B |
|
Before Width: | Height: | Size: 157 B After Width: | Height: | Size: 157 B |
|
Before Width: | Height: | Size: 136 B After Width: | Height: | Size: 127 B |
|
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 200 B |
|
Before Width: | Height: | Size: 283 B After Width: | Height: | Size: 296 B |
|
Before Width: | Height: | Size: 564 B After Width: | Height: | Size: 597 B |
|
Before Width: | Height: | Size: 171 B After Width: | Height: | Size: 169 B |
|
Before Width: | Height: | Size: 301 B After Width: | Height: | Size: 301 B |
|
Before Width: | Height: | Size: 179 B After Width: | Height: | Size: 188 B |
|
Before Width: | Height: | Size: 298 B After Width: | Height: | Size: 313 B |
|
Before Width: | Height: | Size: 136 B After Width: | Height: | Size: 139 B |
|
Before Width: | Height: | Size: 199 B After Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 158 B After Width: | Height: | Size: 153 B |
|
Before Width: | Height: | Size: 248 B After Width: | Height: | Size: 249 B |
|
Before Width: | Height: | Size: 129 B After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 194 B |
|
Before Width: | Height: | Size: 111 B After Width: | Height: | Size: 111 B |
|
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 150 B |
|
Before Width: | Height: | Size: 104 B After Width: | Height: | Size: 94 B |
|
Before Width: | Height: | Size: 139 B After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 120 B After Width: | Height: | Size: 115 B |
|
Before Width: | Height: | Size: 175 B After Width: | Height: | Size: 172 B |
|
Before Width: | Height: | Size: 144 B After Width: | Height: | Size: 159 B |
|
Before Width: | Height: | Size: 220 B After Width: | Height: | Size: 280 B |
|
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 181 B |
|
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 302 B |
|
Before Width: | Height: | Size: 220 B After Width: | Height: | Size: 280 B |
|
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 463 B |
|
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 187 B |
|
Before Width: | Height: | Size: 332 B After Width: | Height: | Size: 323 B |
|
Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 158 B |
|
Before Width: | Height: | Size: 219 B After Width: | Height: | Size: 274 B |
|
Before Width: | Height: | Size: 222 B After Width: | Height: | Size: 217 B |
|
Before Width: | Height: | Size: 412 B After Width: | Height: | Size: 414 B |
|
Before Width: | Height: | Size: 158 B After Width: | Height: | Size: 172 B |
|
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 295 B |
|
Before Width: | Height: | Size: 94 B After Width: | Height: | Size: 94 B |
|
Before Width: | Height: | Size: 127 B After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 151 B After Width: | Height: | Size: 149 B |
|
Before Width: | Height: | Size: 242 B After Width: | Height: | Size: 234 B |
|
Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 128 B |
|
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 169 B |
|
Before Width: | Height: | Size: 148 B After Width: | Height: | Size: 132 B |
|
Before Width: | Height: | Size: 188 B After Width: | Height: | Size: 164 B |
|
Before Width: | Height: | Size: 130 B After Width: | Height: | Size: 115 B |
|
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 172 B |
|
Before Width: | Height: | Size: 220 B After Width: | Height: | Size: 208 B |
|
Before Width: | Height: | Size: 350 B After Width: | Height: | Size: 332 B |
|
Before Width: | Height: | Size: 149 B After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 213 B After Width: | Height: | Size: 179 B |
|
Before Width: | Height: | Size: 149 B After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 180 B |
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -161,7 +161,9 @@ public class ParameterHintsPassFactory extends AbstractProjectComponent implemen
|
||||
int offset = inlay.getOffset();
|
||||
Caret caret = caretMap.get(offset);
|
||||
if (caret == null) return false;
|
||||
char afterCaret = myEditor.getDocument().getImmutableCharSequence().charAt(offset);
|
||||
CharSequence text = myEditor.getDocument().getImmutableCharSequence();
|
||||
if (offset >= text.length()) return false;
|
||||
char afterCaret = text.charAt(offset);
|
||||
if (afterCaret != ',' && afterCaret != ')') return false;
|
||||
VisualPosition afterInlayPosition = myEditor.offsetToVisualPosition(offset, true, false);
|
||||
// check whether caret is to the right of inlay
|
||||
|
||||
@@ -311,8 +311,5 @@ public class ProjectSettingsStepBase extends AbstractActionWithPanel implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
myProjectGenerator = null;
|
||||
myCallback = null;
|
||||
}
|
||||
public void dispose() {}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -34,7 +34,8 @@ public class RtfTransferableData extends AbstractSyntaxAwareInputStreamTransfera
|
||||
@NotNull private static final String HEADER_PREFIX = "{\\rtf1\\ansi\\deff0";
|
||||
@NotNull private static final String HEADER_SUFFIX = "}";
|
||||
@NotNull private static final String TAB = "\\tab\n";
|
||||
@NotNull private static final String NEW_LINE = "\\line\n";
|
||||
// using undocumented way to denote line break on Mac (used e.g. by TextEdit) to resolve IDEA-165337
|
||||
@NotNull private static final String NEW_LINE = SystemInfo.isMac ? "\\\n" : "\\line\n";
|
||||
@NotNull private static final String BOLD = "\\b";
|
||||
@NotNull private static final String ITALIC = "\\i";
|
||||
|
||||
|
||||
@@ -3266,6 +3266,7 @@ public class JBTabsImpl extends JComponent
|
||||
TabInfo dropInfo = myDropInfo;
|
||||
myDropInfo = null;
|
||||
myShowDropLocation = true;
|
||||
myForcedRelayout = true;
|
||||
setDropInfoIndex(-1);
|
||||
if (!isDisposed()) {
|
||||
removeTab(dropInfo, null, false, true);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -17,6 +17,7 @@ package com.intellij.ide.impl;
|
||||
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -48,6 +49,12 @@ public abstract class DataValidator<T> {
|
||||
return project.isDisposed() ? project : null;
|
||||
}
|
||||
};
|
||||
private static final DataValidator<Editor> EDITOR_VALIDATOR = new DataValidator<Editor>() {
|
||||
@Override
|
||||
public Editor findInvalid(final String dataId, final Editor editor, final Object dataSource) {
|
||||
return editor.isDisposed() ? editor : null;
|
||||
}
|
||||
};
|
||||
|
||||
@Nullable
|
||||
public abstract T findInvalid(final String dataId, T data, final Object dataSource);
|
||||
@@ -73,6 +80,7 @@ public abstract class DataValidator<T> {
|
||||
ourValidators.put(CommonDataKeys.VIRTUAL_FILE.getName(), VIRTUAL_FILE_VALIDATOR);
|
||||
ourValidators.put(CommonDataKeys.VIRTUAL_FILE_ARRAY.getName(), new ArrayValidator<>(VIRTUAL_FILE_VALIDATOR));
|
||||
ourValidators.put(CommonDataKeys.PROJECT.getName(), PROJECT_VALIDATOR);
|
||||
ourValidators.put(CommonDataKeys.EDITOR.getName(), EDITOR_VALIDATOR);
|
||||
}
|
||||
|
||||
public static class ArrayValidator<T> extends DataValidator<T[]> {
|
||||
|
||||
@@ -653,18 +653,22 @@ public class EditorWindow {
|
||||
}
|
||||
}
|
||||
else {
|
||||
int indexToInsert;
|
||||
|
||||
Integer initialIndex = editor.getFile().getUserData(INITIAL_INDEX_KEY);
|
||||
int indexToInsert = 0;
|
||||
if (Registry.is("ide.editor.tabs.open.at.the.end")) {
|
||||
if (initialIndex != null) {
|
||||
indexToInsert = initialIndex;
|
||||
}
|
||||
else if (Registry.is("ide.editor.tabs.open.at.the.end")) {
|
||||
indexToInsert = myTabbedPane.getTabCount();
|
||||
} else {
|
||||
if (initialIndex == null) {
|
||||
int selectedIndex = myTabbedPane.getSelectedIndex();
|
||||
if (selectedIndex >= 0) {
|
||||
indexToInsert = selectedIndex + 1;
|
||||
}
|
||||
} else {
|
||||
indexToInsert = initialIndex;
|
||||
}
|
||||
else {
|
||||
int selectedIndex = myTabbedPane.getSelectedIndex();
|
||||
if (selectedIndex >= 0) {
|
||||
indexToInsert = selectedIndex + 1;
|
||||
}
|
||||
else {
|
||||
indexToInsert = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -157,8 +157,8 @@ public class EmptyIcon extends JBUI.CachingScalableJBIcon<EmptyIcon> {
|
||||
|
||||
final EmptyIcon icon = (EmptyIcon)o;
|
||||
|
||||
if (scaleVal(height, Scale.EFFECTIVE) != icon.scaleVal(height, Scale.EFFECTIVE)) return false;
|
||||
if (scaleVal(width, Scale.EFFECTIVE) != icon.scaleVal(width, Scale.EFFECTIVE)) return false;
|
||||
if (scaleVal(height, Scale.EFFECTIVE) != icon.scaleVal(icon.height, Scale.EFFECTIVE)) return false;
|
||||
if (scaleVal(width, Scale.EFFECTIVE) != icon.scaleVal(icon.width, Scale.EFFECTIVE)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -37,8 +37,32 @@ public class ImageUtil {
|
||||
return (BufferedImage)image;
|
||||
}
|
||||
|
||||
final int width = image.getWidth(null);
|
||||
final int height = image.getHeight(null);
|
||||
if (width <= 0 || height <= 0) {
|
||||
// avoiding NPE
|
||||
return new BufferedImage(Math.max(width, 1), Math.max(height, 1), BufferedImage.TYPE_INT_ARGB) {
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return Math.max(width, 0);
|
||||
}
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return Math.max(height, 0);
|
||||
}
|
||||
@Override
|
||||
public int getWidth(ImageObserver observer) {
|
||||
return Math.max(width, 0);
|
||||
}
|
||||
@Override
|
||||
public int getHeight(ImageObserver observer) {
|
||||
return Math.max(height, 0);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@SuppressWarnings("UndesirableClassUsage")
|
||||
BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB);
|
||||
BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics2D g = bufferedImage.createGraphics();
|
||||
g.drawImage(image, 0, 0, null);
|
||||
g.dispose();
|
||||
|
||||
@@ -215,11 +215,12 @@ public class JBUI {
|
||||
*/
|
||||
public static float sysScale(@Nullable Graphics2D g) {
|
||||
if (UIUtil.isJDKManagedHiDPI() && g != null) {
|
||||
if (g.getDeviceConfiguration() instanceof BufferedImageGraphicsConfig) {
|
||||
GraphicsConfiguration conf = g.getDeviceConfiguration();
|
||||
if (conf instanceof BufferedImageGraphicsConfig) {
|
||||
// take BI's scale directly, not inspecting the device
|
||||
return (float)g.getTransform().getScaleX();
|
||||
}
|
||||
return sysScale(g.getDeviceConfiguration().getDevice());
|
||||
if (conf != null) return sysScale(conf.getDevice());
|
||||
}
|
||||
return sysScale();
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public abstract class PythonTestCommandLineStateBase extends PythonCommandLineSt
|
||||
}
|
||||
|
||||
protected PythonTRunnerConsoleProperties createConsoleProperties(Executor executor) {
|
||||
return new PythonTRunnerConsoleProperties(myConfiguration, executor, false, getTestLocator());
|
||||
return new PythonTRunnerConsoleProperties(myConfiguration, executor, true, getTestLocator());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||