assert edt thread fixed

This commit is contained in:
Alexey Kudravtsev
2011-09-19 15:56:46 +04:00
parent 426f85b7b2
commit 5dbc04fd67
3 changed files with 4 additions and 6 deletions
@@ -47,7 +47,6 @@ import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
import com.intellij.psi.util.PsiUtilBase;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.xml.util.XmlStringUtil;
@@ -163,7 +162,7 @@ public class HighlightInfo implements Segment {
String toolTip,
boolean isEndOfLine,
TextAttributes forcedAttributes) {
LOG.assertTrue(ArrayUtil.find(HighlightSeverity.DEFAULT_SEVERITIES, type.getSeverity(element)) != -1 || element != null, "Custom type demands element to detect text attributes");
LOG.assertTrue(element != null || ArrayUtil.find(HighlightSeverity.DEFAULT_SEVERITIES, type.getSeverity(element)) != -1, "Custom type demands element to detect its text attributes");
HighlightInfo highlightInfo = new HighlightInfo(forcedAttributes, type, start, end, description, toolTip, type.getSeverity(element), isEndOfLine, null, false);
PsiFile file = element == null ? null : element.getContainingFile();
for (HighlightInfoFilter filter : getFilters()) {
@@ -474,8 +473,7 @@ public class HighlightInfo implements Segment {
}
@Nullable
public List<IntentionAction> getOptions(@NotNull PsiElement element) {
Editor editor = PsiUtilBase.findEditor(element);
public List<IntentionAction> getOptions(@NotNull PsiElement element, @Nullable Editor editor) {
if (editor != null && Boolean.FALSE.equals(editor.getUserData(IntentionManager.SHOW_INTENTION_OPTIONS_KEY))) {
return null;
}
@@ -165,7 +165,7 @@ class IntentionListStep implements ListPopupStep<IntentionActionWithTextCaching>
@NotNull PsiFile containingFile,
@NotNull Editor containingEditor) {
IntentionActionWithTextCaching cachedAction = new IntentionActionWithTextCaching(descriptor);
final List<IntentionAction> options = descriptor.getOptions(element);
final List<IntentionAction> options = descriptor.getOptions(element, containingEditor);
if (options == null) return cachedAction;
for (IntentionAction option : options) {
if (!option.isAvailable(myProject, containingEditor, containingFile)) {
@@ -1464,7 +1464,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
// add all intention options for simplicity
for (HighlightInfo.IntentionActionDescriptor descriptor : descriptors) {
result.add(descriptor.getAction());
List<IntentionAction> options = descriptor.getOptions(element);
List<IntentionAction> options = descriptor.getOptions(element,editor);
if (options != null) {
for (IntentionAction option : options) {
if (option.isAvailable(file.getProject(), editor, file)) {