mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -19,4 +19,4 @@ LangString uninstall_previous_installations_title ${LANG_ENGLISH} "Uninstall old
|
||||
LangString uninstall_previous_installations ${LANG_ENGLISH} ""
|
||||
LangString uninstall_previous_installations_prompt ${LANG_ENGLISH} "Select the ${MUI_PRODUCT} version$2 that you want to uninstall."
|
||||
LangString empty_or_upgrade_folder ${LANG_ENGLISH} "Please select an empty folder or a folder where ${MUI_PRODUCT} ${UPGRADE_VERSION} is installed as the target for installing ${MUI_PRODUCT}."
|
||||
LangString application_running ${LANG_ENGLISH} "$3 is running. Close the application and retry the installation."
|
||||
LangString application_running ${LANG_ENGLISH} "$INSTDIR is running. Close the application and retry the installation."
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.ui.configuration.PathUIUtils;
|
||||
import com.intellij.openapi.roots.ui.configuration.LibrarySourceRootDetectorUtil;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.ui.popup.ListSeparator;
|
||||
@@ -305,7 +305,7 @@ public class AttachSourcesNotificationProvider extends EditorNotifications.Provi
|
||||
Library firstLibrary = libraries.get(0).getLibrary();
|
||||
VirtualFile[] roots = firstLibrary != null ? firstLibrary.getFiles(OrderRootType.CLASSES) : VirtualFile.EMPTY_ARRAY;
|
||||
VirtualFile[] candidates = FileChooser.chooseFiles(descriptor, myProject, roots.length == 0 ? null : PathUtil.getLocalFile(roots[0]));
|
||||
final VirtualFile[] files = PathUIUtils.scanAndSelectDetectedJavaSourceRoots(myParentComponent, candidates);
|
||||
final VirtualFile[] files = LibrarySourceRootDetectorUtil.scanAndSelectDetectedJavaSourceRoots(myParentComponent, candidates);
|
||||
if (files.length == 0) {
|
||||
return ActionCallback.REJECTED;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.intellij.openapi.progress.Task;
|
||||
import com.intellij.openapi.roots.LibraryOrderEntry;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.ui.configuration.PathUIUtils;
|
||||
import com.intellij.openapi.roots.ui.configuration.LibrarySourceRootDetectorUtil;
|
||||
import com.intellij.openapi.util.ActionCallback;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.JarFileSystem;
|
||||
@@ -215,7 +215,7 @@ public class InternetAttachSourceProvider implements AttachSourcesProvider {
|
||||
VirtualFile jarRoot = JarFileSystem.getInstance().getJarRootForLocalFile(srcFile);
|
||||
if (jarRoot == null) return;
|
||||
|
||||
VirtualFile[] roots = PathUIUtils.scanAndSelectDetectedJavaSourceRoots(null, new VirtualFile[]{jarRoot});
|
||||
VirtualFile[] roots = LibrarySourceRootDetectorUtil.scanAndSelectDetectedJavaSourceRoots(null, new VirtualFile[]{jarRoot});
|
||||
if (roots.length == 0) {
|
||||
roots = new VirtualFile[]{jarRoot};
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,8 +23,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class JavaSourceRootDetector extends RootDetector {
|
||||
public JavaSourceRootDetector() {
|
||||
public class LibraryJavaSourceRootDetector extends RootDetector {
|
||||
public LibraryJavaSourceRootDetector() {
|
||||
super(OrderRootType.SOURCES, false, "sources");
|
||||
}
|
||||
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.roots.ui.configuration;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.libraries.ui.OrderRoot;
|
||||
import com.intellij.openapi.roots.libraries.ui.RootDetector;
|
||||
import com.intellij.openapi.roots.libraries.ui.impl.LibraryRootsDetectorImpl;
|
||||
import com.intellij.openapi.roots.libraries.ui.impl.RootDetectionUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This utility class contains utility methods for selecting paths.
|
||||
*
|
||||
* @author Constantine.Plotnikov
|
||||
*/
|
||||
public class LibrarySourceRootDetectorUtil {
|
||||
public static ExtensionPointName<RootDetector> JAVA_SOURCE_ROOT_DETECTOR = ExtensionPointName.create("com.intellij.library.javaSourceRootDetector");
|
||||
|
||||
protected LibrarySourceRootDetectorUtil() {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method takes a candidates for the project root, then scans the candidates and
|
||||
* if multiple candidates or non root source directories are found within some
|
||||
* directories, it shows a dialog that allows selecting or deselecting them.
|
||||
* @param parent a parent parent or project
|
||||
* @param rootCandidates a candidates for roots
|
||||
* @return a array of source folders or empty array if non was selected or dialog was canceled.
|
||||
*/
|
||||
public static VirtualFile[] scanAndSelectDetectedJavaSourceRoots(Component parentComponent, final VirtualFile[] rootCandidates) {
|
||||
final List<OrderRoot> orderRoots = RootDetectionUtil.detectRoots(Arrays.asList(rootCandidates), parentComponent, null,
|
||||
new LibraryRootsDetectorImpl(Arrays.asList(Extensions.getExtensions(JAVA_SOURCE_ROOT_DETECTOR))),
|
||||
new OrderRootType[] {OrderRootType.SOURCES});
|
||||
final List<VirtualFile> result = new ArrayList<VirtualFile>();
|
||||
for (OrderRoot root : orderRoots) {
|
||||
result.add(root.getFile());
|
||||
}
|
||||
return VfsUtil.toVirtualFileArray(result);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -15,46 +15,12 @@
|
||||
*/
|
||||
package com.intellij.openapi.roots.ui.configuration;
|
||||
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.libraries.ui.OrderRoot;
|
||||
import com.intellij.openapi.roots.libraries.ui.RootDetector;
|
||||
import com.intellij.openapi.roots.libraries.ui.impl.LibraryRootsDetectorImpl;
|
||||
import com.intellij.openapi.roots.libraries.ui.impl.RootDetectionUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This utility class contains utility methods for selecting paths.
|
||||
*
|
||||
* @author Constantine.Plotnikov
|
||||
* @deprecated please use {@link LibrarySourceRootDetectorUtil} directly
|
||||
*/
|
||||
public class PathUIUtils {
|
||||
public static final RootDetector JAVA_SOURCE_ROOT_DETECTOR = new JavaSourceRootDetector();
|
||||
public class PathUIUtils extends LibrarySourceRootDetectorUtil {
|
||||
public static final RootDetector JAVA_SOURCE_ROOT_DETECTOR = new LibraryJavaSourceRootDetector();
|
||||
|
||||
private PathUIUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method takes a candidates for the project root, then scans the candidates and
|
||||
* if multiple candidates or non root source directories are found whithin some
|
||||
* directories, it shows a dialog that allows selecting or deselecting them.
|
||||
* @param parent a parent parent or project
|
||||
* @param rootCandidates a candidates for roots
|
||||
* @return a array of source folders or empty array if non was selected or dialog was canceled.
|
||||
*/
|
||||
public static VirtualFile[] scanAndSelectDetectedJavaSourceRoots(Component parentComponent, final VirtualFile[] rootCandidates) {
|
||||
final List<OrderRoot> orderRoots = RootDetectionUtil.detectRoots(Arrays.asList(rootCandidates), parentComponent, null,
|
||||
new LibraryRootsDetectorImpl(Arrays.asList(Extensions.getExtensions(RootDetector.JAVA_SOURCE_ROOT_DETECTOR))),
|
||||
new OrderRootType[0]);
|
||||
final List<VirtualFile> result = new ArrayList<VirtualFile>();
|
||||
for (OrderRoot root : orderRoots) {
|
||||
result.add(root.getFile());
|
||||
}
|
||||
return VfsUtil.toVirtualFileArray(result);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -30,6 +30,7 @@ import com.intellij.openapi.roots.NativeLibraryOrderRootType;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.libraries.ui.*;
|
||||
import com.intellij.openapi.roots.ui.OrderRootTypeUIFactory;
|
||||
import com.intellij.openapi.roots.ui.configuration.LibrarySourceRootDetectorUtil;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -73,7 +74,7 @@ public class DefaultLibraryRootsComponentDescriptor extends LibraryRootsComponen
|
||||
List<RootDetector> results = new ArrayList<>();
|
||||
results.add(new FileTypeBasedRootFilter(OrderRootType.CLASSES, false, StdFileTypes.CLASS, "classes"));
|
||||
results.add(new FileTypeBasedRootFilter(OrderRootType.CLASSES, true, StdFileTypes.CLASS, "jar directory"));
|
||||
results.addAll(Arrays.asList(Extensions.getExtensions(RootDetector.JAVA_SOURCE_ROOT_DETECTOR)));
|
||||
results.addAll(Arrays.asList(Extensions.getExtensions(LibrarySourceRootDetectorUtil.JAVA_SOURCE_ROOT_DETECTOR)));
|
||||
Collections.addAll(results,
|
||||
new FileTypeBasedRootFilter(OrderRootType.SOURCES, true, StdFileTypes.JAVA, "source archive directory"),
|
||||
new JavadocRootDetector(),
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.ui.SdkPathEditor;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.ui.OrderRootTypeUIFactory;
|
||||
import com.intellij.openapi.roots.ui.configuration.PathUIUtils;
|
||||
import com.intellij.openapi.roots.ui.configuration.LibrarySourceRootDetectorUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -61,7 +61,7 @@ public class SourcesOrderRootTypeUIFactory implements OrderRootTypeUIFactory {
|
||||
@Override
|
||||
protected VirtualFile[] adjustAddedFileSet(final Component component, final VirtualFile[] files) {
|
||||
if (mySdk.getSdkType() instanceof JavaSdkType) {
|
||||
return PathUIUtils.scanAndSelectDetectedJavaSourceRoots(component, files);
|
||||
return LibrarySourceRootDetectorUtil.scanAndSelectDetectedJavaSourceRoots(component, files);
|
||||
}
|
||||
return super.adjustAddedFileSet(component, files);
|
||||
}
|
||||
|
||||
@@ -1728,6 +1728,22 @@ public class ExtractMethodProcessor implements MatchProvider {
|
||||
myExtractedMethod = suggester.getExtractedMethod();
|
||||
myMethodCall = suggester.getMethodCall();
|
||||
myVariableDatum = suggester.getVariableData();
|
||||
|
||||
final List<PsiVariable> outputVariables = new ArrayList<>();
|
||||
for (PsiReturnStatement statement : PsiUtil.findReturnStatements(myExtractedMethod)) {
|
||||
final PsiExpression returnValue = statement.getReturnValue();
|
||||
if (returnValue instanceof PsiReferenceExpression) {
|
||||
final PsiElement resolve = ((PsiReferenceExpression)returnValue).resolve();
|
||||
if (resolve instanceof PsiLocalVariable) {
|
||||
outputVariables.add((PsiVariable)resolve);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (outputVariables.size() == 1) {
|
||||
myOutputVariable = outputVariables.get(0);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -334,6 +334,12 @@ public class ExtractMethodSignatureSuggester {
|
||||
for (PsiParameter parameter : parameters) {
|
||||
uniqueNameGenerator.addExistingName(parameter.getName());
|
||||
}
|
||||
|
||||
SyntaxTraverser.psiTraverser().withRoot(myExtractedMethod.getBody())
|
||||
.filter(element -> element instanceof PsiVariable)
|
||||
.forEach(element -> uniqueNameGenerator.addExistingName(((PsiVariable)element).getName()));
|
||||
|
||||
|
||||
final THashMap<PsiExpression, String> unique = new THashMap<PsiExpression, String>(ourEquivalenceStrategy);
|
||||
final Map<PsiExpression, String> replacement = new HashMap<PsiExpression, String>();
|
||||
for (PsiExpression expr : exprs) {
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
|
||||
class Test {
|
||||
|
||||
private BigDecimal getRevenue() {
|
||||
<selection>final String query = createNamedQuery("revenues");
|
||||
String revenues = "";
|
||||
final String revenue;
|
||||
revenue = "a";
|
||||
</selection>
|
||||
return revenue;
|
||||
}
|
||||
|
||||
public BigDecimal getExpense() {
|
||||
final String query = createNamedQuery("expenses");
|
||||
String expenses = "";
|
||||
final String expense;
|
||||
expense = "a";
|
||||
|
||||
return expense;
|
||||
}
|
||||
|
||||
private String createNamedQuery(String expenses) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class Test {
|
||||
|
||||
private BigDecimal getRevenue() {
|
||||
final String revenue = newMethod("revenues");
|
||||
|
||||
return revenue;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String newMethod(String revenues2) {
|
||||
final String query = createNamedQuery(revenues2);
|
||||
String revenues = "";
|
||||
final String revenue;
|
||||
revenue = "a";
|
||||
return revenue;
|
||||
}
|
||||
|
||||
public BigDecimal getExpense() {
|
||||
final String expense = newMethod("expenses");
|
||||
|
||||
return expense;
|
||||
}
|
||||
|
||||
private String createNamedQuery(String expenses) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -675,6 +675,10 @@ public class ExtractMethodTest extends LightCodeInsightTestCase {
|
||||
doDuplicatesTest();
|
||||
}
|
||||
|
||||
public void testSuggestChangeSignatureWithOutputVariables() throws Exception {
|
||||
doDuplicatesTest();
|
||||
}
|
||||
|
||||
public void testSuggestChangeSignatureWithChangedParameterName() throws Exception {
|
||||
configureByFile(BASE_PATH + getTestName(false) + ".java");
|
||||
boolean success = performExtractMethod(true, true, getEditor(), getFile(), getProject(), false, null, false, "p");
|
||||
|
||||
+10
-1
@@ -606,7 +606,7 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme {
|
||||
Element element = new Element(OPTION_ELEMENT);
|
||||
element.setAttribute(NAME_ATTR, key.getExternalName());
|
||||
if (baseKey != null && value.isFallbackEnabled()) {
|
||||
if (defaultFallbackAttr != null && defaultAttr != null && defaultAttr != defaultFallbackAttr) {
|
||||
if (isParentOverwritingInheritance(key)) {
|
||||
element.setAttribute(BASE_ATTRIBUTES_ATTR, baseKey.getExternalName());
|
||||
attrElements.addContent(element);
|
||||
}
|
||||
@@ -622,6 +622,15 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isParentOverwritingInheritance(@NotNull TextAttributesKey key) {
|
||||
TextAttributes parentAttrs =
|
||||
myParentScheme instanceof AbstractColorsScheme ? ((AbstractColorsScheme)myParentScheme).getDirectlyDefinedAttributes(key) : null;
|
||||
if (parentAttrs != null) {
|
||||
return !parentAttrs.isFallbackEnabled();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected Color getOwnColor(ColorKey key) {
|
||||
return myColorsMap.get(key);
|
||||
}
|
||||
|
||||
+2
-1
@@ -59,6 +59,7 @@ import com.intellij.util.Consumer;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import com.intellij.util.ui.GraphicsUtil;
|
||||
import com.intellij.util.ui.JBDimension;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -626,7 +627,7 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr
|
||||
|
||||
EditorColorsManager colorsManager = EditorColorsManager.getInstance();
|
||||
EditorColorsScheme scheme = colorsManager.getGlobalScheme();
|
||||
StyleConstants.setFontSize(myFontSizeStyle, scheme.getQuickDocFontSize().getSize());
|
||||
StyleConstants.setFontSize(myFontSizeStyle, JBUI.scale(scheme.getQuickDocFontSize().getSize()));
|
||||
if (Registry.is("documentation.component.editor.font")) {
|
||||
StyleConstants.setFontFamily(myFontSizeStyle, scheme.getEditorFontName());
|
||||
}
|
||||
|
||||
@@ -46,6 +46,9 @@ import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.DefaultTreeModel;
|
||||
import javax.swing.tree.TreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -170,6 +173,15 @@ public class QuickFixAction extends AnAction {
|
||||
}, templatePresentationText, null);
|
||||
|
||||
refreshViews(project, ignoredElements, myToolWrapper);
|
||||
final InspectionTree tree = context.getView().getTree();
|
||||
final TreePath[] selected = tree.getSelectionPaths();
|
||||
if (selected != null) {
|
||||
for (TreePath path : selected) {
|
||||
path.getLastPathComponent();
|
||||
((DefaultTreeModel) tree.getModel()).reload((TreeNode)path.getLastPathComponent());
|
||||
}
|
||||
}
|
||||
tree.restoreExpansionAndSelection();
|
||||
}
|
||||
finally { //to make offline view lazy
|
||||
if (initial) refManager.inspectionReadActionStarted();
|
||||
|
||||
@@ -86,16 +86,18 @@ public class QuickFixToolbar extends JPanel {
|
||||
@NotNull final TreePath[] paths,
|
||||
@NotNull final Project project,
|
||||
boolean multipleDescriptors) {
|
||||
final AnAction[] suppressors = new SuppressActionWrapper(project, toolWrapper, paths).getChildren(null);
|
||||
final ComboBoxAction action = new ComboBoxAction() {
|
||||
{
|
||||
getTemplatePresentation().setText(multipleDescriptors ? "Suppress All" : "Suppress");
|
||||
getTemplatePresentation().setEnabledAndVisible(suppressors.length != 0);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected DefaultActionGroup createPopupActionGroup(JComponent button) {
|
||||
DefaultActionGroup group = new DefaultActionGroup();
|
||||
group.addAll(new SuppressActionWrapper(project, toolWrapper, paths).getChildren(null));
|
||||
group.addAll(suppressors);
|
||||
return group;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -62,6 +62,4 @@ public abstract class RootDetector {
|
||||
*/
|
||||
@NotNull
|
||||
public abstract Collection<VirtualFile> detectRoots(@NotNull VirtualFile rootCandidate, @NotNull ProgressIndicator progressIndicator);
|
||||
|
||||
public static ExtensionPointName<RootDetector> JAVA_SOURCE_ROOT_DETECTOR = ExtensionPointName.create("com.intellij.library.javaSourceRootDetector");
|
||||
}
|
||||
|
||||
+30
-12
@@ -28,6 +28,7 @@ import com.intellij.openapi.roots.libraries.ui.DetectedLibraryRoot;
|
||||
import com.intellij.openapi.roots.libraries.ui.LibraryRootsComponentDescriptor;
|
||||
import com.intellij.openapi.roots.libraries.ui.LibraryRootsDetector;
|
||||
import com.intellij.openapi.roots.libraries.ui.OrderRoot;
|
||||
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;
|
||||
@@ -119,20 +120,37 @@ public class RootDetectionUtil {
|
||||
}
|
||||
LOG.assertTrue(!types.isEmpty(), "No allowed root types found for " + detector);
|
||||
List<String> names = new ArrayList<String>(types.keySet());
|
||||
String title = "Choose Categories of Selected Files";
|
||||
String description = XmlStringUtil.wrapInHtml(ApplicationNamesInfo.getInstance().getProductName() + " cannot determine what kind of files the chosen items contain.<br>" +
|
||||
"Choose the appropriate categories from the list.");
|
||||
ChooseElementsDialog<String> dialog;
|
||||
if (parentComponent != null) {
|
||||
dialog = new ChooseRootTypeElementsDialog(parentComponent, names, title, description);
|
||||
if (names.size() == 1) {
|
||||
String title = "Attach Roots";
|
||||
String typeName = names.get(0);
|
||||
String message = ApplicationNamesInfo.getInstance().getProductName() + " cannot determine what kind of files the chosen items contain. " +
|
||||
"Do you want to attach them as '" + typeName + "'?";
|
||||
int answer = parentComponent != null
|
||||
? Messages.showYesNoDialog(parentComponent, message, title, null)
|
||||
: Messages.showYesNoDialog(project, message, title, null);
|
||||
if (answer == Messages.YES) {
|
||||
Pair<OrderRootType, Boolean> pair = types.get(typeName);
|
||||
for (VirtualFile candidate : rootCandidates) {
|
||||
result.add(new OrderRoot(candidate, pair.getFirst(), pair.getSecond()));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dialog = new ChooseRootTypeElementsDialog(project, names, title, description);
|
||||
}
|
||||
for (String rootType : dialog.showAndGetResult()) {
|
||||
final Pair<OrderRootType, Boolean> pair = types.get(rootType);
|
||||
for (VirtualFile candidate : rootCandidates) {
|
||||
result.add(new OrderRoot(candidate, pair.getFirst(), pair.getSecond()));
|
||||
String title = "Choose Categories of Selected Files";
|
||||
String description = XmlStringUtil.wrapInHtml(ApplicationNamesInfo.getInstance().getProductName() + " cannot determine what kind of files the chosen items contain.<br>" +
|
||||
"Choose the appropriate categories from the list.");
|
||||
ChooseElementsDialog<String> dialog;
|
||||
if (parentComponent != null) {
|
||||
dialog = new ChooseRootTypeElementsDialog(parentComponent, names, title, description);
|
||||
}
|
||||
else {
|
||||
dialog = new ChooseRootTypeElementsDialog(project, names, title, description);
|
||||
}
|
||||
for (String rootType : dialog.showAndGetResult()) {
|
||||
final Pair<OrderRootType, Boolean> pair = types.get(rootType);
|
||||
for (VirtualFile candidate : rootCandidates) {
|
||||
result.add(new OrderRoot(candidate, pair.getFirst(), pair.getSecond()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,8 +147,9 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent
|
||||
|
||||
public ComboBoxButton(Presentation presentation) {
|
||||
myPresentation = presentation;
|
||||
setEnabled(myPresentation.isEnabled());
|
||||
setModel(new MyButtonModel());
|
||||
getModel().setEnabled(myPresentation.isEnabled());
|
||||
setVisible(presentation.isVisible());
|
||||
setHorizontalAlignment(LEFT);
|
||||
setFocusable(false);
|
||||
if (isSmallVariant()) {
|
||||
|
||||
@@ -121,14 +121,14 @@ public class PluginGroups {
|
||||
"com.intellij.spring," +
|
||||
"com.intellij.spring.webflow," +
|
||||
"com.intellij.spring.ws,com.intellij.aop",
|
||||
"J2EE:com.intellij.javaee.batch," +
|
||||
"Java EE:com.intellij.javaee.batch," +
|
||||
"com.intellij.beanValidation," +
|
||||
"com.intellij.cdi," +
|
||||
"com.intellij.javaee," +
|
||||
"com.intellij.jsf," +
|
||||
"com.intellij.javaee.extensions," +
|
||||
"com.jetbrains.restWebServices," +
|
||||
"Java EE: Web Services (JAX-WS)," +
|
||||
"Web Services (JAX-WS)," +
|
||||
"com.intellij.javaee.webSocket," +
|
||||
"com.intellij.jsp," +
|
||||
"com.intellij.persistence",
|
||||
|
||||
+2
-2
@@ -81,7 +81,7 @@ public class NotificationsManagerImpl extends NotificationsManager {
|
||||
}
|
||||
|
||||
public static boolean newEnabled() {
|
||||
return Registry.is("ide.new.notification.enabled", false);
|
||||
return ApplicationManager.getApplication().isInternal() && Registry.is("ide.new.notification.enabled", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -227,7 +227,7 @@ public class NotificationsManagerImpl extends NotificationsManager {
|
||||
final ProjectManager projectManager = ProjectManager.getInstance();
|
||||
final boolean noProjects = projectManager.getOpenProjects().length == 0;
|
||||
final boolean sticky = NotificationDisplayType.STICKY_BALLOON == displayType || noProjects;
|
||||
Ref<Object> layoutDataRef = newEnabled() && notification.getIcon() != null ? new Ref<Object>() : null;
|
||||
Ref<Object> layoutDataRef = newEnabled() ? new Ref<Object>() : null;
|
||||
final Balloon balloon = createBalloon((IdeFrame)window, notification, false, false, layoutDataRef);
|
||||
Disposer.register(project != null ? project : ApplicationManager.getApplication(), balloon);
|
||||
|
||||
|
||||
@@ -298,6 +298,10 @@ public class IdeRootPane extends JRootPane implements UISettingsListener {
|
||||
return myStatusBar;
|
||||
}
|
||||
|
||||
public int getStatusBarHeight() {
|
||||
return myStatusBar.isVisible() ? myStatusBar.getHeight() : 0;
|
||||
}
|
||||
|
||||
private void updateToolbarVisibility(){
|
||||
myToolbar.setVisible(myUISettings.SHOW_MAIN_TOOLBAR && !UISettings.getInstance().PRESENTATION_MODE);
|
||||
}
|
||||
|
||||
@@ -445,6 +445,10 @@ public final class ToolWindowsPane extends JBLayeredPane implements Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
public int getBottomHeight() {
|
||||
return myBottomStripe.isVisible() ? myBottomStripe.getHeight() : 0;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Stripe getStripeFor(String id) {
|
||||
ToolWindow window = myManager.getToolWindow(id);
|
||||
|
||||
@@ -17,9 +17,11 @@ package com.intellij.ui;
|
||||
|
||||
import com.intellij.ide.ui.LafManager;
|
||||
import com.intellij.ide.ui.LafManagerListener;
|
||||
import com.intellij.notification.impl.NotificationsManagerImpl;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.ui.popup.Balloon;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.wm.impl.IdeRootPane;
|
||||
import com.intellij.openapi.wm.impl.ToolWindowsPane;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.ui.JBInsets;
|
||||
@@ -162,7 +164,7 @@ public class BalloonLayoutImpl implements BalloonLayout {
|
||||
|
||||
private void calculateSize() {
|
||||
myWidth = null;
|
||||
if (myLayoutData.isEmpty()) {
|
||||
if (myLayoutData.isEmpty() && !NotificationsManagerImpl.newEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -199,6 +201,11 @@ public class BalloonLayoutImpl implements BalloonLayout {
|
||||
JComponent layeredPane = pane != null ? pane.getMyLayeredPane() : null;
|
||||
int eachColumnX = (layeredPane == null ? myLayeredPane.getWidth() : layeredPane.getX() + layeredPane.getWidth()) - 4;
|
||||
|
||||
if (NotificationsManagerImpl.newEnabled()) {
|
||||
newLayout(columns.get(0), eachColumnX + 4, (int)myLayeredPane.getBounds().getMaxY());
|
||||
return;
|
||||
}
|
||||
|
||||
if (myLayoutData.isEmpty()) {
|
||||
for (int i = 0; i < columns.size(); i++) {
|
||||
final ArrayList<Balloon> eachColumn = columns.get(i);
|
||||
@@ -282,6 +289,24 @@ public class BalloonLayoutImpl implements BalloonLayout {
|
||||
}
|
||||
}
|
||||
|
||||
private void newLayout(List<Balloon> balloons, int startX, int bottomY) {
|
||||
int y = bottomY;
|
||||
ToolWindowsPane pane = UIUtil.findComponentOfType(myParent, ToolWindowsPane.class);
|
||||
if (pane != null) {
|
||||
y -= pane.getBottomHeight();
|
||||
}
|
||||
if (myParent instanceof IdeRootPane) {
|
||||
y -= ((IdeRootPane)myParent).getStatusBarHeight();
|
||||
}
|
||||
|
||||
for (Balloon balloon : balloons) {
|
||||
Rectangle bounds = new Rectangle(getSize(balloon));
|
||||
y -= bounds.height;
|
||||
bounds.setLocation(startX - bounds.width, y);
|
||||
balloon.setBounds(bounds);
|
||||
}
|
||||
}
|
||||
|
||||
private List<Integer> computeWidths(List<ArrayList<Balloon>> columns) {
|
||||
List<Integer> columnWidths = new ArrayList<Integer>();
|
||||
for (ArrayList<Balloon> eachColumn : columns) {
|
||||
|
||||
+37
-4
@@ -20,6 +20,7 @@ import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
import com.intellij.openapi.editor.colors.FontPreferences;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.editor.markup.EffectType;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
@@ -45,20 +46,21 @@ import java.util.Collections;
|
||||
import static com.intellij.openapi.editor.colors.FontPreferencesTest.*;
|
||||
import static java.util.Collections.singletonList;
|
||||
|
||||
@SuppressWarnings("Duplicates")
|
||||
public class EditorColorsSchemeImplTest extends LightPlatformCodeInsightTestCase {
|
||||
EditorColorsSchemeImpl myScheme = new EditorColorsSchemeImpl(null);
|
||||
|
||||
public void testDefaults() {
|
||||
checkState(myScheme.getFontPreferences(),
|
||||
Collections.<String>emptyList(),
|
||||
Collections.<String>emptyList(),
|
||||
Collections.emptyList(),
|
||||
Collections.emptyList(),
|
||||
FontPreferences.DEFAULT_FONT_NAME,
|
||||
FontPreferences.DEFAULT_FONT_NAME, null);
|
||||
assertEquals(FontPreferences.DEFAULT_FONT_NAME, myScheme.getEditorFontName());
|
||||
assertEquals(FontPreferences.DEFAULT_FONT_SIZE, myScheme.getEditorFontSize());
|
||||
checkState(myScheme.getConsoleFontPreferences(),
|
||||
Collections.<String>emptyList(),
|
||||
Collections.<String>emptyList(),
|
||||
Collections.emptyList(),
|
||||
Collections.emptyList(),
|
||||
FontPreferences.DEFAULT_FONT_NAME,
|
||||
FontPreferences.DEFAULT_FONT_NAME, null);
|
||||
assertEquals(FontPreferences.DEFAULT_FONT_NAME, myScheme.getConsoleFontName());
|
||||
@@ -290,6 +292,37 @@ public class EditorColorsSchemeImplTest extends LightPlatformCodeInsightTestCase
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void testIdea152156() throws Exception {
|
||||
EditorColorsScheme defaultScheme = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME);
|
||||
EditorColorsScheme parentScheme = (EditorColorsScheme)defaultScheme.clone();
|
||||
parentScheme.setName("DefaultTest");
|
||||
EditorColorsScheme editorColorsScheme = new EditorColorsSchemeImpl(parentScheme);
|
||||
editorColorsScheme.setName("test");
|
||||
TextAttributes defaultAttributes = new TextAttributes(null, null, Color.BLACK, EffectType.LINE_UNDERSCORE, Font.PLAIN);
|
||||
TextAttributes attributes = new TextAttributes(null, null, null, EffectType.BOXED, Font.PLAIN);
|
||||
attributes.setEnforceEmpty(false);
|
||||
assertTrue(attributes.isFallbackEnabled());
|
||||
TextAttributesKey testKey = TextAttributesKey.createTextAttributesKey("TEST_KEY", DefaultLanguageHighlighterColors.PARAMETER);
|
||||
parentScheme.setAttributes(testKey, defaultAttributes);
|
||||
editorColorsScheme.setAttributes(testKey, attributes);
|
||||
try {
|
||||
Element root = new Element("scheme");
|
||||
((AbstractColorsScheme)editorColorsScheme).writeExternal(root);
|
||||
EditorColorsScheme targetScheme = new EditorColorsSchemeImpl(parentScheme);
|
||||
for (final Element child : root.getChildren()) {
|
||||
if ("attributes".equals(child.getName())) {
|
||||
((EditorColorsSchemeImpl)targetScheme).readAttributes(child);
|
||||
}
|
||||
}
|
||||
TextAttributes targetAttributes = ((AbstractColorsScheme)targetScheme).getDirectlyDefinedAttributes(testKey);
|
||||
assertTrue(targetAttributes != null && targetAttributes.isFallbackEnabled());
|
||||
}
|
||||
finally {
|
||||
TextAttributesKey.removeTextAttributesKey(testKey.getExternalName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static EditorColorsScheme loadScheme(@NotNull String docText) throws ParserConfigurationException, IOException, SAXException {
|
||||
|
||||
@@ -852,7 +852,8 @@ public class StringUtil extends StringUtilRt {
|
||||
return suggestion.substring(0, len - 2) + "en";
|
||||
}
|
||||
|
||||
if (endsWithIgnoreCase(suggestion, "s") || endsWithIgnoreCase(suggestion, "x") || endsWithIgnoreCase(suggestion, "ch")) {
|
||||
if (endsWithIgnoreCase(suggestion, "s") || endsWithIgnoreCase(suggestion, "x") ||
|
||||
endsWithIgnoreCase(suggestion, "ch") || endsWithIgnoreCase(suggestion, "sh")) {
|
||||
return suggestion + "es";
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.intellij.util.ui;
|
||||
import com.intellij.ui.Gray;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
@@ -28,7 +27,6 @@ public class ColorIcon extends EmptyIcon {
|
||||
private final Color myColor;
|
||||
private boolean myBorder;
|
||||
private int myColorSize;
|
||||
private ColorIcon myScaledCache;
|
||||
|
||||
public ColorIcon(int size, int colorSize, @NotNull Color color, final boolean border) {
|
||||
super(size, size);
|
||||
@@ -68,20 +66,13 @@ public class ColorIcon extends EmptyIcon {
|
||||
}
|
||||
|
||||
protected int getColorSize() {
|
||||
return scale == 1f ? myColorSize : (int)(myColorSize * scale);
|
||||
return scale(myColorSize);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Icon scale(float scaleFactor) {
|
||||
if (scale == scaleFactor) {
|
||||
return this;
|
||||
}
|
||||
if (myScaledCache != null && myScaledCache.scale == scaleFactor) {
|
||||
return myScaledCache;
|
||||
}
|
||||
myScaledCache = new ColorIcon(getIconWidth(), myColorSize, myColor, myBorder);
|
||||
myScaledCache.scale = scaleFactor;
|
||||
return myScaledCache;
|
||||
protected EmptyIcon createScaledInstance(float scale) {
|
||||
return new ColorIcon(getIconWidth(), myColorSize, myColor, myBorder);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,6 +42,7 @@ public class EmptyIcon implements Icon, ScalableIcon {
|
||||
private final int width;
|
||||
private final int height;
|
||||
protected float scale = 1f;
|
||||
private EmptyIcon myScaledCache;
|
||||
|
||||
public static Icon create(int size) {
|
||||
Icon icon = cache.get(size);
|
||||
@@ -80,12 +81,12 @@ public class EmptyIcon implements Icon, ScalableIcon {
|
||||
|
||||
@Override
|
||||
public int getIconWidth() {
|
||||
return scale == 1f ? width : (int) (width * scale);
|
||||
return scale(width);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight() {
|
||||
return scale == 1f ? height : (int) (height * scale);
|
||||
return scale(height);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -117,19 +118,33 @@ public class EmptyIcon implements Icon, ScalableIcon {
|
||||
return new EmptyIconUIResource(this);
|
||||
}
|
||||
|
||||
protected int scale(int n) {
|
||||
return scale == 1f ? n : (int) (n * scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon scale(float scaleFactor) {
|
||||
if (scaleFactor != scale) {
|
||||
EmptyIcon icon;
|
||||
if (scale != 1f) {
|
||||
icon = this;
|
||||
} else {
|
||||
icon = this instanceof UIResource ? new EmptyIconUIResource(width, height) : new EmptyIcon(width, height);
|
||||
}
|
||||
icon.scale = scaleFactor;
|
||||
return icon;
|
||||
if (scale == scaleFactor) {
|
||||
return this;
|
||||
}
|
||||
return this;
|
||||
|
||||
if (myScaledCache != null && myScaledCache.scale == scaleFactor) {
|
||||
return myScaledCache;
|
||||
}
|
||||
|
||||
myScaledCache = createScaledInstance(scaleFactor);
|
||||
myScaledCache.scale = scaleFactor;
|
||||
return myScaledCache;
|
||||
}
|
||||
|
||||
protected EmptyIcon createScaledInstance(float scale) {
|
||||
final EmptyIcon icon;
|
||||
if (scale != 1f) {
|
||||
icon = this;
|
||||
} else {
|
||||
icon = this instanceof UIResource ? new EmptyIconUIResource(width, height) : new EmptyIcon(width, height);
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
public static class EmptyIconUIResource extends EmptyIcon implements UIResource {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
import com.intellij.openapi.ui.GraphicsConfig;
|
||||
import com.intellij.ui.Gray;
|
||||
import com.intellij.ui.JBColor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -22,45 +25,59 @@ import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
/**
|
||||
* User: Vassiliy.Kudryashov
|
||||
* @author Vassiliy Kudryashov
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class TwoColorsIcon extends EmptyIcon {
|
||||
@NotNull private final Paint myColor1;
|
||||
@NotNull private final Paint myColor2;
|
||||
private static final int SQUARE_SIZE = 6;
|
||||
public class TwoColorsIcon extends ColorIcon {
|
||||
@NotNull private final Color mySecondColor;
|
||||
private static final int SQUARE_SIZE = JBUI.scale(6);
|
||||
private static final BufferedImage CHESS_IMAGE = UIUtil.createImage(SQUARE_SIZE, SQUARE_SIZE, BufferedImage.TYPE_INT_RGB);
|
||||
private static final TexturePaint CHESS;
|
||||
|
||||
static {
|
||||
Graphics2D graphics = CHESS_IMAGE.createGraphics();
|
||||
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
|
||||
graphics.setColor(Color.LIGHT_GRAY);
|
||||
graphics.setColor(JBColor.LIGHT_GRAY);
|
||||
graphics.fillRect(0, 0, SQUARE_SIZE + 1, SQUARE_SIZE + 1);
|
||||
graphics.setColor(Color.GRAY);
|
||||
graphics.setColor(JBColor.GRAY);
|
||||
graphics.fillRect(0, 0, SQUARE_SIZE / 2, SQUARE_SIZE / 2);
|
||||
graphics.fillRect(SQUARE_SIZE / 2, SQUARE_SIZE / 2, SQUARE_SIZE / 2, SQUARE_SIZE / 2);
|
||||
graphics.dispose();
|
||||
CHESS = new TexturePaint(CHESS_IMAGE, new Rectangle(0, 0, SQUARE_SIZE, SQUARE_SIZE));
|
||||
}
|
||||
private TexturePaint CHESS = new TexturePaint(CHESS_IMAGE, new Rectangle(0, 0, SQUARE_SIZE, SQUARE_SIZE));
|
||||
|
||||
public TwoColorsIcon(int size, @Nullable Color color1, @Nullable Color color2) {
|
||||
super(size, size);
|
||||
myColor1 = color1 != null ? color1 : CHESS;
|
||||
myColor2 = color2 != null ? color2 : CHESS;
|
||||
public TwoColorsIcon(int size, @Nullable Color color1, @Nullable Color secondColor) {
|
||||
super(size, size, color1 != null ? color1 : Gray.TRANSPARENT, false);
|
||||
mySecondColor = secondColor != null ? secondColor : Gray.TRANSPARENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIcon(final Component component, final Graphics g, final int x, final int y) {
|
||||
public void paintIcon(final Component component, Graphics g, int x, int y) {
|
||||
Graphics2D g2d = (Graphics2D)g.create();
|
||||
final GraphicsConfig config = GraphicsUtil.setupAAPainting(g2d);
|
||||
try {
|
||||
final int w = getIconWidth();
|
||||
final int h = getIconHeight();
|
||||
GraphicsUtil.setupAAPainting(g2d);
|
||||
g2d.setPaint(myColor1);
|
||||
g2d.setPaint(getPaint(getIconColor()));
|
||||
g2d.fillPolygon(new int[]{x, x + w, x}, new int[]{y, y, y + h}, 3);
|
||||
g2d.setPaint(myColor2);
|
||||
g2d.setPaint(getPaint(mySecondColor));
|
||||
g2d.fillPolygon(new int[]{x + w, x + w, x}, new int[]{y, y + h, y + h}, 3);
|
||||
}
|
||||
catch (Exception e) {
|
||||
g2d.dispose();
|
||||
}
|
||||
finally {
|
||||
config.restore();
|
||||
}
|
||||
}
|
||||
|
||||
protected Paint getPaint(Color color) {
|
||||
return color == null || color.getAlpha() == 0 ? CHESS : color;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EmptyIcon createScaledInstance(float scale) {
|
||||
return new TwoColorsIcon(getColorSize(), getIconColor(), mySecondColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,16 +90,14 @@ public class TwoColorsIcon extends EmptyIcon {
|
||||
|
||||
if (getIconWidth() != icon.getIconWidth()) return false;
|
||||
if (getIconHeight() != icon.getIconHeight()) return false;
|
||||
if (!myColor1.equals(icon.myColor1)) return false;
|
||||
if (!myColor2.equals(icon.myColor2)) return false;
|
||||
if (!mySecondColor.equals(icon.mySecondColor)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = super.hashCode();
|
||||
result = 31 * result + myColor1.hashCode();
|
||||
result = 31 * result + myColor2.hashCode();
|
||||
result = 31 * result + mySecondColor.hashCode();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,6 +110,7 @@ public class StringUtilTest {
|
||||
assertEquals("fixes", StringUtil.pluralize("fix"));
|
||||
assertEquals("men", StringUtil.pluralize("man"));
|
||||
assertEquals("media", StringUtil.pluralize("medium"));
|
||||
assertEquals("stashes", StringUtil.pluralize("stash"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -47,8 +47,8 @@ import com.intellij.util.NullableFunction;
|
||||
import com.intellij.util.WaitForProgressToShow;
|
||||
import com.intellij.util.concurrency.Semaphore;
|
||||
import com.intellij.util.ui.ConfirmationDialog;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.jetbrains.annotations.CalledInAwt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -202,6 +202,9 @@ public class CommitHelper {
|
||||
@NotNull
|
||||
private String getCommitSummary(@NotNull GeneralCommitProcessor processor) {
|
||||
StringBuilder content = new StringBuilder(getFileSummaryReport(processor.getChangesFailedToCommit()));
|
||||
if (!StringUtil.isEmpty(myCommitMessage)) {
|
||||
content.append(": ").append(escape(myCommitMessage));
|
||||
}
|
||||
if (!myFeedback.isEmpty()) {
|
||||
content.append("<br/>");
|
||||
content.append(StringUtil.join(myFeedback, "<br/>"));
|
||||
@@ -269,8 +272,6 @@ public class CommitHelper {
|
||||
}
|
||||
|
||||
processor.doBeforeRefresh();
|
||||
|
||||
AbstractVcsHelper.getInstance(myProject).showErrors(processor.getVcsExceptions(), myActionName);
|
||||
}
|
||||
catch (ProcessCanceledException pce) {
|
||||
throw pce;
|
||||
@@ -443,8 +444,13 @@ public class CommitHelper {
|
||||
}
|
||||
|
||||
public void afterFailedCheckIn() {
|
||||
moveToFailedList(myChangeList, myCommitMessage, getChangesFailedToCommit(),
|
||||
VcsBundle.message("commit.dialog.failed.commit.template", myChangeList.getName()), myProject);
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
moveToFailedList(myChangeList, myCommitMessage, getChangesFailedToCommit(),
|
||||
VcsBundle.message("commit.dialog.failed.commit.template", myChangeList.getName()), myProject);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void doBeforeRefresh() {
|
||||
@@ -626,6 +632,7 @@ public class CommitHelper {
|
||||
}
|
||||
}
|
||||
|
||||
@CalledInAwt
|
||||
public static void moveToFailedList(final ChangeList changeList,
|
||||
final String commitMessage,
|
||||
final List<Change> failedChanges,
|
||||
|
||||
+64
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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,11 +17,15 @@ package org.jetbrains.java.decompiler.modules.decompiler;
|
||||
|
||||
import org.jetbrains.java.decompiler.code.CodeConstants;
|
||||
import org.jetbrains.java.decompiler.modules.decompiler.exps.*;
|
||||
import org.jetbrains.java.decompiler.struct.consts.PooledConstant;
|
||||
import org.jetbrains.java.decompiler.struct.consts.PrimitiveConstant;
|
||||
import org.jetbrains.java.decompiler.struct.gen.MethodDescriptor;
|
||||
import org.jetbrains.java.decompiler.struct.gen.VarType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ConcatenationHelper {
|
||||
|
||||
@@ -52,6 +56,12 @@ public class ConcatenationHelper {
|
||||
exprTmp = iex.getInstance();
|
||||
}
|
||||
}
|
||||
else if ("makeConcatWithConstants".equals(iex.getName())) { // java 9 style
|
||||
List<Exprent> parameters = extractParameters(iex.getBootstrapArguments(), iex);
|
||||
if (parameters.size() >= 2) {
|
||||
return createConcatExprent(parameters, expr.bytecode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (exprTmp == null) {
|
||||
@@ -125,20 +135,69 @@ public class ConcatenationHelper {
|
||||
lstOperands.set(i, rep);
|
||||
}
|
||||
}
|
||||
return createConcatExprent(lstOperands, expr.bytecode);
|
||||
}
|
||||
|
||||
private static Exprent createConcatExprent(List<Exprent> lstOperands, Set<Integer> bytecode) {
|
||||
// build exprent to return
|
||||
Exprent func = lstOperands.get(0);
|
||||
|
||||
for (int i = 1; i < lstOperands.size(); i++) {
|
||||
List<Exprent> lstTmp = new ArrayList<Exprent>();
|
||||
lstTmp.add(func);
|
||||
lstTmp.add(lstOperands.get(i));
|
||||
func = new FunctionExprent(FunctionExprent.FUNCTION_STR_CONCAT, lstTmp, expr.bytecode);
|
||||
func = new FunctionExprent(FunctionExprent.FUNCTION_STR_CONCAT, Arrays.asList(func, lstOperands.get(i)), bytecode);
|
||||
}
|
||||
|
||||
return func;
|
||||
}
|
||||
|
||||
// See StringConcatFactory in jdk sources
|
||||
private static final char TAG_ARG = '\u0001';
|
||||
private static final char TAG_CONST = '\u0002';
|
||||
|
||||
private static List<Exprent> extractParameters(List<PooledConstant> bootstrapArguments, InvocationExprent expr) {
|
||||
List<Exprent> parameters = expr.getLstParameters();
|
||||
if (bootstrapArguments != null) {
|
||||
PooledConstant constant = bootstrapArguments.get(0);
|
||||
if (constant.type == CodeConstants.CONSTANT_String) {
|
||||
String recipe = ((PrimitiveConstant)constant).getString();
|
||||
|
||||
List<Exprent> res = new ArrayList<>();
|
||||
StringBuilder acc = new StringBuilder();
|
||||
int parameterId = 0;
|
||||
for (int i = 0; i < recipe.length(); i++) {
|
||||
char c = recipe.charAt(i);
|
||||
|
||||
if (c == TAG_CONST || c == TAG_ARG) {
|
||||
// Detected a special tag, flush all accumulated characters
|
||||
// as a constant first:
|
||||
if (acc.length() > 0) {
|
||||
res.add(new ConstExprent(VarType.VARTYPE_STRING, acc.toString(), expr.bytecode));
|
||||
acc.setLength(0);
|
||||
}
|
||||
if (c == TAG_CONST) {
|
||||
// skip for now
|
||||
}
|
||||
if (c == TAG_ARG) {
|
||||
res.add(parameters.get(parameterId++));
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Not a special characters, this is a constant embedded into
|
||||
// the recipe itself.
|
||||
acc.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
// Flush the remaining characters as constant:
|
||||
if (acc.length() > 0) {
|
||||
res.add(new ConstExprent(VarType.VARTYPE_STRING, acc.toString(), expr.bytecode));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return new ArrayList<>(parameters);
|
||||
}
|
||||
|
||||
private static boolean isAppendConcat(InvocationExprent expr, VarType cltype) {
|
||||
|
||||
if ("append".equals(expr.getName())) {
|
||||
|
||||
+3
-10
@@ -567,21 +567,14 @@ public class ExprProcessor implements CodeConstants {
|
||||
case opc_invokeinterface:
|
||||
case opc_invokedynamic:
|
||||
if (instr.opcode != opc_invokedynamic || instr.bytecode_version >= CodeConstants.BYTECODE_JAVA_7) {
|
||||
|
||||
LinkConstant invoke_constant = pool.getLinkConstant(instr.getOperand(0));
|
||||
int dynamic_invokation_type = -1;
|
||||
|
||||
List<PooledConstant> bootstrap_arguments = null;
|
||||
if (instr.opcode == opc_invokedynamic && bootstrap != null) {
|
||||
List<PooledConstant> bootstrap_arguments = bootstrap.getMethodArguments(invoke_constant.index1);
|
||||
if (bootstrap_arguments.size() > 1) { // INVOKEDYNAMIC is used not only for lambdas
|
||||
PooledConstant link = bootstrap_arguments.get(1);
|
||||
if (link instanceof LinkConstant) {
|
||||
dynamic_invokation_type = ((LinkConstant)link).index1;
|
||||
}
|
||||
}
|
||||
bootstrap_arguments = bootstrap.getMethodArguments(invoke_constant.index1);
|
||||
}
|
||||
|
||||
InvocationExprent exprinv = new InvocationExprent(instr.opcode, invoke_constant, stack, dynamic_invokation_type, bytecode_offsets);
|
||||
InvocationExprent exprinv = new InvocationExprent(instr.opcode, invoke_constant, bootstrap_arguments, stack, bytecode_offsets);
|
||||
if (exprinv.getDescriptor().ret.type == CodeConstants.TYPE_VOID) {
|
||||
exprlist.add(exprinv);
|
||||
}
|
||||
|
||||
+26
-9
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -15,13 +15,6 @@
|
||||
*/
|
||||
package org.jetbrains.java.decompiler.modules.decompiler.exps;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jetbrains.java.decompiler.code.CodeConstants;
|
||||
import org.jetbrains.java.decompiler.main.ClassesProcessor.ClassNode;
|
||||
import org.jetbrains.java.decompiler.main.DecompilerContext;
|
||||
@@ -36,6 +29,7 @@ import org.jetbrains.java.decompiler.modules.decompiler.vars.VarVersionPair;
|
||||
import org.jetbrains.java.decompiler.struct.StructClass;
|
||||
import org.jetbrains.java.decompiler.struct.StructMethod;
|
||||
import org.jetbrains.java.decompiler.struct.consts.LinkConstant;
|
||||
import org.jetbrains.java.decompiler.struct.consts.PooledConstant;
|
||||
import org.jetbrains.java.decompiler.struct.gen.MethodDescriptor;
|
||||
import org.jetbrains.java.decompiler.struct.gen.VarType;
|
||||
import org.jetbrains.java.decompiler.struct.match.MatchEngine;
|
||||
@@ -45,6 +39,9 @@ import org.jetbrains.java.decompiler.util.InterpreterUtil;
|
||||
import org.jetbrains.java.decompiler.util.ListStack;
|
||||
import org.jetbrains.java.decompiler.util.TextUtil;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class InvocationExprent extends Exprent {
|
||||
|
||||
public static final int INVOKE_SPECIAL = 1;
|
||||
@@ -69,16 +66,22 @@ public class InvocationExprent extends Exprent {
|
||||
private String invokeDynamicClassSuffix;
|
||||
private int invocationTyp = INVOKE_VIRTUAL;
|
||||
private List<Exprent> lstParameters = new ArrayList<Exprent>();
|
||||
private List<PooledConstant> bootstrapArguments;
|
||||
|
||||
public InvocationExprent() {
|
||||
super(EXPRENT_INVOCATION);
|
||||
}
|
||||
|
||||
public InvocationExprent(int opcode, LinkConstant cn, ListStack<Exprent> stack, int dynamicInvocationType, Set<Integer> bytecodeOffsets) {
|
||||
public InvocationExprent(int opcode,
|
||||
LinkConstant cn,
|
||||
List<PooledConstant> bootstrapArguments,
|
||||
ListStack<Exprent> stack,
|
||||
Set<Integer> bytecodeOffsets) {
|
||||
this();
|
||||
|
||||
name = cn.elementname;
|
||||
classname = cn.classname;
|
||||
this.bootstrapArguments = bootstrapArguments;
|
||||
|
||||
switch (opcode) {
|
||||
case CodeConstants.opc_invokestatic:
|
||||
@@ -115,6 +118,15 @@ public class InvocationExprent extends Exprent {
|
||||
}
|
||||
|
||||
if (opcode == CodeConstants.opc_invokedynamic) {
|
||||
int dynamicInvocationType = -1;
|
||||
if (bootstrapArguments != null) {
|
||||
if (bootstrapArguments.size() > 1) { // INVOKEDYNAMIC is used not only for lambdas
|
||||
PooledConstant link = bootstrapArguments.get(1);
|
||||
if (link instanceof LinkConstant) {
|
||||
dynamicInvocationType = ((LinkConstant)link).index1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dynamicInvocationType == CodeConstants.CONSTANT_MethodHandle_REF_invokeStatic) {
|
||||
isStatic = true;
|
||||
}
|
||||
@@ -154,6 +166,7 @@ public class InvocationExprent extends Exprent {
|
||||
ExprProcessor.copyEntries(lstParameters);
|
||||
|
||||
addBytecodeOffsets(expr.bytecode);
|
||||
bootstrapArguments = expr.getBootstrapArguments();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -492,6 +505,10 @@ public class InvocationExprent extends Exprent {
|
||||
return invokeDynamicClassSuffix;
|
||||
}
|
||||
|
||||
public List<PooledConstant> getBootstrapArguments() {
|
||||
return bootstrapArguments;
|
||||
}
|
||||
|
||||
// *****************************************************************************
|
||||
// IMatchable implementation
|
||||
// *****************************************************************************
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -77,6 +77,8 @@ public class SingleClassesTest {
|
||||
@Test public void testInnerSignature() { doTest("pkg/TestInnerSignature"); }
|
||||
@Test public void testParameterizedTypes() { doTest("pkg/TestParameterizedTypes"); }
|
||||
@Test public void testShadowing() { doTest("pkg/TestShadowing", "pkg/Shadow", "ext/Shadow"); }
|
||||
@Test public void testStringConcat() { doTest("pkg/TestStringConcat"); }
|
||||
@Test public void testJava9StringConcat() { doTest("java9/TestJava9StringConcat"); }
|
||||
|
||||
protected void doTest(String testFile, String... companionFiles) {
|
||||
ConsoleDecompiler decompiler = fixture.getDecompiler();
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,27 @@
|
||||
package java9;
|
||||
|
||||
public class TestJava9StringConcat {
|
||||
public String test1(String var1, int var2) {
|
||||
return var1 + var2;// 20
|
||||
}
|
||||
|
||||
public String test2(String var1, int var2, Object var3) {
|
||||
return "(" + var1 + "-" + var2 + "---" + var3 + ")";// 24
|
||||
}
|
||||
}
|
||||
|
||||
class 'java9/TestJava9StringConcat' {
|
||||
method 'test1 (Ljava/lang/String;I)Ljava/lang/String;' {
|
||||
2 4
|
||||
7 4
|
||||
}
|
||||
|
||||
method 'test2 (Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;' {
|
||||
3 8
|
||||
8 8
|
||||
}
|
||||
}
|
||||
|
||||
Lines mapping:
|
||||
20 <-> 5
|
||||
24 <-> 9
|
||||
@@ -0,0 +1,31 @@
|
||||
package pkg;
|
||||
|
||||
public class TestStringConcat {
|
||||
public String test1(String var1, int var2) {
|
||||
return var1 + var2;// 20
|
||||
}
|
||||
|
||||
public String test2(String var1, int var2, Object var3) {
|
||||
return "(" + var1 + "-" + var2 + "---" + var3 + ")";// 24
|
||||
}
|
||||
}
|
||||
|
||||
class 'pkg/TestStringConcat' {
|
||||
method 'test1 (Ljava/lang/String;I)Ljava/lang/String;' {
|
||||
f 4
|
||||
12 4
|
||||
}
|
||||
|
||||
method 'test2 (Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;' {
|
||||
7 8
|
||||
10 8
|
||||
19 8
|
||||
22 8
|
||||
27 8
|
||||
2a 8
|
||||
}
|
||||
}
|
||||
|
||||
Lines mapping:
|
||||
20 <-> 5
|
||||
24 <-> 9
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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 java9;
|
||||
|
||||
public class TestJava9StringConcat {
|
||||
public String test1(String prefix, int a) {
|
||||
return prefix + a;
|
||||
}
|
||||
|
||||
public String test2(String var, int b, Object c) {
|
||||
return "(" + var + "-" + b + "---" + c + ")";
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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 pkg;
|
||||
|
||||
public class TestStringConcat {
|
||||
public String test1(String prefix, int a) {
|
||||
return prefix + a;
|
||||
}
|
||||
|
||||
public String test2(String var, int b, Object c) {
|
||||
return "(" + var + "-" + b + "---" + c + ")";
|
||||
}
|
||||
}
|
||||
@@ -126,16 +126,30 @@ public class StudyTaskManager implements PersistentStateComponent<Element>, Dumb
|
||||
StudyStatus taskFileStatus = getStatus(taskFile);
|
||||
if (taskFileStatus == StudyStatus.Unchecked) {
|
||||
task.setStatus(StudyStatus.Unchecked);
|
||||
removeObsoleteTaskStatus(task);
|
||||
return StudyStatus.Unchecked;
|
||||
}
|
||||
if (taskFileStatus == StudyStatus.Failed) {
|
||||
task.setStatus(StudyStatus.Failed);
|
||||
removeObsoleteTaskStatus(task);
|
||||
return StudyStatus.Failed;
|
||||
}
|
||||
}
|
||||
task.setStatus(StudyStatus.Solved);
|
||||
removeObsoleteTaskStatus(task);
|
||||
return StudyStatus.Solved;
|
||||
}
|
||||
|
||||
private void removeObsoleteTaskStatus(Task task) {
|
||||
for (TaskFile taskFile: task.taskFiles.values()) {
|
||||
myTaskStatusMap.remove(taskFile);
|
||||
|
||||
for (AnswerPlaceholder answerPlaceholder: taskFile.getAnswerPlaceholders()) {
|
||||
myStudyStatusMap.remove(answerPlaceholder);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private StudyStatus getStatus(@NotNull final TaskFile file) {
|
||||
if (file.getAnswerPlaceholders().isEmpty()) {
|
||||
|
||||
@@ -1725,7 +1725,7 @@
|
||||
<actionPromoter implementation="com.intellij.execution.testframework.TestTreeViewActionsPromoter"/>
|
||||
<refactoring.invertBoolean implementation="com.intellij.refactoring.invertBoolean.JavaInvertBooleanDelegate"/>
|
||||
<refactoring.pushDown language="JAVA" implementationClass="com.intellij.refactoring.memberPushDown.JavaPushDownDelegate" id="java"/>
|
||||
<library.javaSourceRootDetector implementation="com.intellij.openapi.roots.ui.configuration.JavaSourceRootDetector"/>
|
||||
<library.javaSourceRootDetector implementation="com.intellij.openapi.roots.ui.configuration.LibraryJavaSourceRootDetector"/>
|
||||
</extensions>
|
||||
|
||||
<actions>
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.codeInsight.completion;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.filters.AndFilter;
|
||||
import com.intellij.psi.filters.ElementFilter;
|
||||
import com.intellij.psi.filters.OrFilter;
|
||||
@@ -25,6 +26,7 @@ import com.intellij.psi.filters.TextContainFilter;
|
||||
import com.intellij.psi.filters.getters.HtmlAttributeValueGetter;
|
||||
import com.intellij.psi.filters.getters.XmlAttributeValueGetter;
|
||||
import com.intellij.psi.filters.position.XmlTokenTypeFilter;
|
||||
import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReference;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.xml.XmlAttribute;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
@@ -136,7 +138,8 @@ public class HtmlCompletionData extends XmlCompletionData {
|
||||
@Override
|
||||
public boolean isAcceptable(Object element, PsiElement context) {
|
||||
if (isStyleAttributeContext(context)) return false;
|
||||
if ( isScriptContext((PsiElement)element) ) return false;
|
||||
if (isScriptContext((PsiElement)element)) return false;
|
||||
if (hasCaseSensitiveFileReferences(context)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -147,6 +150,13 @@ public class HtmlCompletionData extends XmlCompletionData {
|
||||
};
|
||||
}
|
||||
|
||||
private static boolean hasCaseSensitiveFileReferences(PsiElement context) {
|
||||
for (PsiReference reference : context.getReferences()) {
|
||||
if (reference instanceof FileReference && ((FileReference)reference).getFileReferenceSet().isCaseSensitive()) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isScriptContext(PsiElement element) {
|
||||
final Language language = element.getLanguage();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user