diff --git a/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java b/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java index 0c2f05e44c1..2efdf7a5cd3 100644 --- a/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java +++ b/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java @@ -68,6 +68,8 @@ import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.widgets.ButtonFactory; +import org.eclipse.jface.widgets.WidgetFactory; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; @@ -451,7 +453,9 @@ private OverlayPreferenceStore createDialogOverlayStore() { overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_ENCLOSED_TABS)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_TRAILING_TABS)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_CARRIAGE_RETURN)); - overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_LINE_FEED)); + overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_LINE_FEED)); + overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, + AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_ZW_CHARACTERS)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_WHITESPACE_CHARACTER_ALPHA_VALUE)); OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()]; @@ -571,6 +575,15 @@ protected Control createDialogArea(Composite parent) { preference= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_LINE_FEED, "", null); //$NON-NLS-1$ addCheckBox(tabularComposite, preference, new BooleanDomain(), 0); + WidgetFactory.label(SWT.NONE).text(TextEditorMessages.TextEditorDefaultsPreferencePage_zwcharacters) + .layoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)).create(tabularComposite); + ButtonFactory checkboxFactory = WidgetFactory.button(SWT.CHECK) + .supplyLayoutData(() -> new GridData(SWT.CENTER, SWT.CENTER, false, false)).enabled(false); + checkboxFactory.create(tabularComposite); + preference = new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_ZW_CHARACTERS, "", null); //$NON-NLS-1$ + addCheckBox(tabularComposite, preference, new BooleanDomain(), 0); + checkboxFactory.create(tabularComposite); + Composite alphaComposite= new Composite(composite, SWT.NONE); layout= new GridLayout(); layout.numColumns= 2; @@ -809,6 +822,8 @@ private OverlayPreferenceStore createOverlayStore() { overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_TRAILING_TABS)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_CARRIAGE_RETURN)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_LINE_FEED)); + overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, + AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_ZW_CHARACTERS)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_WHITESPACE_CHARACTER_ALPHA_VALUE)); OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()]; diff --git a/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java b/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java index 92a3d48a385..fdcd1091798 100644 --- a/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java +++ b/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java @@ -159,6 +159,7 @@ private TextEditorMessages() { public static String TextEditorDefaultsPreferencePage_ideographicSpace; public static String TextEditorDefaultsPreferencePage_leading; public static String TextEditorDefaultsPreferencePage_lineFeed; + public static String TextEditorDefaultsPreferencePage_zwcharacters; public static String TextEditorDefaultsPreferencePage_range_indicator; public static String TextEditorDefaultsPreferencePage_smartHomeEnd; public static String TextEditorDefaultsPreferencePage_warn_if_derived; diff --git a/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties b/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties index 2e5a7267edc..0193e814379 100644 --- a/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties +++ b/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties @@ -61,6 +61,7 @@ TextEditorDefaultsPreferencePage_enrichHover_onClick=Enrich on click TextEditorDefaultsPreferencePage_ideographicSpace=Ideographic space ( \u00b0 ) TextEditorDefaultsPreferencePage_leading=Leading TextEditorDefaultsPreferencePage_lineFeed=Line Feed ( \u00b6 ) +TextEditorDefaultsPreferencePage_zwcharacters=Zero-Width Characters TextEditorDefaultsPreferencePage_range_indicator=Show &range indicator TextEditorDefaultsPreferencePage_warn_if_derived= War&n before editing a derived file TextEditorDefaultsPreferencePage_smartHomeEnd= &Smart caret positioning at line start and end diff --git a/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java b/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java index 3c1a98e38e5..a1ca2f26191 100644 --- a/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java +++ b/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java @@ -502,7 +502,8 @@ private AbstractDecoratedTextEditorPreferenceConstants() { *
* *- * The following preferences can be used for fine-grained configuration when enabled. + * The following preferences can be used for fine-grained configuration when + * enabled. *
*true.
+ *
+ * Value is of type Boolean.
+ *
true.
@@ -858,6 +872,7 @@ public static void initializeDefaultValues(IPreferenceStore store) {
store.setDefault(EDITOR_SHOW_TRAILING_TABS, true);
store.setDefault(EDITOR_SHOW_CARRIAGE_RETURN, true);
store.setDefault(EDITOR_SHOW_LINE_FEED, true);
+ store.setDefault(EDITOR_SHOW_ZW_CHARACTERS, true);
store.setDefault(EDITOR_WHITESPACE_CHARACTER_ALPHA_VALUE, 80);
store.setDefault(EDITOR_TEXT_DRAG_AND_DROP_ENABLED, true);
diff --git a/bundles/org.eclipse.ui.workbench.texteditor/plugin.properties b/bundles/org.eclipse.ui.workbench.texteditor/plugin.properties
index f647d810d8d..309a98d7429 100644
--- a/bundles/org.eclipse.ui.workbench.texteditor/plugin.properties
+++ b/bundles/org.eclipse.ui.workbench.texteditor/plugin.properties
@@ -215,3 +215,5 @@ blockSelectionModeFont.label= Text Editor Block Selection Font
blockSelectionModeFont.description= The block selection mode font is used by text editors in block (column) mode. A monospace font should be used.
MinimapView.name=Minimap
+
+CodeMining.show.ZWSP=Show ZWSP (Zero-Width Space)
diff --git a/bundles/org.eclipse.ui.workbench.texteditor/plugin.xml b/bundles/org.eclipse.ui.workbench.texteditor/plugin.xml
index e2ef210299f..aaf9928b511 100644
--- a/bundles/org.eclipse.ui.workbench.texteditor/plugin.xml
+++ b/bundles/org.eclipse.ui.workbench.texteditor/plugin.xml
@@ -1491,5 +1491,13 @@
visible="false">
-
+
+ + * The code mining is only shown if configured in the preferences. + *
+ */ +public class ZeroWidthCharactersLineContentCodeMiningProvider extends AbstractCodeMiningProvider + implements IPropertyChangeListener { + + private static final char ZW_SPACE = '\u200b'; + private static final char ZW_NON_JOINER = '\u200c'; + private static final char ZW_JOINER = '\u200d'; + private static final char ZW_NO_BREAK_SPACE = '\ufeff'; + + private static final Settrue.
*
+ * Value is of type Boolean.
+ *
true.
+ *
* Value is of type Integer.
*