-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
10 changed files
with
127 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/resharper-presentation-assistant/PresentationAssistantSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using JetBrains.Application.Settings; | ||
using JetBrains.UI; | ||
|
||
namespace JetBrains.ReSharper.Plugins.PresentationAssistant | ||
{ | ||
[SettingsKey(typeof(UserInterfaceSettings), "Presentation Assistant settings")] | ||
public class PresentationAssistantSettings | ||
{ | ||
[SettingsEntry(true, "Enabled")] | ||
public bool Enabled { get; set; } | ||
|
||
[SettingsEntry(false, "Welcome message shown")] | ||
public bool WelcomeMessageShown { get; set; } | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
src/resharper-presentation-assistant/PresentationAssistantSettingsStore.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using JetBrains.Application; | ||
using JetBrains.Application.DataContext; | ||
using JetBrains.Application.Settings; | ||
using JetBrains.DataFlow; | ||
|
||
namespace JetBrains.ReSharper.Plugins.PresentationAssistant | ||
{ | ||
[ShellComponent] | ||
public class PresentationAssistantSettingsStore | ||
{ | ||
private readonly ISettingsStore settingsStore; | ||
private readonly DataContexts dataContexts; | ||
|
||
public PresentationAssistantSettingsStore(Lifetime lifetime, ISettingsStore settingsStore, DataContexts dataContexts) | ||
{ | ||
this.settingsStore = settingsStore; | ||
this.dataContexts = dataContexts; | ||
|
||
SettingsChanged = new SimpleSignal(lifetime, "Presentation Assistant settings changed"); | ||
|
||
var key = settingsStore.Schema.GetKey<PresentationAssistantSettings>(); | ||
settingsStore.Changed.Advise(lifetime, args => | ||
{ | ||
foreach (var changedEntry in args.ChangedEntries) | ||
{ | ||
if (changedEntry.Parent == key) | ||
{ | ||
if (changedEntry.LocalName == "Enabled") | ||
SettingsChanged.Fire(); | ||
break; | ||
} | ||
} | ||
}); | ||
} | ||
|
||
public SimpleSignal SettingsChanged { get; private set; } | ||
|
||
public PresentationAssistantSettings GetSettings() | ||
{ | ||
var boundSettings = BindSettingsStore(); | ||
return boundSettings.GetKey<PresentationAssistantSettings>(SettingsOptimization.OptimizeDefault); | ||
} | ||
|
||
public void SetSettings(PresentationAssistantSettings settings) | ||
{ | ||
var boundSettings = BindSettingsStore(); | ||
boundSettings.SetKey(settings, SettingsOptimization.OptimizeDefault); | ||
} | ||
|
||
private IContextBoundSettingsStore BindSettingsStore() | ||
{ | ||
var store = settingsStore.BindToContextTransient(ContextRange.Smart((l, _) => dataContexts.CreateOnSelection(l))); | ||
return store; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters