Skip to content

Commit

Permalink
Add Setting for Folding
Browse files Browse the repository at this point in the history
  • Loading branch information
jakub-suliga committed Dec 27, 2024
1 parent 97f9ab0 commit 8788edb
Show file tree
Hide file tree
Showing 5 changed files with 514 additions and 340 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private OverlayKey[] createKeys() {
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_FOLDING_METHODS));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_FOLDING_IMPORTS));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_FOLDING_HEADERS));

overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_NEW_FOLDING_ENABLED));
return overlayKeys.toArray(new OverlayKey[overlayKeys.size()]);
}

Expand All @@ -102,6 +102,12 @@ public Control createControl(Composite composite) {
addCheckBox(inner, FoldingMessages.DefaultJavaFoldingPreferenceBlock_methods, PreferenceConstants.EDITOR_FOLDING_METHODS, 0);
addCheckBox(inner, FoldingMessages.DefaultJavaFoldingPreferenceBlock_imports, PreferenceConstants.EDITOR_FOLDING_IMPORTS, 0);

Label label2= new Label(inner, SWT.LEFT);
label2.setText(""); //$NON-NLS-1$
Label label1= new Label(inner, SWT.LEFT);
label1.setText(FoldingMessages.DefaultJavaFoldingPreferenceBlock_New_Setting_Title);

addCheckBox(inner, FoldingMessages.DefaultJavaFoldingPreferenceBlock_New, PreferenceConstants.EDITOR_NEW_FOLDING_ENABLED, 0);
return inner;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ private FoldingMessages() {
public static String DefaultJavaFoldingPreferenceBlock_innerTypes;
public static String DefaultJavaFoldingPreferenceBlock_methods;
public static String DefaultJavaFoldingPreferenceBlock_imports;
public static String DefaultJavaFoldingPreferenceBlock_New;
public static String DefaultJavaFoldingPreferenceBlock_headers;
public static String EmptyJavaFoldingPreferenceBlock_emptyCaption;
public static String JavaFoldingStructureProviderRegistry_warning_providerNotFound_resetToDefault;

public static String DefaultJavaFoldingPreferenceBlock_New_Setting_Title;
static {
NLS.initializeMessages(BUNDLE_NAME, FoldingMessages.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ DefaultJavaFoldingPreferenceBlock_innerTypes= Inner &types
DefaultJavaFoldingPreferenceBlock_methods= &Members
DefaultJavaFoldingPreferenceBlock_imports= &Imports
DefaultJavaFoldingPreferenceBlock_headers= &Header Comments

DefaultJavaFoldingPreferenceBlock_New = &New Folding (Experimental)
DefaultJavaFoldingPreferenceBlock_New_Setting_Title = &New Folding
JavaFoldingStructureProviderRegistry_warning_providerNotFound_resetToDefault= The ''{0}'' folding provider could not be found. Resetting to the default folding provider.

EmptyJavaFoldingPreferenceBlock_emptyCaption=
12 changes: 12 additions & 0 deletions org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/PreferenceConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -3411,6 +3411,16 @@ private PreferenceConstants() {
*/
public static final String EDITOR_FOLDING_ENABLED= "editor_folding_enabled"; //$NON-NLS-1$

/**
* A named preference that controls whether the new or the old folding is used.
* <p>
* Value is of type <code>Boolean</code>.
* </p>
*
* @since 3.34
*/
public static final String EDITOR_NEW_FOLDING_ENABLED= "editor_new_folding_enabled"; //$NON-NLS-1$

/**
* A named preference that stores the configured folding provider.
* <p>
Expand Down Expand Up @@ -4387,6 +4397,8 @@ public static void initializeDefaultValues(IPreferenceStore store) {
store.setDefault(EDITOR_JAVA_CODEMINING_DEFAULT_FILTER_FOR_PARAMETER_NAMES, true);
store.setDefault(EDITOR_JAVA_CODEMINING_SHOW_PARAMETER_NAME_SINGLE_ARG, true);

store.setDefault(EDITOR_NEW_FOLDING_ENABLED, false);

// Javadoc hover & view
JavaElementLinks.initDefaultPreferences(store);
}
Expand Down
Loading

0 comments on commit 8788edb

Please sign in to comment.