mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
editable preview in font configuration (IDEA-73342)
This commit is contained in:
+3
-2
@@ -348,7 +348,8 @@ public class ColorAndFontOptions extends SearchableConfigurable.Parent.Abstract
|
||||
|
||||
private static class FontConfigurableFactory implements ColorAndFontPanelFactory {
|
||||
public NewColorAndFontPanel createPanel(ColorAndFontOptions options) {
|
||||
return new NewColorAndFontPanel(new SchemesPanel(options), new FontOptions(options), new FontEditorPreview(options), "Font", null, null){
|
||||
FontEditorPreview previewPanel = new FontEditorPreview(options, true);
|
||||
return new NewColorAndFontPanel(new SchemesPanel(options), new FontOptions(options), previewPanel, "Font", null, null){
|
||||
@Override
|
||||
public boolean containsFontOptions() {
|
||||
return true;
|
||||
@@ -363,7 +364,7 @@ public class ColorAndFontOptions extends SearchableConfigurable.Parent.Abstract
|
||||
|
||||
private static class ConsoleFontConfigurableFactory implements ColorAndFontPanelFactory {
|
||||
public NewColorAndFontPanel createPanel(ColorAndFontOptions options) {
|
||||
FontEditorPreview previewPanel = new FontEditorPreview(options) {
|
||||
FontEditorPreview previewPanel = new FontEditorPreview(options, false) {
|
||||
@Override
|
||||
protected EditorColorsScheme updateOptionsScheme(EditorColorsScheme selectedScheme) {
|
||||
return ConsoleViewUtil.updateConsoleColorScheme(selectedScheme);
|
||||
|
||||
+4
-4
@@ -36,12 +36,12 @@ public class FontEditorPreview implements PreviewPanel{
|
||||
|
||||
private final EventDispatcher<ColorAndFontSettingsListener> myDispatcher = EventDispatcher.create(ColorAndFontSettingsListener.class);
|
||||
|
||||
public FontEditorPreview(final ColorAndFontOptions options) {
|
||||
public FontEditorPreview(final ColorAndFontOptions options, boolean editable) {
|
||||
myOptions = options;
|
||||
|
||||
@Nls String text = getIDEDemoText();
|
||||
|
||||
myEditor = (EditorEx)createPreviewEditor(text, 10, 3, -1, myOptions);
|
||||
myEditor = (EditorEx)createPreviewEditor(text, 10, 3, -1, myOptions, editable);
|
||||
|
||||
installTrafficLights(myEditor);
|
||||
}
|
||||
@@ -70,10 +70,10 @@ public class FontEditorPreview implements PreviewPanel{
|
||||
((EditorMarkupModel)editor.getMarkupModel()).setErrorStripeVisible(true);
|
||||
}
|
||||
|
||||
static Editor createPreviewEditor(String text, int column, int line, int selectedLine, ColorAndFontOptions options) {
|
||||
static Editor createPreviewEditor(String text, int column, int line, int selectedLine, ColorAndFontOptions options, boolean editable) {
|
||||
EditorFactory editorFactory = EditorFactory.getInstance();
|
||||
Document editorDocument = editorFactory.createDocument(text);
|
||||
EditorEx editor = (EditorEx)editorFactory.createViewer(editorDocument);
|
||||
EditorEx editor = (EditorEx) (editable ? editorFactory.createEditor(editorDocument) : editorFactory.createViewer(editorDocument));
|
||||
editor.setColorsScheme(options.getSelectedScheme());
|
||||
EditorSettings settings = editor.getSettings();
|
||||
settings.setLineNumbersShown(true);
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ public class SimpleEditorPreview implements PreviewPanel{
|
||||
myHighlightData = extractant2.extractHighlights(text);
|
||||
|
||||
int selectedLine = -1;
|
||||
myEditor = (EditorEx)FontEditorPreview.createPreviewEditor(extractant2.cutDefinedTags(text), 10, 3, selectedLine, myOptions);
|
||||
myEditor = (EditorEx)FontEditorPreview.createPreviewEditor(extractant2.cutDefinedTags(text), 10, 3, selectedLine, myOptions, false);
|
||||
|
||||
FontEditorPreview.installTrafficLights(myEditor);
|
||||
myBlinkingAlarm = new Alarm().setActivationComponent(myEditor.getComponent());
|
||||
|
||||
Reference in New Issue
Block a user