Skip to content

Commit

Permalink
add OptionPages sample
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoch committed May 30, 2024
1 parent 5927988 commit 022b7a6
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 19 deletions.
1 change: 1 addition & 0 deletions .github/workflows/samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
'ContextActions',
'InlayHints',
'Notifications',
'OptionPages',
'PostfixTemplates'
]
runs-on: windows-latest
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion samples/OptionPages/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions samples/OptionPages/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import org.apache.tools.ant.taskdefs.condition.Os

plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.9.21'
id 'org.jetbrains.intellij' version '1.16.1' // See https://github.com/JetBrains/gradle-intellij-plugin/releases
id 'org.jetbrains.kotlin.jvm' version '2.0.0'
id 'org.jetbrains.intellij' version '1.17.0' // See https://github.com/JetBrains/gradle-intellij-plugin/releases
id 'com.jetbrains.rdgen' version '2023.3.2' // See https://github.com/JetBrains/rd/releases
id 'me.filippov.gradle.jvm.wrapper' version '0.14.0'
}
Expand Down Expand Up @@ -208,7 +208,7 @@ prepareSandbox {
}

publishPlugin {
dependsOn testDotNet
// dependsOn testDotNet
dependsOn buildPlugin
token = "${PublishToken}"

Expand Down
2 changes: 1 addition & 1 deletion samples/OptionPages/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ PublishToken="_PLACEHOLDER_"
# Release: 2020.2
# EAP: 2020.3-EAP2-SNAPSHOT
# Nightly: 2020.3-SNAPSHOT
ProductVersion=2023.3
ProductVersion=2024.1

# Kotlin 1.4 will bundle the stdlib dependency by default, causing problems with the version bundled with the IDE
# https://blog.jetbrains.com/kotlin/2020/07/kotlin-1-4-rc-released/#stdlib-default
Expand Down
2 changes: 1 addition & 1 deletion samples/OptionPages/runVisualStudio.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if (!(Test-Path "$UserProjectXmlFile")) {
# Adapt user project file
$HostIdentifier = "$($InstallationDirectory.Parent.Name)_$($InstallationDirectory.Name.Split('_')[-1])"

Set-Content -Path "$UserProjectXmlFile" -Value "<Project><PropertyGroup><HostFullIdentifier></HostFullIdentifier></PropertyGroup></Project>"
Set-Content -Path "$UserProjectXmlFile" -Value "<Project><PropertyGroup Condition=`"'`$(MSBuildRuntimeType)' == 'Full'`"><HostFullIdentifier></HostFullIdentifier></PropertyGroup></Project>"

$ProjectXml = [xml] (Get-Content "$UserProjectXmlFile")
$HostIdentifierNode = $ProjectXml.SelectSingleNode(".//HostFullIdentifier")
Expand Down
6 changes: 6 additions & 0 deletions samples/OptionPages/src/dotnet/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,10 @@
<EmbeddedResource Include="*.DotSettings" />
</ItemGroup>

<ItemDefinitionGroup>
<EmbeddedResource>
<Generator>JetResourceGenerator</Generator>
</EmbeddedResource>
</ItemDefinitionGroup>

</Project>
2 changes: 1 addition & 1 deletion samples/OptionPages/src/dotnet/Plugin.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<PropertyGroup>
<SdkVersion>2023.3.0</SdkVersion>
<SdkVersion>2024.1.0</SdkVersion>

<Title>ReSharper SDK – Options</Title>
<Description>Adds an option page to the settings dialog.</Description>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.jetbrains.rider.plugins.samples

import com.intellij.DynamicBundle
import org.jetbrains.annotations.Nls
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey

class OptionPagesBundle : DynamicBundle(BUNDLE) {
companion object {
@NonNls
private const val BUNDLE = "messages.OptionPagesBundle"
private val INSTANCE: OptionPagesBundle = OptionPagesBundle()

@Nls
fun message(
@PropertyKey(resourceBundle = BUNDLE) key: String,
vararg params: Any
): String {
return INSTANCE.getMessage(key, *params)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package com.jetbrains.rider.plugins.samples.options

import com.jetbrains.rider.plugins.samples.OptionPagesBundle
import com.jetbrains.rider.settings.simple.SimpleOptionsPage

class SamplePage : SimpleOptionsPage(
name = "ReSharper SDK",
name = OptionPagesBundle.message("configurable.name.optionpages.options.title"),
pageId = "SamplePage" // Must be in sync with SamplePage.PID
) {
override fun getId(): String {
return "SamplePage"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
<applicationConfigurable
parentId="tools"
instance="com.jetbrains.rider.plugins.samples.options.SamplePage"
id="SamplePage" />
id="SamplePage"
bundle="messages.OptionPagesBundle"
key="configurable.name.optionpages.options.title" />
</extensions>

</idea-plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
configurable.name.optionpages.options.title=SamplePage

0 comments on commit 022b7a6

Please sign in to comment.