mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote branch 'origin/master'
This commit is contained in:
+4
-2
@@ -23,12 +23,14 @@ import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
public class LanguageLevelUsagesCollector extends AbstractApplicationUsagesCollector {
|
||||
@@ -49,10 +51,10 @@ public class LanguageLevelUsagesCollector extends AbstractApplicationUsagesColle
|
||||
final LanguageLevelModuleExtension instance = LanguageLevelModuleExtension.getInstance(module);
|
||||
final LanguageLevel languageLevel = instance.getLanguageLevel();
|
||||
if (languageLevel != null) {
|
||||
languageLevels.add(languageLevel.getPresentableText());
|
||||
languageLevels.add(languageLevel.toString());
|
||||
}
|
||||
}
|
||||
languageLevels.add(LanguageLevelProjectExtension.getInstance(project).getLanguageLevel().getPresentableText());
|
||||
languageLevels.add(LanguageLevelProjectExtension.getInstance(project).getLanguageLevel().toString());
|
||||
|
||||
return ContainerUtil.map2Set(languageLevels, new Function<String, UsageDescriptor>() {
|
||||
@Override
|
||||
|
||||
+6
-3
@@ -47,7 +47,8 @@ public class SelectionQuotingTypedHandler extends TypedHandlerDelegate {
|
||||
return super.checkAutoPopup(c, project, editor, psiFile);
|
||||
}
|
||||
myCaretPosition = editor.getCaretModel().getOffset();
|
||||
if (selectedText.length() > 1 && !Registry.is("editor.smarterSelectionQuoting")) {
|
||||
boolean replace = false;
|
||||
if (selectedText.length() > 1) {
|
||||
final char firstChar = selectedText.charAt(0);
|
||||
if (isSimilarDelimiters(firstChar, c) &&
|
||||
selectedText.charAt(selectedText.length() - 1) == getMatchingDelimiter(firstChar) &&
|
||||
@@ -55,14 +56,16 @@ public class SelectionQuotingTypedHandler extends TypedHandlerDelegate {
|
||||
!shouldSkipReplacementOfQuotesOrBraces(psiFile, editor, selectedText, c)
|
||||
) {
|
||||
selectedText = selectedText.substring(1, selectedText.length() - 1);
|
||||
replace = true;
|
||||
}
|
||||
}
|
||||
final int caretOffset = editor.getSelectionModel().getSelectionStart();
|
||||
final char c2 = getMatchingDelimiter(c);
|
||||
final String newText = String.valueOf(c) + selectedText + c2;
|
||||
EditorModificationUtil.insertStringAtCaret(editor, newText);
|
||||
if (Registry.is("editor.smarterSelectionQuoting")) {
|
||||
if (Registry.is("editor.smarterSelectionQuoting") && !replace) {
|
||||
myReplacedTextRange = new TextRange(caretOffset + 1, caretOffset + newText.length() - 1);
|
||||
myCaretPosition += 1;
|
||||
} else {
|
||||
myReplacedTextRange = new TextRange(caretOffset, caretOffset + newText.length());
|
||||
}
|
||||
@@ -109,7 +112,7 @@ public class SelectionQuotingTypedHandler extends TypedHandlerDelegate {
|
||||
if (myReplacedTextRange.getEndOffset() <= editor.getDocument().getTextLength()) {
|
||||
editor.getSelectionModel().setSelection(myReplacedTextRange.getStartOffset(), myReplacedTextRange.getEndOffset());
|
||||
if (Registry.is("editor.smarterSelectionQuoting")) {
|
||||
editor.getCaretModel().moveToOffset(myCaretPosition + 1);
|
||||
editor.getCaretModel().moveToOffset(myCaretPosition);
|
||||
}
|
||||
}
|
||||
myReplacedTextRange = null;
|
||||
|
||||
@@ -65,11 +65,15 @@ import com.intellij.util.ui.update.MergingUpdateQueue;
|
||||
import com.intellij.util.ui.update.Update;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.FocusManager;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@@ -612,10 +616,10 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
|
||||
});
|
||||
}
|
||||
|
||||
public static void printToConsole(final LanguageConsoleImpl console,
|
||||
final String string,
|
||||
final ConsoleViewContentType mainType,
|
||||
ConsoleViewContentType additionalType) {
|
||||
public static void printToConsole(@NotNull final LanguageConsoleImpl console,
|
||||
@NotNull final String string,
|
||||
@NotNull final ConsoleViewContentType mainType,
|
||||
@Nullable ConsoleViewContentType additionalType) {
|
||||
final TextAttributes mainAttributes = mainType.getAttributes();
|
||||
final TextAttributes attributes;
|
||||
if (additionalType == null) {
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ public class StatisticsUploadAssistant {
|
||||
return settings != null && settings.isAllowed();
|
||||
}
|
||||
|
||||
public static String getData(@NotNull Set<String> disabledGroups) {
|
||||
public String getData(@NotNull Set<String> disabledGroups) {
|
||||
return getStringPatch(disabledGroups, ProjectManager.getInstance().getOpenProjects());
|
||||
}
|
||||
|
||||
|
||||
+130
-115
@@ -21,139 +21,154 @@ import com.intellij.util.containers.hash.HashMap;
|
||||
import java.util.*;
|
||||
|
||||
public class ConvertUsagesUtil {
|
||||
private static final Character GROUP_SEPARATOR = ':';
|
||||
private static final Character GROUPS_SEPARATOR = ';';
|
||||
private static final Character GROUP_VALUE_SEPARATOR = ',';
|
||||
private static final Character GROUP_SEPARATOR = ':';
|
||||
private static final Character GROUPS_SEPARATOR = ';';
|
||||
private static final Character GROUP_VALUE_SEPARATOR = ',';
|
||||
|
||||
private ConvertUsagesUtil() {
|
||||
private ConvertUsagesUtil() {
|
||||
}
|
||||
|
||||
|
||||
// @NotNull
|
||||
public static <T extends UsageDescriptor> String convertUsages(Map<GroupDescriptor, Set<T>> map) {
|
||||
assert map != null;
|
||||
final Map<GroupDescriptor, Set<T>> sortedMap = sortDescriptorsByPriority(map);
|
||||
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
for (Map.Entry<GroupDescriptor, Set<T>> entry : sortedMap.entrySet()) {
|
||||
buffer.append(entry.getKey().getId());
|
||||
buffer.append(GROUP_SEPARATOR);
|
||||
buffer.append(convertValueMap(entry.getValue()));
|
||||
buffer.append(GROUPS_SEPARATOR);
|
||||
}
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
// @NotNull
|
||||
public static <T extends UsageDescriptor> String convertUsages(Map<GroupDescriptor, Set<T>> map) {
|
||||
assert map != null;
|
||||
final Map<GroupDescriptor, Set<T>> sortedMap = sortDescriptorsByPriority(map);
|
||||
//@NotNull
|
||||
public static String convertValueMap(Set<? extends UsageDescriptor> descriptors) {
|
||||
assert descriptors != null;
|
||||
final StringBuffer buffer = new StringBuffer();
|
||||
for (UsageDescriptor usageDescriptor : descriptors) {
|
||||
buffer.append(usageDescriptor.getKey());
|
||||
buffer.append("=");
|
||||
buffer.append(usageDescriptor.getValue());
|
||||
buffer.append(GROUP_VALUE_SEPARATOR);
|
||||
}
|
||||
buffer.deleteCharAt(buffer.length() - 1);
|
||||
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
for (Map.Entry<GroupDescriptor, Set<T>> entry : sortedMap.entrySet()) {
|
||||
buffer.append(entry.getKey().getId());
|
||||
buffer.append(GROUP_SEPARATOR);
|
||||
buffer.append(convertValueMap(entry.getValue()));
|
||||
buffer.append(GROUPS_SEPARATOR);
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
//@NotNull
|
||||
public static String cutPatchString(String patchStr, int maxSize) {
|
||||
assert patchStr != null;
|
||||
for (int i = maxSize - 1; i >= 0; i--) {
|
||||
final char c = patchStr.charAt(i);
|
||||
if (c == GROUPS_SEPARATOR || c == GROUP_VALUE_SEPARATOR) {
|
||||
return patchStr.substring(0, i);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//@NotNull
|
||||
public static Map<GroupDescriptor, Set<UsageDescriptor>> convertString(String usages) {
|
||||
assert usages != null;
|
||||
Map<GroupDescriptor, Set<UsageDescriptor>> descriptors = new HashMap<GroupDescriptor, Set<UsageDescriptor>>();
|
||||
for (String groupStr : usages.split(GROUPS_SEPARATOR.toString())) {
|
||||
if (!isEmptyOrSpaces(groupStr)) {
|
||||
final StringPair group = getPair(groupStr, GROUP_SEPARATOR.toString());
|
||||
if (group != null) {
|
||||
descriptors.putAll(convertValueString(GroupDescriptor.create(group.first), group.second));
|
||||
}
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
}
|
||||
return descriptors;
|
||||
}
|
||||
|
||||
//@NotNull
|
||||
public static String convertValueMap(Set<? extends UsageDescriptor> descriptors) {
|
||||
assert descriptors != null;
|
||||
final StringBuffer buffer = new StringBuffer();
|
||||
for (UsageDescriptor usageDescriptor : descriptors) {
|
||||
buffer.append(usageDescriptor.getKey());
|
||||
buffer.append("=");
|
||||
buffer.append(usageDescriptor.getValue());
|
||||
buffer.append(GROUP_VALUE_SEPARATOR);
|
||||
}
|
||||
buffer.deleteCharAt(buffer.length() - 1);
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
//@NotNull
|
||||
public static String cutPatchString(String patchStr, int maxSize) {
|
||||
assert patchStr != null;
|
||||
for (int i = maxSize - 1; i >= 0; i--) {
|
||||
final char c = patchStr.charAt(i);
|
||||
if (c == GROUPS_SEPARATOR || c == GROUP_VALUE_SEPARATOR) {
|
||||
return patchStr.substring(0, i);
|
||||
//@NotNull
|
||||
public static Map<GroupDescriptor, Set<UsageDescriptor>> convertValueString(GroupDescriptor groupId, String valueData) {
|
||||
assert groupId != null;
|
||||
final Map<GroupDescriptor, Set<UsageDescriptor>> descriptors = new HashMap<GroupDescriptor, Set<UsageDescriptor>>();
|
||||
for (String value : valueData.split(GROUP_VALUE_SEPARATOR.toString())) {
|
||||
if (!isEmptyOrSpaces(value)) {
|
||||
final StringPair pair = getPair(value, "=");
|
||||
if (pair != null) {
|
||||
final String count = pair.second;
|
||||
if (!isEmptyOrSpaces(count)) {
|
||||
try {
|
||||
final int i = Integer.parseInt(count);
|
||||
if (!descriptors.containsKey(groupId)) {
|
||||
descriptors.put(groupId, new LinkedHashSet<UsageDescriptor>());
|
||||
}
|
||||
descriptors.get(groupId).add(new UsageDescriptor(pair.first, i));
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//@NotNull
|
||||
public static Map<GroupDescriptor, Set<UsageDescriptor>> convertString(String usages) {
|
||||
assert usages != null;
|
||||
Map<GroupDescriptor, Set<UsageDescriptor>> descriptors = new HashMap<GroupDescriptor, Set<UsageDescriptor>>();
|
||||
for (String groupStr : usages.split(GROUPS_SEPARATOR.toString())) {
|
||||
if (!isEmptyOrSpaces(groupStr)) {
|
||||
final StringPair group = getPair(groupStr, GROUP_SEPARATOR.toString());
|
||||
if (group != null) {
|
||||
descriptors.putAll(convertValueString(GroupDescriptor.create(group.first), group.second));
|
||||
}
|
||||
catch (NumberFormatException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return descriptors;
|
||||
}
|
||||
}
|
||||
|
||||
//@NotNull
|
||||
public static Map<GroupDescriptor, Set<UsageDescriptor>> convertValueString(GroupDescriptor groupId, String valueData) {
|
||||
assert groupId != null;
|
||||
final Map<GroupDescriptor, Set<UsageDescriptor>> descriptors = new HashMap<GroupDescriptor, Set<UsageDescriptor>>();
|
||||
for (String value : valueData.split(GROUP_VALUE_SEPARATOR.toString())) {
|
||||
if (!isEmptyOrSpaces(value)) {
|
||||
final StringPair pair = getPair(value, "=");
|
||||
if (pair != null) {
|
||||
final String count = pair.second;
|
||||
if (!isEmptyOrSpaces(count)) {
|
||||
try {
|
||||
final int i = Integer.parseInt(count);
|
||||
if (!descriptors.containsKey(groupId)) {
|
||||
descriptors.put(groupId, new LinkedHashSet<UsageDescriptor>());
|
||||
}
|
||||
descriptors.get(groupId).add(new UsageDescriptor(pair.first, i));
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return descriptors;
|
||||
}
|
||||
|
||||
return descriptors;
|
||||
//@Nullable
|
||||
public static StringPair getPair(String str, String separator) {
|
||||
assert str != null;
|
||||
assert separator != null;
|
||||
final int i = str.indexOf(separator);
|
||||
if (i > 0 && i < str.length() - 1) {
|
||||
String key = str.substring(0, i).trim();
|
||||
String value = str.substring(i + 1).trim();
|
||||
if (!isEmptyOrSpaces(key) && !isEmptyOrSpaces(value)) {
|
||||
return new StringPair(key, value);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//@Nullable
|
||||
public static StringPair getPair(String str, String separator) {
|
||||
assert str != null;
|
||||
assert separator != null;
|
||||
final int i = str.indexOf(separator);
|
||||
if (i > 0 && i < str.length() - 1) {
|
||||
String key = str.substring(0, i).trim();
|
||||
String value = str.substring(i + 1).trim();
|
||||
if (!isEmptyOrSpaces(key) && !isEmptyOrSpaces(value)) {
|
||||
return new StringPair(key, value);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
//@NotNull
|
||||
public static <T extends UsageDescriptor> Map<GroupDescriptor, Set<T>> sortDescriptorsByPriority(Map<GroupDescriptor, Set<T>> descriptors) {
|
||||
assert descriptors != null;
|
||||
final SortedMap<GroupDescriptor, Set<T>> map = new TreeMap<GroupDescriptor, Set<T>>(new Comparator<GroupDescriptor>() {
|
||||
public int compare(GroupDescriptor g1, GroupDescriptor g2) {
|
||||
final int priority = (int)(g2.getPriority() - g1.getPriority());
|
||||
return priority == 0 ? g1.getId().compareTo(g2.getId()) : priority;
|
||||
}
|
||||
});
|
||||
|
||||
map.putAll(descriptors);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
private static class StringPair {
|
||||
public final String first;
|
||||
public final String second;
|
||||
|
||||
public StringPair(String first, String second) {
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
}
|
||||
}
|
||||
|
||||
//@NotNull
|
||||
public static <T extends UsageDescriptor> Map<GroupDescriptor, Set<T>> sortDescriptorsByPriority(Map<GroupDescriptor, Set<T>> descriptors) {
|
||||
assert descriptors != null;
|
||||
final SortedMap<GroupDescriptor, Set<T>> map = new TreeMap<GroupDescriptor, Set<T>>(new Comparator<GroupDescriptor>() {
|
||||
public int compare(GroupDescriptor g1, GroupDescriptor g2) {
|
||||
final int priority = (int) (g2.getPriority() - g1.getPriority());
|
||||
return priority == 0 ? g1.getId().compareTo(g2.getId()) : priority;
|
||||
}
|
||||
});
|
||||
public static boolean isEmptyOrSpaces(final String s) {
|
||||
return s == null || s.trim().length() == 0;
|
||||
}
|
||||
|
||||
map.putAll(descriptors);
|
||||
public static void assertDescriptorName(String key) {
|
||||
assert key != null;
|
||||
assert containsChar(key, ConvertUsagesUtil.GROUP_SEPARATOR) == false;
|
||||
assert containsChar(key, ConvertUsagesUtil.GROUPS_SEPARATOR) == false;
|
||||
assert containsChar(key, ConvertUsagesUtil.GROUP_VALUE_SEPARATOR) == false;
|
||||
assert key.contains("=") == false;
|
||||
assert key.contains("'") == false;
|
||||
assert key.contains("\"") == false;
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
private static class StringPair {
|
||||
public final String first;
|
||||
public final String second;
|
||||
|
||||
public StringPair(String first, String second) {
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isEmptyOrSpaces(final String s) {
|
||||
return s == null || s.trim().length() == 0;
|
||||
}
|
||||
public static boolean containsChar(final String value, final char ch) {
|
||||
return value.indexOf(ch) >= 0;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -24,8 +24,9 @@ public class GroupDescriptor implements Comparable<GroupDescriptor> {
|
||||
private double myPriority;
|
||||
|
||||
public static GroupDescriptor create(String id) {
|
||||
assert id != null;
|
||||
return new GroupDescriptor(id);
|
||||
ConvertUsagesUtil.assertDescriptorName(id);
|
||||
|
||||
return new GroupDescriptor(id);
|
||||
}
|
||||
|
||||
public static GroupDescriptor create(String id, double priority) {
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ public class UsageDescriptor implements Comparable<UsageDescriptor> {
|
||||
private int myValue;
|
||||
|
||||
public UsageDescriptor(String key, int value) {
|
||||
assert key != null;
|
||||
ConvertUsagesUtil.assertDescriptorName(key);
|
||||
|
||||
myKey = key;
|
||||
myValue = value;
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ public class RemotelyConfigurableStatisticsService implements StatisticsService
|
||||
return new StatisticsResult(StatisticsResult.ResultCode.NOT_PERMITTED_SERVER, "NOT_PERMITTED");
|
||||
}
|
||||
|
||||
String content = myAssistant.getData();
|
||||
String content = myAssistant.getData(myConnectionService.getDisabledGroups());
|
||||
|
||||
if (StringUtil.isEmptyOrSpaces(content)) {
|
||||
return new StatisticsResult(StatisticsResult.ResultCode.NOTHING_TO_SEND, "NOTHING_TO_SEND");
|
||||
|
||||
+3
@@ -56,6 +56,9 @@ public class StatisticsHttpClientSender implements StatisticsDataSender {
|
||||
throw new StatServiceException("Error during updating statistics " + (!StringUtil.isEmptyOrSpaces(value) ? " : " + value : ""));
|
||||
}
|
||||
}
|
||||
catch (StatServiceException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new StatServiceException("Error during data sending...", e);
|
||||
}
|
||||
|
||||
+32
-7
@@ -19,6 +19,7 @@ package com.intellij.internal.statistic.persistence;
|
||||
import com.intellij.ide.AppLifecycleListener;
|
||||
import com.intellij.internal.statistic.AbstractApplicationUsagesCollector;
|
||||
import com.intellij.internal.statistic.UsagesCollector;
|
||||
import com.intellij.internal.statistic.beans.ConvertUsagesUtil;
|
||||
import com.intellij.internal.statistic.beans.GroupDescriptor;
|
||||
import com.intellij.internal.statistic.beans.UsageDescriptor;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -94,7 +95,7 @@ public class ApplicationStatisticsPersistenceComponent extends ApplicationStatis
|
||||
if (!StringUtil.isEmptyOrSpaces(projectId) && !StringUtil.isEmptyOrSpaces(frameworks)) {
|
||||
Set<UsageDescriptor> frameworkDescriptors = new HashSet<UsageDescriptor>();
|
||||
for (String key : StringUtil.split(frameworks, TOKENIZER)) {
|
||||
frameworkDescriptors.add(new UsageDescriptor(key, 1));
|
||||
frameworkDescriptors.add(getUsageDescriptor(key));
|
||||
}
|
||||
getApplicationData(groupDescriptor).put(projectId, frameworkDescriptors);
|
||||
}
|
||||
@@ -129,13 +130,37 @@ public class ApplicationStatisticsPersistenceComponent extends ApplicationStatis
|
||||
return element;
|
||||
}
|
||||
|
||||
private static String joinUsages(@NotNull Set<UsageDescriptor> usages) {
|
||||
return StringUtil.join(usages, new Function<UsageDescriptor, String>() {
|
||||
@Override
|
||||
public String fun(UsageDescriptor usageDescriptor) {
|
||||
return usageDescriptor.getKey();
|
||||
private UsageDescriptor getUsageDescriptor(String usage) {
|
||||
// for instance, usage can be: "_foo"(equals "_foo=1") or "_foo=2"
|
||||
final int i = usage.indexOf("=");
|
||||
if (i > 0 && i < usage.length() - 1) {
|
||||
String key = usage.substring(0, i).trim();
|
||||
String value = usage.substring(i + 1).trim();
|
||||
if (!StringUtil.isEmptyOrSpaces(key) && !StringUtil.isEmptyOrSpaces(value)) {
|
||||
try {
|
||||
final int count = Integer.parseInt(value);
|
||||
if (count > 0) {
|
||||
return new UsageDescriptor(key, count);
|
||||
}
|
||||
}
|
||||
}, TOKENIZER);
|
||||
catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return new UsageDescriptor(usage, 1);
|
||||
}
|
||||
|
||||
private static String joinUsages(@NotNull Set<UsageDescriptor> usages) {
|
||||
// for instance, usage can be: "_foo"(equals "_foo=1") or "_foo=2"
|
||||
return StringUtil.join(usages, new Function<UsageDescriptor, String>() {
|
||||
@Override
|
||||
public String fun(UsageDescriptor usageDescriptor) {
|
||||
final String key = usageDescriptor.getKey();
|
||||
final int value = usageDescriptor.getValue();
|
||||
|
||||
return value > 1 ? key + "=" + value : key;
|
||||
}
|
||||
}, TOKENIZER);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -236,8 +236,8 @@ public final class WindowManagerImpl extends WindowManagerEx implements Applicat
|
||||
}
|
||||
|
||||
frame.setBounds(myFrameBounds);
|
||||
frame.setExtendedState(myFrameExtendedState);
|
||||
frame.setVisible(true);
|
||||
frame.setExtendedState(myFrameExtendedState);
|
||||
}
|
||||
|
||||
public IdeFrameImpl[] getAllFrames() {
|
||||
|
||||
@@ -39,10 +39,10 @@ import com.intellij.openapi.ui.Splitter;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.vcs.*;
|
||||
import com.intellij.openapi.vcs.changes.actions.IgnoredSettingsAction;
|
||||
import com.intellij.openapi.vcs.changes.ui.ChangesBrowserNode;
|
||||
import com.intellij.openapi.vcs.changes.ui.ChangesListView;
|
||||
import com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.impl.DebugUtil;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.content.Content;
|
||||
import com.intellij.ui.content.ContentFactory;
|
||||
@@ -102,7 +102,7 @@ public class ChangesViewManager implements ChangesViewI, JDOMExternalizable, Pro
|
||||
private final TreeSelectionListener myTsl;
|
||||
private final FileAndDocumentListenersForShortDiff myListenersForShortDiff;
|
||||
private Content myContent;
|
||||
private Change[] mySelectedPaths;
|
||||
private Change[] mySelectedChanges;
|
||||
|
||||
public static ChangesViewI getInstance(Project project) {
|
||||
return PeriodicalTasksCloser.getInstance().safeGetComponent(project, ChangesViewI.class);
|
||||
@@ -161,27 +161,10 @@ public class ChangesViewManager implements ChangesViewI, JDOMExternalizable, Pro
|
||||
@Override
|
||||
public void valueChanged(TreeSelectionEvent e) {
|
||||
Change[] selectedChanges = myView.getSelectedChanges();
|
||||
if (mySelectedPaths == null && selectedChanges == null) {
|
||||
return;
|
||||
}
|
||||
if (mySelectedPaths != null && selectedChanges != null) {
|
||||
if (mySelectedPaths.length == selectedChanges.length) {
|
||||
boolean changed = false;
|
||||
int idx = 0;
|
||||
for (; idx < selectedChanges.length; idx++) {
|
||||
Change change = selectedChanges[idx];
|
||||
if (! change.equals(mySelectedPaths[idx])) {
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (! changed) return;
|
||||
}
|
||||
}
|
||||
if (Comparing.equal(mySelectedChanges, selectedChanges)) return;
|
||||
mySelectedChanges = selectedChanges;
|
||||
if (LOG.isDebugEnabled()) {
|
||||
StringWriter sw = new StringWriter();
|
||||
new Throwable().printStackTrace(new PrintWriter(sw));
|
||||
LOG.debug("selection changed. selected: " + toStringPaths(myView.getSelectionPaths()) + " from: " + sw.toString());
|
||||
LOG.debug("selection changed. selected: " + toStringPaths(myView.getSelectionPaths()) + " from: " + DebugUtil.currentStackTrace());
|
||||
}
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -166,19 +166,19 @@ public class XDebuggerTestUtil {
|
||||
assertVariableValue(findVar(vars, name), name, value);
|
||||
}
|
||||
|
||||
public static void assertVariableValueMatches(Collection<XValue> vars,
|
||||
public static void assertVariableValueMatches(@NotNull Collection<XValue> vars,
|
||||
@Nullable String name,
|
||||
@Nullable String valuePattern) throws InterruptedException {
|
||||
assertVariableValueMatches(findVar(vars, name), name, valuePattern);
|
||||
}
|
||||
|
||||
public static void assertVariableValueMatches(XValue var,
|
||||
public static void assertVariableValueMatches(@NotNull XValue var,
|
||||
@Nullable String name,
|
||||
@Nullable String valuePattern) throws InterruptedException {
|
||||
assertVariableValueMatches(var, name, null, valuePattern);
|
||||
}
|
||||
|
||||
public static void assertVariableValueMatches(XValue var,
|
||||
public static void assertVariableValueMatches(@NotNull XValue var,
|
||||
@Nullable String name,
|
||||
@Nullable String type,
|
||||
@Nullable String valuePattern) throws InterruptedException {
|
||||
@@ -190,7 +190,9 @@ public class XDebuggerTestUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static void assertVariableTypeMatches(XValue var, String name, @Language("RegExp") String typePattern) throws InterruptedException {
|
||||
public static void assertVariableTypeMatches(@NotNull XValue var,
|
||||
@Nullable String name,
|
||||
@Nullable @Language("RegExp") String typePattern) throws InterruptedException {
|
||||
XTestValueNode node = computePresentation(var);
|
||||
if (name != null) {
|
||||
Assert.assertEquals(name, node.myName);
|
||||
@@ -200,7 +202,8 @@ public class XDebuggerTestUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static void assertVariableFullValue(XValue var, @Nullable String value) throws InterruptedException {
|
||||
public static void assertVariableFullValue(@NotNull XValue var,
|
||||
@Nullable String value) throws InterruptedException {
|
||||
XTestValueNode node = computePresentation(var);
|
||||
final String[] result = new String[1];
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2010 Dave Griffith, Bas Leijdekkers
|
||||
* Copyright 2003-2011 Dave Griffith, Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -333,7 +333,7 @@ public class ManualArrayCopyInspection extends BaseInspection {
|
||||
}
|
||||
final int precedence = ParenthesesUtils.getPrecedence(min);
|
||||
final String minText;
|
||||
if (precedence > ParenthesesUtils.ADDITIVE_PRECEDENCE) {
|
||||
if (precedence >= ParenthesesUtils.ADDITIVE_PRECEDENCE) {
|
||||
minText = '(' + min.getText() + ')';
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2010 Dave Griffith, Bas Leijdekkers
|
||||
* Copyright 2003-2011 Dave Griffith, Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -73,10 +73,10 @@ class VariableAssignedVisitor extends JavaRecursiveElementVisitor {
|
||||
if (assigned) {
|
||||
return;
|
||||
}
|
||||
super.visitPrefixExpression(prefixExpression);
|
||||
if (!checkUnaryExpressions) {
|
||||
return;
|
||||
}
|
||||
super.visitPrefixExpression(prefixExpression);
|
||||
final IElementType tokenType = prefixExpression.getOperationTokenType();
|
||||
if (!tokenType.equals(JavaTokenType.PLUSPLUS) &&
|
||||
!tokenType.equals(JavaTokenType.MINUSMINUS)) {
|
||||
@@ -94,10 +94,10 @@ class VariableAssignedVisitor extends JavaRecursiveElementVisitor {
|
||||
if (assigned) {
|
||||
return;
|
||||
}
|
||||
super.visitPostfixExpression(postfixExpression);
|
||||
if (!checkUnaryExpressions) {
|
||||
return;
|
||||
}
|
||||
super.visitPostfixExpression(postfixExpression);
|
||||
final IElementType tokenType = postfixExpression.getOperationTokenType();
|
||||
if (!tokenType.equals(JavaTokenType.PLUSPLUS) &&
|
||||
!tokenType.equals(JavaTokenType.MINUSMINUS)) {
|
||||
|
||||
+11
@@ -166,4 +166,15 @@ public class MismatchedCollectionQueryUpdate {
|
||||
for (final String value : ourValues) {}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateAttachmentWarning(final String message) {
|
||||
final List<String> includedAttachments;
|
||||
if (message instanceof Object &&
|
||||
!(includedAttachments = boo()).isEmpty()) {
|
||||
if (includedAttachments.size() == 1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> boo() {return null;}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -92,11 +93,14 @@ public class AndroidPrecompileTask implements CompileTask {
|
||||
|
||||
LOG.debug("Platform-tools revision for module " + module.getName() + " is " + platformToolsRevision);
|
||||
|
||||
if (platformToolsRevision >= 0 && platformToolsRevision <= 7) {
|
||||
if (facet.getConfiguration().LIBRARY_PROJECT) {
|
||||
if (facet.getConfiguration().LIBRARY_PROJECT) {
|
||||
if (platformToolsRevision >= 0 && platformToolsRevision <= 7) {
|
||||
LOG.debug("Excluded sources of module " + module.getName());
|
||||
excludeAllSourceRoots(module, configuration, addedEntries);
|
||||
}
|
||||
else {
|
||||
unexcludeAllSourceRoots(module, configuration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,6 +164,24 @@ public class AndroidPrecompileTask implements CompileTask {
|
||||
vFile.refresh(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
private static void unexcludeAllSourceRoots(Module module,
|
||||
ExcludedEntriesConfiguration configuration) {
|
||||
final VirtualFile[] sourceRoots = ModuleRootManager.getInstance(module).getSourceRoots();
|
||||
final Set<VirtualFile> sourceRootSet = new HashSet<VirtualFile>();
|
||||
sourceRootSet.addAll(Arrays.asList(sourceRoots));
|
||||
|
||||
final ExcludeEntryDescription[] descriptions = configuration.getExcludeEntryDescriptions();
|
||||
configuration.removeAllExcludeEntryDescriptions();
|
||||
|
||||
for (ExcludeEntryDescription description : descriptions) {
|
||||
final VirtualFile file = description.getVirtualFile();
|
||||
|
||||
if (file == null || !sourceRootSet.contains(file)) {
|
||||
configuration.addExcludeEntryDescription(description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void excludeAllSourceRoots(Module module,
|
||||
ExcludedEntriesConfiguration configuration,
|
||||
|
||||
@@ -231,7 +231,7 @@ public class XsltSupport {
|
||||
return level != XsltChecker.LanguageLevel.NONE;
|
||||
}
|
||||
|
||||
public static XsltChecker.LanguageLevel getXsltLanguageLevel(PsiFile psiFile) {
|
||||
public static XsltChecker.LanguageLevel getXsltLanguageLevel(@NotNull PsiFile psiFile) {
|
||||
final CachedValuesManager mgr = CachedValuesManager.getManager(psiFile.getProject());
|
||||
return mgr.getParameterizedCachedValue(psiFile, FORCE_XSLT_KEY, XsltSupportProvider.INSTANCE, false, psiFile);
|
||||
}
|
||||
|
||||
+147
-58
@@ -22,9 +22,15 @@ import net.sf.saxon.expr.instruct.GlobalVariable;
|
||||
import net.sf.saxon.expr.instruct.LocalVariable;
|
||||
import net.sf.saxon.expr.instruct.SlotManager;
|
||||
import net.sf.saxon.functions.FunctionLibrary;
|
||||
import net.sf.saxon.om.*;
|
||||
import net.sf.saxon.om.Item;
|
||||
import net.sf.saxon.om.SequenceIterator;
|
||||
import net.sf.saxon.om.StructuredQName;
|
||||
import net.sf.saxon.om.ValueRepresentation;
|
||||
import net.sf.saxon.style.*;
|
||||
import net.sf.saxon.trans.XPathException;
|
||||
import net.sf.saxon.tree.iter.EmptyIterator;
|
||||
import net.sf.saxon.tree.iter.SingletonIterator;
|
||||
import net.sf.saxon.type.AnyItemType;
|
||||
import net.sf.saxon.type.ItemType;
|
||||
import net.sf.saxon.type.Type;
|
||||
import net.sf.saxon.type.TypeHierarchy;
|
||||
@@ -74,18 +80,7 @@ class Saxon9StyleFrame<N extends StyleElement> extends AbstractSaxon9Frame<Debug
|
||||
final int variables = myXPathContext.getStackFrame().getStackFrameMap().getNumberOfVariables();
|
||||
ExpressionTool.allocateSlots(expression, variables, myElement.getContainingSlotManager());
|
||||
|
||||
final TypeHierarchy typeHierarchy = myXPathContext.getConfiguration().getTypeHierarchy();
|
||||
final ItemType itemType = expression.getItemType(typeHierarchy);
|
||||
|
||||
final SequenceIterator it = expression.iterate(myXPathContext);
|
||||
Item value = null;
|
||||
if (it.next() != null) {
|
||||
value = it.current();
|
||||
}
|
||||
if (it.next() == null) {
|
||||
return new SingleValue(value, itemType);
|
||||
}
|
||||
return new SequenceValue(value, it, itemType);
|
||||
return createValue(new ExpressionFacade(expression));
|
||||
} catch (AssertionError e) {
|
||||
debug(e);
|
||||
throw new Debugger.EvaluationException(e.getMessage() != null ? e.getMessage() : e.toString());
|
||||
@@ -97,9 +92,38 @@ class Saxon9StyleFrame<N extends StyleElement> extends AbstractSaxon9Frame<Debug
|
||||
}
|
||||
}
|
||||
|
||||
private Value createValue(ValueFacade expression) throws XPathException {
|
||||
final TypeHierarchy typeHierarchy = myXPathContext.getConfiguration().getTypeHierarchy();
|
||||
final ItemType itemType = expression.getItemType(typeHierarchy);
|
||||
|
||||
final SequenceIterator it = expression.iterate(myXPathContext);
|
||||
Item value = null;
|
||||
if (it.next() != null) {
|
||||
value = it.current();
|
||||
}
|
||||
if (it.next() == null) {
|
||||
return new SingleValue(value, itemType);
|
||||
}
|
||||
return new SequenceValue(value, it, itemType);
|
||||
}
|
||||
|
||||
public List<Debugger.Variable> getVariables() {
|
||||
assert isValid();
|
||||
|
||||
Saxon9TraceListener.MUTED = true;
|
||||
final ArrayList<Debugger.Variable> variables;
|
||||
try {
|
||||
variables = collectVariables();
|
||||
} finally {
|
||||
Saxon9TraceListener.MUTED = false;
|
||||
}
|
||||
|
||||
Collections.sort(variables, VariableComparator.INSTANCE);
|
||||
|
||||
return variables;
|
||||
}
|
||||
|
||||
private ArrayList<Debugger.Variable> collectVariables() {
|
||||
final ArrayList<Debugger.Variable> variables = new ArrayList<Debugger.Variable>();
|
||||
|
||||
final HashMap<StructuredQName,GlobalVariable> globalVariables =
|
||||
@@ -107,20 +131,11 @@ class Saxon9StyleFrame<N extends StyleElement> extends AbstractSaxon9Frame<Debug
|
||||
if (globalVariables != null) {
|
||||
for (StructuredQName name : globalVariables.keySet()) {
|
||||
final GlobalVariable globalVariable = globalVariables.get(name);
|
||||
variables.add(new VariableImpl(globalVariable.getVariableQName().getDisplayName(), new Value() {
|
||||
public Object getValue() {
|
||||
try {
|
||||
final ValueRepresentation valueRepresentation = globalVariable.evaluateVariable(myXPathContext);
|
||||
return valueRepresentation != null ? valueRepresentation.getStringValue() : null;
|
||||
} catch (XPathException e) {
|
||||
return " - error: " + e.getMessage() + " - ";
|
||||
}
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return new ObjectType(globalVariable.getRequiredType().toString());
|
||||
}
|
||||
}, false, Debugger.Variable.Kind.VARIABLE, "", -1));
|
||||
final Value value = createVariableValue(new GlobalVariableFacade(globalVariable));
|
||||
final int lineNumber = globalVariable.getLineNumber();
|
||||
final String systemId = globalVariable.getSourceLocator().getSystemId();
|
||||
variables.add(new VariableImpl(globalVariable.getVariableQName().getDisplayName(), value, true, Debugger.Variable.Kind.VARIABLE, systemId, lineNumber));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,16 +143,8 @@ class Saxon9StyleFrame<N extends StyleElement> extends AbstractSaxon9Frame<Debug
|
||||
while (context != null) {
|
||||
final StackFrame frame = context.getStackFrame();
|
||||
final SlotManager map = frame.getStackFrameMap();
|
||||
//final int numberOfVariables = map.getNumberOfVariables();
|
||||
//System.out.println("numberOfVariables = " + numberOfVariables);
|
||||
|
||||
//for (int i = 0; i < numberOfVariables; i++) {
|
||||
// final ValueRepresentation valueRepresentation = context.evaluateLocalVariable(i);
|
||||
// System.out.println("valueRepresentation = " + valueRepresentation);
|
||||
//}
|
||||
|
||||
final ValueRepresentation[] values = frame.getStackFrameValues();
|
||||
//System.out.println("values = " + Arrays.toString(values));
|
||||
|
||||
outer:
|
||||
for (int i = 0, valuesLength = values.length; i < valuesLength; i++) {
|
||||
@@ -150,38 +157,24 @@ class Saxon9StyleFrame<N extends StyleElement> extends AbstractSaxon9Frame<Debug
|
||||
}
|
||||
}
|
||||
|
||||
variables.add(new VariableImpl(name, new Value() {
|
||||
public Object getValue() {
|
||||
try {
|
||||
return value.getStringValue();
|
||||
} catch (XPathException e) {
|
||||
return " - error: " + e.getMessage() + " - ";
|
||||
}
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
if (value instanceof net.sf.saxon.value.Value) {
|
||||
final ItemType type =
|
||||
((net.sf.saxon.value.Value)value).getItemType(myXPathContext.getConfiguration().getTypeHierarchy());
|
||||
return new ObjectType(type.toString());
|
||||
} else if (value instanceof NodeInfo) {
|
||||
return XPathType.NODESET;
|
||||
}
|
||||
return XPathType.UNKNOWN;
|
||||
}
|
||||
}, false, Debugger.Variable.Kind.VARIABLE, "", -1));
|
||||
final Value localValue = createVariableValue(new LocalVariableFacade(value));
|
||||
variables.add(new VariableImpl(name, localValue, false, Debugger.Variable.Kind.VARIABLE, "", -1));
|
||||
}
|
||||
}
|
||||
|
||||
context = context.getCaller();
|
||||
//System.out.println("context = " + context);
|
||||
}
|
||||
|
||||
Collections.sort(variables, VariableComparator.INSTANCE);
|
||||
|
||||
return variables;
|
||||
}
|
||||
|
||||
private Value createVariableValue(ValueFacade facade) {
|
||||
try {
|
||||
return createValue(facade);
|
||||
} catch (XPathException e) {
|
||||
return new ErrorValue(e.getMessage(), facade);
|
||||
}
|
||||
}
|
||||
|
||||
private static class SingleValue implements Value {
|
||||
private final Item myValue;
|
||||
private final ItemType myItemType;
|
||||
@@ -339,4 +332,100 @@ class Saxon9StyleFrame<N extends StyleElement> extends AbstractSaxon9Frame<Debug
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private interface ValueFacade {
|
||||
ItemType getItemType(TypeHierarchy hierarchy);
|
||||
|
||||
SequenceIterator iterate(XPathContext context) throws XPathException;
|
||||
}
|
||||
|
||||
private static class ExpressionFacade implements ValueFacade {
|
||||
private final Expression myExpression;
|
||||
|
||||
public ExpressionFacade(Expression expression) {
|
||||
myExpression = expression;
|
||||
}
|
||||
|
||||
public ItemType getItemType(TypeHierarchy hierarchy) {
|
||||
return myExpression.getItemType(hierarchy);
|
||||
}
|
||||
|
||||
public SequenceIterator iterate(XPathContext context) throws XPathException {
|
||||
return myExpression.iterate(context);
|
||||
}
|
||||
}
|
||||
|
||||
private static class GlobalVariableFacade implements ValueFacade {
|
||||
private final GlobalVariable myVariable;
|
||||
|
||||
public GlobalVariableFacade(GlobalVariable variable) {
|
||||
myVariable = variable;
|
||||
}
|
||||
|
||||
public ItemType getItemType(TypeHierarchy hierarchy) {
|
||||
return myVariable.getRequiredType().getPrimaryType();
|
||||
}
|
||||
|
||||
public SequenceIterator iterate(XPathContext context) throws XPathException {
|
||||
final SequenceIterator iterator = myVariable.iterate(context);
|
||||
if (iterator instanceof EmptyIterator) {
|
||||
final ValueRepresentation value = myVariable.evaluateVariable(context);
|
||||
if (value instanceof Item) {
|
||||
return SingletonIterator.makeIterator((Item)value);
|
||||
} else if (value instanceof net.sf.saxon.value.Value) {
|
||||
return ((net.sf.saxon.value.Value)value).iterate();
|
||||
} else {
|
||||
return iterator;
|
||||
}
|
||||
} else {
|
||||
return iterator;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class LocalVariableFacade implements ValueFacade {
|
||||
private final ValueRepresentation myValue;
|
||||
|
||||
public LocalVariableFacade(ValueRepresentation value) {
|
||||
myValue = value;
|
||||
}
|
||||
|
||||
public ItemType getItemType(TypeHierarchy hierarchy) {
|
||||
if (myValue instanceof net.sf.saxon.value.Value) {
|
||||
return ((net.sf.saxon.value.Value)myValue).getItemType(hierarchy);
|
||||
}
|
||||
if (myValue instanceof Item) {
|
||||
return Type.getItemType((Item)myValue, hierarchy);
|
||||
}
|
||||
return AnyItemType.getInstance();
|
||||
}
|
||||
|
||||
public SequenceIterator iterate(XPathContext context) throws XPathException {
|
||||
if (myValue instanceof net.sf.saxon.value.Value) {
|
||||
return ((net.sf.saxon.value.Value)myValue).iterate(context);
|
||||
}
|
||||
if (myValue instanceof Item) {
|
||||
return ((Item)myValue).getTypedValue();
|
||||
}
|
||||
return EmptyIterator.getInstance();
|
||||
}
|
||||
}
|
||||
|
||||
private class ErrorValue implements Value {
|
||||
private final String myError;
|
||||
private final ValueFacade myFacade;
|
||||
|
||||
public ErrorValue(String error, ValueFacade facade) {
|
||||
myError = error;
|
||||
myFacade = facade;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return " - error: " + myError + " - ";
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return new ObjectType(myFacade.getItemType(myXPathContext.getConfiguration().getTypeHierarchy()).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -67,6 +67,7 @@ public class Saxon9Support {
|
||||
public static TransformerFactory createTransformerFactory() {
|
||||
final TransformerFactoryImpl factory = new TransformerFactoryImpl();
|
||||
factory.setAttribute(FeatureKeys.TRACE_LISTENER, new Saxon9TraceListener());
|
||||
factory.setAttribute(FeatureKeys.OPTIMIZATION_LEVEL, 0);
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -68,7 +68,7 @@ class XalanStyleFrame extends AbstractFrame<Debugger.StyleFrame> implements Debu
|
||||
final String name = variable.getName().getLocalName();
|
||||
try {
|
||||
final Value value = kind == Debugger.Variable.Kind.PARAMETER ?
|
||||
eval("$" + variable.getName().toNamespacedString()) : // http://youtrack.jetbrains.net/issue/IDEA-78638
|
||||
eval("$" + variable.getName().toString()) : // http://youtrack.jetbrains.net/issue/IDEA-78638
|
||||
new XObjectValue(variable.getValue(myTransformer, myCurrentNode));
|
||||
|
||||
variables.add(new VariableImpl(name, value, global, kind, variable.getSystemId(), variable.getLineNumber()));
|
||||
|
||||
@@ -20,8 +20,7 @@
|
||||
</change-notes>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<xdebugger.breakpointType implementation="org.intellij.plugins.xsltDebugger.XsltBreakpointType$V1"/>
|
||||
<xdebugger.breakpointType implementation="org.intellij.plugins.xsltDebugger.XsltBreakpointType$V2"/>
|
||||
<xdebugger.breakpointType implementation="org.intellij.plugins.xsltDebugger.XsltBreakpointType"/>
|
||||
|
||||
<programRunner implementation="org.intellij.plugins.xsltDebugger.XsltDebuggerRunner"/>
|
||||
</extensions>
|
||||
|
||||
+28
-31
@@ -8,7 +8,10 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointProperties;
|
||||
import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XLineBreakpointType;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
|
||||
import com.intellij.xdebugger.ui.DebuggerIcons;
|
||||
@@ -24,12 +27,13 @@ import javax.swing.*;
|
||||
* User: sweinreuter
|
||||
* Date: 03.03.11
|
||||
*/
|
||||
public abstract class XsltBreakpointType extends XLineBreakpointType<XBreakpointProperties> {
|
||||
public class XsltBreakpointType extends XLineBreakpointType<XBreakpointProperties> {
|
||||
|
||||
private final XsltDebuggerEditorsProvider myMyEditorsProvider = new XsltDebuggerEditorsProvider(getLanguageLevel());
|
||||
private final XsltDebuggerEditorsProvider myMyEditorsProvider1 = new XsltDebuggerEditorsProvider(XsltChecker.LanguageLevel.V1);
|
||||
private final XsltDebuggerEditorsProvider myMyEditorsProvider2 = new XsltDebuggerEditorsProvider(XsltChecker.LanguageLevel.V2);
|
||||
|
||||
protected XsltBreakpointType(final String id) {
|
||||
super(id, "XSLT Breakpoints");
|
||||
public XsltBreakpointType() {
|
||||
super("xslt", "XSLT Breakpoints");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -45,14 +49,29 @@ public abstract class XsltBreakpointType extends XLineBreakpointType<XBreakpoint
|
||||
if (fileType != StdFileTypes.XML || !XsltSupport.isXsltFile(psiFile)) {
|
||||
return false;
|
||||
}
|
||||
return getLanguageLevel() == XsltSupport.getXsltLanguageLevel(psiFile);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected abstract XsltChecker.LanguageLevel getLanguageLevel();
|
||||
|
||||
@Override
|
||||
public XDebuggerEditorsProvider getEditorsProvider() {
|
||||
return myMyEditorsProvider;
|
||||
public XDebuggerEditorsProvider getEditorsProvider(@NotNull XLineBreakpoint<XBreakpointProperties> breakpoint, @NotNull Project project) {
|
||||
final XSourcePosition position = breakpoint.getSourcePosition();
|
||||
if (position == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final PsiFile file = PsiManager.getInstance(project).findFile(position.getFile());
|
||||
if (file == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final XsltChecker.LanguageLevel level = XsltSupport.getXsltLanguageLevel(file);
|
||||
if (level == XsltChecker.LanguageLevel.V1) {
|
||||
return myMyEditorsProvider1;
|
||||
} else if (level == XsltChecker.LanguageLevel.V2) {
|
||||
return myMyEditorsProvider2;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -71,26 +90,4 @@ public abstract class XsltBreakpointType extends XLineBreakpointType<XBreakpoint
|
||||
public XBreakpointProperties createBreakpointProperties(@NotNull VirtualFile file, int line) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final class V1 extends XsltBreakpointType {
|
||||
public V1() {
|
||||
super("xslt");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected XsltChecker.LanguageLevel getLanguageLevel() {
|
||||
return XsltChecker.LanguageLevel.V1;
|
||||
}
|
||||
}
|
||||
|
||||
public static final class V2 extends XsltBreakpointType {
|
||||
public V2() {
|
||||
super("xslt2");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected XsltChecker.LanguageLevel getLanguageLevel() {
|
||||
return XsltChecker.LanguageLevel.V2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -37,8 +37,7 @@ public class XsltDebugProcess extends XDebugProcess implements Disposable {
|
||||
private BreakpointManager myBreakpointManager = new BreakpointManagerImpl();
|
||||
|
||||
private final XBreakpointHandler<?>[] myXBreakpointHandlers = new XBreakpointHandler<?>[]{
|
||||
new XsltBreakpointHandler(this, XsltBreakpointType.V1.class),
|
||||
new XsltBreakpointHandler(this, XsltBreakpointType.V2.class)
|
||||
new XsltBreakpointHandler(this, XsltBreakpointType.class),
|
||||
};
|
||||
private XsltDebuggerSession myDebuggerSession;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user