mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-27 08:47:50 +08:00
2024.1 Release: update pages, extension point lists, code samples, etc. (#1265)
This commit is contained in:
parent
5efa9a2a86
commit
3e9f33b1cb
@ -18,7 +18,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
}
|
||||
|
||||
tasks {
|
||||
@ -28,7 +28,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
plugins.set(listOf("com.intellij.java"))
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
plugins.set(listOf("com.intellij.java"))
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
}
|
||||
|
||||
tasks {
|
||||
@ -28,7 +28,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
}
|
||||
|
||||
tasks {
|
||||
@ -28,7 +28,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.facet;
|
||||
|
||||
@ -9,7 +9,6 @@ import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import icons.SdkIcons;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@ -46,7 +45,6 @@ final class DemoFacetType extends FacetType<DemoFacet, DemoFacetConfiguration> {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return SdkIcons.Sdk_default_icon;
|
||||
|
@ -18,7 +18,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
plugins.set(listOf("com.intellij.java"))
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
}
|
||||
|
||||
tasks {
|
||||
@ -29,8 +29,8 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
|
@ -18,7 +18,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
}
|
||||
|
||||
tasks {
|
||||
@ -28,7 +28,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.liveTemplates;
|
||||
|
||||
@ -27,7 +27,7 @@ final class TitleCaseMacro extends MacroBase {
|
||||
if (text == null) {
|
||||
return null;
|
||||
}
|
||||
if (text.length() > 0) {
|
||||
if (!text.isEmpty()) {
|
||||
// Capitalize the start of every word
|
||||
text = StringUtil.toTitleCase(text);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
plugins {
|
||||
id("java")
|
||||
id("org.jetbrains.intellij") version "1.17.3"
|
||||
id("org.jetbrains.kotlin.jvm") version "1.9.23"
|
||||
}
|
||||
|
||||
group = "org.intellij.sdk"
|
||||
@ -18,7 +19,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
}
|
||||
|
||||
tasks {
|
||||
@ -28,7 +29,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.maxOpenProjects;
|
||||
|
||||
@ -14,11 +14,6 @@ public class ProjectCloseListener implements ProjectManagerListener {
|
||||
|
||||
@Override
|
||||
public void projectClosed(@NotNull Project project) {
|
||||
// Ensure this isn't part of testing
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the counting service
|
||||
ProjectCountingService projectCountingService =
|
||||
ApplicationManager.getApplication().getService(ProjectCountingService.class);
|
||||
|
@ -1,41 +0,0 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.maxOpenProjects;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.startup.StartupActivity;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Invoked on opening a project.
|
||||
*/
|
||||
final class ProjectOpenStartupActivity implements StartupActivity.DumbAware {
|
||||
|
||||
@Override
|
||||
public void runActivity(@NotNull Project project) {
|
||||
// Ensure this isn't part of testing
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the counting service
|
||||
ProjectCountingService projectCountingService =
|
||||
ApplicationManager.getApplication().getService(ProjectCountingService.class);
|
||||
// Increment the project count
|
||||
projectCountingService.increaseOpenProjectCount();
|
||||
|
||||
// See if the total # of projects violates the limit.
|
||||
if (projectCountingService.isOpenProjectsLimitExceeded()) {
|
||||
// Transitioned to outside the limit
|
||||
String title = String.format("Opening Project \"%s\"", project.getName());
|
||||
String message = "<br>The number of open projects exceeds the SDK plugin max_opened_projects limit.<br><br>";
|
||||
|
||||
ApplicationManager.getApplication().invokeLater(() ->
|
||||
Messages.showMessageDialog(project, message, title, Messages.getInformationIcon())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.intellij.sdk.maxOpenProjects
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.project.DumbAware
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.startup.ProjectActivity
|
||||
import com.intellij.openapi.ui.Messages
|
||||
|
||||
/**
|
||||
* Invoked on opening a project.
|
||||
*/
|
||||
internal class ProjectOpenStartupActivity : ProjectActivity, DumbAware {
|
||||
override suspend fun execute(project: Project) {
|
||||
val application = ApplicationManager.getApplication()
|
||||
val projectCountingService = application.getService(ProjectCountingService::class.java)
|
||||
projectCountingService.increaseOpenProjectCount()
|
||||
if (projectCountingService.isOpenProjectsLimitExceeded) {
|
||||
application.invokeLater {
|
||||
Messages.showMessageDialog(
|
||||
project,
|
||||
"The number of open projects exceeded the limit while opening the '${project.name}' project.",
|
||||
"Open Projects Limit Exceeded",
|
||||
Messages.getInformationIcon()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
}
|
||||
|
||||
tasks {
|
||||
@ -28,7 +28,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.module;
|
||||
|
||||
@ -6,6 +6,7 @@ import com.intellij.ide.util.projectWizard.ModuleBuilder;
|
||||
import com.intellij.ide.util.projectWizard.ModuleWizardStep;
|
||||
import com.intellij.ide.util.projectWizard.WizardContext;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@ -17,7 +18,7 @@ public class DemoModuleBuilder extends ModuleBuilder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DemoModuleType getModuleType() {
|
||||
public ModuleType<DemoModuleBuilder> getModuleType() {
|
||||
return DemoModuleType.getInstance();
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
plugins.set(listOf("com.intellij.java"))
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.project.model;
|
||||
|
||||
@ -62,8 +62,7 @@ public class LibrariesAction extends AnAction {
|
||||
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
|
||||
StringBuilder jars = new StringBuilder();
|
||||
for (OrderEntry orderEntry : fileIndex.getOrderEntriesForFile(virtualFile)) {
|
||||
if (orderEntry instanceof LibraryOrderEntry) {
|
||||
final LibraryOrderEntry libraryEntry = (LibraryOrderEntry) orderEntry;
|
||||
if (orderEntry instanceof LibraryOrderEntry libraryEntry) {
|
||||
final Library library = libraryEntry.getLibrary();
|
||||
if (library == null) {
|
||||
continue;
|
||||
@ -79,7 +78,7 @@ public class LibrariesAction extends AnAction {
|
||||
}
|
||||
String fileAndLibs;
|
||||
if (jars.length() > 0) {
|
||||
fileAndLibs = virtualFile.getName() + ": " + jars.toString();
|
||||
fileAndLibs = virtualFile.getName() + ": " + jars;
|
||||
} else {
|
||||
fileAndLibs = "None";
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.project.model;
|
||||
|
||||
@ -32,7 +32,7 @@ public class ShowSourceRootsActions extends AnAction {
|
||||
sourceRootsList.append(file.getUrl()).append("\n");
|
||||
}
|
||||
Messages.showInfoMessage(
|
||||
"Source roots for the " + projectName + " plugin:\n" + sourceRootsList.toString(),
|
||||
"Source roots for the " + projectName + " plugin:\n" + sourceRootsList,
|
||||
"Project Properties"
|
||||
);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
}
|
||||
|
||||
tasks {
|
||||
@ -28,7 +28,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
}
|
||||
|
||||
tasks {
|
||||
@ -28,7 +28,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
plugins.set(listOf("com.intellij.java"))
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
}
|
||||
|
||||
tasks {
|
||||
@ -28,7 +28,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
}
|
||||
|
||||
tasks {
|
||||
@ -28,7 +28,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.settings;
|
||||
|
||||
@ -8,7 +8,6 @@ import com.intellij.openapi.components.State;
|
||||
import com.intellij.openapi.components.Storage;
|
||||
import com.intellij.util.xmlb.XmlSerializerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Supports storing the application settings in a persistent way.
|
||||
@ -28,7 +27,6 @@ final class AppSettingsState implements PersistentStateComponent<AppSettingsStat
|
||||
return ApplicationManager.getApplication().getService(AppSettingsState.class);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public AppSettingsState getState() {
|
||||
return this;
|
||||
|
@ -31,7 +31,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
plugins.set(listOf("com.intellij.java"))
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.language;
|
||||
|
||||
@ -10,7 +10,6 @@ import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsProvider;
|
||||
import com.intellij.psi.codeStyle.CustomCodeStyleSettings;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
final class SimpleCodeStyleSettingsProvider extends CodeStyleSettingsProvider {
|
||||
|
||||
@ -19,7 +18,6 @@ final class SimpleCodeStyleSettingsProvider extends CodeStyleSettingsProvider {
|
||||
return new SimpleCodeStyleSettings(settings);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getConfigurableDisplayName() {
|
||||
return "Simple";
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.language;
|
||||
|
||||
@ -22,7 +22,6 @@ final class SimpleColorSettingsPage implements ColorSettingsPage {
|
||||
new AttributesDescriptor("Bad value", SimpleSyntaxHighlighter.BAD_CHARACTER)
|
||||
};
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return SimpleIcons.FILE;
|
||||
@ -37,18 +36,19 @@ final class SimpleColorSettingsPage implements ColorSettingsPage {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getDemoText() {
|
||||
return "# You are reading the \".properties\" entry.\n" +
|
||||
"! The exclamation mark can also mark text as comments.\n" +
|
||||
"website = https://en.wikipedia.org/\n" +
|
||||
"language = English\n" +
|
||||
"# The backslash below tells the application to continue reading\n" +
|
||||
"# the value onto the next line.\n" +
|
||||
"message = Welcome to \\\n" +
|
||||
" Wikipedia!\n" +
|
||||
"# Add spaces to the key\n" +
|
||||
"key\\ with\\ spaces = This is the value that could be looked up with the key \"key with spaces\".\n" +
|
||||
"# Unicode\n" +
|
||||
"tab : \\u0009";
|
||||
return """
|
||||
# You are reading the ".properties" entry.
|
||||
! The exclamation mark can also mark text as comments.
|
||||
website = https://en.wikipedia.org/
|
||||
language = English
|
||||
# The backslash below tells the application to continue reading
|
||||
# the value onto the next line.
|
||||
message = Welcome to \\
|
||||
Wikipedia!
|
||||
# Add spaces to the key
|
||||
key\\ with\\ spaces = This is the value that could be looked up with the key "key with spaces".
|
||||
# Unicode
|
||||
tab : \\u0009""";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.language;
|
||||
|
||||
@ -7,13 +7,11 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
final class SimpleCommenter implements Commenter {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getLineCommentPrefix() {
|
||||
return "#";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getBlockCommentPrefix() {
|
||||
return "";
|
||||
|
@ -1,10 +1,9 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.language;
|
||||
|
||||
import com.intellij.openapi.fileTypes.LanguageFileType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@ -34,7 +33,6 @@ public final class SimpleFileType extends LanguageFileType {
|
||||
return "simple";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return SimpleIcons.FILE;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.language;
|
||||
|
||||
@ -15,7 +15,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
final class SimpleFindUsagesProvider implements FindUsagesProvider {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public WordsScanner getWordsScanner() {
|
||||
return new DefaultWordsScanner(new SimpleLexerAdapter(),
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.language;
|
||||
|
||||
@ -27,7 +27,9 @@ import java.util.List;
|
||||
final class SimpleFoldingBuilder extends FoldingBuilderEx implements DumbAware {
|
||||
|
||||
@Override
|
||||
public FoldingDescriptor @NotNull [] buildFoldRegions(@NotNull PsiElement root, @NotNull Document document, boolean quick) {
|
||||
public FoldingDescriptor @NotNull [] buildFoldRegions(@NotNull PsiElement root,
|
||||
@NotNull Document document,
|
||||
boolean quick) {
|
||||
// Initialize the group of folding regions that will expand/collapse together.
|
||||
FoldingGroup group = FoldingGroup.newGroup(SimpleAnnotator.SIMPLE_PREFIX_STR);
|
||||
// Initialize the list of folding regions
|
||||
@ -40,7 +42,8 @@ final class SimpleFoldingBuilder extends FoldingBuilderEx implements DumbAware {
|
||||
super.visitLiteralExpression(literalExpression);
|
||||
|
||||
String value = PsiLiteralUtil.getStringLiteralContent(literalExpression);
|
||||
if (value != null && value.startsWith(SimpleAnnotator.SIMPLE_PREFIX_STR + SimpleAnnotator.SIMPLE_SEPARATOR_STR)) {
|
||||
if (value != null &&
|
||||
value.startsWith(SimpleAnnotator.SIMPLE_PREFIX_STR + SimpleAnnotator.SIMPLE_SEPARATOR_STR)) {
|
||||
Project project = literalExpression.getProject();
|
||||
String key = value.substring(
|
||||
SimpleAnnotator.SIMPLE_PREFIX_STR.length() + SimpleAnnotator.SIMPLE_SEPARATOR_STR.length()
|
||||
@ -58,7 +61,7 @@ final class SimpleFoldingBuilder extends FoldingBuilderEx implements DumbAware {
|
||||
}
|
||||
});
|
||||
|
||||
return descriptors.toArray(FoldingDescriptor.EMPTY);
|
||||
return descriptors.toArray(FoldingDescriptor.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -95,7 +98,9 @@ final class SimpleFoldingBuilder extends FoldingBuilderEx implements DumbAware {
|
||||
return StringUtil.THREE_DOTS;
|
||||
}
|
||||
|
||||
return propertyValue.replaceAll("\n", "\\n").replaceAll("\"", "\\\\\"");
|
||||
return propertyValue
|
||||
.replaceAll("\n", "\\n")
|
||||
.replaceAll("\"", "\\\\\"");
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.language;
|
||||
|
||||
@ -27,19 +27,20 @@ final class SimpleLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSet
|
||||
|
||||
@Override
|
||||
public String getCodeSample(@NotNull SettingsType settingsType) {
|
||||
return "# You are reading the \".properties\" entry.\n" +
|
||||
"! The exclamation mark can also mark text as comments.\n" +
|
||||
"website = https://en.wikipedia.org/\n" +
|
||||
"\n" +
|
||||
"language = English\n" +
|
||||
"# The backslash below tells the application to continue reading\n" +
|
||||
"# the value onto the next line.\n" +
|
||||
"message = Welcome to \\\n" +
|
||||
" Wikipedia!\n" +
|
||||
"# Add spaces to the key\n" +
|
||||
"key\\ with\\ spaces = This is the value that could be looked up with the key \"key with spaces\".\n" +
|
||||
"# Unicode\n" +
|
||||
"tab : \\u0009";
|
||||
return """
|
||||
# You are reading the ".properties" entry.
|
||||
! The exclamation mark can also mark text as comments.
|
||||
website = https://en.wikipedia.org/
|
||||
|
||||
language = English
|
||||
# The backslash below tells the application to continue reading
|
||||
# the value onto the next line.
|
||||
message = Welcome to \\
|
||||
Wikipedia!
|
||||
# Add spaces to the key
|
||||
key\\ with\\ spaces = This is the value that could be looked up with the key "key with spaces".
|
||||
# Unicode
|
||||
tab : \\u0009""";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.language;
|
||||
|
||||
@ -21,12 +21,11 @@ final class SimpleLineMarkerProvider extends RelatedItemLineMarkerProvider {
|
||||
protected void collectNavigationMarkers(@NotNull PsiElement element,
|
||||
@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)) {
|
||||
if (!(element instanceof PsiJavaTokenImpl) || !(element.getParent() instanceof PsiLiteralExpression literalExpression)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The literal expression must start with the Simple language literal expression
|
||||
PsiLiteralExpression literalExpression = (PsiLiteralExpression) element.getParent();
|
||||
String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null;
|
||||
if ((value == null) ||
|
||||
!value.startsWith(SimpleAnnotator.SIMPLE_PREFIX_STR + SimpleAnnotator.SIMPLE_SEPARATOR_STR)) {
|
||||
@ -39,7 +38,7 @@ final class SimpleLineMarkerProvider extends RelatedItemLineMarkerProvider {
|
||||
SimpleAnnotator.SIMPLE_PREFIX_STR.length() + SimpleAnnotator.SIMPLE_SEPARATOR_STR.length()
|
||||
);
|
||||
final List<SimpleProperty> properties = SimpleUtil.findProperties(project, possibleProperties);
|
||||
if (properties.size() > 0) {
|
||||
if (!properties.isEmpty()) {
|
||||
// Add the property to a collection of line marker info
|
||||
NavigationGutterIconBuilder<PsiElement> builder =
|
||||
NavigationGutterIconBuilder.create(SimpleIcons.FILE)
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.language;
|
||||
|
||||
@ -47,7 +47,7 @@ final class SimpleReference extends PsiReferenceBase<PsiElement> implements PsiP
|
||||
List<SimpleProperty> properties = SimpleUtil.findProperties(project);
|
||||
List<LookupElement> variants = new ArrayList<>();
|
||||
for (final SimpleProperty property : properties) {
|
||||
if (property.getKey() != null && property.getKey().length() > 0) {
|
||||
if (property.getKey() != null && !property.getKey().isEmpty()) {
|
||||
variants.add(LookupElementBuilder
|
||||
.create(property).withIcon(SimpleIcons.FILE)
|
||||
.withTypeText(property.getContainingFile().getName())
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.language;
|
||||
|
||||
@ -34,7 +34,7 @@ final class SimpleSpellcheckingStrategy extends SpellcheckingStrategy {
|
||||
private static class SimpleCommentTokenizer extends Tokenizer<PsiComment> {
|
||||
|
||||
@Override
|
||||
public void tokenize(@NotNull PsiComment element, TokenConsumer consumer) {
|
||||
public void tokenize(@NotNull PsiComment element, @NotNull TokenConsumer consumer) {
|
||||
// Exclude the start of the comment with its # characters from spell checking
|
||||
int startIndex = 0;
|
||||
for (char c : element.textToCharArray()) {
|
||||
@ -53,7 +53,7 @@ final class SimpleSpellcheckingStrategy extends SpellcheckingStrategy {
|
||||
|
||||
private static class SimplePropertyTokenizer extends Tokenizer<SimpleProperty> {
|
||||
|
||||
public void tokenize(@NotNull SimpleProperty element, TokenConsumer consumer) {
|
||||
public void tokenize(@NotNull SimpleProperty element, @NotNull TokenConsumer consumer) {
|
||||
//Spell check the keys and values of properties with different splitters
|
||||
final ASTNode key = element.getNode().findChildByType(SimpleTypes.KEY);
|
||||
if (key != null && key.getTextLength() > 0) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.language;
|
||||
|
||||
@ -13,7 +13,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
final class SimpleStructureViewFactory implements PsiStructureViewFactory {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public StructureViewBuilder getStructureViewBuilder(@NotNull final PsiFile psiFile) {
|
||||
return new TreeBasedStructureViewBuilder() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.language;
|
||||
|
||||
@ -13,7 +13,6 @@ import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.intellij.sdk.language.psi.SimpleProperty;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -49,7 +48,7 @@ public class SimpleCodeInsightTest extends LightJavaCodeInsightFixtureTestCase {
|
||||
WriteCommandAction.writeCommandAction(getProject()).run(() ->
|
||||
CodeStyleManager.getInstance(getProject()).reformatText(
|
||||
myFixture.getFile(),
|
||||
ContainerUtil.newArrayList(myFixture.getFile().getTextRange())
|
||||
List.of(myFixture.getFile().getTextRange())
|
||||
)
|
||||
);
|
||||
myFixture.checkResultByFile("DefaultTestData.simple");
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.intellij.sdk.language;
|
||||
|
||||
@ -22,11 +22,6 @@ public class SimpleParsingTest extends ParsingTestCase {
|
||||
return "src/test/testData";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean skipSpaces() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean includeRanges() {
|
||||
return true;
|
||||
|
@ -18,7 +18,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
}
|
||||
|
||||
tasks {
|
||||
@ -28,7 +28,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ java {
|
||||
|
||||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
|
||||
intellij {
|
||||
version.set("2023.1.5")
|
||||
version.set("2023.2.6")
|
||||
}
|
||||
|
||||
tasks {
|
||||
@ -28,7 +28,7 @@ tasks {
|
||||
|
||||
patchPluginXml {
|
||||
version.set("${project.version}")
|
||||
sinceBuild.set("231")
|
||||
untilBuild.set("233.*")
|
||||
sinceBuild.set("232")
|
||||
untilBuild.set("241.*")
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user