Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bundles/org.eclipse.ui.editors/plugin.properties
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ preferenceKeywords.lineSpacing= line space height spacing
preferenceKeywords.lineNumber= line numbers
preferenceKeywords.printMargin= print margin
preferenceKeywords.annotationCodeMining= annotation code mining marker error warning info
preferenceKeywords.blockEndCodeMining= block end code mining closing brace curly
preferenceKeywords.annotations= annotations vertical ruler overview colors text editor
preferenceKeywords.quickdiff= quick diff compare reference colors text editor changes
preferenceKeywords.accessibility= accessibility caret cursor quick diff text editor ruler
Expand Down
4 changes: 4 additions & 0 deletions bundles/org.eclipse.ui.editors/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@
<keywordReference id="org.eclipse.ui.editors.lineNumber"/>
<keywordReference id="org.eclipse.ui.editors.printMargin"/>
<keywordReference id="org.eclipse.ui.editors.annotationCodeMining"/>
<keywordReference id="org.eclipse.ui.editors.blockEndCodeMining"/>
<keywordReference id="org.eclipse.ui.editors.wordWrap"/>
</page>
<page
Expand Down Expand Up @@ -354,6 +355,9 @@
<keyword
label="%preferenceKeywords.annotationCodeMining"
id="org.eclipse.ui.editors.annotationCodeMining"/>
<keyword
label="%preferenceKeywords.blockEndCodeMining"
id="org.eclipse.ui.editors.blockEndCodeMining"/>
<keyword
label="%preferenceKeywords.annotations"
id="org.eclipse.ui.editors.annotations"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Shell;
Expand Down Expand Up @@ -79,6 +80,8 @@
import org.eclipse.ui.internal.editors.text.TextEditorDefaultsPreferencePage.EnumeratedDomain.EnumValue;
import org.eclipse.ui.internal.editors.text.codemining.annotation.AnnotationCodeMiningPreferenceConstants;

import org.eclipse.ui.internal.texteditor.BlockEndCodeMiningPreferenceConstants;

import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.ui.texteditor.AbstractTextEditor;

Expand Down Expand Up @@ -808,6 +811,9 @@ private OverlayPreferenceStore createOverlayStore() {
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, AnnotationCodeMiningPreferenceConstants.SHOW_ANNOTATION_CODE_MINING_LEVEL));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, AnnotationCodeMiningPreferenceConstants.SHOW_ANNOTATION_CODE_MINING_MAX));

overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, BlockEndCodeMiningPreferenceConstants.SHOW_BLOCK_END_CODE_MINING));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, BlockEndCodeMiningPreferenceConstants.BLOCK_END_CODE_MINING_MIN_LINES));

overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_STICKY_SCROLLING_ENABLED));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_STICKY_SCROLLING_MAXIMUM_COUNT));

Expand Down Expand Up @@ -995,8 +1001,26 @@ public void widgetSelected(SelectionEvent e) {
Preference smartHomeEnd= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SMART_HOME_END, label, null);
addCheckBox(appearanceComposite, smartHomeEnd, new BooleanDomain(), 0);

label= TextEditorMessages.TextEditorDefaultsPreferencePage_stickyScrollingEnabled;
Preference stickyScrollingEnabled= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_STICKY_SCROLLING_ENABLED, label, null);
Button stickyScrollingEnabledButton= addCheckBox(appearanceComposite, stickyScrollingEnabled, new BooleanDomain(), 0);

label= TextEditorMessages.TextEditorDefaultsPreferencePage_stickyScrollingMaximumCount;
String description= TextEditorMessages.TextEditorDefaultsPreferencePage_stickyScrollingMaximumCount;
Preference stickyScrollingMaximumCount= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_STICKY_SCROLLING_MAXIMUM_COUNT, label, description);
final IntegerDomain stickyScrollingMaximumCountDomain= new IntegerDomain(1, 10);
final Control[] stickyScrollingMaximumCountControls= addTextField(appearanceComposite, stickyScrollingMaximumCount, stickyScrollingMaximumCountDomain, 15, 20);
createDependency(stickyScrollingEnabledButton, stickyScrollingEnabled, stickyScrollingMaximumCountControls);

Group codeMiningGroup= new Group(appearanceComposite, SWT.NONE);
codeMiningGroup.setText(TextEditorMessages.TextEditorDefaultsPreferencePage_codeMinings_group);
codeMiningGroup.setLayout(new GridLayout(2, false));
gd= new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan= 2;
codeMiningGroup.setLayoutData(gd);

label= TextEditorMessages.TextEditorDefaultsPreferencePage_codeMinings_show;
String description= TextEditorMessages.TextEditorDefaultsPreferencePage_codeMinings_description;
description= TextEditorMessages.TextEditorDefaultsPreferencePage_codeMinings_description;
Preference showCodeMinings= new Preference(AnnotationCodeMiningPreferenceConstants.SHOW_ANNOTATION_CODE_MINING_LEVEL, label, description);
EnumeratedDomain codeMiningsDomain= new EnumeratedDomain();
codeMiningsDomain.addValue(new EnumValue(AnnotationCodeMiningPreferenceConstants.SHOW_ANNOTATION_CODE_MINING_LEVEL__NONE, TextEditorMessages.TextEditorDefaultsPreferencePage_codeMinings_none));
Expand All @@ -1005,13 +1029,13 @@ public void widgetSelected(SelectionEvent e) {
TextEditorMessages.TextEditorDefaultsPreferencePage_codeMinings_ErrorWarnings));
codeMiningsDomain.addValue(new EnumValue(AnnotationCodeMiningPreferenceConstants.SHOW_ANNOTATION_CODE_MINING_LEVEL__ERROR_WARNING_INFO,
TextEditorMessages.TextEditorDefaultsPreferencePage_codeMinings_ErrorWarningsInfo));
final Control[] showCodeMiningsControls= addCombo(appearanceComposite, showCodeMinings, codeMiningsDomain, 0);
final Control[] showCodeMiningsControls= addCombo(codeMiningGroup, showCodeMinings, codeMiningsDomain, 0);

label= TextEditorMessages.TextEditorDefaultsPreferencePage_codeMinings_max;
description= TextEditorMessages.TextEditorDefaultsPreferencePage_codeMinings_max_description;
Preference maxCodeMinings= new Preference(AnnotationCodeMiningPreferenceConstants.SHOW_ANNOTATION_CODE_MINING_MAX, label, description);
IntegerDomain maxCodeMiningsDomain= new IntegerDomain(0, 99999);
Control[] maxCodeMiningsControls= addTextField(appearanceComposite, maxCodeMinings, maxCodeMiningsDomain, 15, 20);
Control[] maxCodeMiningsControls= addTextField(codeMiningGroup, maxCodeMinings, maxCodeMiningsDomain, 15, 20);

final SelectionListener codeMiningsListener= new SelectionAdapter() {
@Override
Expand All @@ -1027,16 +1051,17 @@ public void widgetSelected(SelectionEvent e) {
((Combo) showCodeMiningsControls[1]).addSelectionListener(codeMiningsListener);
fMasterSlaveListeners.add(codeMiningsListener);

label= TextEditorMessages.TextEditorDefaultsPreferencePage_stickyScrollingEnabled;
Preference stickyScrollingEnabled= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_STICKY_SCROLLING_ENABLED, label, null);
Button stickyScrollingEnabledButton= addCheckBox(appearanceComposite, stickyScrollingEnabled, new BooleanDomain(), 0);

label= TextEditorMessages.TextEditorDefaultsPreferencePage_stickyScrollingMaximumCount;
description= TextEditorMessages.TextEditorDefaultsPreferencePage_stickyScrollingMaximumCount;
Preference stickyScrollingMaximumCount= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_STICKY_SCROLLING_MAXIMUM_COUNT, label, description);
final IntegerDomain stickyScrollingMaximumCountDomain= new IntegerDomain(1, 10);
final Control[] stickyScrollingMaximumCountControls= addTextField(appearanceComposite, stickyScrollingMaximumCount, stickyScrollingMaximumCountDomain, 15, 20);
createDependency(stickyScrollingEnabledButton, stickyScrollingEnabled, stickyScrollingMaximumCountControls);
label= TextEditorMessages.TextEditorDefaultsPreferencePage_blockEndCodeMining;
description= TextEditorMessages.TextEditorDefaultsPreferencePage_blockEndCodeMining_description;
Preference blockEndCodeMining= new Preference(BlockEndCodeMiningPreferenceConstants.SHOW_BLOCK_END_CODE_MINING, label, description);
Button blockEndCodeMiningButton= addCheckBox(codeMiningGroup, blockEndCodeMining, new BooleanDomain(), 0);

label= TextEditorMessages.TextEditorDefaultsPreferencePage_blockEndCodeMining_minLines;
description= TextEditorMessages.TextEditorDefaultsPreferencePage_blockEndCodeMining_minLines_description;
Preference blockEndCodeMiningMinLines= new Preference(BlockEndCodeMiningPreferenceConstants.BLOCK_END_CODE_MINING_MIN_LINES, label, description);
IntegerDomain blockEndCodeMiningMinLinesDomain= new IntegerDomain(2, 99999);
Control[] blockEndCodeMiningMinLinesControls= addTextField(codeMiningGroup, blockEndCodeMiningMinLines, blockEndCodeMiningMinLinesDomain, 15, 20);
createDependency(blockEndCodeMiningButton, blockEndCodeMining, blockEndCodeMiningMinLinesControls);

addFiller(appearanceComposite, 2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ private TextEditorMessages() {
public static String TextEditorDefaultsPreferencePage_codeMinings_max_description;
public static String TextEditorDefaultsPreferencePage_codeMinings_none;
public static String TextEditorDefaultsPreferencePage_codeMinings_show;
public static String TextEditorDefaultsPreferencePage_codeMinings_group;
public static String TextEditorDefaultsPreferencePage_blockEndCodeMining;
public static String TextEditorDefaultsPreferencePage_blockEndCodeMining_description;
public static String TextEditorDefaultsPreferencePage_blockEndCodeMining_minLines;
public static String TextEditorDefaultsPreferencePage_blockEndCodeMining_minLines_description;
public static String TextEditorDefaultsPreferencePage_configureWhitespaceCharacterPainterProperties;
public static String TextEditorDefaultsPreferencePage_deleteSpacesAsTabs;
public static String TextEditorDefaultsPreferencePage_enclosed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ TextEditorDefaultsPreferencePage_codeMinings_max=Maximum annotations shown:
TextEditorDefaultsPreferencePage_codeMinings_max_description=Limits the number of shown annotations to prevent performance issues
TextEditorDefaultsPreferencePage_codeMinings_none=None
TextEditorDefaultsPreferencePage_codeMinings_show=Show code minings &for problem annotations:
TextEditorDefaultsPreferencePage_codeMinings_group=Code Minings
TextEditorDefaultsPreferencePage_blockEndCodeMining=Show &block end code minings
TextEditorDefaultsPreferencePage_blockEndCodeMining_description=Shows the opening line of a code block at its closing brace
TextEditorDefaultsPreferencePage_blockEndCodeMining_minLines=Minimum block size (lines):
TextEditorDefaultsPreferencePage_blockEndCodeMining_minLines_description=A block end code mining is only shown when the block spans at least this many lines
TextEditorDefaultsPreferencePage_configureWhitespaceCharacterPainterProperties=Configure visibility of whitespace characters in different regions of a line of text:
TextEditorDefaultsPreferencePage_deleteSpacesAsTabs=Remove &multiple spaces on backspace/delete
TextEditorDefaultsPreferencePage_enclosed=Enclosed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import org.eclipse.ui.internal.editors.text.EditorsPlugin;
import org.eclipse.ui.internal.editors.text.EditorsPluginPreferenceInitializer;
import org.eclipse.ui.internal.texteditor.BlockEndCodeMiningPreferenceConstants;

import org.eclipse.ui.texteditor.spelling.SpellingService;

Expand Down Expand Up @@ -883,6 +884,9 @@ public static void initializeDefaultValues(IPreferenceStore store) {
store.setDefault(EDITOR_STICKY_SCROLLING_ENABLED, false);
store.setDefault(EDITOR_STICKY_SCROLLING_MAXIMUM_COUNT, 4);

store.setDefault(BlockEndCodeMiningPreferenceConstants.SHOW_BLOCK_END_CODE_MINING, false);
store.setDefault(BlockEndCodeMiningPreferenceConstants.BLOCK_END_CODE_MINING_MIN_LINES, BlockEndCodeMiningPreferenceConstants.DEFAULT_MIN_LINES);

MarkerAnnotationPreferences.initializeDefaultValues(store);

EditorsPluginPreferenceInitializer.setThemeBasedPreferences(store, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,4 @@ blockSelectionModeFont.description= The block selection mode font is used by tex
MinimapView.name=Minimap

CodeMining.show.ZWSP=Show ZWSP (Zero-Width Space)
CodeMining.blockEnd=Show block end code minings
5 changes: 5 additions & 0 deletions bundles/org.eclipse.ui.workbench.texteditor/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1554,6 +1554,11 @@
id="org.eclipse.test.codemining.zswpProvider"
label="%CodeMining.show.ZWSP">
</codeMiningProvider>
<codeMiningProvider
class="org.eclipse.ui.internal.texteditor.codemining.BlockEndCodeMiningProvider"
id="org.eclipse.ui.workbench.texteditor.codemining.blockEndProvider"
label="%CodeMining.blockEnd">
</codeMiningProvider>
</extension>

<extension
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*******************************************************************************
* Copyright (c) 2026 Eclipse Platform contributors.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.ui.internal.texteditor;

/**
* Preference keys of the block end code mining, shared with {@code org.eclipse.ui.editors} which
* contributes their defaults and their preference page.
*/
public final class BlockEndCodeMiningPreferenceConstants {

/** Whether a block's opening line is echoed at its closing brace. Off by default. */
public static final String SHOW_BLOCK_END_CODE_MINING= "showBlockEndCodeMining"; //$NON-NLS-1$

/** The minimum number of lines a block must span to be annotated. */
public static final String BLOCK_END_CODE_MINING_MIN_LINES= "blockEndCodeMiningMinLines"; //$NON-NLS-1$

/** Default value for {@link #BLOCK_END_CODE_MINING_MIN_LINES}. */
public static final int DEFAULT_MIN_LINES= 20;

private BlockEndCodeMiningPreferenceConstants() {
// Prevent instantiation
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*******************************************************************************
* Copyright (c) 2026 Eclipse Platform contributors.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.ui.internal.texteditor.codemining;

import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.codemining.ICodeMiningProvider;
import org.eclipse.jface.text.codemining.LineEndCodeMining;

/** Echoes a block's opening line at the end of its closing brace line. */
class BlockEndCodeMining extends LineEndCodeMining {

private final String label;

BlockEndCodeMining(IDocument document, int line, String label, ICodeMiningProvider provider) throws BadLocationException {
super(document, line, provider);
this.label= label;
}

@Override
public boolean isResolved() {
return true;
}

@Override
public String getLabel() {
return label;
}
}
Loading
Loading