com.intellij.openapi.editor.markup.EffectType Java Examples

The following examples show how to use com.intellij.openapi.editor.markup.EffectType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LivePreview.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void updateCursorHighlighting() {
  hideBalloon();

  if (myCursorHighlighter != null) {
    removeHighlighter(myCursorHighlighter);
    myCursorHighlighter = null;
  }

  final FindResult cursor = mySearchResults.getCursor();
  Editor editor = mySearchResults.getEditor();
  if (cursor != null && cursor.getEndOffset() <= editor.getDocument().getTextLength()) {
    Color color = editor.getColorsScheme().getColor(EditorColors.CARET_COLOR);
    myCursorHighlighter = addHighlighter(cursor.getStartOffset(), cursor.getEndOffset(), new TextAttributes(null, null, color, EffectType.ROUNDED_BOX, Font.PLAIN));

    editor.getScrollingModel().runActionOnScrollingFinished(() -> showReplacementPreview());
  }
}
 
Example #2
Source File: LSPDiagnosticsToMarkers.java    From intellij-quarkus with Eclipse Public License 2.0 6 votes vote down vote up
private void createMarkers(Editor editor, Document document, List<Diagnostic> diagnostics) {
    RangeHighlighter[] rangeHighlighters = new RangeHighlighter[diagnostics.size()];
    int index = 0;
    for(Diagnostic diagnostic : diagnostics) {
        int startOffset = LSPIJUtils.toOffset(diagnostic.getRange().getStart(), document);
        int endOffset = LSPIJUtils.toOffset(diagnostic.getRange().getEnd(), document);
        if (endOffset > document.getLineEndOffset(document.getLineCount() - 1)) {
            endOffset = document.getLineEndOffset(document.getLineCount() - 1);
        }
        int layer = getLayer(diagnostic.getSeverity());
        EffectType effectType = getEffectType(diagnostic.getSeverity());
        Color color = getColor(diagnostic.getSeverity());
        RangeHighlighter rangeHighlighter = editor.getMarkupModel().addRangeHighlighter(startOffset, endOffset, layer, new TextAttributes(editor.getColorsScheme().getDefaultForeground(), editor.getColorsScheme().getDefaultBackground(), color, effectType, Font.PLAIN), HighlighterTargetArea.EXACT_RANGE);
        rangeHighlighter.setErrorStripeTooltip(diagnostic);
        rangeHighlighters[index++] = rangeHighlighter;
    }
    Map<String, RangeHighlighter[]> allMarkers = getAllMarkers(editor);
    allMarkers.put(languageServerId, rangeHighlighters);

}
 
Example #3
Source File: Switcher.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected void customizeCellRenderer(@Nonnull JList<? extends FileInfo> list, FileInfo value, int index, boolean selected, boolean hasFocus) {
  Project project = mySwitcherPanel.project;
  VirtualFile virtualFile = value.getFirst();
  String renderedName = value.getNameForRendering();
  setIcon(VfsIconUtil.getIcon(virtualFile, Iconable.ICON_FLAG_READ_STATUS, project));

  FileStatus fileStatus = FileStatusManager.getInstance(project).getStatus(virtualFile);
  open = FileEditorManager.getInstance(project).isFileOpen(virtualFile);

  boolean hasProblem = WolfTheProblemSolver.getInstance(project).isProblemFile(virtualFile);
  TextAttributes attributes = new TextAttributes(fileStatus.getColor(), null, hasProblem ? JBColor.red : null, EffectType.WAVE_UNDERSCORE, Font.PLAIN);
  append(renderedName, SimpleTextAttributes.fromTextAttributes(attributes));

  // calc color the same way editor tabs do this, i.e. including EPs
  Color color = EditorTabPresentationUtil.getFileBackgroundColor(project, virtualFile);

  if (!selected && color != null) {
    setBackground(color);
  }
  SpeedSearchUtil.applySpeedSearchHighlighting(mySwitcherPanel, this, false, selected);

  IdeDocumentHistoryImpl.appendTimestamp(project, this, virtualFile);
}
 
Example #4
Source File: EditorDocOps.java    From KodeBeagle with Apache License 2.0 5 votes vote down vote up
public final void addHighlighting(final List<Integer> linesForHighlighting,
                                  final Document document) {
    TextAttributes attributes = new TextAttributes();
    JBColor color = JBColor.GREEN;
    attributes.setEffectColor(color);
    attributes.setEffectType(EffectType.SEARCH_MATCH);
    attributes.setBackgroundColor(HIGHLIGHTING_COLOR);
    Editor projectEditor =
            FileEditorManager.getInstance(windowObjects.getProject()).getSelectedTextEditor();
    if (projectEditor != null) {
        PsiFile psiFile =
                PsiDocumentManager.getInstance(windowObjects.getProject()).
                        getPsiFile(projectEditor.getDocument());
        MarkupModel markupModel = projectEditor.getMarkupModel();
        if (markupModel != null) {
            markupModel.removeAllHighlighters();

            for (int line : linesForHighlighting) {
                line = line - 1;
                if (line < document.getLineCount()) {
                    int startOffset = document.getLineStartOffset(line);
                    int endOffset = document.getLineEndOffset(line);
                    String lineText =
                            document.getCharsSequence().
                                    subSequence(startOffset, endOffset).toString();
                    int lineStartOffset =
                            startOffset + lineText.length() - lineText.trim().length();
                    markupModel.addRangeHighlighter(lineStartOffset, endOffset,
                            HighlighterLayer.ERROR, attributes,
                            HighlighterTargetArea.EXACT_RANGE);
                    if (psiFile != null && psiFile.findElementAt(lineStartOffset) != null) {
                        HighlightUsagesHandler.doHighlightElements(projectEditor,
                                new PsiElement[]{psiFile.findElementAt(lineStartOffset)},
                                attributes, false);
                    }
                }
            }
        }
    }
}
 
Example #5
Source File: AbstractBashSyntaxHighlighterTest.java    From BashSupport with Apache License 2.0 5 votes vote down vote up
protected void doLexerHighlightingTest(String fileContent, IElementType targetElementType) {
    BashSyntaxHighlighter syntaxHighlighter = new BashSyntaxHighlighter();
    TextAttributesKey[] keys = syntaxHighlighter.getTokenHighlights(targetElementType);
    Assert.assertEquals("Expected one key", 1, keys.length);

    TextAttributesKey attributesKey = keys[0];
    Assert.assertNotNull(attributesKey);

    EditorColorsManager manager = EditorColorsManager.getInstance();
    EditorColorsScheme scheme = (EditorColorsScheme) manager.getGlobalScheme().clone();
    manager.addColorsScheme(scheme);
    EditorColorsManager.getInstance().setGlobalScheme(scheme);

    TextAttributes targetAttributes = new TextAttributes(JBColor.RED, JBColor.BLUE, JBColor.GRAY, EffectType.BOXED, Font.BOLD);
    scheme.setAttributes(attributesKey, targetAttributes);

    myFixture.configureByText(BashFileType.BASH_FILE_TYPE, fileContent);

    TextAttributes actualAttributes = null;
    HighlighterIterator iterator = ((EditorImpl) myFixture.getEditor()).getHighlighter().createIterator(0);
    while (!iterator.atEnd()) {
        if (iterator.getTokenType() == targetElementType) {
            actualAttributes = iterator.getTextAttributes();
            break;
        }

        iterator.advance();
    }

    Assert.assertEquals("Expected text attributes for " + attributesKey, targetAttributes, actualAttributes);
}
 
Example #6
Source File: BookmarkItem.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void setupRenderer(SimpleColoredComponent renderer, Project project, Bookmark bookmark, boolean selected) {
  VirtualFile file = bookmark.getFile();
  if (!file.isValid()) {
    return;
  }

  PsiManager psiManager = PsiManager.getInstance(project);

  PsiElement fileOrDir = file.isDirectory() ? psiManager.findDirectory(file) : psiManager.findFile(file);
  if (fileOrDir != null) {
    renderer.setIcon(IconDescriptorUpdaters.getIcon(fileOrDir, 0));
  }

  String description = bookmark.getDescription();
  if (description != null) {
    renderer.append(description + " ", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
  }

  FileStatus fileStatus = FileStatusManager.getInstance(project).getStatus(file);
  TextAttributes attributes = new TextAttributes(fileStatus.getColor(), null, null, EffectType.LINE_UNDERSCORE, Font.PLAIN);
  renderer.append(file.getName(), SimpleTextAttributes.fromTextAttributes(attributes));
  if (bookmark.getLine() >= 0) {
    renderer.append(":", SimpleTextAttributes.GRAYED_ATTRIBUTES);
    renderer.append(String.valueOf(bookmark.getLine() + 1), SimpleTextAttributes.GRAYED_ATTRIBUTES);
  }

  if (!selected) {
    FileColorManager colorManager = FileColorManager.getInstance(project);
    if (fileOrDir instanceof PsiFile) {
      Color color = colorManager.getRendererBackground((PsiFile)fileOrDir);
      if (color != null) {
        renderer.setBackground(color);
      }
    }
  }
}
 
Example #7
Source File: LivePreview.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void updateInSelectionHighlighters() {
  final SelectionModel selectionModel = mySearchResults.getEditor().getSelectionModel();
  int[] starts = selectionModel.getBlockSelectionStarts();
  int[] ends = selectionModel.getBlockSelectionEnds();

  for (RangeHighlighter highlighter : myHighlighters) {
    if (!highlighter.isValid()) continue;
    boolean needsAdditionalHighlighting = false;
    TextRange cursor = mySearchResults.getCursor();
    if (cursor == null || highlighter.getStartOffset() != cursor.getStartOffset() || highlighter.getEndOffset() != cursor.getEndOffset()) {
      for (int i = 0; i < starts.length; ++i) {
        TextRange selectionRange = new TextRange(starts[i], ends[i]);
        needsAdditionalHighlighting = selectionRange.intersects(highlighter.getStartOffset(), highlighter.getEndOffset()) &&
                                      selectionRange.getEndOffset() != highlighter.getStartOffset() &&
                                      highlighter.getEndOffset() != selectionRange.getStartOffset();
        if (needsAdditionalHighlighting) break;
      }
    }

    RangeHighlighter inSelectionHighlighter = highlighter.getUserData(IN_SELECTION_KEY);
    if (inSelectionHighlighter != null) {
      if (!needsAdditionalHighlighting) {
        removeHighlighter(inSelectionHighlighter);
      }
    }
    else if (needsAdditionalHighlighting) {
      RangeHighlighter additionalHighlighter = addHighlighter(highlighter.getStartOffset(), highlighter.getEndOffset(), new TextAttributes(null, null, Color.WHITE, EffectType.ROUNDED_BOX, Font.PLAIN));
      highlighter.putUserData(IN_SELECTION_KEY, additionalHighlighter);
    }
  }
}
 
Example #8
Source File: LivePreview.java    From consulo with Apache License 2.0 5 votes vote down vote up
private TextAttributes createAttributes(FindResult range) {
  EditorColorsScheme colorsScheme = mySearchResults.getEditor().getColorsScheme();
  if (mySearchResults.isExcluded(range)) {
    return new TextAttributes(null, null, colorsScheme.getDefaultForeground(), EffectType.STRIKEOUT, Font.PLAIN);
  }
  TextAttributes attributes = colorsScheme.getAttributes(EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES);
  if (range.getLength() == 0) {
    attributes = attributes.clone();
    attributes.setEffectType(EffectType.BOXED);
    attributes.setEffectColor(attributes.getBackgroundColor());
  }
  return attributes;
}
 
Example #9
Source File: DiffOptionsPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void apply(EditorColorsScheme scheme) {
  TextAttributesKey key = myDiffType.getAttributesKey();
  TextAttributes attrs = new TextAttributes(null, myBackgroundColor, null, EffectType.BOXED, Font.PLAIN);
  attrs.setErrorStripeColor(myStripebarColor);
  scheme.setAttributes(key, attrs);
}
 
Example #10
Source File: ColorAndFontDescriptionPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void reset(ColorAndFontDescription description) {
  if (description.isFontEnabled()) {
    myLabelFont.setEnabled(true);
    myCbBold.setEnabled(true);
    myCbItalic.setEnabled(true);
    int fontType = description.getFontType();
    myCbBold.setSelected((fontType & Font.BOLD) != 0);
    myCbItalic.setSelected((fontType & Font.ITALIC) != 0);
  }
  else {
    myLabelFont.setEnabled(false);
    myCbBold.setSelected(false);
    myCbBold.setEnabled(false);
    myCbItalic.setSelected(false);
    myCbItalic.setEnabled(false);
  }

  updateColorChooser(myCbForeground, myForegroundChooser, description.isForegroundEnabled(),
                     description.isForegroundChecked(), description.getForegroundColor());

  updateColorChooser(myCbBackground, myBackgroundChooser, description.isBackgroundEnabled(),
                     description.isBackgroundChecked(), description.getBackgroundColor());

  updateColorChooser(myCbErrorStripe, myErrorStripeColorChooser, description.isErrorStripeEnabled(),
                     description.isErrorStripeChecked(), description.getErrorStripeColor());

  EffectType effectType = description.getEffectType();
  updateColorChooser(myCbEffects, myEffectsColorChooser, description.isEffectsColorEnabled(),
                     description.isEffectsColorChecked(), description.getEffectColor());

  if (description.isEffectsColorEnabled() && description.isEffectsColorChecked()) {
    myEffectsCombo.setEnabled(true);
    myEffectsModel.setEffectName(ContainerUtil.reverseMap(myEffectsMap).get(effectType));
  }
  else {
    myEffectsCombo.setEnabled(false);
  }
  setInheritanceInfo(description);
  myLabelFont.setEnabled(myCbBold.isEnabled() || myCbItalic.isEnabled());
}
 
Example #11
Source File: Breadcrumbs.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected EffectPainter getEffectPainter(EffectType type) {
  if (type == EffectType.STRIKEOUT) return EffectPainter.STRIKE_THROUGH;
  if (type == EffectType.WAVE_UNDERSCORE) return EffectPainter.WAVE_UNDERSCORE;
  if (type == EffectType.LINE_UNDERSCORE) return EffectPainter.LINE_UNDERSCORE;
  if (type == EffectType.BOLD_LINE_UNDERSCORE) return EffectPainter.BOLD_LINE_UNDERSCORE;
  if (type == EffectType.BOLD_DOTTED_LINE) return EffectPainter.BOLD_DOTTED_UNDERSCORE;
  return null;
}
 
Example #12
Source File: SimpleTextAttributes.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static SimpleTextAttributes fromTextAttributes(TextAttributes attributes) {
  if (attributes == null) return REGULAR_ATTRIBUTES;

  Color foregroundColor = attributes.getForegroundColor();
  if (foregroundColor == null) foregroundColor = REGULAR_ATTRIBUTES.getFgColor();

  int style = attributes.getFontType();
  if (attributes.getEffectColor() != null) {
    EffectType effectType = attributes.getEffectType();
    if (effectType == EffectType.STRIKEOUT) {
      style |= STYLE_STRIKEOUT;
    }
    else if (effectType == EffectType.WAVE_UNDERSCORE) {
      style |= STYLE_WAVED;
    }
    else if (effectType == EffectType.LINE_UNDERSCORE ||
             effectType == EffectType.BOLD_LINE_UNDERSCORE ||
             effectType == EffectType.BOLD_DOTTED_LINE) {
      style |= STYLE_UNDERLINE;
    }
    else if (effectType == EffectType.SEARCH_MATCH) {
      style |= STYLE_SEARCH_MATCH;
    }
    else {
      // not supported
    }
  }
  return new SimpleTextAttributes(attributes.getBackgroundColor(), foregroundColor, attributes.getEffectColor(), style);
}
 
Example #13
Source File: SimpleTextAttributes.java    From consulo with Apache License 2.0 5 votes vote down vote up
public TextAttributes toTextAttributes() {
  Color effectColor;
  EffectType effectType;
  if (isWaved()) {
    effectColor = myWaveColor;
    effectType = EffectType.WAVE_UNDERSCORE;
  }
  else if (isStrikeout()) {
    effectColor = myWaveColor;
    effectType = EffectType.STRIKEOUT;
  }
  else if (isUnderline()) {
    effectColor = myWaveColor;
    effectType = EffectType.LINE_UNDERSCORE;
  }
  else if (isBoldDottedLine()) {
    effectColor = myWaveColor;
    effectType = EffectType.BOLD_DOTTED_LINE;
  }
  else if (isSearchMatch()) {
    effectColor = myWaveColor;
    effectType = EffectType.SEARCH_MATCH;
  }
  else {
    effectColor = null;
    effectType = null;
  }
  return new TextAttributes(myFgColor, null, effectColor, effectType, myStyle & FONT_MASK);
}
 
Example #14
Source File: LineExtensionInfo.java    From consulo with Apache License 2.0 5 votes vote down vote up
public LineExtensionInfo(@Nonnull String text, @Nullable Color color, @Nullable EffectType effectType, @Nullable Color effectColor, @JdkConstants.FontStyle int fontType) {
  myText = text;
  myColor = color;
  myEffectType = effectType;
  myEffectColor = effectColor;
  myFontType = fontType;
  myBgColor = null;
}
 
Example #15
Source File: BlazeTargetFilter.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Nullable
private TextAttributes getHighlightAttributes() {
  if (highlightMatches) {
    // normal link highlighting, when we don't expect too many targets in the output
    return null;
  }
  // avoid a sea of blue in sync output: just add a grey underline to navigable targets
  return new TextAttributes(
      UIUtil.getActiveTextColor(),
      null,
      UIUtil.getInactiveTextColor(),
      EffectType.LINE_UNDERSCORE,
      Font.PLAIN);
}
 
Example #16
Source File: CppHighlighter.java    From CppTools with Apache License 2.0 5 votes vote down vote up
private static TextAttributes createUnusedAttributes() {
  TextAttributes attrs = new TextAttributes();
  attrs.setForegroundColor(Color.darkGray);
  attrs.setEffectType(EffectType.STRIKEOUT);

  return attrs;
}
 
Example #17
Source File: ImmediatePainter.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static boolean canRender(final TextAttributes attributes) {
  return attributes.getEffectType() != EffectType.BOXED || attributes.getEffectColor() == null;
}
 
Example #18
Source File: ColorAndFontOptions.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void setExternalEffectType(EffectType type) {
}
 
Example #19
Source File: ColorAndFontOptions.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public EffectType getExternalEffectType() {
  return EffectType.LINE_UNDERSCORE;
}
 
Example #20
Source File: TextAttributesDescription.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public EffectType getExternalEffectType() {
  return myAttributes.getEffectType();
}
 
Example #21
Source File: TextAttributesDescription.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void setExternalEffectType(EffectType type) {
  myAttributes.setEffectType(type);
}
 
Example #22
Source File: PackagingElementNode.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static SimpleTextAttributes addErrorHighlighting(boolean error, SimpleTextAttributes attributes) {
  final TextAttributes textAttributes = attributes.toTextAttributes();
  textAttributes.setEffectType(EffectType.WAVE_UNDERSCORE);
  textAttributes.setEffectColor(error ? JBColor.RED : JBColor.GRAY);
  return SimpleTextAttributes.fromTextAttributes(textAttributes);
}
 
Example #23
Source File: CppHighlighter.java    From CppTools with Apache License 2.0 4 votes vote down vote up
private static TextAttributes createParameterAttributes() {
  TextAttributes attrs = new TextAttributes();
  attrs.setEffectType(EffectType.LINE_UNDERSCORE);
  attrs.setEffectColor(Color.black);
  return attrs;
}
 
Example #24
Source File: ColorAndFontDescription.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public final void setEffectType(EffectType effectType) {
  super.setEffectType(effectType);
  setExternalEffectType(effectType);
}
 
Example #25
Source File: LineExtensionInfo.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
public EffectType getEffectType() {
  return myEffectType;
}
 
Example #26
Source File: Breadcrumbs.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected EffectType getEffectType(Crumb crumb) {
  TextAttributes attributes = getAttributes(crumb);
  return attributes == null ? null : attributes.getEffectType();
}
 
Example #27
Source File: HyperlinkLabel.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void setEffectType(EffectType effectType) {
  throw new UnsupportedOperationException();
}
 
Example #28
Source File: HyperlinkLabel.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public EffectType getEffectType() {
  return !isEnabled() || myMouseHover || myMousePressed ? EffectType.LINE_UNDERSCORE : null;
}
 
Example #29
Source File: ColoredOutputTypeRegistry.java    From consulo with Apache License 2.0 4 votes vote down vote up
public Key getOutputKey(@NonNls String attribute) {
  final Key key = myRegisteredKeys.get(attribute);
  if (key != null) {
    return key;
  }
  final String completeAttribute = attribute;
  if (attribute.startsWith("\u001B[")) {
    attribute = attribute.substring(2);
  }
  else if (attribute.startsWith("[")) {
    attribute = attribute.substring(1);
  }
  if (attribute.endsWith("m")) {
    attribute = attribute.substring(0, attribute.length() - 1);
  }
  if (attribute.equals("0")) {
    return ProcessOutputTypes.STDOUT;
  }
  TextAttributes attrs = new TextAttributes();
  final String[] strings = attribute.split(";");
  for (String string : strings) {
    int value;
    try {
      value = Integer.parseInt(string);
    }
    catch (NumberFormatException e) {
      continue;
    }
    if (value == 1) {
      attrs.setFontType(Font.BOLD);
    }
    else if (value == 4) {
      attrs.setEffectType(EffectType.LINE_UNDERSCORE);
    }
    else if (value == 22) {
      attrs.setFontType(Font.PLAIN);
    }
    else if (value == 24) {  //not underlined
      attrs.setEffectType(null);
    }
    else if (value >= 30 && value <= 37) {
      attrs.setForegroundColor(getAnsiColor(value - 30));
    }
    else if (value == 38) {
      //TODO: 256 colors foreground
    }
    else if (value == 39) {
      attrs.setForegroundColor(getColorByKey(ConsoleViewContentType.NORMAL_OUTPUT_KEY));
    }
    else if (value >= 40 && value <= 47) {
      attrs.setBackgroundColor(getAnsiColor(value - 40));
    }
    else if (value == 48) {
      //TODO: 256 colors background
    }
    else if (value == 49) {
      attrs.setBackgroundColor(getColorByKey(ConsoleViewContentType.NORMAL_OUTPUT_KEY));
    }
    else if (value >= 90 && value <= 97) {
      attrs.setForegroundColor(
              getAnsiColor(value - 82));
    }
    else if (value >= 100 && value <= 107) {
      attrs.setBackgroundColor(
              getAnsiColor(value - 92));
    }
  }
  if (attrs.getEffectType() == EffectType.LINE_UNDERSCORE) {
    attrs.setEffectColor(attrs.getForegroundColor());
  }
  Key newKey = new Key(completeAttribute);
  ConsoleViewContentType contentType = new ConsoleViewContentType(completeAttribute, attrs);
  ConsoleViewContentType.registerNewConsoleViewType(newKey, contentType);
  myRegisteredKeys.put(completeAttribute, newKey);
  return newKey;
}
 
Example #30
Source File: TextAttributesReader.java    From consulo with Apache License 2.0 4 votes vote down vote up
static EffectType read(TextAttributesReader reader, Element element) {
  Effect effect = reader.readChild(Effect.class, element, EFFECT_TYPE);
  return effect != null ? effect.myType : EffectType.BOXED;
}