mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-27 16:57:49 +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/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
}
|
||||
|
||||
buildSearchableOptions {
|
||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ dependencies {
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
plugins = ['java']
|
||||
}
|
||||
|
||||
@ -36,6 +36,6 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ test {
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
plugins = ['java']
|
||||
}
|
||||
|
||||
@ -36,6 +36,6 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ repositories {
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
}
|
||||
|
||||
buildSearchableOptions {
|
||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ repositories {
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
}
|
||||
|
||||
buildSearchableOptions {
|
||||
@ -25,7 +25,7 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import com.intellij.facet.ui.FacetEditorTab;
|
||||
import com.intellij.facet.ui.FacetValidatorsManager;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -73,7 +74,7 @@ public class DemoFacetEditorTab extends FacetEditorTab {
|
||||
*/
|
||||
@Override
|
||||
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;
|
||||
|
||||
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 org.jetbrains.annotations.*;
|
||||
|
||||
|
@ -16,7 +16,7 @@ repositories {
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
plugins = ['java']
|
||||
}
|
||||
|
||||
@ -26,6 +26,6 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ repositories {
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
}
|
||||
|
||||
buildSearchableOptions {
|
||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ sourceSets {
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
}
|
||||
|
||||
buildSearchableOptions {
|
||||
@ -34,8 +34,8 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
|
@ -16,7 +16,7 @@ repositories {
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
}
|
||||
|
||||
buildSearchableOptions {
|
||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
|
||||
package org.intellij.sdk.liveTemplates;
|
||||
|
||||
import com.intellij.codeInsight.template.TemplateActionContext;
|
||||
import com.intellij.codeInsight.template.TemplateContextType;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -12,7 +13,8 @@ public class MarkdownContext extends TemplateContextType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInContext(@NotNull PsiFile file, int offset) {
|
||||
return file.getName().endsWith(".md");
|
||||
public boolean isInContext(@NotNull TemplateActionContext templateActionContext) {
|
||||
return templateActionContext.getFile().getName().endsWith(".md");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ repositories {
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
}
|
||||
|
||||
buildSearchableOptions {
|
||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ repositories {
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
}
|
||||
|
||||
buildSearchableOptions {
|
||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ repositories {
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
type = 'PY'
|
||||
}
|
||||
|
||||
@ -26,6 +26,6 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ repositories {
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
plugins = ['java']
|
||||
}
|
||||
|
||||
@ -26,6 +26,6 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
||||
|
@ -15,10 +15,13 @@ public class ProjectSdkAction extends AnAction {
|
||||
public void actionPerformed(@NotNull final AnActionEvent event) {
|
||||
Project project = event.getProject();
|
||||
if (project != null) {
|
||||
String projectSDKName = ProjectRootManager.getInstance(project).getProjectSdkName();
|
||||
String newProjectSdkName = "New Sdk Name";
|
||||
ProjectRootManager.getInstance(project).setProjectSdkName(newProjectSdkName);
|
||||
Messages.showInfoMessage(projectSDKName + " has changed to " + newProjectSdkName, "Project Sdk Info");
|
||||
Sdk sdk = ProjectRootManager.getInstance(project).getProjectSdk();
|
||||
if (sdk != null) {
|
||||
String projectSDKName = sdk.getName();
|
||||
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/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
}
|
||||
|
||||
buildSearchableOptions {
|
||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
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.ProjectViewTree;
|
||||
import com.intellij.ide.util.treeView.AbstractTreeBuilder;
|
||||
import com.intellij.ide.util.treeView.AbstractTreeNode;
|
||||
import com.intellij.ide.util.treeView.AbstractTreeUpdater;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -75,7 +74,7 @@ public class ImagesProjectViewPane extends AbstractProjectViewPSIPane {
|
||||
protected ProjectAbstractTreeStructureBase createStructure() {
|
||||
return new ProjectTreeStructure(myProject, ID) {
|
||||
@Override
|
||||
protected AbstractTreeNode createRoot(@NotNull Project project, @NotNull ViewSettings settings) {
|
||||
protected ImagesProjectNode createRoot(@NotNull Project project, @NotNull ViewSettings settings) {
|
||||
return new ImagesProjectNode(project);
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ repositories {
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
}
|
||||
|
||||
buildSearchableOptions {
|
||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
@ -16,7 +16,7 @@ repositories {
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
plugins = ['java']
|
||||
}
|
||||
|
||||
@ -26,6 +26,6 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ repositories {
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
}
|
||||
|
||||
buildSearchableOptions {
|
||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
||||
|
@ -1,26 +1,26 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.jetbrains.intellij' version '0.4.21'
|
||||
id 'java'
|
||||
id 'org.jetbrains.intellij' version '0.4.21'
|
||||
}
|
||||
|
||||
group 'org.intellij.sdk'
|
||||
version '0.1'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version '2020.1'
|
||||
version = '2020.2'
|
||||
}
|
||||
|
||||
buildSearchableOptions {
|
||||
enabled = false
|
||||
enabled = false
|
||||
}
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
version = project.version
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ dependencies {
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
plugins = ['java']
|
||||
}
|
||||
|
||||
@ -42,6 +42,6 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
||||
|
@ -2,16 +2,22 @@
|
||||
|
||||
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.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.jetbrains.annotations.NotNull;
|
||||
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
|
||||
|
||||
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 {
|
||||
// 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();
|
||||
List<SimpleProperty> properties = SimpleUtil.findProperties(project, possibleProperties);
|
||||
|
||||
// Set the annotations using the text ranges.
|
||||
Annotation keyAnnotation = holder.createInfoAnnotation(prefixRange, null);
|
||||
keyAnnotation.setTextAttributes(DefaultLanguageHighlighterColors.KEYWORD);
|
||||
Annotation separatorAnnotation = holder.createInfoAnnotation(separatorRange, null);
|
||||
separatorAnnotation.setTextAttributes(SimpleSyntaxHighlighter.SEPARATOR);
|
||||
// Set the annotations using the text ranges - Normally there would be one range, set by the element itself.
|
||||
holder.newAnnotation(INFORMATION, "").range(prefixRange).textAttributes(DefaultLanguageHighlighterColors.KEYWORD).create();
|
||||
holder.newAnnotation(INFORMATION, "").range(separatorRange).textAttributes(SimpleSyntaxHighlighter.SEPARATOR).create();
|
||||
if (properties.isEmpty()) {
|
||||
// No well-formed property found following the key-separator
|
||||
Annotation badProperty = holder.createErrorAnnotation(keyRange, "Unresolved property");
|
||||
badProperty.setTextAttributes(SimpleSyntaxHighlighter.BAD_CHARACTER);
|
||||
AnnotationBuilder builder = holder.newAnnotation(ERROR, "Unresolved property").range(keyRange);
|
||||
// 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
|
||||
badProperty.registerFix(new SimpleCreatePropertyQuickFix(possibleProperties));
|
||||
builder.withFix(new SimpleCreatePropertyQuickFix(possibleProperties));
|
||||
// Finish creating new annotation
|
||||
builder.create();
|
||||
} else {
|
||||
// Found at least one property
|
||||
Annotation annotation = holder.createInfoAnnotation(keyRange, null);
|
||||
annotation.setTextAttributes(SimpleSyntaxHighlighter.VALUE);
|
||||
// Found at least one property, force the text attributes to Simple syntax value character
|
||||
holder.newAnnotation(INFORMATION, "").range(keyRange).textAttributes(SimpleSyntaxHighlighter.VALUE).create();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ import java.util.*;
|
||||
public class SimpleLineMarkerProvider extends RelatedItemLineMarkerProvider {
|
||||
@Override
|
||||
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
|
||||
if ( !(element instanceof PsiJavaTokenImpl) || !(element.getParent() instanceof PsiLiteralExpression) ) return;
|
||||
|
||||
|
@ -16,7 +16,7 @@ repositories {
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
}
|
||||
|
||||
buildSearchableOptions {
|
||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ repositories {
|
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/
|
||||
intellij {
|
||||
version = '2020.1'
|
||||
version = '2020.2'
|
||||
}
|
||||
|
||||
buildSearchableOptions {
|
||||
@ -25,6 +25,6 @@ buildSearchableOptions {
|
||||
|
||||
patchPluginXml {
|
||||
version = project.version
|
||||
sinceBuild = '201'
|
||||
untilBuild = '201.*'
|
||||
sinceBuild = '202'
|
||||
untilBuild = '202.*'
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user