mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-29 09:47:50 +08:00
[2020.2 release] IJSDK-869 update intellij.version to 2020.2
Add notes about AnnotationHolder changes Update upsource links per inspections Fixes deprecation warning for AnnotationHolder Compiles, but deprecation warnings for AbstractTreeBuilder, AbstractTreeUpdater, AnnotationHolder
This commit is contained in:
parent
ba79da41e8
commit
f47a5ac1bf
@ -16,7 +16,7 @@ repositories {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
buildSearchableOptions {
|
buildSearchableOptions {
|
||||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ dependencies {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
plugins = ['java']
|
plugins = ['java']
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,6 +36,6 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ test {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
plugins = ['java']
|
plugins = ['java']
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,6 +36,6 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ repositories {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
buildSearchableOptions {
|
buildSearchableOptions {
|
||||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ repositories {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
buildSearchableOptions {
|
buildSearchableOptions {
|
||||||
@ -25,7 +25,7 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import com.intellij.facet.ui.FacetEditorTab;
|
|||||||
import com.intellij.facet.ui.FacetValidatorsManager;
|
import com.intellij.facet.ui.FacetValidatorsManager;
|
||||||
import com.intellij.openapi.options.ConfigurationException;
|
import com.intellij.openapi.options.ConfigurationException;
|
||||||
import com.intellij.openapi.util.Comparing;
|
import com.intellij.openapi.util.Comparing;
|
||||||
|
import com.intellij.openapi.util.text.StringUtil;
|
||||||
import org.jetbrains.annotations.Nls;
|
import org.jetbrains.annotations.Nls;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@ -73,7 +74,7 @@ public class DemoFacetEditorTab extends FacetEditorTab {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isModified() {
|
public boolean isModified() {
|
||||||
return !Comparing.equal(mySettings.getDemoFacetState(), myPath.getText().trim());
|
return !StringUtil.equals(mySettings.getDemoFacetState(), myPath.getText().trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
package org.intellij.sdk.facet;
|
package org.intellij.sdk.facet;
|
||||||
|
|
||||||
import com.intellij.facet.*;
|
import com.intellij.facet.*;
|
||||||
import com.intellij.openapi.module.*;
|
import com.intellij.openapi.module.Module;
|
||||||
|
import com.intellij.openapi.module.ModuleType;
|
||||||
import icons.SdkIcons;
|
import icons.SdkIcons;
|
||||||
import org.jetbrains.annotations.*;
|
import org.jetbrains.annotations.*;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ repositories {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
plugins = ['java']
|
plugins = ['java']
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,6 +26,6 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ repositories {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
buildSearchableOptions {
|
buildSearchableOptions {
|
||||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ sourceSets {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
buildSearchableOptions {
|
buildSearchableOptions {
|
||||||
@ -34,8 +34,8 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
||||||
|
|
||||||
compileKotlin {
|
compileKotlin {
|
||||||
|
@ -16,7 +16,7 @@ repositories {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
buildSearchableOptions {
|
buildSearchableOptions {
|
||||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
package org.intellij.sdk.liveTemplates;
|
package org.intellij.sdk.liveTemplates;
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.template.TemplateActionContext;
|
||||||
import com.intellij.codeInsight.template.TemplateContextType;
|
import com.intellij.codeInsight.template.TemplateContextType;
|
||||||
import com.intellij.psi.PsiFile;
|
import com.intellij.psi.PsiFile;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -12,7 +13,8 @@ public class MarkdownContext extends TemplateContextType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInContext(@NotNull PsiFile file, int offset) {
|
public boolean isInContext(@NotNull TemplateActionContext templateActionContext) {
|
||||||
return file.getName().endsWith(".md");
|
return templateActionContext.getFile().getName().endsWith(".md");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ repositories {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
buildSearchableOptions {
|
buildSearchableOptions {
|
||||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ repositories {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
buildSearchableOptions {
|
buildSearchableOptions {
|
||||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ repositories {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
type = 'PY'
|
type = 'PY'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,6 +26,6 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ repositories {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
plugins = ['java']
|
plugins = ['java']
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,6 +26,6 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,13 @@ public class ProjectSdkAction extends AnAction {
|
|||||||
public void actionPerformed(@NotNull final AnActionEvent event) {
|
public void actionPerformed(@NotNull final AnActionEvent event) {
|
||||||
Project project = event.getProject();
|
Project project = event.getProject();
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
String projectSDKName = ProjectRootManager.getInstance(project).getProjectSdkName();
|
Sdk sdk = ProjectRootManager.getInstance(project).getProjectSdk();
|
||||||
String newProjectSdkName = "New Sdk Name";
|
if (sdk != null) {
|
||||||
ProjectRootManager.getInstance(project).setProjectSdkName(newProjectSdkName);
|
String projectSDKName = sdk.getName();
|
||||||
Messages.showInfoMessage(projectSDKName + " has changed to " + newProjectSdkName, "Project Sdk Info");
|
String newProjectSdkName = "New Sdk Name";
|
||||||
|
ProjectRootManager.getInstance(project).setProjectSdkName(newProjectSdkName, sdk.getSdkType().getName());
|
||||||
|
Messages.showInfoMessage(projectSDKName + " has changed to " + newProjectSdkName, "Project Sdk Info");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ repositories {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
buildSearchableOptions {
|
buildSearchableOptions {
|
||||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
@ -11,7 +11,6 @@ import com.intellij.ide.projectView.impl.ProjectAbstractTreeStructureBase;
|
|||||||
import com.intellij.ide.projectView.impl.ProjectTreeStructure;
|
import com.intellij.ide.projectView.impl.ProjectTreeStructure;
|
||||||
import com.intellij.ide.projectView.impl.ProjectViewTree;
|
import com.intellij.ide.projectView.impl.ProjectViewTree;
|
||||||
import com.intellij.ide.util.treeView.AbstractTreeBuilder;
|
import com.intellij.ide.util.treeView.AbstractTreeBuilder;
|
||||||
import com.intellij.ide.util.treeView.AbstractTreeNode;
|
|
||||||
import com.intellij.ide.util.treeView.AbstractTreeUpdater;
|
import com.intellij.ide.util.treeView.AbstractTreeUpdater;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -75,7 +74,7 @@ public class ImagesProjectViewPane extends AbstractProjectViewPSIPane {
|
|||||||
protected ProjectAbstractTreeStructureBase createStructure() {
|
protected ProjectAbstractTreeStructureBase createStructure() {
|
||||||
return new ProjectTreeStructure(myProject, ID) {
|
return new ProjectTreeStructure(myProject, ID) {
|
||||||
@Override
|
@Override
|
||||||
protected AbstractTreeNode createRoot(@NotNull Project project, @NotNull ViewSettings settings) {
|
protected ImagesProjectNode createRoot(@NotNull Project project, @NotNull ViewSettings settings) {
|
||||||
return new ImagesProjectNode(project);
|
return new ImagesProjectNode(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ repositories {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
buildSearchableOptions {
|
buildSearchableOptions {
|
||||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
@ -16,7 +16,7 @@ repositories {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
plugins = ['java']
|
plugins = ['java']
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,6 +26,6 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ repositories {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
buildSearchableOptions {
|
buildSearchableOptions {
|
||||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'org.jetbrains.intellij' version '0.4.21'
|
id 'org.jetbrains.intellij' version '0.4.21'
|
||||||
}
|
}
|
||||||
|
|
||||||
group 'org.intellij.sdk'
|
group 'org.intellij.sdk'
|
||||||
version '0.1'
|
version '0.1'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version '2020.1'
|
version = '2020.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
buildSearchableOptions {
|
buildSearchableOptions {
|
||||||
enabled = false
|
enabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ dependencies {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
plugins = ['java']
|
plugins = ['java']
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,6 +42,6 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
||||||
|
@ -2,16 +2,22 @@
|
|||||||
|
|
||||||
package org.intellij.sdk.language;
|
package org.intellij.sdk.language;
|
||||||
|
|
||||||
import com.intellij.lang.annotation.*;
|
import com.intellij.lang.annotation.AnnotationBuilder;
|
||||||
|
import com.intellij.lang.annotation.AnnotationHolder;
|
||||||
|
import com.intellij.lang.annotation.Annotator;
|
||||||
|
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.openapi.util.TextRange;
|
import com.intellij.openapi.util.TextRange;
|
||||||
import com.intellij.psi.*;
|
import com.intellij.psi.PsiElement;
|
||||||
|
import com.intellij.psi.PsiLiteralExpression;
|
||||||
import org.intellij.sdk.language.psi.SimpleProperty;
|
import org.intellij.sdk.language.psi.SimpleProperty;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.intellij.lang.annotation.HighlightSeverity.ERROR;
|
||||||
|
import static com.intellij.lang.annotation.HighlightSeverity.INFORMATION;
|
||||||
|
|
||||||
|
|
||||||
public class SimpleAnnotator implements Annotator {
|
public class SimpleAnnotator implements Annotator {
|
||||||
// Define strings for the Simple language prefix - used for annotations, line markers, etc.
|
// Define strings for the Simple language prefix - used for annotations, line markers, etc.
|
||||||
@ -40,21 +46,21 @@ public class SimpleAnnotator implements Annotator {
|
|||||||
Project project = element.getProject();
|
Project project = element.getProject();
|
||||||
List<SimpleProperty> properties = SimpleUtil.findProperties(project, possibleProperties);
|
List<SimpleProperty> properties = SimpleUtil.findProperties(project, possibleProperties);
|
||||||
|
|
||||||
// Set the annotations using the text ranges.
|
// Set the annotations using the text ranges - Normally there would be one range, set by the element itself.
|
||||||
Annotation keyAnnotation = holder.createInfoAnnotation(prefixRange, null);
|
holder.newAnnotation(INFORMATION, "").range(prefixRange).textAttributes(DefaultLanguageHighlighterColors.KEYWORD).create();
|
||||||
keyAnnotation.setTextAttributes(DefaultLanguageHighlighterColors.KEYWORD);
|
holder.newAnnotation(INFORMATION, "").range(separatorRange).textAttributes(SimpleSyntaxHighlighter.SEPARATOR).create();
|
||||||
Annotation separatorAnnotation = holder.createInfoAnnotation(separatorRange, null);
|
|
||||||
separatorAnnotation.setTextAttributes(SimpleSyntaxHighlighter.SEPARATOR);
|
|
||||||
if (properties.isEmpty()) {
|
if (properties.isEmpty()) {
|
||||||
// No well-formed property found following the key-separator
|
// No well-formed property found following the key-separator
|
||||||
Annotation badProperty = holder.createErrorAnnotation(keyRange, "Unresolved property");
|
AnnotationBuilder builder = holder.newAnnotation(ERROR, "Unresolved property").range(keyRange);
|
||||||
badProperty.setTextAttributes(SimpleSyntaxHighlighter.BAD_CHARACTER);
|
// Force the text attributes to Simple syntax bad character
|
||||||
|
builder.textAttributes(SimpleSyntaxHighlighter.BAD_CHARACTER);
|
||||||
// ** Tutorial step 18.3 - Add a quick fix for the string containing possible properties
|
// ** Tutorial step 18.3 - Add a quick fix for the string containing possible properties
|
||||||
badProperty.registerFix(new SimpleCreatePropertyQuickFix(possibleProperties));
|
builder.withFix(new SimpleCreatePropertyQuickFix(possibleProperties));
|
||||||
|
// Finish creating new annotation
|
||||||
|
builder.create();
|
||||||
} else {
|
} else {
|
||||||
// Found at least one property
|
// Found at least one property, force the text attributes to Simple syntax value character
|
||||||
Annotation annotation = holder.createInfoAnnotation(keyRange, null);
|
holder.newAnnotation(INFORMATION, "").range(keyRange).textAttributes(SimpleSyntaxHighlighter.VALUE).create();
|
||||||
annotation.setTextAttributes(SimpleSyntaxHighlighter.VALUE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import java.util.*;
|
|||||||
public class SimpleLineMarkerProvider extends RelatedItemLineMarkerProvider {
|
public class SimpleLineMarkerProvider extends RelatedItemLineMarkerProvider {
|
||||||
@Override
|
@Override
|
||||||
protected void collectNavigationMarkers( @NotNull PsiElement element,
|
protected void collectNavigationMarkers( @NotNull PsiElement element,
|
||||||
@NotNull Collection< ? super RelatedItemLineMarkerInfo > result ) {
|
@NotNull Collection< ? super RelatedItemLineMarkerInfo<?> > result ) {
|
||||||
// This must be an element with a literal expression as a parent
|
// This must be an element with a literal expression as a parent
|
||||||
if ( !(element instanceof PsiJavaTokenImpl) || !(element.getParent() instanceof PsiLiteralExpression) ) return;
|
if ( !(element instanceof PsiJavaTokenImpl) || !(element.getParent() instanceof PsiLiteralExpression) ) return;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ repositories {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
buildSearchableOptions {
|
buildSearchableOptions {
|
||||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ repositories {
|
|||||||
|
|
||||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||||
intellij {
|
intellij {
|
||||||
version = '2020.1'
|
version = '2020.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
buildSearchableOptions {
|
buildSearchableOptions {
|
||||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
version = project.version
|
version = project.version
|
||||||
sinceBuild = '201'
|
sinceBuild = '202'
|
||||||
untilBuild = '201.*'
|
untilBuild = '202.*'
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user