From 5ff6fa79b6df61bd067c3bfaf13b42b9dcf86c42 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Tue, 11 Jul 2017 17:56:34 +0300 Subject: [PATCH] cleanup --- .../vfs/InvalidVirtualFileAccessException.java | 10 ++++++---- .../diff/util/DiffLineSeparatorRenderer.java | 1 + .../diff/impl/DiffLineMarkerRenderer.java | 1 + .../intellij/openapi/editor/ex/EditorEx.java | 18 +++++++++--------- .../openapi/editor/ex/SoftWrapModelEx.java | 14 +++++++------- .../coverage/CoverageLineMarkerRenderer.java | 2 +- 6 files changed, 25 insertions(+), 21 deletions(-) diff --git a/platform/core-api/src/com/intellij/openapi/vfs/InvalidVirtualFileAccessException.java b/platform/core-api/src/com/intellij/openapi/vfs/InvalidVirtualFileAccessException.java index e6c0e6f18cd3..7546529e0eba 100644 --- a/platform/core-api/src/com/intellij/openapi/vfs/InvalidVirtualFileAccessException.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/InvalidVirtualFileAccessException.java @@ -15,21 +15,23 @@ */ package com.intellij.openapi.vfs; +import org.jetbrains.annotations.NotNull; + import java.io.File; /** * @author max */ public class InvalidVirtualFileAccessException extends RuntimeException { - public InvalidVirtualFileAccessException(final VirtualFile file) { + public InvalidVirtualFileAccessException(@NotNull VirtualFile file) { super(composeMessage(file)); } - public InvalidVirtualFileAccessException(String message) { + public InvalidVirtualFileAccessException(@NotNull String message) { super(message); } - private static String composeMessage(VirtualFile file) { + private static String composeMessage(@NotNull VirtualFile file) { String url = file.getUrl(); String message = "Accessing invalid virtual file: " + url; @@ -52,6 +54,6 @@ public class InvalidVirtualFileAccessException extends RuntimeException { } private static String hashCode(Object o) { - return o != null ? String.valueOf(o.hashCode()) : "-"; + return o == null ? "-" : String.valueOf(o.hashCode()); } } \ No newline at end of file diff --git a/platform/diff-impl/src/com/intellij/diff/util/DiffLineSeparatorRenderer.java b/platform/diff-impl/src/com/intellij/diff/util/DiffLineSeparatorRenderer.java index b9c1b08b7a6d..5766b66d41ef 100644 --- a/platform/diff-impl/src/com/intellij/diff/util/DiffLineSeparatorRenderer.java +++ b/platform/diff-impl/src/com/intellij/diff/util/DiffLineSeparatorRenderer.java @@ -131,6 +131,7 @@ public class DiffLineSeparatorRenderer implements LineMarkerRendererEx, LineSepa draw(g, shiftX, y, lineHeight, myEditor.getColorsScheme()); } + @NotNull @Override public LineMarkerRendererEx.Position getPosition() { return LineMarkerRendererEx.Position.CUSTOM; diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffLineMarkerRenderer.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffLineMarkerRenderer.java index a0943b13cda6..bd8126a4f455 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffLineMarkerRenderer.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffLineMarkerRenderer.java @@ -72,6 +72,7 @@ public class DiffLineMarkerRenderer implements LineMarkerRendererEx { } } + @NotNull @Override public LineMarkerRendererEx.Position getPosition() { return LineMarkerRendererEx.Position.CUSTOM; diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/EditorEx.java b/platform/platform-impl/src/com/intellij/openapi/editor/ex/EditorEx.java index 830bd00fc2d7..7c5474b7d600 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/ex/EditorEx.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/ex/EditorEx.java @@ -69,7 +69,7 @@ public interface EditorEx extends Editor { * * @return the markup model instance. * @see com.intellij.openapi.editor.markup.MarkupEditorFilter - * @see com.intellij.openapi.editor.impl.EditorImpl#setHighlightingFilter(Condition) + * @see com.intellij.openapi.editor.impl.EditorImpl#setHighlightingFilter(Condition) * @see com.intellij.openapi.editor.impl.DocumentMarkupModel#forDocument(Document, Project, boolean) */ @NotNull @@ -214,7 +214,7 @@ public interface EditorEx extends Editor { void setSoftWrapAppliancePlace(@NotNull SoftWrapAppliancePlaces place); /** - * Allows to define 'placeholder text' for the current editor, i.e. virtual text that will be represented until + * Allows to define {@code 'placeholder text'} for the current editor, i.e. virtual text that will be represented until * any user data is entered. * * Feel free to see the detailed feature @@ -226,14 +226,14 @@ public interface EditorEx extends Editor { /** * Sets text attributes for a placeholder. Font style and color are currently supported. - * null means default values should be used. + * {@code null} means default values should be used. * * @see #setPlaceholder(CharSequence) */ void setPlaceholderAttributes(@Nullable TextAttributes attributes); /** - * Controls whether 'placeholder text' is visible when editor is focused. + * Controls whether {@code 'placeholder text'} is visible when editor is focused. * * @param show flag indicating whether placeholder is visible when editor is focused. * @@ -245,16 +245,16 @@ public interface EditorEx extends Editor { * Allows to answer if 'sticky selection' is active for the current editor. *

* 'Sticky selection' means that every time caret position changes, selection end offset is automatically set to the same position. - * Selection start is always caret offset on {@link #setStickySelection(boolean)} call with 'true' argument. + * Selection start is always caret offset on {@link #setStickySelection(boolean)} call with {@code 'true'} argument. * - * @return true if 'sticky selection' mode is active at the current editor; false otherwise + * @return {@code true} if 'sticky selection' mode is active at the current editor; {@code false} otherwise */ boolean isStickySelection(); /** * Allows to set current {@link #isStickySelection() sticky selection} mode. * - * @param enable flag that identifies if 'sticky selection' mode should be enabled + * @param enable flag that identifies if {@code 'sticky selection'} mode should be enabled */ void setStickySelection(boolean enable); @@ -313,7 +313,7 @@ public interface EditorEx extends Editor { /** * Sets id of action group what will be used to construct context menu displayed on mouse right button's click. Setting this to - * null disables built-in logic for showing context menu (it can still be achieved by implementing corresponding mouse + * {@code null} disables built-in logic for showing context menu (it can still be achieved by implementing corresponding mouse * event listener). * * @see #getContextMenuGroupId() @@ -321,7 +321,7 @@ public interface EditorEx extends Editor { void setContextMenuGroupId(@Nullable String groupId); /** - * Returns id of action group what will be used to construct context menu displayed on mouse right button's click. null + * Returns id of action group what will be used to construct context menu displayed on mouse right button's click. {@code null} * value means built-in logic for showing context menu is disabled. * * @see #setContextMenuGroupId(String) diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/SoftWrapModelEx.java b/platform/platform-impl/src/com/intellij/openapi/editor/ex/SoftWrapModelEx.java index 6f129fcab653..f3dcec5b7392 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/ex/SoftWrapModelEx.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/ex/SoftWrapModelEx.java @@ -39,11 +39,11 @@ public interface SoftWrapModelEx extends SoftWrapModel { /** * Tries to find index of the target soft wrap at {@link #getRegisteredSoftWraps() soft wraps collection}. - * 'Target' soft wrap is the one that starts at the given offset. + * {@code 'Target'} soft wrap is the one that starts at the given offset. * * @param offset target offset * @return index that conforms to {@link Collections#binarySearch(List, Object)} contract, i.e. non-negative returned - * index points to soft wrap that starts at the given offset; '-(negative value) - 1' points + * index points to soft wrap that starts at the given offset; {@code '-(negative value) - 1'} points * to position at {@link #getRegisteredSoftWraps() soft wraps collection} where soft wrap for the given index * should be inserted */ @@ -54,8 +54,8 @@ public interface SoftWrapModelEx extends SoftWrapModel { * * @param g target graphics buffer to draw in * @param drawingType target drawing type - * @param x target 'x' coordinate to use - * @param y target 'y' coordinate to use + * @param x target {@code 'x'} coordinate to use + * @param y target {@code 'y'} coordinate to use * @param lineHeight line height used at editor * @return painted drawing width */ @@ -73,7 +73,7 @@ public interface SoftWrapModelEx extends SoftWrapModel { * Registers given listener within the current model * * @param listener listener to register - * @return true if given listener was not registered before; false otherwise + * @return {@code true} if given listener was not registered before; {@code false} otherwise */ boolean addSoftWrapChangeListener(@NotNull SoftWrapChangeListener listener); @@ -84,13 +84,13 @@ public interface SoftWrapModelEx extends SoftWrapModel { *

* The main idea of soft wraps is to avoid horizontal scrolling, so, when soft wrapping is enabled and succeeds (so that resulting * text layout fits view area's width), additional columns wont be added to the preferred editor width. - * This method answers whether the above behaviour should be overridden, and additional columns setting should be respected regardless of + * This method answers whether the above behaviour should be overridden, and additional columns setting should be respected regardless of * soft wrapping success. This happens when {@link #forceAdditionalColumnsUsage()} has been invoked previously. */ boolean isRespectAdditionalColumns(); /** - * Allows to instruct current model to return 'true' from {@link #isRespectAdditionalColumns()}. + * Allows to instruct current model to return {@code 'true'} from {@link #isRespectAdditionalColumns()}. */ void forceAdditionalColumnsUsage(); diff --git a/plugins/coverage-common/src/com/intellij/coverage/CoverageLineMarkerRenderer.java b/plugins/coverage-common/src/com/intellij/coverage/CoverageLineMarkerRenderer.java index 29e1a4062fb3..d2e3ea74c2d4 100644 --- a/plugins/coverage-common/src/com/intellij/coverage/CoverageLineMarkerRenderer.java +++ b/plugins/coverage-common/src/com/intellij/coverage/CoverageLineMarkerRenderer.java @@ -37,7 +37,6 @@ import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.editor.ex.EditorGutterComponentEx; import com.intellij.openapi.editor.impl.EditorImpl; import com.intellij.openapi.editor.markup.ActiveGutterRenderer; -import com.intellij.openapi.editor.markup.LineMarkerRendererEx; import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.options.Configurable; import com.intellij.openapi.options.SearchableConfigurable; @@ -269,6 +268,7 @@ public class CoverageLineMarkerRenderer implements ActiveGutterRenderer, LineMar return editor.getColorsScheme().getAttributes(myKey).getErrorStripeColor(); } + @NotNull @Override public Position getPosition() { return Position.LEFT;