Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folding mechanism for while/for/if/switch-case #1562

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
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