[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:
JohnHake 2020-07-27 14:21:22 -07:00
parent ba79da41e8
commit f47a5ac1bf
28 changed files with 105 additions and 93 deletions

View File

@ -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.*'
} }

View File

@ -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.*'
} }

View File

@ -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.*'
} }

View File

@ -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.*'
} }

View File

@ -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.*'
} }

View File

@ -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());
} }
/** /**

View File

@ -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.*;

View File

@ -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.*'
} }

View File

@ -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.*'
} }

View File

@ -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 {

View File

@ -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.*'
} }

View File

@ -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");
} }
} }

View File

@ -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.*'
} }

View File

@ -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.*'
} }

View File

@ -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.*'
} }

View File

@ -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.*'
} }

View File

@ -15,12 +15,15 @@ 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();
if (sdk != null) {
String projectSDKName = sdk.getName();
String newProjectSdkName = "New Sdk Name"; String newProjectSdkName = "New Sdk Name";
ProjectRootManager.getInstance(project).setProjectSdkName(newProjectSdkName); ProjectRootManager.getInstance(project).setProjectSdkName(newProjectSdkName, sdk.getSdkType().getName());
Messages.showInfoMessage(projectSDKName + " has changed to " + newProjectSdkName, "Project Sdk Info"); Messages.showInfoMessage(projectSDKName + " has changed to " + newProjectSdkName, "Project Sdk Info");
} }
} }
}
@Override @Override
public void update(@NotNull final AnActionEvent event) { public void update(@NotNull final AnActionEvent event) {

View File

@ -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.*'
} }

View File

@ -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);
} }

View File

@ -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.*'
} }

View File

@ -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.*'
} }

View File

@ -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.*'
} }

View File

@ -12,7 +12,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 {
@ -21,6 +21,6 @@ buildSearchableOptions {
patchPluginXml { patchPluginXml {
version = project.version version = project.version
sinceBuild = '201' sinceBuild = '202'
untilBuild = '201.*' untilBuild = '202.*'
} }

View File

@ -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.*'
} }

View File

@ -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);
} }
} }

View File

@ -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;

View File

@ -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.*'
} }

View File

@ -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.*'
} }