Skip to content

Commit eca7310

Browse files
authored
Merge pull request #264 from SeeSharpSoft/fb_quickfix
[FIX] annotator fix
2 parents 822befe + 1ef88d0 commit eca7310

File tree

6 files changed

+15
-30
lines changed

6 files changed

+15
-30
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ jdk:
33
- openjdk11
44

55
env:
6-
- IDEA_VERSION=PC-2020.3.3 GRAMMAR_KIT_VERSION=2019.3
7-
- IDEA_VERSION=IU-LATEST-EAP-SNAPSHOT GRAMMAR_KIT_VERSION=2019.3
6+
- IDEA_VERSION=PC-2020.3.3 GRAMMAR_KIT_VERSION=2019.3 IDEA_SOURCES=false
7+
- IDEA_VERSION=IU-LATEST-EAP-SNAPSHOT GRAMMAR_KIT_VERSION=2019.3 IDEA_SOURCES=false
88

99
script: xvfb-run gradle check
1010

@@ -14,9 +14,9 @@ after_success:
1414
jobs:
1515
include:
1616
- if: (branch = master AND type = push) OR (type = pull_request)
17-
env: IDEA_VERSION=IC-193.5233.102 GRAMMAR_KIT_VERSION=2019.3
17+
env: IDEA_VERSION=IC-193.5233.102 GRAMMAR_KIT_VERSION=2019.3 IDEA_SOURCES=false
1818
script: xvfb-run gradle check verifyPlugin
1919
- stage: deploy
2020
if: branch IN (Testing, Staging, Stable) AND type = push
21-
env: IDEA_VERSION=IC-193.5233.102 GRAMMAR_KIT_VERSION=2019.3 JI_CHANNELS=$TRAVIS_BRANCH
21+
env: IDEA_VERSION=IC-193.5233.102 GRAMMAR_KIT_VERSION=2019.3 IDEA_SOURCES=false JI_CHANNELS=$TRAVIS_BRANCH
2222
script: xvfb-run gradle publishPlugin

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ repositories {
4242
}
4343
dependencies {
4444
implementation 'net.seesharpsoft.sharping:sharping-commons:0.21.0'
45-
compileOnly 'org.apache.ant:ant:1.7.0'
46-
testCompile 'org.mockito:mockito-core:2.28.2'
45+
compileOnly 'org.apache.ant:ant:1.10.9'
46+
testCompile 'org.mockito:mockito-core:3.8.0'
4747
}
4848
sourceSets {
4949
main {
@@ -79,11 +79,11 @@ idea {
7979
apply plugin: 'org.jetbrains.intellij'
8080
intellij {
8181
// IDE version - https://www.jetbrains.com/intellij-repository/releases
82-
version = System.getenv().getOrDefault('IDEA_VERSION', 'IU-201.6668.121')
82+
version = System.getenv().getOrDefault('IDEA_VERSION', 'IC-193.5233.102')
8383
pluginName = 'CSV Plugin'
8484
instrumentCode = true
8585
updateSinceUntilBuild = false
86-
downloadSources = false
86+
downloadSources = System.getenv().getOrDefault('IDEA_SOURCES', 'true')
8787
}
8888
publishPlugin {
8989
token = System.getenv().getOrDefault('JI_TOKEN', '')

src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvPlugin.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package net.seesharpsoft.intellij.plugins.csv;
22

33
import com.intellij.ide.actions.ShowSettingsUtilImpl;
4-
import com.intellij.ide.plugins.IdeaPluginDescriptorImpl;
5-
import com.intellij.ide.plugins.PluginManager;
4+
import com.intellij.ide.plugins.IdeaPluginDescriptor;
65
import com.intellij.ide.plugins.PluginManagerCore;
76
import com.intellij.notification.*;
87
import com.intellij.openapi.extensions.PluginId;
@@ -20,8 +19,8 @@
2019

2120
public class CsvPlugin implements StartupActivity {
2221

23-
protected static IdeaPluginDescriptorImpl getPluginDescriptor() {
24-
return (IdeaPluginDescriptorImpl)PluginManagerCore.getPlugin(PluginId.getId("net.seesharpsoft.intellij.plugins.csv"));
22+
protected static IdeaPluginDescriptor getPluginDescriptor() {
23+
return PluginManagerCore.getPlugin(PluginId.getId("net.seesharpsoft.intellij.plugins.csv"));
2524
}
2625

2726
protected static String getVersion() {

src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/CsvAnnotator.java

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,7 @@ public void annotate(@NotNull final PsiElement element, @NotNull final Annotatio
6565
textRange = TextRange.from(textRange.getStartOffset() - 1, 1);
6666
}
6767

68-
final Annotation annotation =
69-
new Annotation(
70-
textRange.getStartOffset(),
71-
textRange.getEndOffset(),
72-
CSV_COLUMN_INFO_SEVERITY,
73-
message,
74-
tooltip
75-
);
68+
final Annotation annotation = holder.createAnnotation(CSV_COLUMN_INFO_SEVERITY, textRange, message, tooltip);
7669
annotation.setEnforcedTextAttributes(
7770
CsvEditorSettings.getInstance().getValueColoring() == CsvEditorSettings.ValueColoring.RAINBOW ?
7871
CsvColorSettings.getTextAttributesOfColumn(columnInfo.getColumnIndex(), holder.getCurrentAnnotationSession()) :
@@ -106,14 +99,7 @@ protected boolean handleSeparatorElement(@NotNull PsiElement element, @NotNull A
10699
}
107100
if (textAttributes != null) {
108101
final TextRange textRange = element.getTextRange();
109-
final Annotation annotation =
110-
new Annotation(
111-
textRange.getStartOffset(),
112-
textRange.getEndOffset(),
113-
CSV_COLUMN_INFO_SEVERITY,
114-
showInfoBalloon(holder.getCurrentAnnotationSession()) ? "↹" : null,
115-
null
116-
);
102+
final Annotation annotation = holder.createAnnotation(CSV_COLUMN_INFO_SEVERITY, textRange, showInfoBalloon(holder.getCurrentAnnotationSession()) ? "↹" : null);
117103
annotation.setEnforcedTextAttributes(textAttributes);
118104
annotation.setNeedsUpdateOnTyping(false);
119105
}

src/main/java/net/seesharpsoft/intellij/plugins/psv/PsvFileType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
public final class PsvFileType extends LanguageFileType {
1111
public static final PsvFileType INSTANCE = new PsvFileType();
1212

13-
public static final Icon ICON = IconLoader.getIcon("/media/icons/psv-icon.png");
13+
public static final Icon ICON = IconLoader.getIcon("/media/icons/psv-icon.png", PsvFileType.class);
1414

1515
private PsvFileType() {
1616
super(PsvLanguage.INSTANCE);

src/main/java/net/seesharpsoft/intellij/plugins/tsv/TsvFileType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
public final class TsvFileType extends LanguageFileType {
1111
public static final TsvFileType INSTANCE = new TsvFileType();
1212

13-
public static final Icon ICON = IconLoader.getIcon("/media/icons/tsv-icon.png");
13+
public static final Icon ICON = IconLoader.getIcon("/media/icons/tsv-icon.png", TsvFileType.class);
1414

1515
private TsvFileType() {
1616
super(TsvLanguage.INSTANCE);

0 commit comments

Comments
 (0)