View | Details | Raw Unified | Return to bug 148582 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/cdt/ui/dialogs/CodeFormatterBlock.java (-168 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 QNX Software Systems and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     QNX Software Systems - Initial API and implementation
10
 *******************************************************************************/
11
12
package org.eclipse.cdt.ui.dialogs;
13
14
import java.util.HashMap;
15
import java.util.Iterator;
16
import java.util.Map;
17
18
import org.eclipse.core.runtime.IConfigurationElement;
19
import org.eclipse.core.runtime.IExtension;
20
import org.eclipse.core.runtime.IExtensionPoint;
21
import org.eclipse.core.runtime.Platform;
22
import org.eclipse.core.runtime.Preferences;
23
import org.eclipse.swt.SWT;
24
import org.eclipse.swt.events.SelectionAdapter;
25
import org.eclipse.swt.events.SelectionEvent;
26
import org.eclipse.swt.layout.GridData;
27
import org.eclipse.swt.layout.GridLayout;
28
import org.eclipse.swt.widgets.Combo;
29
import org.eclipse.swt.widgets.Composite;
30
import org.eclipse.swt.widgets.Control;
31
import org.eclipse.swt.widgets.Label;
32
import org.eclipse.ui.PlatformUI;
33
34
import org.eclipse.cdt.core.CCorePlugin;
35
import org.eclipse.cdt.core.CCorePreferenceConstants;
36
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
37
38
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
39
import org.eclipse.cdt.internal.ui.preferences.PreferencesMessages;
40
41
/**
42
 * 
43
 */
44
public class CodeFormatterBlock {
45
46
	private HashMap idMap = new HashMap();
47
	Preferences fPrefs;
48
	protected Combo fFormatterCombo;
49
	private static final String ATTR_NAME = "name"; //$NON-NLS-1$
50
	private static final String ATTR_ID="id"; //$NON-NLS-1$
51
	// This is a hack until we have a default Formatter.
52
	// For now it is comment out in the plugin.xml
53
	private static final String NONE=PreferencesMessages.getString("CodeFormatterPreferencePage.emptyName"); //$NON-NLS-1$
54
55
56
	public CodeFormatterBlock(Preferences prefs) {
57
		fPrefs = prefs;
58
		initializeFormatters();
59
	}
60
61
	public void performOk() {
62
		String text = fFormatterCombo.getText();
63
		String selection = (String)idMap.get(text);
64
		if (selection != null && selection.length() > 0) {
65
			HashMap options = CCorePlugin.getOptions();
66
			String formatterID = (String)options.get(CCorePreferenceConstants.CODE_FORMATTER);
67
			if (formatterID == null || !formatterID.equals(selection)) {
68
				options.put(CCorePreferenceConstants.CODE_FORMATTER, selection);
69
				CCorePlugin.setOptions(options);
70
			}
71
		} else {
72
			// simply reset to the default one.
73
			performDefaults();
74
		}
75
	}
76
77
	public void performDefaults() {
78
		HashMap optionsDefault = CCorePlugin.getDefaultOptions();
79
		HashMap options = CCorePlugin.getOptions();
80
		String formatterID = (String)optionsDefault.get(CCorePreferenceConstants.CODE_FORMATTER);
81
		options.put(CCorePreferenceConstants.CODE_FORMATTER, formatterID);
82
		CCorePlugin.setOptions(options);
83
84
		fFormatterCombo.clearSelection();
85
		fFormatterCombo.setText(NONE);
86
		Iterator iterator = idMap.entrySet().iterator();
87
		while (iterator.hasNext()) {
88
			Map.Entry entry = (Map.Entry)iterator.next();
89
			String val = (String)entry.getValue();
90
			if (val != null && val.equals(formatterID)) {
91
				fFormatterCombo.setText((String)entry.getKey());
92
			}
93
		}
94
	}
95
96
	/* (non-Javadoc)
97
	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
98
	 */
99
	public Control createControl(Composite parent) {
100
		Composite control = ControlFactory.createComposite(parent, 2);
101
		((GridLayout) control.getLayout()).makeColumnsEqualWidth = false;
102
		((GridLayout) control.getLayout()).marginWidth = 5;
103
104
		PlatformUI.getWorkbench().getHelpSystem().setHelp(control, ICHelpContextIds.CODEFORMATTER_PREFERENCE_PAGE);
105
106
		ControlFactory.createEmptySpace(control, 2);
107
108
		Label label = ControlFactory.createLabel(control, PreferencesMessages.getString("CodeFormatterPreferencePage.selectionName")); //$NON-NLS-1$
109
		label.setLayoutData(new GridData());
110
		fFormatterCombo = new Combo(control, SWT.DROP_DOWN | SWT.READ_ONLY);
111
		GridData gd = new GridData(GridData.GRAB_HORIZONTAL);
112
		gd.grabExcessHorizontalSpace = true;
113
		fFormatterCombo.setLayoutData(gd);
114
		fFormatterCombo.addSelectionListener(new SelectionAdapter() {
115
			public void widgetSelected(SelectionEvent e) {
116
				handleFormatterChanged();
117
			}
118
		});
119
		Iterator items = idMap.keySet().iterator();
120
		while (items.hasNext()) {
121
			fFormatterCombo.add((String) items.next());
122
		}
123
124
		initDefault();
125
		handleFormatterChanged();
126
		return control;
127
	}
128
129
	public void handleFormatterChanged() {	
130
		// TODO: UI part.
131
	}
132
133
	public void initDefault() {
134
		boolean init = false;
135
		String selection = CCorePlugin.getOption(CCorePreferenceConstants.CODE_FORMATTER);
136
		if (selection != null) {
137
			Iterator iterator = idMap.entrySet().iterator();
138
			while (iterator.hasNext()) {
139
				Map.Entry entry = (Map.Entry)iterator.next();
140
				String val = (String)entry.getValue();
141
				if (val != null && val.equals(selection)) {
142
					fFormatterCombo.setText((String)entry.getKey());
143
					init = true;
144
				}
145
			}
146
		}
147
		if (!init) {
148
			fFormatterCombo.setText(NONE);
149
		}
150
	}
151
152
	private void initializeFormatters() {
153
		idMap = new HashMap();
154
		idMap.put(NONE, null);
155
		IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, CCorePlugin.FORMATTER_EXTPOINT_ID);
156
		if (point != null) {
157
			IExtension[] exts = point.getExtensions();
158
			for (int i = 0; i < exts.length; i++) {
159
		 		IConfigurationElement[] elements = exts[i].getConfigurationElements();
160
		 		for (int j = 0; j < elements.length; ++j) {
161
		 			String name = elements[j].getAttribute(ATTR_NAME);
162
		 			idMap.put(name, elements[j].getAttribute(ATTR_ID));
163
		 		}
164
			}
165
		}
166
	}
167
168
}
(-)src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java (-6 / +43 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.cdt.internal.ui.preferences;
12
package org.eclipse.cdt.internal.ui.preferences;
12
13
Lines 14-35 Link Here
14
import java.util.MissingResourceException;
15
import java.util.MissingResourceException;
15
import java.util.ResourceBundle;
16
import java.util.ResourceBundle;
16
17
17
public class PreferencesMessages {
18
import org.eclipse.osgi.util.NLS;
18
19
19
	private static final String RESOURCE_BUNDLE= "org.eclipse.cdt.internal.ui.preferences.PreferencesMessages";//$NON-NLS-1$
20
public class PreferencesMessages extends NLS {
20
21
22
	private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.ui.preferences.PreferencesMessages";//$NON-NLS-1$
23
24
	private PreferencesMessages() {
25
		// Do not instantiate
26
	}
27
28
	static {
29
		NLS.initializeMessages(BUNDLE_NAME, PreferencesMessages.class);
30
	}
31
32
	public static String CEditorPreferencePage_empty_input;
33
	public static String CEditorPreferencePage_invalid_input;
34
	public static String CEditorPreferencePage_typing_tabTitle;
35
	public static String CEditorPreferencePage_typing_description;
36
	public static String CEditorPreferencePage_closeStrings;
37
	public static String CEditorPreferencePage_closeBrackets;
38
	public static String CEditorPreferencePage_closeAngularBrackets;
39
	public static String CEditorPreferencePage_closeBraces;
40
	public static String CEditorPreferencePage_wrapStrings;
41
	public static String CEditorPreferencePage_escapeStrings;
42
	public static String CEditorPreferencePage_smartPaste;
43
44
	public static String CEditorPreferencePage_typing_smartTab;
45
46
	public static String SmartTypingConfigurationBlock_autoclose_title;
47
	public static String SmartTypingConfigurationBlock_tabs_title;
48
	public static String SmartTypingConfigurationBlock_tabs_message_tab_text;
49
	public static String SmartTypingConfigurationBlock_tabs_message_others_text;
50
	public static String SmartTypingConfigurationBlock_tabs_message_tooltip;
51
	public static String SmartTypingConfigurationBlock_tabs_message_spaces;
52
	public static String SmartTypingConfigurationBlock_tabs_message_tabs;
53
	public static String SmartTypingConfigurationBlock_tabs_message_tabsAndSpaces;
54
	public static String SmartTypingConfigurationBlock_pasting_title;
55
	public static String SmartTypingConfigurationBlock_strings_title;
56
57
	public static String CodeFormatterPreferencePage_title;
58
	public static String CodeFormatterPreferencePage_description; 
59
	
60
	// Old style string resource access.
21
	private static ResourceBundle fgResourceBundle;
61
	private static ResourceBundle fgResourceBundle;
22
	static {
62
	static {
23
		try {
63
		try {
24
			fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
64
			fgResourceBundle = ResourceBundle.getBundle(BUNDLE_NAME);
25
		} catch (MissingResourceException x) {
65
		} catch (MissingResourceException x) {
26
			fgResourceBundle = null;
66
			fgResourceBundle = null;
27
		}
67
		}
28
	}
68
	}
29
69
30
	private PreferencesMessages() {
31
	}
32
33
	public static String getString(String key) {
70
	public static String getString(String key) {
34
		try {
71
		try {
35
			return fgResourceBundle.getString(key);
72
			return fgResourceBundle.getString(key);
(-)src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties (-6 / +32 lines)
Lines 117-122 Link Here
117
CEditorPreferencePage.behaviorPage.Color=Color:
117
CEditorPreferencePage.behaviorPage.Color=Color:
118
CEditorPreferencePage.textFont.changeButton=C&hange...
118
CEditorPreferencePage.textFont.changeButton=C&hange...
119
119
120
# Smart typing block
121
SmartTypingConfigurationBlock_autoclose_title=Automatically close
122
SmartTypingConfigurationBlock_tabs_title=Tabulators
123
# The argument will be replaced by the tab display size
124
SmartTypingConfigurationBlock_tabs_message_tab_text=The tab display value (currently {0}) and whether spaces are used to indent lines are configured on the <a>code style preference page</a>. The current indentation mode uses tabs.
125
# The first argument will be replaced by the tab display size, the second by the indent size and the third by the NLSed string of 'SmartTypingConfigurationBlock_tabs_message_spaces' or 'SmartTypingConfigurationBlock_tabs_message_tabs' (see below)  
126
SmartTypingConfigurationBlock_tabs_message_others_text=The tab display value (currently {0}) and whether spaces are used to indent lines are configured on the <a>code style preference page</a>. The current indentation size is {1}, using {2}.
127
SmartTypingConfigurationBlock_tabs_message_tooltip=Go to the code style preference page
128
SmartTypingConfigurationBlock_tabs_message_spaces=spaces
129
SmartTypingConfigurationBlock_tabs_message_tabs=tabs
130
SmartTypingConfigurationBlock_tabs_message_tabsAndSpaces=tabs and spaces
131
SmartTypingConfigurationBlock_pasting_title=When pasting
132
SmartTypingConfigurationBlock_strings_title=In string literals
133
134
CEditorPreferencePage_empty_input=Empty input
135
CEditorPreferencePage_invalid_input="{0}" is not a valid input.
136
CEditorPreferencePage_typing_tabTitle=T&yping
137
CEditorPreferencePage_typing_description=Enable these typing aids in Smart Insert mode:
138
CEditorPreferencePage_closeStrings="&Strings"
139
CEditorPreferencePage_closeBrackets=(&Parentheses) and [square] brackets
140
CEditorPreferencePage_closeAngularBrackets=<A&ngle> brackets
141
CEditorPreferencePage_closeBraces={B&races}
142
CEditorPreferencePage_wrapStrings=&Wrap automatically
143
CEditorPreferencePage_escapeStrings=Escape text w&hen pasting into a string literal
144
CEditorPreferencePage_smartPaste=Adjust &indentation
145
146
CEditorPreferencePage_typing_smartTab= &Tab key indents the current line
147
148
# Code Formatting
149
CodeFormatterPreferencePage_title=Code Style
150
CodeFormatterPreferencePage_description=Sele&ct a profile:
151
120
TemplatePreferencePage.Viewer.preview=Preview:
152
TemplatePreferencePage.Viewer.preview=Preview:
121
153
122
CFileTypesPreferencePage.description=C/C++ File Types
154
CFileTypesPreferencePage.description=C/C++ File Types
Lines 196-207 Link Here
196
FoldingConfigurationBlock.info.no_preferences= The selected folding provider did not provide a preference control
228
FoldingConfigurationBlock.info.no_preferences= The selected folding provider did not provide a preference control
197
FoldingConfigurationBlock.error.not_exist= The selected folding provider does not exist
229
FoldingConfigurationBlock.error.not_exist= The selected folding provider does not exist
198
230
199
#Code Formatting
200
CodeFormatterPreferencePage.title=Code Formatter
201
CodeFormatterPreferencePage.selectionName=Formatters:
202
CodeFormatterPreferencePage.emptyName=(NONE)
203
CodeFormatterPreferencePage.description=Code Formatter
204
205
# --- Linked Resources ---
231
# --- Linked Resources ---
206
PathEntryVariablePreference.explanation = PathEntry variables.
232
PathEntryVariablePreference.explanation = PathEntry variables.
207
PathEntryVariablePreference.enableLinkedResources = &Enable linked resources
233
PathEntryVariablePreference.enableLinkedResources = &Enable linked resources
(-)src/org/eclipse/cdt/internal/ui/preferences/CodeFormatterPreferencePage.java (-49 / +111 lines)
Lines 7-91 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     QNX Software Systems - Initial API and implementation
9
 *     QNX Software Systems - Initial API and implementation
10
 *     Sergey Prigogin, Google
10
 *******************************************************************************/
11
 *******************************************************************************/
11
12
12
package org.eclipse.cdt.internal.ui.preferences;
13
package org.eclipse.cdt.internal.ui.preferences;
13
14
14
15
15
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
16
import org.eclipse.core.runtime.IAdaptable;
16
import org.eclipse.cdt.internal.ui.dialogs.StatusUtil;
17
17
import org.eclipse.cdt.ui.CUIPlugin;
18
import org.eclipse.core.resources.IProject;
18
import org.eclipse.cdt.ui.dialogs.CodeFormatterBlock;
19
19
import org.eclipse.core.runtime.IStatus;
20
import org.eclipse.jface.preference.PreferencePage;
21
import org.eclipse.swt.SWT;
22
import org.eclipse.swt.layout.GridData;
23
import org.eclipse.swt.layout.GridLayout;
24
import org.eclipse.swt.widgets.Composite;
20
import org.eclipse.swt.widgets.Composite;
25
import org.eclipse.swt.widgets.Control;
21
import org.eclipse.swt.widgets.Control;
26
import org.eclipse.ui.IWorkbench;
22
27
import org.eclipse.ui.IWorkbenchPreferencePage;
23
import org.eclipse.jface.preference.IPreferencePageContainer;
24
28
import org.eclipse.ui.PlatformUI;
25
import org.eclipse.ui.PlatformUI;
26
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
27
import org.eclipse.ui.preferences.IWorkingCopyManager;
28
import org.eclipse.ui.preferences.WorkingCopyManager;
29
30
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
31
import org.eclipse.cdt.internal.ui.preferences.formatter.CodeFormatterConfigurationBlock;
29
32
30
/**
33
/*
31
 * 
34
 * The page to configure the code formatter options.
32
 */
35
 */
33
public class CodeFormatterPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
36
public class CodeFormatterPreferencePage extends PropertyAndPreferencePage {
34
37
35
	CodeFormatterBlock fCodeFormatterBlock;
38
	public static final String PREF_ID= "org.eclipse.jdt.ui.preferences.CodeFormatterPreferencePage"; //$NON-NLS-1$
39
	public static final String PROP_ID= "org.eclipse.jdt.ui.propertyPages.CodeFormatterPreferencePage"; //$NON-NLS-1$
36
	
40
	
41
	private CodeFormatterConfigurationBlock fConfigurationBlock;
42
37
	public CodeFormatterPreferencePage() {
43
	public CodeFormatterPreferencePage() {
38
		setPreferenceStore(CUIPlugin.getDefault().getPreferenceStore());
44
		setDescription(PreferencesMessages.CodeFormatterPreferencePage_description); 
45
		
39
		// only used when page is shown programatically
46
		// only used when page is shown programatically
40
		setTitle(PreferencesMessages.getString("CodeFormatterPreferencePage.title"));		 //$NON-NLS-1$
47
		setTitle(PreferencesMessages.CodeFormatterPreferencePage_title);		 
41
		//setDescription(PreferencesMessages.getString("CodeFormatterPreferencePage.description")); //$NON-NLS-1$
42
		fCodeFormatterBlock= new CodeFormatterBlock(CUIPlugin.getDefault().getPluginPreferences());
43
	}
44
	
45
46
	/*
47
	 * @see IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
48
	 */	
49
	public void init(IWorkbench workbench) {
50
	}
48
	}
51
49
52
	/*
50
	/* (non-Javadoc)
53
	 * @see PreferencePage#createContents(Composite)
51
	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
54
	 */
52
	 */
55
	protected Control createContents(Composite parent) {
53
	public void createControl(Composite parent) {
56
		Composite topPane = new Composite(parent, SWT.NONE);
54
		IPreferencePageContainer container= getContainer();
57
55
		IWorkingCopyManager workingCopyManager;
58
		topPane.setLayout(new GridLayout());
56
		if (container instanceof IWorkbenchPreferenceContainer) {
59
		topPane.setLayoutData(new GridData(GridData.FILL_BOTH));
57
			workingCopyManager= ((IWorkbenchPreferenceContainer) container).getWorkingCopyManager();
60
58
		} else {
59
			workingCopyManager= new WorkingCopyManager(); // non shared 
60
		}
61
		PreferencesAccess access= PreferencesAccess.getWorkingCopyPreferences(workingCopyManager);
62
		fConfigurationBlock= new CodeFormatterConfigurationBlock(getProject(), access);
61
		
63
		
62
		applyDialogFont(parent);
64
		super.createControl(parent);
63
		PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), ICHelpContextIds.CODEFORMATTER_PREFERENCE_PAGE);
65
		PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), ICHelpContextIds.CODEFORMATTER_PREFERENCE_PAGE);
64
		return fCodeFormatterBlock.createControl(topPane);
65
	}
66
	}
66
67
67
	/*
68
	/* (non-Javadoc)
68
	 * @see IPreferencePage#performOk()
69
	 * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#createPreferenceContent(org.eclipse.swt.widgets.Composite)
69
	 */
70
	 */
70
	public boolean performOk() {
71
	protected Control createPreferenceContent(Composite composite) {
71
		fCodeFormatterBlock.performOk();
72
		return fConfigurationBlock.createContents(composite);
72
		return super.performOk();
73
	}
74
	
75
	/* (non-Javadoc)
76
	 * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#hasProjectSpecificOptions(org.eclipse.core.resources.IProject)
77
	 */
78
	protected boolean hasProjectSpecificOptions(IProject project) {
79
		return fConfigurationBlock.hasProjectSpecificOptions(project);
80
	}
81
	
82
//	/* (non-Javadoc)
83
//	 * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#enableProjectSpecificSettings(boolean)
84
//	 */
85
//	protected void enableProjectSpecificSettings(boolean useProjectSpecificSettings) {
86
//		super.enableProjectSpecificSettings(useProjectSpecificSettings);
87
//		if (fConfigurationBlock != null) {
88
//			fConfigurationBlock.enableProjectSpecificSettings(useProjectSpecificSettings);
89
//		}
90
//	}
91
	
92
	/* (non-Javadoc)
93
	 * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#getPreferencePageID()
94
	 */
95
	protected String getPreferencePageID() {
96
		return PREF_ID;
97
	}
98
	
99
	/* (non-Javadoc)
100
	 * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#getPropertyPageID()
101
	 */
102
	protected String getPropertyPageID() {
103
		return PROP_ID;
104
	}
105
	
106
	/* (non-Javadoc)
107
	 * @see org.eclipse.jface.dialogs.DialogPage#dispose()
108
	 */
109
	public void dispose() {
110
		if (fConfigurationBlock != null) {
111
			fConfigurationBlock.dispose();
112
		}
113
		super.dispose();
73
	}
114
	}
74
	
115
	
75
	/* (non-Javadoc)
116
	/* (non-Javadoc)
76
	 * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
117
	 * @see org.eclipse.jface.preference.IPreferencePage#performDefaults()
77
	 */
118
	 */
78
	protected void performDefaults() {
119
	protected void performDefaults() {
79
		fCodeFormatterBlock.performDefaults();
120
		if (fConfigurationBlock != null) {
121
			fConfigurationBlock.performDefaults();
122
		}
80
		super.performDefaults();
123
		super.performDefaults();
81
	}
124
	}
82
		
125
83
	/* (non-Javadoc)
126
	/* (non-Javadoc)
84
	 * @see org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener#statusChanged(org.eclipse.core.runtime.IStatus)
127
	 * @see org.eclipse.jface.preference.IPreferencePage#performOk()
85
	 */
128
	 */
86
	public void statusChanged(IStatus status) {
129
	public boolean performOk() {
87
		setValid(!status.matches(IStatus.ERROR));
130
		if (fConfigurationBlock != null && !fConfigurationBlock.performOk()) {
88
		StatusUtil.applyToStatusLine(this, status);		
131
			return false;
132
		}	
133
		return super.performOk();
134
	}
135
	
136
	/* (non-Javadoc)
137
	 * @see org.eclipse.jface.preference.IPreferencePage#performOk()
138
	 */
139
	public void performApply() {
140
		if (fConfigurationBlock != null) {
141
			fConfigurationBlock.performApply();
142
		}	
143
		super.performApply();
144
	}
145
	
146
	/* (non-Javadoc)
147
	 * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#setElement(org.eclipse.core.runtime.IAdaptable)
148
	 */
149
	public void setElement(IAdaptable element) {
150
		super.setElement(element);
151
		setDescription(null); // no description for property page
89
	}
152
	}
90
91
}
153
}
(-)utils.ui/org/eclipse/cdt/utils/ui/controls/ControlFactory.java (-73 / +51 lines)
Lines 10-16 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.utils.ui.controls;
11
package org.eclipse.cdt.utils.ui.controls;
12
12
13
14
import java.util.StringTokenizer;
13
import java.util.StringTokenizer;
15
14
16
import org.eclipse.jface.viewers.CellEditor;
15
import org.eclipse.jface.viewers.CellEditor;
Lines 56-62 Link Here
56
	 *
55
	 *
57
	 * @param parent  the parent of the new composite
56
	 * @param parent  the parent of the new composite
58
	 * @param numColumns  the number of columns for the new composite
57
	 * @param numColumns  the number of columns for the new composite
59
	 * @return the newly-created coposite
58
	 * @return the newly-created composite
60
	 */
59
	 */
61
	public static Composite createComposite(Composite parent, int numColumns) {
60
	public static Composite createComposite(Composite parent, int numColumns) {
62
		return createCompositeEx(parent, numColumns, GridData.FILL_HORIZONTAL);
61
		return createCompositeEx(parent, numColumns, GridData.FILL_HORIZONTAL);
Lines 68-77 Link Here
68
	 * @param parent  the parent of the new composite
67
	 * @param parent  the parent of the new composite
69
	 * @param numColumns  the number of columns for the new composite
68
	 * @param numColumns  the number of columns for the new composite
70
	 * @param layoutMode - GridData modes that should be applied to this control
69
	 * @param layoutMode - GridData modes that should be applied to this control
71
	 * @return the newly-created coposite
70
	 * @return the newly-created composite
72
	 */
71
	 */
73
	public static Composite createCompositeEx(Composite parent, int numColumns, int layoutMode) {
72
	public static Composite createCompositeEx(Composite parent, int numColumns, int layoutMode) {
74
		Composite composite = new Composite(parent, SWT.NULL);
73
		Composite composite = new Composite(parent, SWT.NULL);
74
		composite.setFont(parent.getFont());
75
	
75
	
76
		composite.setLayout(new GridLayout(numColumns, true));
76
		composite.setLayout(new GridLayout(numColumns, true));
77
		composite.setLayoutData(new GridData(layoutMode));
77
		composite.setLayoutData(new GridData(layoutMode));
Lines 108-113 Link Here
108
		separator.setLayoutData(data);
108
		separator.setLayoutData(data);
109
		return separator;
109
		return separator;
110
	}
110
	}
111
111
	/**
112
	/**
112
	 * Creates a spacer control.
113
	 * Creates a spacer control.
113
	 * @param parent The parent composite
114
	 * @param parent The parent composite
Lines 115-120 Link Here
115
	public static Control createEmptySpace(Composite parent) {
116
	public static Control createEmptySpace(Composite parent) {
116
		return createEmptySpace(parent, 1);
117
		return createEmptySpace(parent, 1);
117
	}
118
	}
119
118
	/**
120
	/**
119
	 * Creates a spacer control with the given span.
121
	 * Creates a spacer control with the given span.
120
	 * The composite is assumed to have <code>MGridLayout</code> as
122
	 * The composite is assumed to have <code>MGridLayout</code> as
Lines 136-142 Link Here
136
138
137
	/**
139
	/**
138
	 * Creates an new label (basic method)
140
	 * Creates an new label (basic method)
139
	 * 
140
	 *
141
	 *
141
	 * @param parent  parent object
142
	 * @param parent  parent object
142
	 * @param text  the label text
143
	 * @param text  the label text
Lines 148-153 Link Here
148
	public static Label createLabel(Composite parent, String text, int widthHint, int heightHint, int style) {
149
	public static Label createLabel(Composite parent, String text, int widthHint, int heightHint, int style) {
149
150
150
		Label label = new Label(parent, style);		
151
		Label label = new Label(parent, style);		
152
		label.setFont(parent.getFont());
151
		label.setText(text);
153
		label.setText(text);
152
		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
154
		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
153
		gd.horizontalSpan = 1;
155
		gd.horizontalSpan = 1;
Lines 187-193 Link Here
187
		return label;
189
		return label;
188
	}
190
	}
189
191
190
191
	/**
192
	/**
192
	 * Creates an new Wrapped label 
193
	 * Creates an new Wrapped label 
193
	 * 
194
	 * 
Lines 202-208 Link Here
202
		return createLabel(parent, text, widthHint, heightHint, SWT.LEFT | SWT.WRAP);
203
		return createLabel(parent, text, widthHint, heightHint, SWT.LEFT | SWT.WRAP);
203
	}
204
	}
204
205
205
206
	/**
206
	/**
207
	 * Creates an new checkbox instance and sets the default
207
	 * Creates an new checkbox instance and sets the default
208
	 * layout data.
208
	 * layout data.
Lines 213-218 Link Here
213
	 */ 
213
	 */ 
214
	public static Button createCheckBox(Composite group, String label) {
214
	public static Button createCheckBox(Composite group, String label) {
215
		Button button = new Button(group, SWT.CHECK | SWT.LEFT);
215
		Button button = new Button(group, SWT.CHECK | SWT.LEFT);
216
		button.setFont(group.getFont());
216
		button.setText(label);
217
		button.setText(label);
217
		GridData data = new GridData();
218
		GridData data = new GridData();
218
		button.setLayoutData(data);
219
		button.setLayoutData(data);
Lines 231-236 Link Here
231
	 */ 
232
	 */ 
232
	public static Button createCheckBoxEx(Composite group, String label, int style) {
233
	public static Button createCheckBoxEx(Composite group, String label, int style) {
233
		Button button = new Button(group, SWT.CHECK | style);
234
		Button button = new Button(group, SWT.CHECK | style);
235
		button.setFont(group.getFont());
234
		button.setText(label);
236
		button.setText(label);
235
		GridData data = new GridData();
237
		GridData data = new GridData();
236
		button.setLayoutData(data);
238
		button.setLayoutData(data);
Lines 250-262 Link Here
250
	 */ 
252
	 */ 
251
	public static Button createRadioButton(Composite group, String label, String value, SelectionListener listener) {
253
	public static Button createRadioButton(Composite group, String label, String value, SelectionListener listener) {
252
		Button button = new Button(group, SWT.RADIO | SWT.LEFT);
254
		Button button = new Button(group, SWT.RADIO | SWT.LEFT);
255
		button.setFont(group.getFont());
253
		button.setText(label);
256
		button.setText(label);
254
		button.setData((null == value) ? label : value);
257
		button.setData((null == value) ? label : value);
255
		GridData data = new GridData(GridData.FILL_HORIZONTAL);
258
		GridData data = new GridData(GridData.FILL_HORIZONTAL);
256
		data.horizontalAlignment = GridData.FILL;
259
		data.horizontalAlignment = GridData.FILL;
257
		data.verticalAlignment = GridData.BEGINNING;
260
		data.verticalAlignment = GridData.BEGINNING;
258
		button.setLayoutData(data);
261
		button.setLayoutData(data);
259
		if(null != listener)
262
		if (null != listener)
260
			button.addSelectionListener(listener);
263
			button.addSelectionListener(listener);
261
		return button;
264
		return button;
262
	}
265
	}
Lines 271-276 Link Here
271
	 */
274
	 */
272
	public static Button createPushButton(Composite parent, String label) {
275
	public static Button createPushButton(Composite parent, String label) {
273
		Button button = new Button(parent, SWT.PUSH);
276
		Button button = new Button(parent, SWT.PUSH);
277
		button.setFont(parent.getFont());
274
		button.setText(label);
278
		button.setText(label);
275
//		button.addSelectionListener(this);
279
//		button.addSelectionListener(this);
276
		GridData data = new GridData();
280
		GridData data = new GridData();
Lines 278-284 Link Here
278
		button.setLayoutData(data);
282
		button.setLayoutData(data);
279
		return button;
283
		return button;
280
	}
284
	}
281
282
    	
285
    	
283
	/**
286
	/**
284
	 * Create a text field specific for this application
287
	 * Create a text field specific for this application
Lines 312-317 Link Here
312
	 */
315
	 */
313
    public static Group createGroup(Composite parent, String label, int nColumns) {
316
    public static Group createGroup(Composite parent, String label, int nColumns) {
314
		Group group = new Group(parent, SWT.NONE);
317
		Group group = new Group(parent, SWT.NONE);
318
		group.setFont(parent.getFont());
315
		group.setText(label);
319
		group.setText(label);
316
		GridLayout layout = new GridLayout();
320
		GridLayout layout = new GridLayout();
317
		layout.numColumns = nColumns;
321
		layout.numColumns = nColumns;
Lines 321-327 Link Here
321
        return group;    	
325
        return group;    	
322
    }
326
    }
323
327
324
325
	/**
328
	/**
326
	 * Create a List box
329
	 * Create a List box
327
	 *
330
	 *
Lines 332-361 Link Here
332
	 */
335
	 */
333
    public static List createList(Composite parent, String strdata, String selData) {
336
    public static List createList(Composite parent, String strdata, String selData) {
334
		List list = new List(parent, SWT.SINGLE);
337
		List list = new List(parent, SWT.SINGLE);
338
		list.setFont(parent.getFont());
335
		GridData data = new GridData();
339
		GridData data = new GridData();
336
		list.setLayoutData(data);
340
		list.setLayoutData(data);
337
		StringTokenizer st = new StringTokenizer(strdata, ","); //$NON-NLS-1$
341
		StringTokenizer st = new StringTokenizer(strdata, ","); //$NON-NLS-1$
338
		while(st.hasMoreTokens())
342
		while (st.hasMoreTokens())
339
			list.add(st.nextToken());
343
			list.add(st.nextToken());
340
	    if(selData == null) {
344
	    if (selData == null) {
341
	    	if(list.getItemCount() > 0)
345
	    	if (list.getItemCount() > 0)
342
				list.select(0);
346
				list.select(0);
347
	    } else {
348
			selectList(list, selData);
343
	    }
349
	    }
344
	    else
345
			selectList(list, selData);	    
346
		return list;
350
		return list;
347
	}
351
	}
348
352
349
	public static void selectList(List list, String selData)	{
353
	public static void selectList(List list, String selData)	{
350
		int n_sel = list.indexOf(selData);
354
		int n_sel = list.indexOf(selData);
351
		if(0 > n_sel)
355
		if (0 > n_sel)
352
			n_sel = 0;
356
			n_sel = 0;
353
	    list.select(n_sel);
357
	    list.select(n_sel);
354
	}
358
	}
355
	
359
	
356
357
358
359
	/**
360
	/**
360
	 *	Create this group's list viewer.
361
	 *	Create this group's list viewer.
361
	 */
362
	 */
Lines 366-377 Link Here
366
		data.widthHint = width;
367
		data.widthHint = width;
367
		data.heightHint = height;
368
		data.heightHint = height;
368
		listViewer.getTable().setLayoutData(data);
369
		listViewer.getTable().setLayoutData(data);
369
		if(null != opt_list)
370
		if (null != opt_list)
370
			listViewer.add(opt_list);
371
			listViewer.add(opt_list);
371
        return listViewer; 
372
        return listViewer; 
372
	}
373
	}
373
374
374
375
	/**
375
	/**
376
	 *	Create this group's list viewer.
376
	 *	Create this group's list viewer.
377
	 */
377
	 */
Lines 391-401 Link Here
391
		tableLayout.addColumnData(new ColumnWeightData(colWidths[0], false));
391
		tableLayout.addColumnData(new ColumnWeightData(colWidths[0], false));
392
*/		
392
*/		
393
		TableColumn column;
393
		TableColumn column;
394
		for(int i = 0; i < columns.length; ++i) {
394
		for (int i = 0; i < columns.length; ++i) {
395
			column= new TableColumn(table, SWT.NULL);
395
			column= new TableColumn(table, SWT.NULL);
396
			column.setText(columns[i]); 	
396
			column.setText(columns[i]); 	
397
			tableLayout.addColumnData(new ColumnWeightData(colWidths[i], true));
397
			tableLayout.addColumnData(new ColumnWeightData(colWidths[i], true));
398
			
399
		}
398
		}
400
399
401
		table.setLayout(tableLayout);
400
		table.setLayout(tableLayout);
Lines 404-418 Link Here
404
	}
403
	}
405
404
406
	public static void deactivateCellEditor(TableViewer viewer) {
405
	public static void deactivateCellEditor(TableViewer viewer) {
407
		if(null == viewer)
406
		if (null == viewer)
408
			return;
407
			return;
409
		CellEditor[] es = viewer.getCellEditors();
408
		CellEditor[] es = viewer.getCellEditors();
410
		TableItem[] items = viewer.getTable().getSelection();
409
		TableItem[] items = viewer.getTable().getSelection();
411
		if(items.length >= 0)  {
410
		if (items.length >= 0)  {
412
			for(int i = 0; i < es.length; ++i) {
411
			for (int i = 0; i < es.length; ++i) {
413
				CellEditor e = es[i];
412
				CellEditor e = es[i];
414
				if(e.isActivated()) {
413
				if (e.isActivated()) {
415
					if(e.isValueValid()) {
414
					if (e.isValueValid()) {
416
						Object[] properties = viewer.getColumnProperties();
415
						Object[] properties = viewer.getColumnProperties();
417
						Object value = e.getValue();
416
						Object value = e.getValue();
418
						viewer.cancelEditing();
417
						viewer.cancelEditing();
Lines 432-457 Link Here
432
	    int width, int height, int style) {
431
	    int width, int height, int style) {
433
	    	
432
	    	
434
	    Table table = new Table(parent, SWT.BORDER | SWT.CHECK);
433
	    Table table = new Table(parent, SWT.BORDER | SWT.CHECK);
434
		table.setFont(parent.getFont());
435
	    CheckboxTableViewer listViewer = new CheckboxTableViewer(table);
435
	    CheckboxTableViewer listViewer = new CheckboxTableViewer(table);
436
		GridData data = new GridData(style);
436
		GridData data = new GridData(style);
437
		data.widthHint = width;
437
		data.widthHint = width;
438
		data.heightHint = height;
438
		data.heightHint = height;
439
		listViewer.getTable().setLayoutData(data);
439
		listViewer.getTable().setLayoutData(data);
440
		if(null != opt_list)
440
		if (null != opt_list)
441
			listViewer.add(opt_list);
441
			listViewer.add(opt_list);
442
//		listViewer.setLabelProvider(listLabelProvider);
442
//		listViewer.setLabelProvider(listLabelProvider);
443
//		listViewer.addCheckStateListener(this);
443
//		listViewer.addCheckStateListener(this);
444
        return listViewer; 
444
        return listViewer; 
445
	}
445
	}
446
446
447
448
449
	public static CheckboxTableViewer createListViewer(Composite parent,  
447
	public static CheckboxTableViewer createListViewer(Composite parent,  
450
	    int width, int height, int style, String[] columns, int[] colWidths) {
448
	    int width, int height, int style, String[] columns, int[] colWidths) {
451
	    CheckboxTableViewer listViewer = createListViewer(parent, null, 
449
	    CheckboxTableViewer listViewer = createListViewer(parent, null, 
452
	    	width, height, style);
450
	    	width, height, style);
453
		
451
		
454
		Table table= listViewer.getTable();
452
		Table table= listViewer.getTable();
453
		table.setFont(parent.getFont());
455
		
454
		
456
		table.setHeaderVisible(true);
455
		table.setHeaderVisible(true);
457
		table.setLinesVisible(true);
456
		table.setLinesVisible(true);
Lines 463-469 Link Here
463
		column.setText(columns[0]); 	    
462
		column.setText(columns[0]); 	    
464
		tableLayout.addColumnData(new ColumnWeightData(colWidths[0], false));
463
		tableLayout.addColumnData(new ColumnWeightData(colWidths[0], false));
465
		
464
		
466
		for(int i = 1; i < columns.length; ++i) {
465
		for (int i = 1; i < columns.length; ++i) {
467
			column= new TableColumn(table, SWT.NULL);
466
			column= new TableColumn(table, SWT.NULL);
468
			column.setText(columns[i]); 	
467
			column.setText(columns[i]); 	
469
			tableLayout.addColumnData(new ColumnWeightData(colWidths[i], false));
468
			tableLayout.addColumnData(new ColumnWeightData(colWidths[i], false));
Lines 472-478 Link Here
472
	    
471
	    
473
        return listViewer; 
472
        return listViewer; 
474
	}
473
	}
475
476
  
474
  
477
	/**
475
	/**
478
	 * Create a selection combo
476
	 * Create a selection combo
Lines 489-509 Link Here
489
		
487
		
490
	public static CCombo createSelectCCombo(Composite parent, String strdata, String selData, int style) {
488
	public static CCombo createSelectCCombo(Composite parent, String strdata, String selData, int style) {
491
		CCombo combo = new CCombo(parent, style);
489
		CCombo combo = new CCombo(parent, style);
490
		combo.setFont(parent.getFont());
492
		GridData data = new GridData(GridData.FILL_HORIZONTAL);
491
		GridData data = new GridData(GridData.FILL_HORIZONTAL);
493
		combo.setLayoutData(data);
492
		combo.setLayoutData(data);
494
		StringTokenizer st = new StringTokenizer(strdata, ","); //$NON-NLS-1$
493
		StringTokenizer st = new StringTokenizer(strdata, ","); //$NON-NLS-1$
495
		while(st.hasMoreTokens())
494
		while (st.hasMoreTokens())
496
			combo.add(st.nextToken());
495
			combo.add(st.nextToken());
497
	    if(selData == null || selData.length() == 0) {
496
	    if (selData == null || selData.length() == 0) {
498
	    	if(combo.getItemCount() > 0)
497
	    	if (combo.getItemCount() > 0)
499
				combo.select(0);
498
				combo.select(0);
499
	    } else {
500
			selectCCombo(combo, selData);
500
	    }
501
	    }
501
	    else
502
			selectCCombo(combo, selData);	    
503
		return combo;
502
		return combo;
504
	}
503
	}
505
504
506
507
	/**
505
	/**
508
	 * Create a selection combo
506
	 * Create a selection combo
509
	 *
507
	 *
Lines 518-529 Link Here
518
	
516
	
519
	public static CCombo createSelectCCombo(Composite parent, String[] strdata, String selData, int style) {
517
	public static CCombo createSelectCCombo(Composite parent, String[] strdata, String selData, int style) {
520
		CCombo combo = new CCombo(parent, style);
518
		CCombo combo = new CCombo(parent, style);
519
		combo.setFont(parent.getFont());
521
		GridData data = new GridData(GridData.FILL_HORIZONTAL);
520
		GridData data = new GridData(GridData.FILL_HORIZONTAL);
522
		combo.setLayoutData(data);
521
		combo.setLayoutData(data);
523
		for(int i = 0; i < strdata.length; ++i) {
522
		for (int i = 0; i < strdata.length; ++i) {
524
			combo.add(strdata[i]);
523
			combo.add(strdata[i]);
525
		}
524
		}
526
	    if(selData == null)
525
	    if (selData == null)
527
			combo.select(0);
526
			combo.select(0);
528
	    else
527
	    else
529
			selectCCombo(combo, selData);	    
528
			selectCCombo(combo, selData);	    
Lines 532-551 Link Here
532
531
533
	public static void selectCCombo(CCombo combo, String selData)	{
532
	public static void selectCCombo(CCombo combo, String selData)	{
534
		int n_sel = combo.indexOf(selData);
533
		int n_sel = combo.indexOf(selData);
535
		if(0 > n_sel)
534
		if (0 > n_sel)
536
			n_sel = 0;
535
			n_sel = 0;
537
	    combo.select(n_sel);
536
	    combo.select(n_sel);
538
	} 
537
	} 
539
538
540
541
542
543
544
545
546
547
548
549
	/**
539
	/**
550
	 * Create a selection combo
540
	 * Create a selection combo
551
	 *
541
	 *
Lines 561-581 Link Here
561
		
551
		
562
	public static Combo createSelectCombo(Composite parent, String strdata, String selData, int style) {
552
	public static Combo createSelectCombo(Composite parent, String strdata, String selData, int style) {
563
		Combo combo = new Combo(parent, style);
553
		Combo combo = new Combo(parent, style);
554
		combo.setFont(parent.getFont());
564
		GridData data = new GridData(GridData.FILL_HORIZONTAL);
555
		GridData data = new GridData(GridData.FILL_HORIZONTAL);
565
		combo.setLayoutData(data);
556
		combo.setLayoutData(data);
566
		StringTokenizer st = new StringTokenizer(strdata, ","); //$NON-NLS-1$
557
		StringTokenizer st = new StringTokenizer(strdata, ","); //$NON-NLS-1$
567
		while(st.hasMoreTokens())
558
		while (st.hasMoreTokens())
568
			combo.add(st.nextToken());
559
			combo.add(st.nextToken());
569
	    if(selData == null || selData.length() == 0) {
560
	    if (selData == null || selData.length() == 0) {
570
	    	if(combo.getItemCount() > 0)
561
	    	if (combo.getItemCount() > 0)
571
				combo.select(0);
562
				combo.select(0);
563
	    } else {
564
			selectCombo(combo, selData);
572
	    }
565
	    }
573
	    else
574
			selectCombo(combo, selData);	    
575
		return combo;
566
		return combo;
576
	}
567
	}
577
568
578
579
	/**
569
	/**
580
	 * Create a selection combo
570
	 * Create a selection combo
581
	 *
571
	 *
Lines 590-601 Link Here
590
	
580
	
591
	public static Combo createSelectCombo(Composite parent, String[] strdata, String selData, int style) {
581
	public static Combo createSelectCombo(Composite parent, String[] strdata, String selData, int style) {
592
		Combo combo = new Combo(parent, style);
582
		Combo combo = new Combo(parent, style);
583
		combo.setFont(parent.getFont());
593
		GridData data = new GridData(GridData.FILL_HORIZONTAL);
584
		GridData data = new GridData(GridData.FILL_HORIZONTAL);
594
		combo.setLayoutData(data);
585
		combo.setLayoutData(data);
595
		for(int i = 0; i < strdata.length; ++i) {
586
		for (int i = 0; i < strdata.length; ++i) {
596
			combo.add(strdata[i]);
587
			combo.add(strdata[i]);
597
		}
588
		}
598
	    if(selData == null)
589
	    if (selData == null)
599
			combo.select(0);
590
			combo.select(0);
600
	    else
591
	    else
601
			selectCombo(combo, selData);	    
592
			selectCombo(combo, selData);	    
Lines 604-611 Link Here
604
595
605
	public static void selectCombo(Combo combo, String selData)	{
596
	public static void selectCombo(Combo combo, String selData)	{
606
		int n_sel = combo.indexOf(selData);
597
		int n_sel = combo.indexOf(selData);
607
		if(0 > n_sel) {
598
		if (0 > n_sel) {
608
			if( ( combo.getStyle() & SWT.READ_ONLY ) == 0 ) {
599
			if ((combo.getStyle() & SWT.READ_ONLY) == 0) {
609
				combo.setText( selData );
600
				combo.setText( selData );
610
				return;
601
				return;
611
			}
602
			}
Lines 614-629 Link Here
614
	    combo.select(n_sel);
605
	    combo.select(n_sel);
615
	} 
606
	} 
616
607
617
618
619
620
621
622
623
624
625
626
627
    /**
608
    /**
628
	 * Create a dialog shell, child to the top level workbench shell.
609
	 * Create a dialog shell, child to the top level workbench shell.
629
	 *
610
	 *
Lines 637-644 Link Here
637
        return new Shell( parent, SWT.DIALOG_TRIM );
618
        return new Shell( parent, SWT.DIALOG_TRIM );
638
    }
619
    }
639
620
640
	
641
642
	public static Composite insertSpace(Composite parent, int nSpan, int height) {
621
	public static Composite insertSpace(Composite parent, int nSpan, int height) {
643
		Composite space = ControlFactory.createCompositeSeparator(parent, parent.getBackground(),
622
		Composite space = ControlFactory.createCompositeSeparator(parent, parent.getBackground(),
644
			 (SWT.DEFAULT != height ? height : 5));
623
			 (SWT.DEFAULT != height ? height : 5));
Lines 664-668 Link Here
664
    public static MessageBox createOkCancelDialog( String title, String message ) {
643
    public static MessageBox createOkCancelDialog( String title, String message ) {
665
        return createDialog( title, message, SWT.OK | SWT.CANCEL | SWT.ICON_INFORMATION );
644
        return createDialog( title, message, SWT.OK | SWT.CANCEL | SWT.ICON_INFORMATION );
666
    }
645
    }
667
	
668
}
646
}
(-)src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java (-61 / +217 lines)
Lines 8-18 Link Here
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     QNX Software System
10
 *     QNX Software System
11
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
 *******************************************************************************/
12
package org.eclipse.cdt.internal.ui.text;
13
package org.eclipse.cdt.internal.ui.text;
13
14
14
import java.util.Vector;
15
import java.util.Vector;
15
16
17
import org.eclipse.core.resources.IFile;
18
import org.eclipse.core.runtime.CoreException;
19
import org.eclipse.core.runtime.IPath;
20
import org.eclipse.core.runtime.content.IContentType;
16
import org.eclipse.jface.dialogs.IDialogSettings;
21
import org.eclipse.jface.dialogs.IDialogSettings;
17
import org.eclipse.jface.preference.IPreferenceStore;
22
import org.eclipse.jface.preference.IPreferenceStore;
18
import org.eclipse.jface.text.DefaultInformationControl;
23
import org.eclipse.jface.text.DefaultInformationControl;
Lines 41-60 Link Here
41
import org.eclipse.jface.text.source.IAnnotationHover;
46
import org.eclipse.jface.text.source.IAnnotationHover;
42
import org.eclipse.jface.text.source.ISourceViewer;
47
import org.eclipse.jface.text.source.ISourceViewer;
43
import org.eclipse.jface.text.source.SourceViewerConfiguration;
48
import org.eclipse.jface.text.source.SourceViewerConfiguration;
49
import org.eclipse.jface.util.Assert;
44
import org.eclipse.jface.util.PropertyChangeEvent;
50
import org.eclipse.jface.util.PropertyChangeEvent;
45
import org.eclipse.swt.SWT;
51
import org.eclipse.swt.SWT;
46
import org.eclipse.swt.widgets.Shell;
52
import org.eclipse.swt.widgets.Shell;
47
import org.eclipse.ui.IEditorInput;
53
import org.eclipse.ui.IEditorInput;
54
import org.eclipse.ui.IPathEditorInput;
55
import org.eclipse.ui.editors.text.ILocationProvider;
48
import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
56
import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
57
import org.eclipse.ui.ide.ResourceUtil;
49
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
58
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
50
import org.eclipse.ui.texteditor.IDocumentProvider;
59
import org.eclipse.ui.texteditor.IDocumentProvider;
51
import org.eclipse.ui.texteditor.ITextEditor;
60
import org.eclipse.ui.texteditor.ITextEditor;
52
61
62
import org.eclipse.cdt.core.CCorePlugin;
53
import org.eclipse.cdt.core.dom.ast.gnu.c.GCCLanguage;
63
import org.eclipse.cdt.core.dom.ast.gnu.c.GCCLanguage;
54
import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage;
64
import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage;
55
import org.eclipse.cdt.core.model.ICElement;
65
import org.eclipse.cdt.core.model.ICElement;
56
import org.eclipse.cdt.core.model.ICProject;
66
import org.eclipse.cdt.core.model.ICProject;
57
import org.eclipse.cdt.core.model.ILanguage;
67
import org.eclipse.cdt.core.model.ILanguage;
68
import org.eclipse.cdt.core.model.ITranslationUnit;
69
import org.eclipse.cdt.core.model.LanguageManager;
58
import org.eclipse.cdt.ui.CElementContentProvider;
70
import org.eclipse.cdt.ui.CElementContentProvider;
59
import org.eclipse.cdt.ui.CUIPlugin;
71
import org.eclipse.cdt.ui.CUIPlugin;
60
import org.eclipse.cdt.ui.ILanguageUI;
72
import org.eclipse.cdt.ui.ILanguageUI;
Lines 63-69 Link Here
63
import org.eclipse.cdt.internal.ui.editor.CDocumentProvider;
75
import org.eclipse.cdt.internal.ui.editor.CDocumentProvider;
64
import org.eclipse.cdt.internal.ui.editor.CEditor;
76
import org.eclipse.cdt.internal.ui.editor.CEditor;
65
import org.eclipse.cdt.internal.ui.editor.CElementHyperlinkDetector;
77
import org.eclipse.cdt.internal.ui.editor.CElementHyperlinkDetector;
66
import org.eclipse.cdt.internal.ui.editor.CSourceViewer;
67
import org.eclipse.cdt.internal.ui.text.c.hover.CEditorTextHoverDescriptor;
78
import org.eclipse.cdt.internal.ui.text.c.hover.CEditorTextHoverDescriptor;
68
import org.eclipse.cdt.internal.ui.text.c.hover.CEditorTextHoverProxy;
79
import org.eclipse.cdt.internal.ui.text.c.hover.CEditorTextHoverProxy;
69
import org.eclipse.cdt.internal.ui.text.contentassist.CCompletionProcessor2;
80
import org.eclipse.cdt.internal.ui.text.contentassist.CCompletionProcessor2;
Lines 71-152 Link Here
71
82
72
83
73
/**
84
/**
74
 * Configuration for an <code>SourceViewer</code> which shows C code.
85
 * Configuration for an <code>SourceViewer</code> which shows C/C++ code.
75
 */
86
 */
76
public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
87
public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
77
	
88
	
78
    private CTextTools fTextTools;
89
    private CTextTools fTextTools;
79
	private CEditor fEditor;
90
	private ITextEditor fTextEditor;
91
	/**
92
	 * The document partitioning.
93
	 */
94
	private String fDocumentPartitioning;
95
	/**
96
	 * The C++ source code scanner.
97
	 */
98
	private AbstractCScanner fCppCodeScanner;
99
	/**
100
	 * The C source code scanner.
101
	 */
102
	private AbstractCScanner fCCodeScanner;
103
	/**
104
	 * The C multi-line comment scanner.
105
	 */
106
	private AbstractCScanner fMultilineCommentScanner;
107
	/**
108
	 * The C single-line comment scanner.
109
	 */
110
	private AbstractCScanner fSinglelineCommentScanner;
111
	/**
112
	 * The C string scanner.
113
	 */
114
	private AbstractCScanner fStringScanner;
115
	/**
116
	 * The color manager.
117
	 */
118
	private IColorManager fColorManager;
80
	
119
	
81
	/**
120
	/**
121
	 * Creates a new C source viewer configuration for viewers in the given editor
122
	 * using the given preference store, the color manager and the specified document partitioning.
123
	 * <p>
124
	 * Creates a C source viewer configuration in the new setup without text tools. Clients are
125
	 * allowed to call {@link CSourceViewerConfiguration#handlePropertyChangeEvent(PropertyChangeEvent)}
126
	 * and disallowed to call {@link CSourceViewerConfiguration#getPreferenceStore()} on the resulting
127
	 * C source viewer configuration.
128
	 * </p>
129
	 *
130
	 * @param colorManager the color manager
131
	 * @param preferenceStore the preference store, can be read-only
132
	 * @param editor the editor in which the configured viewer(s) will reside, or <code>null</code> if none
133
	 * @param partitioning the document partitioning for this configuration, or <code>null</code> for the default partitioning
134
	 */
135
	public CSourceViewerConfiguration(IColorManager colorManager, IPreferenceStore preferenceStore, ITextEditor editor, String partitioning) {
136
		super(preferenceStore);
137
		fColorManager= colorManager;
138
		fTextEditor= editor;
139
		fDocumentPartitioning= partitioning;
140
		initializeScanners();
141
	}
142
143
	/**
82
	 * Creates a new C source viewer configuration for viewers in the given editor using
144
	 * Creates a new C source viewer configuration for viewers in the given editor using
83
	 * the given C tools collection.
145
	 * the given C tools collection.
84
	 *
146
	 *
85
	 * @param tools the C text tools collection to be used
147
	 * @param tools the C text tools collection to be used
86
	 * @param editor the editor in which the configured viewer will reside
148
	 * @param editor the editor in which the configured viewer will reside
87
	 */
149
	 */
88
	public CSourceViewerConfiguration(CTextTools tools, CEditor editor) {
150
	public CSourceViewerConfiguration(CTextTools tools, ITextEditor editor) {
89
		super(CUIPlugin.getDefault().getCombinedPreferenceStore());
151
		super(CUIPlugin.getDefault().getCombinedPreferenceStore());
90
		fTextTools= tools;
152
		fTextTools= tools;
91
		fEditor= editor;
153
		fColorManager= tools.getColorManager();
154
		fTextEditor= editor;
155
		fDocumentPartitioning= fTextTools.getDocumentPartitioning();
156
		fCppCodeScanner= (AbstractCScanner) fTextTools.getCppCodeScanner();
157
		fCCodeScanner= (AbstractCScanner) fTextTools.getCCodeScanner();
158
		fMultilineCommentScanner= (AbstractCScanner) fTextTools.getMultilineCommentScanner();
159
		fSinglelineCommentScanner= (AbstractCScanner) fTextTools.getSinglelineCommentScanner();
160
		fStringScanner= (AbstractCScanner) fTextTools.getStringScanner();
92
	}
161
	}
93
162
94
	/**
163
	/**
95
	 * Returns the C multiline comment scanner for this configuration.
164
	 * Returns the C multi-line comment scanner for this configuration.
96
	 *
165
	 *
97
	 * @return the C multiline comment scanner
166
	 * @return the C multi-line comment scanner
98
	 */
167
	 */
99
	protected RuleBasedScanner getMultilineCommentScanner() {
168
	protected RuleBasedScanner getMultilineCommentScanner() {
100
		return fTextTools.getMultilineCommentScanner();
169
		return fMultilineCommentScanner;
101
	}
170
	}
102
	
171
103
	/**
172
	/**
104
	 * Returns the C singleline comment scanner for this configuration.
173
	 * Returns the C single-line comment scanner for this configuration.
105
	 *
174
	 *
106
	 * @return the C singleline comment scanner
175
	 * @return the C single-line comment scanner
107
	 */
176
	 */
108
	protected RuleBasedScanner getSinglelineCommentScanner() {
177
	protected RuleBasedScanner getSinglelineCommentScanner() {
109
		return fTextTools.getSinglelineCommentScanner();
178
		return fSinglelineCommentScanner;
110
	}
179
	}
111
	
180
112
	/**
181
	/**
113
	 * Returns the C string scanner for this configuration.
182
	 * Returns the C string scanner for this configuration.
114
	 *
183
	 *
115
	 * @return the C string scanner
184
	 * @return the C string scanner
116
	 */
185
	 */
117
	protected RuleBasedScanner getStringScanner() {
186
	protected RuleBasedScanner getStringScanner() {
118
		return fTextTools.getStringScanner();
187
		return fStringScanner;
119
	}	
188
	}
120
	
189
121
	/**
190
	/**
122
	 * Returns the color manager for this configuration.
191
	 * Returns the color manager for this configuration.
123
	 *
192
	 *
124
	 * @return the color manager
193
	 * @return the color manager
125
	 */
194
	 */
126
	protected IColorManager getColorManager() {
195
	protected IColorManager getColorManager() {
127
		return fTextTools.getColorManager();
196
		return fColorManager;
128
	}
197
	}
129
	
198
130
	/**
199
	/**
131
	 * Returns the editor in which the configured viewer(s) will reside.
200
	 * Returns the editor in which the configured viewer(s) will reside.
132
	 *
201
	 *
133
	 * @return the enclosing editor
202
	 * @return the enclosing editor
134
	 */
203
	 */
135
	protected ITextEditor getEditor() {
204
	public ITextEditor getEditor() {
136
		return fEditor;
205
		return fTextEditor;
137
	}
206
	}
138
207
139
	
140
    /**
208
    /**
141
     * Creates outline presenter. 
209
     * Creates outline presenter. 
142
     * @param editor Editor.
143
     * @return Presenter with outline view.
210
     * @return Presenter with outline view.
144
     */
211
     */
145
    public IInformationPresenter getOutlinePresenter(CEditor editor)
212
    public IInformationPresenter getOutlinePresenter(ISourceViewer sourceViewer) {
146
    {
213
        final IInformationControlCreator outlineControlCreator = getOutlineContolCreator();
147
        final IInformationControlCreator outlineControlCreator = getOutlineContolCreator(editor);
148
        final InformationPresenter presenter = new InformationPresenter(outlineControlCreator);
214
        final InformationPresenter presenter = new InformationPresenter(outlineControlCreator);
149
        presenter.setDocumentPartitioning(getConfiguredDocumentPartitioning(null));
215
        presenter.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
150
        final IInformationProvider provider = new CElementContentProvider(getEditor());
216
        final IInformationProvider provider = new CElementContentProvider(getEditor());
151
        presenter.setInformationProvider(provider, IDocument.DEFAULT_CONTENT_TYPE);
217
        presenter.setInformationProvider(provider, IDocument.DEFAULT_CONTENT_TYPE);
152
        presenter.setInformationProvider(provider, ICPartitions.C_MULTI_LINE_COMMENT);
218
        presenter.setInformationProvider(provider, ICPartitions.C_MULTI_LINE_COMMENT);
Lines 158-186 Link Here
158
        return presenter;
224
        return presenter;
159
    }
225
    }
160
226
227
	/**
228
	 * Initializes the scanners.
229
	 */
230
	private void initializeScanners() {
231
		Assert.isTrue(isNewSetup());
232
		fCppCodeScanner= new CppCodeScanner(getColorManager(), fPreferenceStore);
233
		fCCodeScanner= new CppCodeScanner(getColorManager(), fPreferenceStore);
234
		fMultilineCommentScanner= new CCommentScanner(getColorManager(), fPreferenceStore, ICColorConstants.C_MULTI_LINE_COMMENT);
235
		fSinglelineCommentScanner= new CCommentScanner(getColorManager(), fPreferenceStore, ICColorConstants.C_SINGLE_LINE_COMMENT);
236
		fStringScanner= new SingleTokenCScanner(getColorManager(), fPreferenceStore, ICColorConstants.C_STRING);
237
	}
238
161
    /**
239
    /**
162
     * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(org.eclipse.jface.text.source.ISourceViewer)
240
     * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(org.eclipse.jface.text.source.ISourceViewer)
163
	 */
241
	 */
164
    public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
242
    public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
165
166
		PresentationReconciler reconciler= new PresentationReconciler();
243
		PresentationReconciler reconciler= new PresentationReconciler();
167
		reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
244
		reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
168
245
169
		RuleBasedScanner scanner = null;
246
		RuleBasedScanner scanner = null;
170
		if(sourceViewer instanceof CSourceViewer) {
247
		ILanguage language = getLanguage();
171
			ILanguage language = ((CSourceViewer)sourceViewer).getLanguage();
248
		if (language instanceof GPPLanguage) {
172
			if (language instanceof GPPLanguage) {
249
			scanner = fCppCodeScanner;
173
				scanner = fTextTools.getCppCodeScanner();
250
		} else if (language instanceof GCCLanguage) {
174
			} else if (language instanceof GCCLanguage) {
251
			scanner = fCCodeScanner;
175
				scanner = fTextTools.getCCodeScanner();
252
		} else if (language != null) {
176
			} else if (language != null) {
253
			ILanguageUI languageUI = (ILanguageUI)language.getAdapter(ILanguageUI.class);
177
				ILanguageUI languageUI = (ILanguageUI)language.getAdapter(ILanguageUI.class);
254
			if (languageUI != null)
178
				if (languageUI != null)
255
				scanner = languageUI.getCodeScanner();
179
					scanner = languageUI.getCodeScanner();
180
			}
181
		}
256
		}
182
		if (scanner == null) {
257
		if (scanner == null) {
183
			scanner= fTextTools.getCCodeScanner();
258
			scanner= fCppCodeScanner;
184
		}
259
		}
185
260
186
		DefaultDamagerRepairer dr= new DefaultDamagerRepairer(scanner);
261
		DefaultDamagerRepairer dr= new DefaultDamagerRepairer(scanner);
Lines 238-247 Link Here
238
	 * @see SourceViewerConfiguration#getReconciler(ISourceViewer)
313
	 * @see SourceViewerConfiguration#getReconciler(ISourceViewer)
239
	 */
314
	 */
240
	public IReconciler getReconciler(ISourceViewer sourceViewer) {
315
	public IReconciler getReconciler(ISourceViewer sourceViewer) {
241
		if (fEditor != null && fEditor.isEditable()) {
316
		if (fTextEditor != null && fTextEditor.isEditable()) {
242
			//Delay changed and non-incremental reconciler used due to 
317
			//Delay changed and non-incremental reconciler used due to 
243
			//PR 130089
318
			//PR 130089
244
			MonoReconciler reconciler= new MonoReconciler(new CReconcilingStrategy(fEditor), false);
319
			MonoReconciler reconciler= new MonoReconciler(new CReconcilingStrategy(fTextEditor), false);
245
			reconciler.setDelay(500);
320
			reconciler.setDelay(500);
246
			return reconciler;
321
			return reconciler;
247
		}
322
		}
Lines 255-262 Link Here
255
		String partitioning= getConfiguredDocumentPartitioning(sourceViewer);
330
		String partitioning= getConfiguredDocumentPartitioning(sourceViewer);
256
		if (ICPartitions.C_MULTI_LINE_COMMENT.equals(contentType))
331
		if (ICPartitions.C_MULTI_LINE_COMMENT.equals(contentType))
257
			return new IAutoEditStrategy[] { new CCommentAutoIndentStrategy() };
332
			return new IAutoEditStrategy[] { new CCommentAutoIndentStrategy() };
258
//		else if (ICPartitions.C_STRING.equals(contentType))
333
		else if (ICPartitions.C_STRING.equals(contentType))
259
//			return new IAutoEditStrategy[] { new SmartSemicolonAutoEditStrategy(partitioning), new JavaStringAutoIndentStrategy(partitioning) };
334
			return new IAutoEditStrategy[] { /*new SmartSemicolonAutoEditStrategy(partitioning),*/ new CStringAutoIndentStrategy(partitioning, getProject()) };
260
		else
335
		else
261
			return new IAutoEditStrategy[] { new CAutoIndentStrategy(partitioning, getProject()) };
336
			return new IAutoEditStrategy[] { new CAutoIndentStrategy(partitioning, getProject()) };
262
	}
337
	}
Lines 337-344 Link Here
337
		return new CAnnotationHover();
412
		return new CAnnotationHover();
338
	}
413
	}
339
414
340
341
	
342
	/*
415
	/*
343
	 * @see SourceViewerConfiguration#getConfiguredTextHoverStateMasks(ISourceViewer, String)
416
	 * @see SourceViewerConfiguration#getConfiguredTextHoverStateMasks(ISourceViewer, String)
344
	 * @since 2.1
417
	 * @since 2.1
Lines 414-425 Link Here
414
		
487
		
415
		formatter.setMasterStrategy(new CFormattingStrategy());
488
		formatter.setMasterStrategy(new CFormattingStrategy());
416
		return formatter;
489
		return formatter;
417
		
418
		
419
	}
490
	}
420
	
491
	
421
	public boolean affectsBehavior(PropertyChangeEvent event) {
492
	public boolean affectsBehavior(PropertyChangeEvent event) {
422
		return fTextTools.affectsBehavior(event);
493
		return  fCppCodeScanner.affectsBehavior(event)
494
			|| fMultilineCommentScanner.affectsBehavior(event)
495
			|| fSinglelineCommentScanner.affectsBehavior(event)
496
			|| fStringScanner.affectsBehavior(event);
423
	}
497
	}
424
498
425
	/**
499
	/**
Lines 436-441 Link Here
436
		return CUIPlugin.getDefault().getPreferenceStore();
510
		return CUIPlugin.getDefault().getPreferenceStore();
437
	}
511
	}
438
	
512
	
513
	/**
514
	 * @return <code>true</code> iff the new setup without text tools is in use.
515
	 */
516
	private boolean isNewSetup() {
517
		return fTextTools == null;
518
	}
519
439
	/*
520
	/*
440
	 * @see SourceViewerConfiguration#getHoverControlCreator(ISourceViewer)
521
	 * @see SourceViewerConfiguration#getHoverControlCreator(ISourceViewer)
441
	 * @since 2.0
522
	 * @since 2.0
Lines 444-450 Link Here
444
		return getInformationControlCreator(sourceViewer, true);
525
		return getInformationControlCreator(sourceViewer, true);
445
	}
526
	}
446
	
527
	
447
448
	public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer, final boolean cutDown) {
528
	public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer, final boolean cutDown) {
449
			return new IInformationControlCreator() {
529
			return new IInformationControlCreator() {
450
			public IInformationControl createInformationControl(Shell parent) {
530
			public IInformationControl createInformationControl(Shell parent) {
Lines 463-468 Link Here
463
		return super.getInformationPresenter(sourceViewer);
543
		return super.getInformationPresenter(sourceViewer);
464
	}
544
	}
465
    
545
    
546
	/**
547
	 * Determines whether the preference change encoded by the given event
548
	 * changes the behavior of one of its contained components.
549
	 *
550
	 * @param event the event to be investigated
551
	 * @return <code>true</code> if event causes a behavioral change
552
	 */
553
	public boolean affectsTextPresentation(PropertyChangeEvent event) {
554
		return fCppCodeScanner.affectsBehavior(event)
555
		    || fCCodeScanner.affectsBehavior(event)
556
			|| fMultilineCommentScanner.affectsBehavior(event)
557
			|| fSinglelineCommentScanner.affectsBehavior(event)
558
			|| fStringScanner.affectsBehavior(event);
559
	}
560
561
	/**
562
	 * Adapts the behavior of the contained components to the change
563
	 * encoded in the given event.
564
	 * <p>
565
	 * Clients are not allowed to call this method if the old setup with
566
	 * text tools is in use.
567
	 * </p>
568
	 *
569
	 * @param event the event to which to adapt
570
	 * @see CSourceViewerConfiguration#CSourceViewerConfiguration(IColorManager, IPreferenceStore, ITextEditor, String)
571
	 */
572
	public void handlePropertyChangeEvent(PropertyChangeEvent event) {
573
		Assert.isTrue(isNewSetup());
574
		if (fCppCodeScanner.affectsBehavior(event))
575
			fCppCodeScanner.adaptToPreferenceChange(event);
576
		if (fCCodeScanner.affectsBehavior(event))
577
			fCCodeScanner.adaptToPreferenceChange(event);
578
		if (fMultilineCommentScanner.affectsBehavior(event))
579
			fMultilineCommentScanner.adaptToPreferenceChange(event);
580
		if (fSinglelineCommentScanner.affectsBehavior(event))
581
			fSinglelineCommentScanner.adaptToPreferenceChange(event);
582
		if (fStringScanner.affectsBehavior(event))
583
			fStringScanner.adaptToPreferenceChange(event);
584
	}
585
466
	/*
586
	/*
467
	 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getHyperlinkDetectors(org.eclipse.jface.text.source.ISourceViewer)
587
	 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getHyperlinkDetectors(org.eclipse.jface.text.source.ISourceViewer)
468
	 * @since 3.1
588
	 * @since 3.1
Lines 473-484 Link Here
473
		
593
		
474
		IHyperlinkDetector[] inheritedDetectors= super.getHyperlinkDetectors(sourceViewer);
594
		IHyperlinkDetector[] inheritedDetectors= super.getHyperlinkDetectors(sourceViewer);
475
		
595
		
476
		if (fEditor == null)
596
		if (fTextEditor == null)
477
			return inheritedDetectors;
597
			return inheritedDetectors;
478
		
598
		
479
		int inheritedDetectorsLength= inheritedDetectors != null ? inheritedDetectors.length : 0;
599
		int inheritedDetectorsLength= inheritedDetectors != null ? inheritedDetectors.length : 0;
480
		IHyperlinkDetector[] detectors= new IHyperlinkDetector[inheritedDetectorsLength + 1];
600
		IHyperlinkDetector[] detectors= new IHyperlinkDetector[inheritedDetectorsLength + 1];
481
		detectors[0]= new CElementHyperlinkDetector(fEditor); 
601
		detectors[0]= new CElementHyperlinkDetector(fTextEditor); 
482
		for (int i= 0; i < inheritedDetectorsLength; i++) {
602
		for (int i= 0; i < inheritedDetectorsLength; i++) {
483
			detectors[i+1]= inheritedDetectors[i];
603
			detectors[i+1]= inheritedDetectors[i];
484
		}
604
		}
Lines 489-515 Link Here
489
	/*
609
	/*
490
	 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredDocumentPartitioning(org.eclipse.jface.text.source.ISourceViewer)
610
	 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredDocumentPartitioning(org.eclipse.jface.text.source.ISourceViewer)
491
	 */
611
	 */
492
    public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
612
	public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
493
		return fTextTools.getDocumentPartitioning();
613
		if (fDocumentPartitioning != null)
614
			return fDocumentPartitioning;
615
		return super.getConfiguredDocumentPartitioning(sourceViewer);
494
	}
616
	}
495
617
496
	/**
618
	/**
497
     * Creates control for outline presentation in editor.
619
     * Creates control for outline presentation in editor.
498
     * @param editor Editor.
499
     * @return Control.
620
     * @return Control.
500
     */
621
     */
501
    private IInformationControlCreator getOutlineContolCreator(final CEditor editor)
622
    private IInformationControlCreator getOutlineContolCreator() {
502
    {
623
        final IInformationControlCreator conrolCreator = new IInformationControlCreator() {
503
        final IInformationControlCreator conrolCreator = new IInformationControlCreator()
504
        {
505
            /**
624
            /**
506
             * @see org.eclipse.jface.text.IInformationControlCreator#createInformationControl(org.eclipse.swt.widgets.Shell)
625
             * @see org.eclipse.jface.text.IInformationControlCreator#createInformationControl(org.eclipse.swt.widgets.Shell)
507
             */
626
             */
508
            public IInformationControl createInformationControl(Shell parent)
627
            public IInformationControl createInformationControl(Shell parent) {
509
            {
510
                int shellStyle= SWT.RESIZE;
628
                int shellStyle= SWT.RESIZE;
511
                int treeStyle= SWT.V_SCROLL | SWT.H_SCROLL;
629
                int treeStyle= SWT.V_SCROLL | SWT.H_SCROLL;
512
                return new COutlineInformationControl(editor, parent, shellStyle, treeStyle);   
630
                return new COutlineInformationControl(parent, shellStyle, treeStyle);   
513
            }
631
            }
514
        };
632
        };
515
        return conrolCreator;
633
        return conrolCreator;
Lines 530-533 Link Here
530
        return settings;
648
        return settings;
531
    }
649
    }
532
    
650
    
651
	private ILanguage getLanguage() {
652
		if (fTextEditor == null) {
653
			return null;
654
		}
655
		ICElement element = CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(fTextEditor.getEditorInput());
656
		if (element instanceof ITranslationUnit) {
657
			try {
658
				return ((ITranslationUnit)element).getLanguage();
659
			} catch (CoreException e) {
660
				CUIPlugin.getDefault().log(e);
661
			}
662
		} else {
663
			// compute the language from the plain editor input
664
			IContentType contentType = null;
665
			IEditorInput input = fTextEditor.getEditorInput();
666
			IFile file = ResourceUtil.getFile(input);
667
			if (file != null) {
668
				contentType = CCorePlugin.getContentType(file.getProject(), file.getName());
669
			} else if (input instanceof IPathEditorInput) {
670
				IPath path = ((IPathEditorInput)input).getPath();
671
				contentType = CCorePlugin.getContentType(path.lastSegment());
672
			} else {
673
				ILocationProvider locationProvider = (ILocationProvider)input.getAdapter(ILocationProvider.class);
674
				if (locationProvider != null) {
675
					IPath path = locationProvider.getPath(input);
676
					contentType = CCorePlugin.getContentType(path.lastSegment());
677
				}
678
			}
679
			if (contentType != null) {
680
				try {
681
					return LanguageManager.getInstance().getLanguage(contentType);
682
				} catch (CoreException exc) {
683
					CUIPlugin.getDefault().log(exc.getStatus());
684
				}
685
			}
686
		}
687
		return null;
688
	}
533
}
689
}
(-)src/org/eclipse/cdt/internal/ui/text/CCommentScanner.java (+4 lines)
Lines 82-87 Link Here
82
    private String fDefaultTokenProperty;
82
    private String fDefaultTokenProperty;
83
    private String[] fTokenProperties;
83
    private String[] fTokenProperties;
84
84
85
    public CCommentScanner(IColorManager manager, IPreferenceStore store, String defaultTokenProperty) {
86
        this(manager, store, null, defaultTokenProperty, new String[] { defaultTokenProperty, TASK_TAG });
87
    }
88
85
    public CCommentScanner(IColorManager manager, IPreferenceStore store, Preferences coreStore, String defaultTokenProperty) {
89
    public CCommentScanner(IColorManager manager, IPreferenceStore store, Preferences coreStore, String defaultTokenProperty) {
86
        this(manager, store, coreStore, defaultTokenProperty, new String[] { defaultTokenProperty, TASK_TAG });
90
        this(manager, store, coreStore, defaultTokenProperty, new String[] { defaultTokenProperty, TASK_TAG });
87
    }
91
    }
(-)src/org/eclipse/cdt/internal/ui/text/CIndenter.java (-46 / +60 lines)
Lines 7-17 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.cdt.internal.ui.text;
12
package org.eclipse.cdt.internal.ui.text;
12
13
13
import org.eclipse.cdt.core.CCorePlugin;
14
import org.eclipse.cdt.core.CCorePlugin;
14
import org.eclipse.cdt.core.formatter.CodeFormatterConstants;
15
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
15
import org.eclipse.cdt.core.model.ICProject;
16
import org.eclipse.cdt.core.model.ICProject;
16
import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil;
17
import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil;
17
18
Lines 110-120 Link Here
110
			prefIndentBracesForMethods= prefIndentBracesForMethods();
111
			prefIndentBracesForMethods= prefIndentBracesForMethods();
111
			prefIndentBracesForTypes= prefIndentBracesForTypes();
112
			prefIndentBracesForTypes= prefIndentBracesForTypes();
112
			prefHasGenerics= hasGenerics();
113
			prefHasGenerics= hasGenerics();
113
			prefTabChar= getCoreFormatterOption(CodeFormatterConstants.FORMATTER_TAB_CHAR);
114
			prefTabChar= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR);
114
		}
115
		}
115
		
116
		
116
		private boolean prefUseTabs() {
117
		private boolean prefUseTabs() {
117
			return !CCorePlugin.SPACE.equals(getCoreFormatterOption(CodeFormatterConstants.FORMATTER_TAB_CHAR));
118
			return !CCorePlugin.SPACE.equals(getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR));
118
		}
119
		}
119
120
120
		private int prefTabSize() {
121
		private int prefTabSize() {
Lines 130-138 Link Here
130
		}
131
		}
131
132
132
		private int prefArrayIndent() {
133
		private int prefArrayIndent() {
133
			String option= getCoreFormatterOption(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER);
134
			String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER);
134
			try {
135
			try {
135
				if (CodeFormatterConstants.getIndentStyle(option) == CodeFormatterConstants.INDENT_BY_ONE)
136
				if (DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_BY_ONE)
136
					return 1;
137
					return 1;
137
			} catch (IllegalArgumentException e) {
138
			} catch (IllegalArgumentException e) {
138
				// ignore and return default
139
				// ignore and return default
Lines 142-150 Link Here
142
		}
143
		}
143
144
144
		private boolean prefArrayDeepIndent() {
145
		private boolean prefArrayDeepIndent() {
145
			String option= getCoreFormatterOption(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER);
146
			String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER);
146
			try {
147
			try {
147
				return CodeFormatterConstants.getIndentStyle(option) == CodeFormatterConstants.INDENT_ON_COLUMN;
148
				return DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_ON_COLUMN;
148
			} catch (IllegalArgumentException e) {
149
			} catch (IllegalArgumentException e) {
149
				// ignore and return default
150
				// ignore and return default
150
			}
151
			}
Lines 153-161 Link Here
153
		}
154
		}
154
155
155
		private boolean prefTernaryDeepAlign() {
156
		private boolean prefTernaryDeepAlign() {
156
			String option= getCoreFormatterOption(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION);
157
			String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION);
157
			try {
158
			try {
158
				return CodeFormatterConstants.getIndentStyle(option) == CodeFormatterConstants.INDENT_ON_COLUMN;
159
				return DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_ON_COLUMN;
159
			} catch (IllegalArgumentException e) {
160
			} catch (IllegalArgumentException e) {
160
				// ignore and return default
161
				// ignore and return default
161
			}
162
			}
Lines 163-171 Link Here
163
		}
164
		}
164
165
165
		private int prefTernaryIndent() {
166
		private int prefTernaryIndent() {
166
			String option= getCoreFormatterOption(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION);
167
			String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION);
167
			try {
168
			try {
168
				if (CodeFormatterConstants.getIndentStyle(option) == CodeFormatterConstants.INDENT_BY_ONE)
169
				if (DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_BY_ONE)
169
					return 1;
170
					return 1;
170
				else
171
				else
171
					return prefContinuationIndent();
172
					return prefContinuationIndent();
Lines 177-183 Link Here
177
		}
178
		}
178
179
179
		private int prefCaseIndent() {
180
		private int prefCaseIndent() {
180
			if (CodeFormatterConstants.TRUE.equals(getCoreFormatterOption(CodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH)))
181
			if (DefaultCodeFormatterConstants.TRUE.equals(getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH)))
181
				return prefBlockIndent();
182
				return prefBlockIndent();
182
			else
183
			else
183
				return 0;
184
				return 0;
Lines 191-197 Link Here
191
			if (true)
192
			if (true)
192
				return prefBlockIndent();
193
				return prefBlockIndent();
193
194
194
			if (CodeFormatterConstants.TRUE.equals(getCoreFormatterOption(CodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES)))
195
			if (DefaultCodeFormatterConstants.TRUE.equals(getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES)))
195
				return prefBlockIndent();
196
				return prefBlockIndent();
196
			else
197
			else
197
				return 0;
198
				return 0;
Lines 208-216 Link Here
208
		}
209
		}
209
210
210
		private boolean prefMethodDeclDeepIndent() {
211
		private boolean prefMethodDeclDeepIndent() {
211
			String option= getCoreFormatterOption(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION);
212
			String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION);
212
			try {
213
			try {
213
				return CodeFormatterConstants.getIndentStyle(option) == CodeFormatterConstants.INDENT_ON_COLUMN;
214
				return DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_ON_COLUMN;
214
			} catch (IllegalArgumentException e) {
215
			} catch (IllegalArgumentException e) {
215
				// ignore and return default
216
				// ignore and return default
216
			}
217
			}
Lines 219-227 Link Here
219
		}
220
		}
220
221
221
		private int prefMethodDeclIndent() {
222
		private int prefMethodDeclIndent() {
222
			String option= getCoreFormatterOption(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION);
223
			String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION);
223
			try {
224
			try {
224
				if (CodeFormatterConstants.getIndentStyle(option) == CodeFormatterConstants.INDENT_BY_ONE)
225
				if (DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_BY_ONE)
225
					return 1;
226
					return 1;
226
				else
227
				else
227
					return prefContinuationIndent();
228
					return prefContinuationIndent();
Lines 232-240 Link Here
232
		}
233
		}
233
234
234
		private boolean prefMethodCallDeepIndent() {
235
		private boolean prefMethodCallDeepIndent() {
235
			String option= getCoreFormatterOption(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION);
236
			String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION);
236
			try {
237
			try {
237
				return CodeFormatterConstants.getIndentStyle(option) == CodeFormatterConstants.INDENT_ON_COLUMN;
238
				return DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_ON_COLUMN;
238
			} catch (IllegalArgumentException e) {
239
			} catch (IllegalArgumentException e) {
239
				// ignore and return default
240
				// ignore and return default
240
			}
241
			}
Lines 242-250 Link Here
242
		}
243
		}
243
244
244
		private int prefMethodCallIndent() {
245
		private int prefMethodCallIndent() {
245
			String option= getCoreFormatterOption(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION);
246
			String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION);
246
			try {
247
			try {
247
				if (CodeFormatterConstants.getIndentStyle(option) == CodeFormatterConstants.INDENT_BY_ONE)
248
				if (DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_BY_ONE)
248
					return 1;
249
					return 1;
249
				else
250
				else
250
					return prefContinuationIndent();
251
					return prefContinuationIndent();
Lines 259-267 Link Here
259
			if (true) // don't do parenthesis deep indentation
260
			if (true) // don't do parenthesis deep indentation
260
				return false;
261
				return false;
261
262
262
			String option= getCoreFormatterOption(CodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION);
263
			String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION);
263
			try {
264
			try {
264
				return CodeFormatterConstants.getIndentStyle(option) == CodeFormatterConstants.INDENT_ON_COLUMN;
265
				return DefaultCodeFormatterConstants.getIndentStyle(option) == DefaultCodeFormatterConstants.INDENT_ON_COLUMN;
265
			} catch (IllegalArgumentException e) {
266
			} catch (IllegalArgumentException e) {
266
				// ignore and return default
267
				// ignore and return default
267
			}
268
			}
Lines 274-326 Link Here
274
		}
275
		}
275
276
276
		private int prefBlockIndent() {
277
		private int prefBlockIndent() {
277
			String option= getCoreFormatterOption(CodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK);
278
			String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK);
278
			if (CodeFormatterConstants.FALSE.equals(option))
279
			if (DefaultCodeFormatterConstants.FALSE.equals(option))
279
				return 0;
280
				return 0;
280
281
281
			return 1; // sensible default
282
			return 1; // sensible default
282
		}
283
		}
283
284
284
		private int prefMethodBodyIndent() {
285
		private int prefMethodBodyIndent() {
285
			if (CodeFormatterConstants.FALSE.equals(getCoreFormatterOption(CodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY)))
286
			if (DefaultCodeFormatterConstants.FALSE.equals(getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY)))
286
				return 0;
287
				return 0;
287
288
288
			return 1; // sensible default
289
			return 1; // sensible default
289
		}
290
		}
290
291
291
		private int prefTypeIndent() {
292
		private int prefTypeIndent() {
292
			String option= getCoreFormatterOption(CodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_TYPE_HEADER);
293
			String option= getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_TYPE_HEADER);
293
			if (CodeFormatterConstants.FALSE.equals(option))
294
			if (DefaultCodeFormatterConstants.FALSE.equals(option))
294
				return 0;
295
				return 0;
295
296
296
			return 1; // sensible default
297
			return 1; // sensible default
297
		}
298
		}
298
299
299
		private boolean prefIndentBracesForBlocks() {
300
		private boolean prefIndentBracesForBlocks() {
300
			return CodeFormatterConstants.NEXT_LINE_SHIFTED.equals(getCoreFormatterOption(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK));
301
			return DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED.equals(getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK));
301
		}
302
		}
302
303
303
		private boolean prefIndentBracesForArrays() {
304
		private boolean prefIndentBracesForArrays() {
304
			return CodeFormatterConstants.NEXT_LINE_SHIFTED.equals(getCoreFormatterOption(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER));
305
			return DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED.equals(getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER));
305
		}
306
		}
306
307
307
		private boolean prefIndentBracesForMethods() {
308
		private boolean prefIndentBracesForMethods() {
308
			return CodeFormatterConstants.NEXT_LINE_SHIFTED.equals(getCoreFormatterOption(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION));
309
			return DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED.equals(getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION));
309
		}
310
		}
310
311
311
		private boolean prefIndentBracesForTypes() {
312
		private boolean prefIndentBracesForTypes() {
312
			return CodeFormatterConstants.NEXT_LINE_SHIFTED.equals(getCoreFormatterOption(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION));
313
			return DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED.equals(getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION));
313
		}
314
		}
314
315
315
		private int prefContinuationIndent() {
316
		private int prefContinuationIndent() {
316
			try {
317
			try {
317
				return Integer.parseInt(getCoreFormatterOption(CodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION));
318
				return Integer.parseInt(getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION));
318
			} catch (NumberFormatException e) {
319
			} catch (NumberFormatException e) {
319
				// ignore and return default
320
				// ignore and return default
320
			}
321
			}
321
322
322
			return 2; // sensible default
323
			return 2; // sensible default
323
		}
324
		}
325
		
324
		private boolean hasGenerics() {
326
		private boolean hasGenerics() {
325
			return true;
327
			return true;
326
		}
328
		}
Lines 335-341 Link Here
335
	 * (method defs, array initializers)
337
	 * (method defs, array initializers)
336
	 */
338
	 */
337
	private int fAlign;
339
	private int fAlign;
338
	/** The stateful scanposition for the indentation methods. */
340
	/** The stateful scan position for the indentation methods. */
339
	private int fPosition;
341
	private int fPosition;
340
	/** The previous position. */
342
	/** The previous position. */
341
	private int fPreviousPos;
343
	private int fPreviousPos;
Lines 404-410 Link Here
404
	 *         if it cannot be determined
406
	 *         if it cannot be determined
405
	 */
407
	 */
406
	private StringBuffer getReferenceIndentation(int offset, boolean assumeOpeningBrace) {
408
	private StringBuffer getReferenceIndentation(int offset, boolean assumeOpeningBrace) {
407
408
		int unit;
409
		int unit;
409
		if (assumeOpeningBrace)
410
		if (assumeOpeningBrace)
410
			unit= findReferencePosition(offset, Symbols.TokenLBRACE);
411
			unit= findReferencePosition(offset, Symbols.TokenLBRACE);
Lines 416-422 Link Here
416
			return null;
417
			return null;
417
418
418
		return getLeadingWhitespace(unit);
419
		return getLeadingWhitespace(unit);
419
420
	}
420
	}
421
421
422
	/**
422
	/**
Lines 441-447 Link Here
441
	 *         determined
441
	 *         determined
442
	 */
442
	 */
443
	public StringBuffer computeIndentation(int offset, boolean assumeOpeningBrace) {
443
	public StringBuffer computeIndentation(int offset, boolean assumeOpeningBrace) {
444
445
		StringBuffer reference= getReferenceIndentation(offset, assumeOpeningBrace);
444
		StringBuffer reference= getReferenceIndentation(offset, assumeOpeningBrace);
446
445
447
		// handle special alignment
446
		// handle special alignment
Lines 459-469 Link Here
459
		if (reference == null)
458
		if (reference == null)
460
			return null;
459
			return null;
461
460
462
		// add additional indent
461
		// Add additional indent
463
		return createReusingIndent(reference, fIndent);
462
		return createReusingIndent(reference, fIndent);
464
	}
463
	}
465
464
466
	/**
465
	/**
466
	 * Computes the indentation for a continuation line at <code>offset</code>.
467
	 *
468
	 * @param offset the offset in the document
469
	 * @return a StringBuffer which reflects the correct indentation for
470
	 *         the line in  which offset resides, or <code>null</code> if it cannot be
471
	 *         determined.
472
	 * @throws BadLocationException
473
	 */
474
	public StringBuffer computeContinuationLineIndentation(int offset) throws BadLocationException {
475
		StringBuffer reference= getLeadingWhitespace(offset);
476
		IRegion line= fDocument.getLineInformationOfOffset(offset);
477
		String string= fDocument.get(line.getOffset(), offset - line.getOffset());
478
		if (string.trim().length() == 0)
479
			return reference;
480
		// Add additional indent
481
		return createReusingIndent(reference, fPrefs.prefContinuationIndent);
482
	}
483
	
484
	/**
467
	 * Computes the length of a <code>CharacterSequence</code>, counting
485
	 * Computes the length of a <code>CharacterSequence</code>, counting
468
	 * a tab character as the size until the next tab stop and every other
486
	 * a tab character as the size until the next tab stop and every other
469
	 * character as one.
487
	 * character as one.
Lines 572-578 Link Here
572
		try {
590
		try {
573
			int spaces= 0;
591
			int spaces= 0;
574
			while (start < indent) {
592
			while (start < indent) {
575
576
				char ch= fDocument.getChar(start);
593
				char ch= fDocument.getChar(start);
577
				if (ch == '\t') {
594
				if (ch == '\t') {
578
					ret.append('\t');
595
					ret.append('\t');
Lines 609-620 Link Here
609
	 * @return the modified <code>buffer</code> reflecting the indentation
626
	 * @return the modified <code>buffer</code> reflecting the indentation
610
	 *         adapted to <code>additional</code>
627
	 *         adapted to <code>additional</code>
611
	 */
628
	 */
612
	private StringBuffer createReusingIndent(StringBuffer buffer, int additional) {
629
	public StringBuffer createReusingIndent(StringBuffer buffer, int additional) {
613
		int refLength= computeVisualLength(buffer);
630
		int refLength= computeVisualLength(buffer);
614
		int addLength= fPrefs.prefIndentationSize * additional; // may be < 0
631
		int addLength= fPrefs.prefIndentationSize * additional; // may be < 0
615
		int totalLength= Math.max(0, refLength + addLength);
632
		int totalLength= Math.max(0, refLength + addLength);
616
633
617
618
		// copy the reference indentation for the indent up to the last tab
634
		// copy the reference indentation for the indent up to the last tab
619
		// stop within the maxCopy area
635
		// stop within the maxCopy area
620
		int minLength= Math.min(totalLength, refLength);
636
		int minLength= Math.min(totalLength, refLength);
Lines 622-628 Link Here
622
		int maxCopyLength= tabSize > 0 ? minLength - minLength % tabSize : minLength; // maximum indent to copy
638
		int maxCopyLength= tabSize > 0 ? minLength - minLength % tabSize : minLength; // maximum indent to copy
623
		stripExceedingChars(buffer, maxCopyLength);
639
		stripExceedingChars(buffer, maxCopyLength);
624
640
625
626
		// add additional indent
641
		// add additional indent
627
		int missing= totalLength - maxCopyLength;
642
		int missing= totalLength - maxCopyLength;
628
		final int tabs, spaces;
643
		final int tabs, spaces;
Lines 632-647 Link Here
632
		} else if (CCorePlugin.TAB.equals(fPrefs.prefTabChar)) {
647
		} else if (CCorePlugin.TAB.equals(fPrefs.prefTabChar)) {
633
			tabs= tabSize > 0 ? missing / tabSize : 0;
648
			tabs= tabSize > 0 ? missing / tabSize : 0;
634
			spaces= tabSize > 0 ? missing % tabSize : missing;
649
			spaces= tabSize > 0 ? missing % tabSize : missing;
635
		} else if (CodeFormatterConstants.MIXED.equals(fPrefs.prefTabChar)) {
650
		} else if (DefaultCodeFormatterConstants.MIXED.equals(fPrefs.prefTabChar)) {
636
			tabs= tabSize > 0 ? missing / tabSize : 0;
651
			tabs= tabSize > 0 ? missing / tabSize : 0;
637
			spaces= tabSize > 0 ? missing % tabSize : missing;
652
			spaces= tabSize > 0 ? missing % tabSize : missing;
638
		} else {
653
		} else {
639
			Assert.isTrue(false);
654
			Assert.isTrue(false);
640
			return null;
655
			return null;
641
		}
656
		}
642
		for(int i= 0; i < tabs; i++)
657
		for (int i= 0; i < tabs; i++)
643
			buffer.append('\t');
658
			buffer.append('\t');
644
		for(int i= 0; i < spaces; i++)
659
		for (int i= 0; i < spaces; i++)
645
			buffer.append(' ');
660
			buffer.append(' ');
646
		return buffer;
661
		return buffer;
647
	}
662
	}
Lines 930-936 Link Here
930
				// if we are inside a continued expression, then either align with a previous line that has indentation
945
				// if we are inside a continued expression, then either align with a previous line that has indentation
931
				// or indent from the expression start line (either a scope introducer or the start of the expr).
946
				// or indent from the expression start line (either a scope introducer or the start of the expr).
932
				return skipToPreviousListItemOrListStart();
947
				return skipToPreviousListItemOrListStart();
933
934
		}
948
		}
935
	}
949
	}
936
950
(-)src/org/eclipse/cdt/internal/ui/text/COutlineInformationControl.java (-50 / +81 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     QNX Software Systems - initial API and implementation
9
 *     QNX Software Systems - initial API and implementation
10
 *     Sergey Prigogin, Google
10
 *******************************************************************************/
11
 *******************************************************************************/
11
/*
12
/*
12
 * COutlineInformationControl.java 2004-12-14 / 08:17:41
13
 * COutlineInformationControl.java 2004-12-14 / 08:17:41
Lines 20-33 Link Here
20
import org.eclipse.cdt.internal.core.model.CElement;
21
import org.eclipse.cdt.internal.core.model.CElement;
21
import org.eclipse.cdt.internal.ui.CPluginImages;
22
import org.eclipse.cdt.internal.ui.CPluginImages;
22
import org.eclipse.cdt.internal.ui.actions.ActionMessages;
23
import org.eclipse.cdt.internal.ui.actions.ActionMessages;
24
import org.eclipse.cdt.internal.ui.actions.OpenActionUtil;
23
import org.eclipse.cdt.internal.ui.editor.CContentOutlinerProvider;
25
import org.eclipse.cdt.internal.ui.editor.CContentOutlinerProvider;
24
import org.eclipse.cdt.internal.ui.editor.CEditor;
25
import org.eclipse.cdt.internal.ui.util.ProblemTreeViewer;
26
import org.eclipse.cdt.internal.ui.util.ProblemTreeViewer;
26
import org.eclipse.cdt.internal.ui.viewsupport.DecoratingCLabelProvider;
27
import org.eclipse.cdt.internal.ui.viewsupport.DecoratingCLabelProvider;
27
import org.eclipse.cdt.internal.ui.viewsupport.StandardCElementLabelProvider;
28
import org.eclipse.cdt.internal.ui.viewsupport.StandardCElementLabelProvider;
29
30
import org.eclipse.cdt.core.model.ICElement;
31
import org.eclipse.cdt.core.model.ITranslationUnit;
28
import org.eclipse.cdt.ui.CElementGrouping;
32
import org.eclipse.cdt.ui.CElementGrouping;
29
import org.eclipse.cdt.ui.CUIPlugin;
33
import org.eclipse.cdt.ui.CUIPlugin;
30
import org.eclipse.cdt.ui.IWorkingCopyManager;
34
35
import org.eclipse.core.runtime.CoreException;
31
import org.eclipse.jface.action.Action;
36
import org.eclipse.jface.action.Action;
32
import org.eclipse.jface.action.IAction;
37
import org.eclipse.jface.action.IAction;
33
import org.eclipse.jface.action.MenuManager;
38
import org.eclipse.jface.action.MenuManager;
Lines 36-44 Link Here
36
import org.eclipse.jface.dialogs.IDialogSettings;
41
import org.eclipse.jface.dialogs.IDialogSettings;
37
import org.eclipse.jface.text.IInformationControl;
42
import org.eclipse.jface.text.IInformationControl;
38
import org.eclipse.jface.text.IInformationControlExtension;
43
import org.eclipse.jface.text.IInformationControlExtension;
44
import org.eclipse.jface.text.IInformationControlExtension2;
39
import org.eclipse.jface.text.IInformationControlExtension3;
45
import org.eclipse.jface.text.IInformationControlExtension3;
40
import org.eclipse.jface.viewers.AbstractTreeViewer;
46
import org.eclipse.jface.viewers.AbstractTreeViewer;
41
import org.eclipse.jface.viewers.IContentProvider;
47
import org.eclipse.jface.viewers.IContentProvider;
48
import org.eclipse.jface.viewers.IStructuredSelection;
49
import org.eclipse.jface.viewers.StructuredSelection;
42
import org.eclipse.jface.viewers.TreeViewer;
50
import org.eclipse.jface.viewers.TreeViewer;
43
import org.eclipse.jface.viewers.Viewer;
51
import org.eclipse.jface.viewers.Viewer;
44
import org.eclipse.jface.viewers.ViewerSorter;
52
import org.eclipse.jface.viewers.ViewerSorter;
Lines 95-101 Link Here
95
 * @author P.Tomaszewski
103
 * @author P.Tomaszewski
96
 */
104
 */
97
public class COutlineInformationControl implements IInformationControl,
105
public class COutlineInformationControl implements IInformationControl,
98
        IInformationControlExtension, IInformationControlExtension3 {
106
        IInformationControlExtension, IInformationControlExtension2,
107
        IInformationControlExtension3 {
99
108
100
    /** If this option is set, location is not restored. */
109
    /** If this option is set, location is not restored. */
101
    private static final String STORE_RESTORE_SIZE= "ENABLE_RESTORE_SIZE"; //$NON-NLS-1$
110
    private static final String STORE_RESTORE_SIZE= "ENABLE_RESTORE_SIZE"; //$NON-NLS-1$
Lines 111-118 Link Here
111
    /** Minimum width set by setSizeConstrains to tree viewer. */
120
    /** Minimum width set by setSizeConstrains to tree viewer. */
112
    private static final int MIN_WIDTH = 300;
121
    private static final int MIN_WIDTH = 300;
113
122
114
    /** Source viewer which shows this control. */
123
	private ICElement fInput = null;
115
    CEditor fEditor;
124
	
116
    /** Shell for this control. */
125
    /** Shell for this control. */
117
    Shell fShell;
126
    Shell fShell;
118
    /** Control's composite. */
127
    /** Control's composite. */
Lines 155-162 Link Here
155
    /**
164
    /**
156
     * Creates new outline control.
165
     * Creates new outline control.
157
     * 
166
     * 
158
     * @param editor
159
     *            CEditor editor which uses this control.
160
     * @param parent
167
     * @param parent
161
     *            Shell parent.
168
     *            Shell parent.
162
     * @param shellStyle
169
     * @param shellStyle
Lines 164-173 Link Here
164
     * @param treeStyle
171
     * @param treeStyle
165
     *            Style of the tree viewer.
172
     *            Style of the tree viewer.
166
     */
173
     */
167
    public COutlineInformationControl(CEditor editor, Shell parent,
174
    public COutlineInformationControl(Shell parent, int shellStyle, int treeStyle) {
168
            int shellStyle, int treeStyle) {
169
        super();
175
        super();
170
        this.fEditor = editor;
171
        createShell(parent, shellStyle);
176
        createShell(parent, shellStyle);
172
        createComposite();
177
        createComposite();
173
        createToolbar();
178
        createToolbar();
Lines 175-181 Link Here
175
        createTreeeViewer(treeStyle);
180
        createTreeeViewer(treeStyle);
176
    }
181
    }
177
182
178
    /**
183
	/**
184
	 * {@inheritDoc}
185
	 */
186
	public void setInput(Object information) {
187
		if (information == null || information instanceof String) {
188
			inputChanged(null, null);
189
			return;
190
		}
191
		ICElement ce = (ICElement)information;
192
		ITranslationUnit tu = (ITranslationUnit)ce.getAncestor(ICElement.C_UNIT);
193
		if (tu != null)
194
			fInput = tu;
195
196
		inputChanged(fInput, information);
197
	}
198
199
	protected void inputChanged(Object newInput, Object newSelection) {
200
		fFilterText.setText(""); //$NON-NLS-1$
201
		fTreeViewer.setInput(newInput);
202
		if (newSelection != null) {
203
			fTreeViewer.setSelection(new StructuredSelection(newSelection));
204
		}
205
	}
206
207
	/**
208
	 * @return the selected element
209
	 */
210
	protected Object getSelectedElement() {
211
		if (fTreeViewer == null)
212
			return null;
213
214
		return ((IStructuredSelection) fTreeViewer.getSelection()).getFirstElement();
215
	}
216
217
	private void gotoSelectedElement() {
218
		Object selectedElement= getSelectedElement();
219
		if (selectedElement != null) {
220
			try {
221
				dispose();
222
				OpenActionUtil.open(selectedElement, true);
223
			} catch (CoreException e) {
224
				CUIPlugin.getDefault().log(e);
225
			}
226
		}
227
	}
228
229
	/**
179
     * @see org.eclipse.jface.text.IInformationControl#setInformation(java.lang.String)
230
     * @see org.eclipse.jface.text.IInformationControl#setInformation(java.lang.String)
180
     */
231
     */
181
    public void setInformation(String information) {
232
    public void setInformation(String information) {
Lines 415-422 Link Here
415
     * @param treeStyle Tree style.
466
     * @param treeStyle Tree style.
416
     */
467
     */
417
    private void createTreeeViewer(int treeStyle) {
468
    private void createTreeeViewer(int treeStyle) {
418
        final IWorkingCopyManager manager = CUIPlugin.getDefault()
419
                .getWorkingCopyManager();
420
        fTreeViewer = new ProblemTreeViewer(fComposite, treeStyle);
469
        fTreeViewer = new ProblemTreeViewer(fComposite, treeStyle);
421
        final Tree tree = fTreeViewer.getTree();
470
        final Tree tree = fTreeViewer.getTree();
422
        tree.setLayoutData(new GridData(GridData.FILL_BOTH));
471
        tree.setLayoutData(new GridData(GridData.FILL_BOTH));
Lines 429-439 Link Here
429
        fTreeViewer.setLabelProvider(new DecoratingCLabelProvider(
478
        fTreeViewer.setLabelProvider(new DecoratingCLabelProvider(
430
                new StandardCElementLabelProvider(), true));
479
                new StandardCElementLabelProvider(), true));
431
        fTreeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
480
        fTreeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
432
        fTreeViewer.setInput(manager.getWorkingCopy(fEditor.getEditorInput()));
433
        tree.addKeyListener(createKeyListenerForTreeViewer());
481
        tree.addKeyListener(createKeyListenerForTreeViewer());
434
        tree.addSelectionListener(createSelectionListenerForTreeViewer());
482
        tree.addSelectionListener(createSelectionListenerForTreeViewer());
435
        tree.addMouseMoveListener(createMouseMoveListenerForTreeViewer());
483
        tree.addMouseMoveListener(createMouseMoveListenerForTreeViewer());
436
        tree.addMouseListener(createMouseListenerForTreeViewer());
484
        tree.addMouseListener(createMouseListenerForTreeViewer(tree));
437
    }
485
    }
438
486
439
    /**
487
    /**
Lines 522-553 Link Here
522
     * 
570
     * 
523
     * @return Created mouse listener.
571
     * @return Created mouse listener.
524
     */
572
     */
525
    private MouseListener createMouseListenerForTreeViewer() {
573
    private MouseListener createMouseListenerForTreeViewer(final Tree tree) {
526
        final MouseListener mouseListener = new MouseAdapter() {
574
        final MouseListener mouseListener = new MouseAdapter() {
527
            public void mouseUp(MouseEvent e) {
575
			public void mouseUp(MouseEvent e) {
528
                final Tree tree = fTreeViewer.getTree();
529
                if (tree.getSelectionCount() < 1) {
530
                    return;
531
                }
532
                if (e.button != 1) {
533
                    return;
534
                }
535
576
536
                if (tree.equals(e.getSource())) {
577
				if (tree.getSelectionCount() < 1)
537
                    Object o = tree.getItem(new Point(e.x, e.y));
578
					return;
538
                    final TreeItem selection = tree.getSelection()[0];
579
539
                    if (selection.equals(o)) {
580
				if (e.button != 1)
540
                        CElement selectedElement = (CElement) selection
581
					return;
541
                                .getData();
582
542
                        fEditor.setSelection(selectedElement);
583
				if (tree.equals(e.getSource())) {
543
                        dispose();
584
					Object o= tree.getItem(new Point(e.x, e.y));
544
                    }
585
					TreeItem selection= tree.getSelection()[0];
545
                    if (fComposite != null && !fComposite.isDisposed())
586
					if (selection.equals(o))
546
                    {
587
						gotoSelectedElement();
547
                        fBounds = fComposite.getBounds();
588
				}
548
                    }
589
			}
549
                }
550
            }
551
        };
590
        };
552
        return mouseListener;
591
        return mouseListener;
553
    }
592
    }
Lines 612-627 Link Here
612
            /**
651
            /**
613
             * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
652
             * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
614
             */
653
             */
615
            public void widgetDefaultSelected(SelectionEvent e) {
654
			public void widgetDefaultSelected(SelectionEvent e) {
616
                final TreeItem[] selection = ((Tree) fTreeViewer.getControl())
655
				gotoSelectedElement();
617
                        .getSelection();
656
			}
618
                if (selection.length > 0) {
619
                    CElement selectedElement = (CElement) selection[0]
620
                            .getData();
621
                    fEditor.setSelection(selectedElement);
622
                    dispose();
623
                }
624
            }
625
        };
657
        };
626
        return selectionListener;
658
        return selectionListener;
627
    }
659
    }
Lines 1017-1021 Link Here
1017
            fIsDeactivationActive = true;
1049
            fIsDeactivationActive = true;
1018
        }
1050
        }
1019
    }
1051
    }
1020
    
1021
}
1052
}
(-)src/org/eclipse/cdt/internal/ui/text/CFormattingStrategy.java (-3 / +3 lines)
Lines 16-22 Link Here
16
16
17
import org.eclipse.cdt.core.CCorePlugin;
17
import org.eclipse.cdt.core.CCorePlugin;
18
import org.eclipse.cdt.core.formatter.CodeFormatter;
18
import org.eclipse.cdt.core.formatter.CodeFormatter;
19
import org.eclipse.cdt.core.formatter.CodeFormatterConstants;
19
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
20
import org.eclipse.cdt.core.model.CoreModel;
20
import org.eclipse.cdt.core.model.CoreModel;
21
import org.eclipse.cdt.core.parser.ParserLanguage;
21
import org.eclipse.cdt.core.parser.ParserLanguage;
22
import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil;
22
import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil;
Lines 142-149 Link Here
142
		} else
142
		} else
143
            preferences= new HashMap(CCorePlugin.getOptions());
143
            preferences= new HashMap(CCorePlugin.getOptions());
144
144
145
        preferences.put(CodeFormatterConstants.FORMATTER_LANGUAGE, language);
145
        preferences.put(DefaultCodeFormatterConstants.FORMATTER_LANGUAGE, language);
146
		preferences.put(CodeFormatterConstants.FORMATTER_CURRENT_FILE, activeFile);
146
		preferences.put(DefaultCodeFormatterConstants.FORMATTER_CURRENT_FILE, activeFile);
147
	          
147
	          
148
		context.storeToMap(CUIPlugin.getDefault().getPreferenceStore(), preferences, false);
148
		context.storeToMap(CUIPlugin.getDefault().getPreferenceStore(), preferences, false);
149
        context.setProperty(FormattingContextProperties.CONTEXT_PREFERENCES, preferences);
149
        context.setProperty(FormattingContextProperties.CONTEXT_PREFERENCES, preferences);
(-)src/org/eclipse/cdt/internal/ui/text/CAutoIndentStrategy.java (-18 / +445 lines)
Lines 13-25 Link Here
13
 *******************************************************************************/
13
 *******************************************************************************/
14
package org.eclipse.cdt.internal.ui.text;
14
package org.eclipse.cdt.internal.ui.text;
15
15
16
import org.eclipse.core.runtime.Assert;
16
import org.eclipse.jface.preference.IPreferenceStore;
17
import org.eclipse.jface.preference.IPreferenceStore;
17
import org.eclipse.jface.text.BadLocationException;
18
import org.eclipse.jface.text.BadLocationException;
18
import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy;
19
import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy;
20
import org.eclipse.jface.text.Document;
19
import org.eclipse.jface.text.DocumentCommand;
21
import org.eclipse.jface.text.DocumentCommand;
22
import org.eclipse.jface.text.DocumentRewriteSession;
23
import org.eclipse.jface.text.DocumentRewriteSessionType;
20
import org.eclipse.jface.text.IDocument;
24
import org.eclipse.jface.text.IDocument;
21
import org.eclipse.jface.text.IRegion;
25
import org.eclipse.jface.text.IRegion;
22
import org.eclipse.jface.text.TextUtilities;
26
import org.eclipse.jface.text.TextUtilities;
27
import org.eclipse.jface.text.rules.FastPartitioner;
23
import org.eclipse.ui.IEditorPart;
28
import org.eclipse.ui.IEditorPart;
24
import org.eclipse.ui.IWorkbenchPage;
29
import org.eclipse.ui.IWorkbenchPage;
25
import org.eclipse.ui.texteditor.ITextEditorExtension3;
30
import org.eclipse.ui.texteditor.ITextEditorExtension3;
Lines 29-39 Link Here
29
import org.eclipse.cdt.ui.PreferenceConstants;
34
import org.eclipse.cdt.ui.PreferenceConstants;
30
import org.eclipse.cdt.ui.text.ICPartitions;
35
import org.eclipse.cdt.ui.text.ICPartitions;
31
36
37
import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil;
38
32
/**
39
/**
33
 * Auto indent strategy sensitive to brackets.
40
 * Auto indent strategy sensitive to brackets.
34
 */
41
 */
35
public class CAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy {
42
public class CAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy {
36
	private static final String MULTILINE_COMMENT_CLOSE = "*/"; //$NON-NLS-1$
43
	private static final String MULTILINE_COMMENT_CLOSE = "*/"; //$NON-NLS-1$
44
	/** The line comment introducer. Value is "{@value}" */
45
	private static final String LINE_COMMENT= "//"; //$NON-NLS-1$
37
//	private static final GCCScannerExtensionConfiguration C_GNU_SCANNER_EXTENSION = new GCCScannerExtensionConfiguration();
46
//	private static final GCCScannerExtensionConfiguration C_GNU_SCANNER_EXTENSION = new GCCScannerExtensionConfiguration();
38
47
39
	private static class CompilationUnitInfo {
48
	private static class CompilationUnitInfo {
Lines 65-76 Link Here
65
74
66
	// evaluate the line with the opening bracket that matches the closing bracket on the given line
75
	// evaluate the line with the opening bracket that matches the closing bracket on the given line
67
	protected int findMatchingOpenBracket(IDocument d, int line, int end, int closingBracketIncrease) throws BadLocationException {
76
	protected int findMatchingOpenBracket(IDocument d, int line, int end, int closingBracketIncrease) throws BadLocationException {
68
69
70
		int start = d.getLineOffset(line);
77
		int start = d.getLineOffset(line);
71
		int brackcount = getBracketCount(d, start, end, false) - closingBracketIncrease;
78
		int brackcount = getBracketCount(d, start, end, false) - closingBracketIncrease;
72
79
73
74
		// sum up the brackets counts of each line (closing brackets count negative, 
80
		// sum up the brackets counts of each line (closing brackets count negative, 
75
		// opening positive) until we find a line the brings the count to zero
81
		// opening positive) until we find a line the brings the count to zero
76
		while (brackcount < 0) {
82
		while (brackcount < 0) {
Lines 85-91 Link Here
85
		return line;
91
		return line;
86
	}
92
	}
87
93
88
89
	private int getBracketCount(IDocument d, int start, int end, boolean ignoreCloseBrackets) throws BadLocationException {
94
	private int getBracketCount(IDocument d, int start, int end, boolean ignoreCloseBrackets) throws BadLocationException {
90
		int bracketcount = 0;
95
		int bracketcount = 0;
91
		while (start < end) {
96
		while (start < end) {
Lines 135-141 Link Here
135
140
136
	// ----------- bracket counting ------------------------------------------------------
141
	// ----------- bracket counting ------------------------------------------------------
137
142
138
139
	private int getCommentEnd(IDocument d, int pos, int end) throws BadLocationException {
143
	private int getCommentEnd(IDocument d, int pos, int end) throws BadLocationException {
140
		while (pos < end) {
144
		while (pos < end) {
141
			char curr = d.getChar(pos);
145
			char curr = d.getChar(pos);
Lines 183-189 Link Here
183
			int start = d.getLineOffset(line);
187
			int start = d.getLineOffset(line);
184
			int whiteend = findEndOfWhiteSpace(d, start, c.offset);
188
			int whiteend = findEndOfWhiteSpace(d, start, c.offset);
185
189
186
187
			// shift only when line does not contain any text up to the closing bracket
190
			// shift only when line does not contain any text up to the closing bracket
188
			if (whiteend == c.offset) {
191
			if (whiteend == c.offset) {
189
				// evaluate the line with the opening bracket that matches out closing bracket
192
				// evaluate the line with the opening bracket that matches out closing bracket
Lines 257-269 Link Here
257
			if (d.get(lineOffset, p - lineOffset).trim().length() != 0)
260
			if (d.get(lineOffset, p - lineOffset).trim().length() != 0)
258
				return;
261
				return;
259
262
260
			// line of last javacode
263
			// Line of last C code
261
			int pos = scanner.findNonWhitespaceBackward(p, CHeuristicScanner.UNBOUND);
264
			int pos = scanner.findNonWhitespaceBackward(p, CHeuristicScanner.UNBOUND);
262
			if (pos == -1)
265
			if (pos == -1)
263
				return;
266
				return;
264
			int lastLine = d.getLineOfOffset(pos);
267
			int lastLine = d.getLineOfOffset(pos);
265
268
266
			// only shift if the last java line is further up and is a braceless block candidate
269
			// Only shift if the last C line is further up and is a braceless block candidate
267
			if (lastLine < line) {
270
			if (lastLine < line) {
268
				CIndenter indenter = new CIndenter(d, scanner, fProject);
271
				CIndenter indenter = new CIndenter(d, scanner, fProject);
269
				StringBuffer indent = indenter.computeIndentation(p, true);
272
				StringBuffer indent = indenter.computeIndentation(p, true);
Lines 405-411 Link Here
405
	 * Finds a closing parenthesis to the left of <code>position</code> in document, where that parenthesis is only
408
	 * Finds a closing parenthesis to the left of <code>position</code> in document, where that parenthesis is only
406
	 * separated by whitespace from <code>position</code>. If no such parenthesis can be found, <code>position</code> is returned.
409
	 * separated by whitespace from <code>position</code>. If no such parenthesis can be found, <code>position</code> is returned.
407
	 *
410
	 *
408
	 * @param scanner the java heuristic scanner set up on the document
411
	 * @param scanner the C heuristic scanner set up on the document
409
	 * @param position the first character position in <code>document</code> to be considered
412
	 * @param position the first character position in <code>document</code> to be considered
410
	 * @return the position of a closing parenthesis left to <code>position</code> separated only by whitespace, or <code>position</code> if no parenthesis can be found
413
	 * @return the position of a closing parenthesis left to <code>position</code> separated only by whitespace, or <code>position</code> if no parenthesis can be found
411
	 */
414
	 */
Lines 519-524 Link Here
519
		return false;
522
		return false;
520
	}
523
	}
521
524
525
	/**
526
	 * Installs a C partitioner with <code>document</code>.
527
	 *
528
	 * @param document the document
529
	 */
530
	private static void installCPartitioner(Document document) {
531
		String[] types= new String[] {
532
		    ICPartitions.C_MULTI_LINE_COMMENT,
533
			ICPartitions.C_SINGLE_LINE_COMMENT,
534
			ICPartitions.C_STRING,
535
			ICPartitions.C_CHARACTER,
536
			IDocument.DEFAULT_CONTENT_TYPE
537
		};
538
		FastPartitioner partitioner= new FastPartitioner(new FastCPartitionScanner(), types);
539
		partitioner.connect(document);
540
		document.setDocumentPartitioner(ICPartitions.C_PARTITIONING, partitioner);
541
	}
542
543
	/**
544
	 * Installs a C partitioner with <code>document</code>.
545
	 *
546
	 * @param document the document
547
	 */
548
	private static void removeCPartitioner(Document document) {
549
		document.setDocumentPartitioner(ICPartitions.C_PARTITIONING, null);
550
	}
551
	
552
	private void smartPaste(IDocument document, DocumentCommand command) {
553
		int newOffset= command.offset;
554
		int newLength= command.length;
555
		String newText= command.text;
556
557
		try {
558
			CHeuristicScanner scanner= new CHeuristicScanner(document);
559
			CIndenter indenter= new CIndenter(document, scanner, fProject);
560
			int offset= newOffset;
561
562
			// reference position to get the indent from
563
			int refOffset= indenter.findReferencePosition(offset);
564
			if (refOffset == CHeuristicScanner.NOT_FOUND)
565
				return;
566
			int peerOffset= getPeerPosition(document, command);
567
			peerOffset= indenter.findReferencePosition(peerOffset);
568
			refOffset= Math.min(refOffset, peerOffset);
569
570
			// eat any WS before the insertion to the beginning of the line
571
			int firstLine= 1; // don't format the first line per default, as it has other content before it
572
			IRegion line= document.getLineInformationOfOffset(offset);
573
			String notSelected= document.get(line.getOffset(), offset - line.getOffset());
574
			if (notSelected.trim().length() == 0) {
575
				newLength += notSelected.length();
576
				newOffset= line.getOffset();
577
				firstLine= 0;
578
			}
579
580
			// prefix: the part we need for formatting but won't paste
581
			IRegion refLine= document.getLineInformationOfOffset(refOffset);
582
			String prefix= document.get(refLine.getOffset(), newOffset - refLine.getOffset());
583
584
			// handle the indentation computation inside a temporary document
585
			Document temp= new Document(prefix + newText);
586
			DocumentRewriteSession session= temp.startRewriteSession(DocumentRewriteSessionType.STRICTLY_SEQUENTIAL);
587
			scanner= new CHeuristicScanner(temp);
588
			indenter= new CIndenter(temp, scanner, fProject);
589
			installCPartitioner(temp);
590
591
			// indent the first and second line
592
			// compute the relative indentation difference from the second line
593
			// (as the first might be partially selected) and use the value to
594
			// indent all other lines.
595
			boolean isIndentDetected= false;
596
			StringBuffer addition= new StringBuffer();
597
			int insertLength= 0;
598
			int first= document.computeNumberOfLines(prefix) + firstLine; // don't format first line
599
			int lines= temp.getNumberOfLines();
600
			boolean changed= false;
601
602
			for (int l= first; l < lines; l++) { // we don't change the number of lines while adding indents
603
				IRegion r= temp.getLineInformation(l);
604
				int lineOffset= r.getOffset();
605
				int lineLength= r.getLength();
606
607
				if (lineLength == 0) // don't modify empty lines
608
					continue;
609
610
				if (!isIndentDetected) {
611
					// indent the first pasted line
612
					String current= getCurrentIndent(temp, l);
613
					StringBuffer correct= indenter.computeIndentation(lineOffset);
614
					if (correct == null)
615
						return; // bail out
616
617
					insertLength= subtractIndent(correct, current, addition);
618
					if (l != first && temp.get(lineOffset, lineLength).trim().length() != 0) {
619
						isIndentDetected= true;
620
						if (insertLength == 0) {
621
							 // no adjustment needed, bail out
622
							if (firstLine == 0) {
623
								// but we still need to adjust the first line
624
								command.offset= newOffset;
625
								command.length= newLength;
626
								if (changed)
627
									break; // still need to get the leading indent of the first line
628
							}
629
							return;
630
						}
631
						removeCPartitioner(temp);
632
					} else {
633
						changed= insertLength != 0;
634
					}
635
				}
636
637
				// relatively indent all pasted lines
638
				if (insertLength > 0)
639
					addIndent(temp, l, addition);
640
				else if (insertLength < 0)
641
					cutIndent(temp, l, -insertLength);
642
			}
643
644
			temp.stopRewriteSession(session);
645
			newText= temp.get(prefix.length(), temp.getLength() - prefix.length());
646
647
			command.offset= newOffset;
648
			command.length= newLength;
649
			command.text= newText;
650
		} catch (BadLocationException e) {
651
			CUIPlugin.getDefault().log(e);
652
		}
653
	}
654
655
	/**
656
	 * Returns the indentation of the line <code>line</code> in <code>document</code>.
657
	 * The returned string may contain pairs of leading slashes that are considered
658
	 * part of the indentation. The space before the asterix in a javadoc-like
659
	 * comment is not considered part of the indentation.
660
	 *
661
	 * @param document the document
662
	 * @param line the line
663
	 * @return the indentation of <code>line</code> in <code>document</code>
664
	 * @throws BadLocationException if the document is changed concurrently
665
	 */
666
	private static String getCurrentIndent(Document document, int line) throws BadLocationException {
667
		IRegion region= document.getLineInformation(line);
668
		int from= region.getOffset();
669
		int endOffset= region.getOffset() + region.getLength();
670
671
		// go behind line comments
672
		int to= from;
673
		while (to < endOffset - 2 && document.get(to, 2).equals(LINE_COMMENT))
674
			to += 2;
675
676
		while (to < endOffset) {
677
			char ch= document.getChar(to);
678
			if (!Character.isWhitespace(ch))
679
				break;
680
			to++;
681
		}
682
683
		// don't count the space before javadoc like, asterix-style comment lines
684
		if (to > from && to < endOffset - 1 && document.get(to - 1, 2).equals(" *")) { //$NON-NLS-1$
685
			String type= TextUtilities.getContentType(document, ICPartitions.C_PARTITIONING, to, true);
686
			if (type.equals(ICPartitions.C_MULTI_LINE_COMMENT))
687
				to--;
688
		}
689
690
		return document.get(from, to - from);
691
	}
692
693
	/**
694
	 * Computes the difference of two indentations and returns the difference in
695
	 * length of current and correct. If the return value is positive, <code>addition</code>
696
	 * is initialized with a substring of that length of <code>correct</code>.
697
	 *
698
	 * @param correct the correct indentation
699
	 * @param current the current indentation (migth contain non-whitespace)
700
	 * @param difference a string buffer - if the return value is positive, it will be cleared and set to the substring of <code>current</code> of that length
701
	 * @return the difference in lenght of <code>correct</code> and <code>current</code>
702
	 */
703
	private int subtractIndent(CharSequence correct, CharSequence current, StringBuffer difference) {
704
		int c1= computeVisualLength(correct);
705
		int c2= computeVisualLength(current);
706
		int diff= c1 - c2;
707
		if (diff <= 0)
708
			return diff;
709
710
		difference.setLength(0);
711
		int len= 0, i= 0;
712
		while (len < diff) {
713
			char c= correct.charAt(i++);
714
			difference.append(c);
715
			len += computeVisualLength(c);
716
		}
717
718
		return diff;
719
	}
720
721
	/**
722
	 * Indents line <code>line</code> in <code>document</code> with <code>indent</code>.
723
	 * Leaves leading comment signs alone.
724
	 *
725
	 * @param document the document
726
	 * @param line the line
727
	 * @param indent the indentation to insert
728
	 * @throws BadLocationException on concurrent document modification
729
	 */
730
	private static void addIndent(Document document, int line, CharSequence indent) throws BadLocationException {
731
		IRegion region= document.getLineInformation(line);
732
		int insert= region.getOffset();
733
		int endOffset= region.getOffset() + region.getLength();
734
735
		// go behind line comments
736
		while (insert < endOffset - 2 && document.get(insert, 2).equals(LINE_COMMENT))
737
			insert += 2;
738
739
		// insert indent
740
		document.replace(insert, 0, indent.toString());
741
	}
742
743
	/**
744
	 * Cuts the visual equivalent of <code>toDelete</code> characters out of the
745
	 * indentation of line <code>line</code> in <code>document</code>. Leaves
746
	 * leading comment signs alone.
747
	 *
748
	 * @param document the document
749
	 * @param line the line
750
	 * @param toDelete the number of space equivalents to delete.
751
	 * @throws BadLocationException on concurrent document modification
752
	 */
753
	private void cutIndent(Document document, int line, int toDelete) throws BadLocationException {
754
		IRegion region= document.getLineInformation(line);
755
		int from= region.getOffset();
756
		int endOffset= region.getOffset() + region.getLength();
757
758
		// go behind line comments
759
		while (from < endOffset - 2 && document.get(from, 2).equals(LINE_COMMENT))
760
			from += 2;
761
762
		int to= from;
763
		while (toDelete > 0 && to < endOffset) {
764
			char ch= document.getChar(to);
765
			if (!Character.isWhitespace(ch))
766
				break;
767
			toDelete -= computeVisualLength(ch);
768
			if (toDelete >= 0)
769
				to++;
770
			else
771
				break;
772
		}
773
774
		document.replace(from, to - from, null);
775
	}
776
777
	/**
778
	 * Returns the visual length of a given <code>CharSequence</code> taking into
779
	 * account the visual tabulator length.
780
	 *
781
	 * @param seq the string to measure
782
	 * @return the visual length of <code>seq</code>
783
	 */
784
	private int computeVisualLength(CharSequence seq) {
785
		int size= 0;
786
		int tablen= getVisualTabLengthPreference();
787
788
		for (int i= 0; i < seq.length(); i++) {
789
			char ch= seq.charAt(i);
790
			if (ch == '\t') {
791
				if (tablen != 0)
792
					size += tablen - size % tablen;
793
				// else: size stays the same
794
			} else {
795
				size++;
796
			}
797
		}
798
		return size;
799
	}
800
801
	/**
802
	 * Returns the visual length of a given character taking into
803
	 * account the visual tabulator length.
804
	 *
805
	 * @param ch the character to measure
806
	 * @return the visual length of <code>ch</code>
807
	 */
808
	private int computeVisualLength(char ch) {
809
		if (ch == '\t')
810
			return getVisualTabLengthPreference();
811
		else
812
			return 1;
813
	}
814
815
	/**
816
	 * The preference setting for the visual tabulator display.
817
	 *
818
	 * @return the number of spaces displayed for a tabulator in the editor
819
	 */
820
	private int getVisualTabLengthPreference() {
821
		return CodeFormatterUtil.getTabWidth(fProject);
822
	}
823
824
	private int getPeerPosition(IDocument document, DocumentCommand command) {
825
		if (document.getLength() == 0)
826
			return 0;
827
    	/*
828
    	 * Search for scope closers in the pasted text and find their opening peers
829
    	 * in the document.
830
    	 */
831
    	Document pasted= new Document(command.text);
832
    	installCPartitioner(pasted);
833
    	int firstPeer= command.offset;
834
835
    	CHeuristicScanner pScanner= new CHeuristicScanner(pasted);
836
    	CHeuristicScanner dScanner= new CHeuristicScanner(document);
837
838
    	// add scope relevant after context to peer search
839
    	int afterToken= dScanner.nextToken(command.offset + command.length, CHeuristicScanner.UNBOUND);
840
    	try {
841
			switch (afterToken) {
842
			case Symbols.TokenRBRACE:
843
				pasted.replace(pasted.getLength(), 0, "}"); //$NON-NLS-1$
844
				break;
845
			case Symbols.TokenRPAREN:
846
				pasted.replace(pasted.getLength(), 0, ")"); //$NON-NLS-1$
847
				break;
848
			case Symbols.TokenRBRACKET:
849
				pasted.replace(pasted.getLength(), 0, "]"); //$NON-NLS-1$
850
				break;
851
			}
852
		} catch (BadLocationException e) {
853
			// cannot happen
854
			Assert.isTrue(false);
855
		}
856
857
    	int pPos= 0; // paste text position (increasing from 0)
858
    	int dPos= Math.max(0, command.offset - 1); // document position (decreasing from paste offset)
859
    	while (true) {
860
    		int token= pScanner.nextToken(pPos, CHeuristicScanner.UNBOUND);
861
   			pPos= pScanner.getPosition();
862
    		switch (token) {
863
    			case Symbols.TokenLBRACE:
864
    			case Symbols.TokenLBRACKET:
865
    			case Symbols.TokenLPAREN:
866
    				pPos= skipScope(pScanner, pPos, token);
867
    				if (pPos == CHeuristicScanner.NOT_FOUND)
868
    					return firstPeer;
869
    				break; // closed scope -> keep searching
870
    			case Symbols.TokenRBRACE:
871
    				int peer= dScanner.findOpeningPeer(dPos, '{', '}');
872
    				dPos= peer - 1;
873
    				if (peer == CHeuristicScanner.NOT_FOUND)
874
    					return firstPeer;
875
    				firstPeer= peer;
876
    				break; // keep searching
877
    			case Symbols.TokenRBRACKET:
878
    				peer= dScanner.findOpeningPeer(dPos, '[', ']');
879
    				dPos= peer - 1;
880
    				if (peer == CHeuristicScanner.NOT_FOUND)
881
    					return firstPeer;
882
    				firstPeer= peer;
883
    				break; // keep searching
884
    			case Symbols.TokenRPAREN:
885
    				peer= dScanner.findOpeningPeer(dPos, '(', ')');
886
    				dPos= peer - 1;
887
    				if (peer == CHeuristicScanner.NOT_FOUND)
888
    					return firstPeer;
889
    				firstPeer= peer;
890
    				break; // keep searching
891
    			case Symbols.TokenCASE:
892
    			case Symbols.TokenDEFAULT:
893
    				CIndenter indenter= new CIndenter(document, dScanner, fProject);
894
    				peer= indenter.findReferencePosition(dPos, false, false, false, true);
895
    				if (peer == CHeuristicScanner.NOT_FOUND)
896
    					return firstPeer;
897
    				firstPeer= peer;
898
    				break; // keep searching
899
900
    			case Symbols.TokenEOF:
901
    				return firstPeer;
902
    			default:
903
    				// keep searching
904
    		}
905
    	}
906
    }
907
908
    /**
909
     * Skips the scope opened by <code>token</code> in <code>document</code>,
910
     * returns either the position of the
911
     * @param pos
912
     * @param token
913
     * @return the position after the scope
914
     */
915
    private static int skipScope(CHeuristicScanner scanner, int pos, int token) {
916
    	int openToken= token;
917
    	int closeToken;
918
    	switch (token) {
919
    		case Symbols.TokenLPAREN:
920
    			closeToken= Symbols.TokenRPAREN;
921
    			break;
922
    		case Symbols.TokenLBRACKET:
923
    			closeToken= Symbols.TokenRBRACKET;
924
    			break;
925
    		case Symbols.TokenLBRACE:
926
    			closeToken= Symbols.TokenRBRACE;
927
    			break;
928
    		default:
929
    			Assert.isTrue(false);
930
    			return -1; // dummy
931
    	}
932
933
    	int depth= 1;
934
    	int p= pos;
935
936
    	while (true) {
937
    		int tok= scanner.nextToken(p, CHeuristicScanner.UNBOUND);
938
    		p= scanner.getPosition();
939
940
    		if (tok == openToken) {
941
    			depth++;
942
    		} else if (tok == closeToken) {
943
    			depth--;
944
    			if (depth == 0)
945
    				return p + 1;
946
    		} else if (tok == Symbols.TokenEOF) {
947
    			return CHeuristicScanner.NOT_FOUND;
948
    		}
949
    	}
950
    }
951
522
	private void smartIndentOnKeypress(IDocument document, DocumentCommand command) {
952
	private void smartIndentOnKeypress(IDocument document, DocumentCommand command) {
523
		switch (command.text.charAt(0)) {
953
		switch (command.text.charAt(0)) {
524
			case '}':
954
			case '}':
Lines 551-565 Link Here
551
				if (d.get(lineOffset, p - lineOffset).trim().length() != 0)
981
				if (d.get(lineOffset, p - lineOffset).trim().length() != 0)
552
					return;
982
					return;
553
983
554
				// line of last javacode
984
				// Line of last C code
555
				int pos = scanner.findNonWhitespaceBackward(p - 1, CHeuristicScanner.UNBOUND);
985
				int pos = scanner.findNonWhitespaceBackward(p - 1, CHeuristicScanner.UNBOUND);
556
				if (pos == -1)
986
				if (pos == -1)
557
					return;
987
					return;
558
				int lastLine = d.getLineOfOffset(pos);
988
				int lastLine = d.getLineOfOffset(pos);
559
989
560
				// only shift if the last java line is further up and is a braceless block candidate
990
				// Only shift if the last C line is further up and is a braceless block candidate
561
				if (lastLine < line) {
991
				if (lastLine < line) {
562
563
					CIndenter indenter = new CIndenter(d, scanner, fProject);
992
					CIndenter indenter = new CIndenter(d, scanner, fProject);
564
					int ref = indenter.findReferencePosition(p, true, false, false, false);
993
					int ref = indenter.findReferencePosition(p, true, false, false, false);
565
					if (ref == CHeuristicScanner.NOT_FOUND)
994
					if (ref == CHeuristicScanner.NOT_FOUND)
Lines 589-603 Link Here
589
				if (d.get(lineOffset, p - lineOffset).trim().length() != 0)
1018
				if (d.get(lineOffset, p - lineOffset).trim().length() != 0)
590
					return;
1019
					return;
591
1020
592
				// line of last javacode
1021
				// Line of last C code
593
				int pos = scanner.findNonWhitespaceBackward(p - 1, CHeuristicScanner.UNBOUND);
1022
				int pos = scanner.findNonWhitespaceBackward(p - 1, CHeuristicScanner.UNBOUND);
594
				if (pos == -1)
1023
				if (pos == -1)
595
					return;
1024
					return;
596
				int lastLine = d.getLineOfOffset(pos);
1025
				int lastLine = d.getLineOfOffset(pos);
597
1026
598
				// only shift if the last java line is further up and is a braceless block candidate
1027
				// Only shift if the last C line is further up and is a braceless block candidate
599
				if (lastLine < line) {
1028
				if (lastLine < line) {
600
601
					CIndenter indenter = new CIndenter(d, scanner, fProject);
1029
					CIndenter indenter = new CIndenter(d, scanner, fProject);
602
					int ref = indenter.findReferencePosition(p, false, false, false, true);
1030
					int ref = indenter.findReferencePosition(p, false, false, false, true);
603
					if (ref == CHeuristicScanner.NOT_FOUND)
1031
					if (ref == CHeuristicScanner.NOT_FOUND)
Lines 649-657 Link Here
649
			CCommentAutoIndentStrategy.commentIndentForCommentEnd(d, c);
1077
			CCommentAutoIndentStrategy.commentIndentForCommentEnd(d, c);
650
		} else if (c.text.length() == 1) {
1078
		} else if (c.text.length() == 1) {
651
			smartIndentOnKeypress(d, c);
1079
			smartIndentOnKeypress(d, c);
652
// TODO Support smart paste.
1080
		} else if (c.text.length() > 1 && getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SMART_PASTE)) {
653
//		} else if (c.text.length() > 1 && getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SMART_PASTE)) {
1081
			smartPaste(d, c); // no smart backspace for paste
654
//			smartPaste(d, c); // no smart backspace for paste
655
		}
1082
		}
656
	}
1083
	}
657
	
1084
	
(-)src/org/eclipse/cdt/internal/ui/text/CReconcilingStrategy.java (-3 / +1 lines)
Lines 15-21 Link Here
15
import org.eclipse.cdt.core.model.ITranslationUnit;
15
import org.eclipse.cdt.core.model.ITranslationUnit;
16
import org.eclipse.cdt.core.model.IWorkingCopy;
16
import org.eclipse.cdt.core.model.IWorkingCopy;
17
import org.eclipse.cdt.internal.core.model.CModelManager;
17
import org.eclipse.cdt.internal.core.model.CModelManager;
18
import org.eclipse.cdt.internal.ui.editor.CEditor;
19
import org.eclipse.cdt.internal.ui.editor.IReconcilingParticipant;
18
import org.eclipse.cdt.internal.ui.editor.IReconcilingParticipant;
20
import org.eclipse.cdt.ui.CUIPlugin;
19
import org.eclipse.cdt.ui.CUIPlugin;
21
import org.eclipse.cdt.ui.IWorkingCopyManager;
20
import org.eclipse.cdt.ui.IWorkingCopyManager;
Lines 34-40 Link Here
34
	private IProgressMonitor fProgressMonitor;
33
	private IProgressMonitor fProgressMonitor;
35
	private String txt = null;
34
	private String txt = null;
36
	
35
	
37
	public CReconcilingStrategy(CEditor editor) {
36
	public CReconcilingStrategy(ITextEditor editor) {
38
		fEditor= editor;
37
		fEditor= editor;
39
		fManager= CUIPlugin.getDefault().getWorkingCopyManager();
38
		fManager= CUIPlugin.getDefault().getWorkingCopyManager();
40
	}
39
	}
Lines 45-51 Link Here
45
	public void setDocument(IDocument document) {
44
	public void setDocument(IDocument document) {
46
	}	
45
	}	
47
46
48
49
	/*
47
	/*
50
	 * @see IReconcilingStrategyExtension#setProgressMonitor(IProgressMonitor)
48
	 * @see IReconcilingStrategyExtension#setProgressMonitor(IProgressMonitor)
51
	 */
49
	 */
(-)plugin.xml (+6 lines)
Lines 582-587 Link Here
582
            id="org.eclipse.cdt.ui.preferences.TemplatePreferencePage">
582
            id="org.eclipse.cdt.ui.preferences.TemplatePreferencePage">
583
      </page>
583
      </page>
584
      <page
584
      <page
585
            name="%SmartTypingPreferencePage.name"
586
            category="org.eclipse.cdt.ui.preferences.CEditorPreferencePage"
587
            class="org.eclipse.cdt.internal.ui.preferences.SmartTypingPreferencePage"
588
            id="org.eclipse.cdt.ui.preferences.SmartTypingPreferencePage">
589
      </page>
590
      <page
585
            name="%CodeFormatterPreferencePage.name"
591
            name="%CodeFormatterPreferencePage.name"
586
            category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage"
592
            category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage"
587
            class="org.eclipse.cdt.internal.ui.preferences.CodeFormatterPreferencePage"
593
            class="org.eclipse.cdt.internal.ui.preferences.CodeFormatterPreferencePage"
(-)plugin.properties (-1 / +2 lines)
Lines 129-136 Link Here
129
CPluginTemplatePreferencePage.name=Templates
129
CPluginTemplatePreferencePage.name=Templates
130
CPluginBuildConsolePreferencePage.name=Build Console
130
CPluginBuildConsolePreferencePage.name=Build Console
131
CPluginFileTypesPreferencePage.name=File Types
131
CPluginFileTypesPreferencePage.name=File Types
132
CodeFormatterPreferencePage.name=Code Formatter
132
CodeFormatterPreferencePage.name=Code Style
133
CodeAssistPreferencePage.name=Content Assist
133
CodeAssistPreferencePage.name=Content Assist
134
SmartTypingPreferencePage.name=Typing
134
135
135
todoPageName=C/C++ Task Tags
136
todoPageName=C/C++ Task Tags
136
todoTaskPrefName=Task Tags
137
todoTaskPrefName=Task Tags
(-)src/org/eclipse/cdt/internal/corext/util/CodeFormatterUtil.java (-8 / +8 lines)
Lines 15-21 Link Here
15
import org.eclipse.cdt.core.CCorePlugin;
15
import org.eclipse.cdt.core.CCorePlugin;
16
import org.eclipse.cdt.core.ToolFactory;
16
import org.eclipse.cdt.core.ToolFactory;
17
import org.eclipse.cdt.core.formatter.CodeFormatter;
17
import org.eclipse.cdt.core.formatter.CodeFormatter;
18
import org.eclipse.cdt.core.formatter.CodeFormatterConstants;
18
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
19
import org.eclipse.cdt.core.model.ICProject;
19
import org.eclipse.cdt.core.model.ICProject;
20
import org.eclipse.cdt.ui.CUIPlugin;
20
import org.eclipse.cdt.ui.CUIPlugin;
21
21
Lines 55-64 Link Here
55
		 * that case.
55
		 * that case.
56
		 */
56
		 */
57
		String key;
57
		String key;
58
		if (CCorePlugin.SPACE.equals(getCoreOption(project, CodeFormatterConstants.FORMATTER_TAB_CHAR)))
58
		if (CCorePlugin.SPACE.equals(getCoreOption(project, DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR)))
59
			key= CodeFormatterConstants.FORMATTER_INDENTATION_SIZE;
59
			key= DefaultCodeFormatterConstants.FORMATTER_INDENTATION_SIZE;
60
		else
60
		else
61
			key= CodeFormatterConstants.FORMATTER_TAB_SIZE;
61
			key= DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE;
62
		
62
		
63
		return getCoreOption(project, key, 4);
63
		return getCoreOption(project, key, 4);
64
	}
64
	}
Lines 72-81 Link Here
72
	 */
72
	 */
73
	public static int getIndentWidth(ICProject project) {
73
	public static int getIndentWidth(ICProject project) {
74
		String key;
74
		String key;
75
		if (CodeFormatterConstants.MIXED.equals(getCoreOption(project, CodeFormatterConstants.FORMATTER_TAB_CHAR)))
75
		if (DefaultCodeFormatterConstants.MIXED.equals(getCoreOption(project, DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR)))
76
			key= CodeFormatterConstants.FORMATTER_INDENTATION_SIZE;
76
			key= DefaultCodeFormatterConstants.FORMATTER_INDENTATION_SIZE;
77
		else
77
		else
78
			key= CodeFormatterConstants.FORMATTER_TAB_SIZE;
78
			key= DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE;
79
		
79
		
80
		return getCoreOption(project, key, 4);
80
		return getCoreOption(project, key, 4);
81
	}
81
	}
Lines 131-137 Link Here
131
			return doc.get();
131
			return doc.get();
132
		} catch (BadLocationException e) {
132
		} catch (BadLocationException e) {
133
			CUIPlugin.getDefault().log(e); // bug in the formatter
133
			CUIPlugin.getDefault().log(e); // bug in the formatter
134
			Assert.isTrue(false, "Fromatter created edits with wrong positions: " + e.getMessage()); //$NON-NLS-1$
134
			Assert.isTrue(false, "Formatter created edits with wrong positions: " + e.getMessage()); //$NON-NLS-1$
135
		}
135
		}
136
		return null;
136
		return null;
137
	}
137
	}
(-)src/org/eclipse/cdt/internal/ui/editor/CSourceViewer.java (-83 / +37 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     QNX Software Systems - initial API and implementation
9
 *     QNX Software Systems - initial API and implementation
10
 *     Sergey Prigogin, Google
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.cdt.internal.ui.editor;
12
package org.eclipse.cdt.internal.ui.editor;
12
13
Lines 14-23 Link Here
14
import java.util.Iterator;
15
import java.util.Iterator;
15
import java.util.List;
16
import java.util.List;
16
17
17
import org.eclipse.core.resources.IFile;
18
import org.eclipse.core.runtime.CoreException;
19
import org.eclipse.core.runtime.IPath;
20
import org.eclipse.core.runtime.content.IContentType;
21
import org.eclipse.jface.text.DocumentCommand;
18
import org.eclipse.jface.text.DocumentCommand;
22
import org.eclipse.jface.text.ITextViewerExtension;
19
import org.eclipse.jface.text.ITextViewerExtension;
23
import org.eclipse.jface.text.contentassist.IContentAssistant;
20
import org.eclipse.jface.text.contentassist.IContentAssistant;
Lines 26-43 Link Here
26
import org.eclipse.jface.text.source.IVerticalRuler;
23
import org.eclipse.jface.text.source.IVerticalRuler;
27
import org.eclipse.jface.text.source.SourceViewerConfiguration;
24
import org.eclipse.jface.text.source.SourceViewerConfiguration;
28
import org.eclipse.jface.text.source.projection.ProjectionViewer;
25
import org.eclipse.jface.text.source.projection.ProjectionViewer;
26
import org.eclipse.swt.custom.StyledText;
27
import org.eclipse.swt.graphics.Color;
29
import org.eclipse.swt.widgets.Composite;
28
import org.eclipse.swt.widgets.Composite;
30
import org.eclipse.ui.IEditorInput;
31
import org.eclipse.ui.IPathEditorInput;
32
import org.eclipse.ui.editors.text.ILocationProvider;
33
import org.eclipse.ui.ide.ResourceUtil;
34
35
import org.eclipse.cdt.core.CCorePlugin;
36
import org.eclipse.cdt.core.model.ICElement;
37
import org.eclipse.cdt.core.model.ILanguage;
38
import org.eclipse.cdt.core.model.ITranslationUnit;
39
import org.eclipse.cdt.core.model.LanguageManager;
40
import org.eclipse.cdt.ui.CUIPlugin;
41
29
42
import org.eclipse.cdt.internal.ui.editor.CEditor.ITextConverter;
30
import org.eclipse.cdt.internal.ui.editor.CEditor.ITextConverter;
43
import org.eclipse.cdt.internal.ui.text.CSourceViewerConfiguration;
31
import org.eclipse.cdt.internal.ui.text.CSourceViewerConfiguration;
Lines 45-58 Link Here
45
/**
33
/**
46
 * Adapted source viewer for CEditor
34
 * Adapted source viewer for CEditor
47
 */
35
 */
48
49
public class CSourceViewer extends ProjectionViewer implements ITextViewerExtension {
36
public class CSourceViewer extends ProjectionViewer implements ITextViewerExtension {
50
37
51
    /** Show outline operation id. */
38
    /** Show outline operation id. */
52
    public static final int SHOW_OUTLINE = 101;
39
    public static final int SHOW_OUTLINE = 101;
53
    
40
    
54
	/** Editor. */
41
	/** Editor. */
55
    private final CEditor editor;
42
    private CEditor editor;
56
    /** Presents outline. */
43
    /** Presents outline. */
57
    private IInformationPresenter fOutlinePresenter;
44
    private IInformationPresenter fOutlinePresenter;
58
45
Lines 60-140 Link Here
60
    
47
    
61
	/**
48
	/**
62
     * Creates new source viewer. 
49
     * Creates new source viewer. 
63
     * @param editor
64
     * @param parent
50
     * @param parent
65
     * @param ruler
51
	 * @param ruler
66
     * @param styles
52
	 * @param fOverviewRuler
67
     * @param fOverviewRuler
53
	 * @param isOverviewRulerShowing
68
     * @param isOverviewRulerShowing
54
	 * @param styles
69
	 */
55
	 */
70
    public CSourceViewer(
56
    public CSourceViewer(Composite parent, IVerticalRuler ruler, IOverviewRuler fOverviewRuler, boolean isOverviewRulerShowing,
71
    		CEditor editor, Composite parent,
57
    					 int styles) {
72
    		IVerticalRuler ruler,
73
    		int styles,
74
    		IOverviewRuler fOverviewRuler,
75
    		boolean isOverviewRulerShowing) {
76
		super(parent, ruler, fOverviewRuler, isOverviewRulerShowing, styles);
58
		super(parent, ruler, fOverviewRuler, isOverviewRulerShowing, styles);
77
        this.editor = editor;
78
	}
59
	}
79
    
60
    
80
	public IContentAssistant getContentAssistant() {
61
	public IContentAssistant getContentAssistant() {
81
		return fContentAssistant;
62
		return fContentAssistant;
82
	}
63
	}
83
    
64
	
84
	public ILanguage getLanguage() {
65
	/*
85
		ICElement element = editor.getInputCElement();
66
	 * @see ISourceViewer#configure(SourceViewerConfiguration)
86
		if (element instanceof ITranslationUnit) {
67
	 */
87
			try {
68
	public void configure(SourceViewerConfiguration configuration) {
88
				return ((ITranslationUnit)element).getLanguage();
69
		// Prevent access to colors disposed in unconfigure().
89
			} catch (CoreException e) {
70
		StyledText textWidget= getTextWidget();
90
				CUIPlugin.getDefault().log(e);
71
		if (textWidget != null && !textWidget.isDisposed()) {
91
			}
72
			Color foregroundColor= textWidget.getForeground();
92
		} else {
73
			if (foregroundColor != null && foregroundColor.isDisposed())
93
			// compute the language from the plain editor input
74
				textWidget.setForeground(null);
94
			IContentType contentType = null;
75
			Color backgroundColor= textWidget.getBackground();
95
			IEditorInput input = editor.getEditorInput();
76
			if (backgroundColor != null && backgroundColor.isDisposed())
96
			IFile file = ResourceUtil.getFile(input);
77
				textWidget.setBackground(null);
97
			if (file != null) {
78
		}
98
				contentType = CCorePlugin.getContentType(file.getProject(), file.getName());
79
99
			} else if (input instanceof IPathEditorInput) {
80
		super.configure(configuration);
100
				IPath path = ((IPathEditorInput)input).getPath();
81
		if (configuration instanceof CSourceViewerConfiguration) {
101
				contentType = CCorePlugin.getContentType(path.lastSegment());
82
			CSourceViewerConfiguration cConfiguration= (CSourceViewerConfiguration)configuration;
102
			} else {
83
			fOutlinePresenter= cConfiguration.getOutlinePresenter(this);
103
				ILocationProvider locationProvider = (ILocationProvider)input.getAdapter(ILocationProvider.class);
84
			if (fOutlinePresenter != null)
104
				if (locationProvider != null) {
85
				fOutlinePresenter.install(this);
105
					IPath path = locationProvider.getPath(input);
86
			editor = (CEditor) cConfiguration.getEditor();
106
					contentType = CCorePlugin.getContentType(path.lastSegment());
107
				}
108
			}
109
			if (contentType != null) {
110
				try {
111
					return LanguageManager.getInstance().getLanguage(contentType);
112
				} catch (CoreException exc) {
113
					CUIPlugin.getDefault().log(exc.getStatus());
114
				}
115
			}
116
		}
87
		}
117
		return null;
118
	}
88
	}
119
	
120
    /**
121
     * @see org.eclipse.jface.text.source.SourceViewer#configure(org.eclipse.jface.text.source.SourceViewerConfiguration)
122
     */
123
    public void configure(SourceViewerConfiguration configuration)
124
    {
125
        super.configure(configuration);
126
        if (configuration instanceof CSourceViewerConfiguration)
127
        {            
128
            fOutlinePresenter = ((CSourceViewerConfiguration) configuration).getOutlinePresenter(editor);
129
            fOutlinePresenter.install(this);
130
        }
131
    }
132
89
133
    /**
90
    /**
134
     * @see org.eclipse.jface.text.source.SourceViewer#unconfigure()
91
     * @see org.eclipse.jface.text.source.SourceViewer#unconfigure()
135
     */
92
     */
136
    public void unconfigure()
93
    public void unconfigure() {
137
    {
138
        if (fOutlinePresenter != null) {
94
        if (fOutlinePresenter != null) {
139
            fOutlinePresenter.uninstall();  
95
            fOutlinePresenter.uninstall();  
140
            fOutlinePresenter= null;
96
            fOutlinePresenter= null;
Lines 154-160 Link Here
154
			case CONTENTASSIST_PROPOSALS:
110
			case CONTENTASSIST_PROPOSALS:
155
            {
111
            {
156
				String msg= fContentAssistant.showPossibleCompletions();
112
				String msg= fContentAssistant.showPossibleCompletions();
157
				this.editor.setStatusLineErrorMessage(msg);
113
				editor.setStatusLineErrorMessage(msg);
158
				return;
114
				return;
159
            }
115
            }
160
            case SHOW_OUTLINE:
116
            case SHOW_OUTLINE:
Lines 169-178 Link Here
169
    /**
125
    /**
170
     * @see org.eclipse.jface.text.source.projection.ProjectionViewer#canDoOperation(int)
126
     * @see org.eclipse.jface.text.source.projection.ProjectionViewer#canDoOperation(int)
171
     */
127
     */
172
    public boolean canDoOperation(int operation)
128
    public boolean canDoOperation(int operation) {
173
    {
129
        if (operation == SHOW_OUTLINE) {
174
        if (operation == SHOW_OUTLINE)
175
        {
176
            return fOutlinePresenter != null;
130
            return fOutlinePresenter != null;
177
        }
131
        }
178
        return super.canDoOperation(operation);
132
        return super.canDoOperation(operation);
(-)src/org/eclipse/cdt/internal/ui/editor/ICEditorActionDefinitionIds.java (+6 lines)
Lines 55-60 Link Here
55
	public static final String JOIN_LINES= "org.eclipse.cdt.ui.edit.text.c.join.lines"; //$NON-NLS-1$
55
	public static final String JOIN_LINES= "org.eclipse.cdt.ui.edit.text.c.join.lines"; //$NON-NLS-1$
56
	
56
	
57
	/**
57
	/**
58
	 * Action definition ID of the source -> indent action
59
	 * (value <code>"org.eclipse.cdt.ui.edit.text.c.indent"</code>).
60
	 */
61
	public static final String INDENT = "org.eclipse.cdt.ui.edit.text.c.indent"; //$NON-NLS-1$
62
	
63
	/**
58
	 * Action definition ID of the source -> format action
64
	 * Action definition ID of the source -> format action
59
	 * (value <code>"org.eclipse.cdt.ui.edit.text.c.format"</code>).
65
	 * (value <code>"org.eclipse.cdt.ui.edit.text.c.format"</code>).
60
	 */
66
	 */
(-)src/org/eclipse/cdt/internal/ui/editor/CEditor.java (-1319 / +1824 lines)
Lines 18-23 Link Here
18
import java.text.CharacterIterator;
18
import java.text.CharacterIterator;
19
import java.util.Iterator;
19
import java.util.Iterator;
20
import java.util.ResourceBundle;
20
import java.util.ResourceBundle;
21
import java.util.Stack;
21
22
22
import org.eclipse.core.resources.IFile;
23
import org.eclipse.core.resources.IFile;
23
import org.eclipse.core.runtime.CoreException;
24
import org.eclipse.core.runtime.CoreException;
Lines 29-48 Link Here
29
import org.eclipse.jface.preference.IPreferenceStore;
30
import org.eclipse.jface.preference.IPreferenceStore;
30
import org.eclipse.jface.text.AbstractInformationControlManager;
31
import org.eclipse.jface.text.AbstractInformationControlManager;
31
import org.eclipse.jface.text.BadLocationException;
32
import org.eclipse.jface.text.BadLocationException;
33
import org.eclipse.jface.text.BadPositionCategoryException;
32
import org.eclipse.jface.text.DefaultInformationControl;
34
import org.eclipse.jface.text.DefaultInformationControl;
33
import org.eclipse.jface.text.DefaultLineTracker;
35
import org.eclipse.jface.text.DefaultLineTracker;
34
import org.eclipse.jface.text.DocumentCommand;
36
import org.eclipse.jface.text.DocumentCommand;
37
import org.eclipse.jface.text.DocumentEvent;
35
import org.eclipse.jface.text.IDocument;
38
import org.eclipse.jface.text.IDocument;
39
import org.eclipse.jface.text.IDocumentExtension;
40
import org.eclipse.jface.text.IDocumentListener;
36
import org.eclipse.jface.text.IInformationControl;
41
import org.eclipse.jface.text.IInformationControl;
37
import org.eclipse.jface.text.IInformationControlCreator;
42
import org.eclipse.jface.text.IInformationControlCreator;
38
import org.eclipse.jface.text.ILineTracker;
43
import org.eclipse.jface.text.ILineTracker;
44
import org.eclipse.jface.text.IPositionUpdater;
39
import org.eclipse.jface.text.IRegion;
45
import org.eclipse.jface.text.IRegion;
40
import org.eclipse.jface.text.ITextHover;
46
import org.eclipse.jface.text.ITextHover;
41
import org.eclipse.jface.text.ITextSelection;
47
import org.eclipse.jface.text.ITextSelection;
42
import org.eclipse.jface.text.ITextViewer;
48
import org.eclipse.jface.text.ITextViewer;
49
import org.eclipse.jface.text.ITextViewerExtension;
43
import org.eclipse.jface.text.ITextViewerExtension2;
50
import org.eclipse.jface.text.ITextViewerExtension2;
44
import org.eclipse.jface.text.ITextViewerExtension4;
51
import org.eclipse.jface.text.ITextViewerExtension4;
45
import org.eclipse.jface.text.ITextViewerExtension5;
52
import org.eclipse.jface.text.ITextViewerExtension5;
53
import org.eclipse.jface.text.ITypedRegion;
46
import org.eclipse.jface.text.Position;
54
import org.eclipse.jface.text.Position;
47
import org.eclipse.jface.text.Region;
55
import org.eclipse.jface.text.Region;
48
import org.eclipse.jface.text.TextUtilities;
56
import org.eclipse.jface.text.TextUtilities;
Lines 52-57 Link Here
52
import org.eclipse.jface.text.information.IInformationProviderExtension;
60
import org.eclipse.jface.text.information.IInformationProviderExtension;
53
import org.eclipse.jface.text.information.IInformationProviderExtension2;
61
import org.eclipse.jface.text.information.IInformationProviderExtension2;
54
import org.eclipse.jface.text.information.InformationPresenter;
62
import org.eclipse.jface.text.information.InformationPresenter;
63
import org.eclipse.jface.text.link.ILinkedModeListener;
64
import org.eclipse.jface.text.link.LinkedModeModel;
65
import org.eclipse.jface.text.link.LinkedModeUI;
66
import org.eclipse.jface.text.link.LinkedPosition;
67
import org.eclipse.jface.text.link.LinkedPositionGroup;
68
import org.eclipse.jface.text.link.LinkedModeUI.ExitFlags;
69
import org.eclipse.jface.text.link.LinkedModeUI.IExitPolicy;
55
import org.eclipse.jface.text.source.Annotation;
70
import org.eclipse.jface.text.source.Annotation;
56
import org.eclipse.jface.text.source.IAnnotationHover;
71
import org.eclipse.jface.text.source.IAnnotationHover;
57
import org.eclipse.jface.text.source.IAnnotationHoverExtension;
72
import org.eclipse.jface.text.source.IAnnotationHoverExtension;
Lines 76-87 Link Here
76
import org.eclipse.swt.SWT;
91
import org.eclipse.swt.SWT;
77
import org.eclipse.swt.custom.ST;
92
import org.eclipse.swt.custom.ST;
78
import org.eclipse.swt.custom.StyledText;
93
import org.eclipse.swt.custom.StyledText;
94
import org.eclipse.swt.custom.VerifyKeyListener;
79
import org.eclipse.swt.dnd.DND;
95
import org.eclipse.swt.dnd.DND;
80
import org.eclipse.swt.dnd.DragSource;
96
import org.eclipse.swt.dnd.DragSource;
81
import org.eclipse.swt.dnd.DragSourceListener;
97
import org.eclipse.swt.dnd.DragSourceListener;
82
import org.eclipse.swt.dnd.DropTarget;
98
import org.eclipse.swt.dnd.DropTarget;
83
import org.eclipse.swt.dnd.TextTransfer;
99
import org.eclipse.swt.dnd.TextTransfer;
84
import org.eclipse.swt.dnd.Transfer;
100
import org.eclipse.swt.dnd.Transfer;
101
import org.eclipse.swt.events.VerifyEvent;
85
import org.eclipse.swt.graphics.Image;
102
import org.eclipse.swt.graphics.Image;
86
import org.eclipse.swt.graphics.Point;
103
import org.eclipse.swt.graphics.Point;
87
import org.eclipse.swt.widgets.Composite;
104
import org.eclipse.swt.widgets.Composite;
Lines 100-106 Link Here
100
import org.eclipse.ui.part.IShowInSource;
117
import org.eclipse.ui.part.IShowInSource;
101
import org.eclipse.ui.part.IShowInTargetList;
118
import org.eclipse.ui.part.IShowInTargetList;
102
import org.eclipse.ui.part.ShowInContext;
119
import org.eclipse.ui.part.ShowInContext;
103
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
104
import org.eclipse.ui.texteditor.ContentAssistAction;
120
import org.eclipse.ui.texteditor.ContentAssistAction;
105
import org.eclipse.ui.texteditor.IDocumentProvider;
121
import org.eclipse.ui.texteditor.IDocumentProvider;
106
import org.eclipse.ui.texteditor.IEditorStatusLine;
122
import org.eclipse.ui.texteditor.IEditorStatusLine;
Lines 113-126 Link Here
113
import org.eclipse.ui.texteditor.TextEditorAction;
129
import org.eclipse.ui.texteditor.TextEditorAction;
114
import org.eclipse.ui.texteditor.TextNavigationAction;
130
import org.eclipse.ui.texteditor.TextNavigationAction;
115
import org.eclipse.ui.texteditor.TextOperationAction;
131
import org.eclipse.ui.texteditor.TextOperationAction;
132
import org.eclipse.ui.texteditor.link.EditorLinkedModeUI;
116
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
133
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
117
134
118
import com.ibm.icu.text.BreakIterator;
135
import com.ibm.icu.text.BreakIterator;
119
136
120
import org.eclipse.cdt.core.CCorePlugin;
137
import org.eclipse.cdt.core.CCorePlugin;
121
import org.eclipse.cdt.core.CCorePreferenceConstants;
138
import org.eclipse.cdt.core.CCorePreferenceConstants;
139
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
122
import org.eclipse.cdt.core.model.CModelException;
140
import org.eclipse.cdt.core.model.CModelException;
123
import org.eclipse.cdt.core.model.ICElement;
141
import org.eclipse.cdt.core.model.ICElement;
142
import org.eclipse.cdt.core.model.ICProject;
124
import org.eclipse.cdt.core.model.ISourceRange;
143
import org.eclipse.cdt.core.model.ISourceRange;
125
import org.eclipse.cdt.core.model.ISourceReference;
144
import org.eclipse.cdt.core.model.ISourceReference;
126
import org.eclipse.cdt.core.model.ITranslationUnit;
145
import org.eclipse.cdt.core.model.ITranslationUnit;
Lines 131-141 Link Here
131
import org.eclipse.cdt.ui.text.ICPartitions;
150
import org.eclipse.cdt.ui.text.ICPartitions;
132
import org.eclipse.cdt.ui.text.folding.ICFoldingStructureProvider;
151
import org.eclipse.cdt.ui.text.folding.ICFoldingStructureProvider;
133
152
153
import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil;
154
134
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
155
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
135
import org.eclipse.cdt.internal.ui.IContextMenuConstants;
156
import org.eclipse.cdt.internal.ui.IContextMenuConstants;
136
import org.eclipse.cdt.internal.ui.actions.AddBlockCommentAction;
157
import org.eclipse.cdt.internal.ui.actions.AddBlockCommentAction;
137
import org.eclipse.cdt.internal.ui.actions.FoldingActionGroup;
158
import org.eclipse.cdt.internal.ui.actions.FoldingActionGroup;
138
import org.eclipse.cdt.internal.ui.actions.GoToNextPreviousMemberAction;
159
import org.eclipse.cdt.internal.ui.actions.GoToNextPreviousMemberAction;
160
import org.eclipse.cdt.internal.ui.actions.IndentAction;
139
import org.eclipse.cdt.internal.ui.actions.JoinLinesAction;
161
import org.eclipse.cdt.internal.ui.actions.JoinLinesAction;
140
import org.eclipse.cdt.internal.ui.actions.RemoveBlockCommentAction;
162
import org.eclipse.cdt.internal.ui.actions.RemoveBlockCommentAction;
141
import org.eclipse.cdt.internal.ui.dnd.TextEditorDropAdapter;
163
import org.eclipse.cdt.internal.ui.dnd.TextEditorDropAdapter;
Lines 143-154 Link Here
143
import org.eclipse.cdt.internal.ui.search.actions.OpenDeclarationsAction;
165
import org.eclipse.cdt.internal.ui.search.actions.OpenDeclarationsAction;
144
import org.eclipse.cdt.internal.ui.search.actions.OpenDefinitionAction;
166
import org.eclipse.cdt.internal.ui.search.actions.OpenDefinitionAction;
145
import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup;
167
import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup;
168
import org.eclipse.cdt.internal.ui.text.CHeuristicScanner;
146
import org.eclipse.cdt.internal.ui.text.CPairMatcher;
169
import org.eclipse.cdt.internal.ui.text.CPairMatcher;
147
import org.eclipse.cdt.internal.ui.text.CSourceViewerConfiguration;
170
import org.eclipse.cdt.internal.ui.text.CSourceViewerConfiguration;
148
import org.eclipse.cdt.internal.ui.text.CTextTools;
171
import org.eclipse.cdt.internal.ui.text.CTextTools;
149
import org.eclipse.cdt.internal.ui.text.CWordIterator;
172
import org.eclipse.cdt.internal.ui.text.CWordIterator;
150
import org.eclipse.cdt.internal.ui.text.DocumentCharacterIterator;
173
import org.eclipse.cdt.internal.ui.text.DocumentCharacterIterator;
151
import org.eclipse.cdt.internal.ui.text.HTMLTextPresenter;
174
import org.eclipse.cdt.internal.ui.text.HTMLTextPresenter;
175
import org.eclipse.cdt.internal.ui.text.Symbols;
152
import org.eclipse.cdt.internal.ui.text.c.hover.SourceViewerInformationControl;
176
import org.eclipse.cdt.internal.ui.text.c.hover.SourceViewerInformationControl;
153
import org.eclipse.cdt.internal.ui.text.contentassist.ContentAssistPreference;
177
import org.eclipse.cdt.internal.ui.text.contentassist.ContentAssistPreference;
154
import org.eclipse.cdt.internal.ui.util.CUIHelp;
178
import org.eclipse.cdt.internal.ui.util.CUIHelp;
Lines 159-173 Link Here
159
 */
183
 */
160
public class CEditor extends TextEditor implements ISelectionChangedListener, IShowInSource , IReconcilingParticipant{
184
public class CEditor extends TextEditor implements ISelectionChangedListener, IShowInSource , IReconcilingParticipant{
161
185
186
	interface ITextConverter {
187
		void customizeDocumentCommand(IDocument document, DocumentCommand command);
188
	}
189
190
	static class TabConverter implements ITextConverter {
191
		private int fTabRatio;
192
		private ILineTracker fLineTracker;
193
		
194
		public TabConverter() {
195
		}
196
		
197
		public void setNumberOfSpacesPerTab(int ratio) {
198
			fTabRatio = ratio;
199
		}
200
		
201
		public void setLineTracker(ILineTracker lineTracker) {
202
			fLineTracker = lineTracker;
203
		}
204
		
205
		private int insertTabString(StringBuffer buffer, int offsetInLine) {
206
			
207
			if (fTabRatio == 0)
208
				return 0;
209
				
210
			int remainder = offsetInLine % fTabRatio;
211
			remainder = fTabRatio - remainder;
212
			for (int i = 0; i < remainder; i++)
213
				buffer.append(' ');
214
			return remainder;
215
		}
162
		
216
		
217
		public void customizeDocumentCommand(IDocument document, DocumentCommand command) {
218
			String text = command.text;
219
			if (text == null)
220
				return;
221
				
222
			int index = text.indexOf('\t');
223
			if (index > -1) {
224
				StringBuffer buffer = new StringBuffer();
225
				
226
				fLineTracker.set(command.text);
227
				int lines = fLineTracker.getNumberOfLines();
228
				
229
				try {
230
					for (int i = 0; i < lines; i++) {
231
						int offset = fLineTracker.getLineOffset(i);
232
						int endOffset = offset + fLineTracker.getLineLength(i);
233
						String line = text.substring(offset, endOffset);
234
						
235
						int position = 0;
236
						if (i == 0) {
237
							IRegion firstLine = document.getLineInformationOfOffset(command.offset);
238
							position = command.offset - firstLine.getOffset();	
239
						}
240
						
241
						int length = line.length();
242
						for (int j = 0; j < length; j++) {
243
							char c = line.charAt(j);
244
							if (c == '\t') {
245
								int oldPosition = position;
246
								position += insertTabString(buffer, position);
247
								if (command.caretOffset > command.offset + oldPosition) {
248
									command.caretOffset += position - oldPosition - 1;
249
								}
250
							} else {
251
								buffer.append(c);
252
								++position;
253
							}
254
						}
255
					}
256
						
257
					command.text = buffer.toString();
258
				} catch (BadLocationException x) {
259
				}
260
			}
261
		}
262
	}
263
264
	private class ExitPolicy implements IExitPolicy {
265
266
		final char fExitCharacter;
267
		final char fEscapeCharacter;
268
		final Stack fStack;
269
		final int fSize;
270
271
		public ExitPolicy(char exitCharacter, char escapeCharacter, Stack stack) {
272
			fExitCharacter = exitCharacter;
273
			fEscapeCharacter = escapeCharacter;
274
			fStack = stack;
275
			fSize = fStack.size();
276
		}
277
278
		/*
279
		 * @see org.eclipse.jdt.internal.ui.text.link.LinkedPositionUI.ExitPolicy#doExit(org.eclipse.jdt.internal.ui.text.link.LinkedPositionManager, org.eclipse.swt.events.VerifyEvent, int, int)
280
		 */
281
		public ExitFlags doExit(LinkedModeModel model, VerifyEvent event, int offset, int length) {
282
283
			if (fSize == fStack.size() && !isMasked(offset)) {
284
				if (event.character == fExitCharacter) {
285
					BracketLevel level = (BracketLevel) fStack.peek();
286
					if (level.fFirstPosition.offset > offset || level.fSecondPosition.offset < offset)
287
						return null;
288
					if (level.fSecondPosition.offset == offset && length == 0)
289
						// don't enter the character if if its the closing peer
290
						return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
291
				}
292
				// when entering an anonymous class between the parenthesis', we don't want
293
				// to jump after the closing parenthesis when return is pressed
294
				if (event.character == SWT.CR && offset > 0) {
295
					IDocument document = getSourceViewer().getDocument();
296
					try {
297
						if (document.getChar(offset - 1) == '{')
298
							return new ExitFlags(ILinkedModeListener.EXIT_ALL, true);
299
					} catch (BadLocationException e) {
300
					}
301
				}
302
			}
303
			return null;
304
		}
305
306
		private boolean isMasked(int offset) {
307
			IDocument document = getSourceViewer().getDocument();
308
			try {
309
				return fEscapeCharacter == document.getChar(offset - 1);
310
			} catch (BadLocationException e) {
311
			}
312
			return false;
313
		}
314
	}
315
316
	private static class BracketLevel {
317
		int fOffset;
318
		int fLength;
319
		LinkedModeUI fUI;
320
		Position fFirstPosition;
321
		Position fSecondPosition;
322
	}
323
163
	/**
324
	/**
164
	 * The information provider used to present focusable information
325
	 * Position updater that takes any changes at the borders of a position to not belong to the position.
165
	 * shells.
326
	 *
327
	 * @since 4.0
166
	 */
328
	 */
167
	private InformationPresenter fInformationPresenter;
329
	private static class ExclusivePositionUpdater implements IPositionUpdater {
168
	
330
331
		/** The position category. */
332
		private final String fCategory;
333
334
		/**
335
		 * Creates a new updater for the given <code>category</code>.
336
		 *
337
		 * @param category the new category.
338
		 */
339
		public ExclusivePositionUpdater(String category) {
340
			fCategory = category;
341
		}
342
343
		/*
344
		 * @see org.eclipse.jface.text.IPositionUpdater#update(org.eclipse.jface.text.DocumentEvent)
345
		 */
346
		public void update(DocumentEvent event) {
347
348
			int eventOffset = event.getOffset();
349
			int eventOldLength = event.getLength();
350
			int eventNewLength = event.getText() == null ? 0 : event.getText().length();
351
			int deltaLength = eventNewLength - eventOldLength;
352
353
			try {
354
				Position[] positions = event.getDocument().getPositions(fCategory);
355
356
				for (int i = 0; i != positions.length; i++) {
357
358
					Position position = positions[i];
359
360
					if (position.isDeleted())
361
						continue;
362
363
					int offset = position.getOffset();
364
					int length = position.getLength();
365
					int end = offset + length;
366
367
					if (offset >= eventOffset + eventOldLength)
368
						// position comes
369
						// after change - shift
370
						position.setOffset(offset + deltaLength);
371
					else if (end <= eventOffset) {
372
						// position comes way before change -
373
						// leave alone
374
					} else if (offset <= eventOffset && end >= eventOffset + eventOldLength) {
375
						// event completely internal to the position - adjust length
376
						position.setLength(length + deltaLength);
377
					} else if (offset < eventOffset) {
378
						// event extends over end of position - adjust length
379
						int newEnd = eventOffset;
380
						position.setLength(newEnd - offset);
381
					} else if (end > eventOffset + eventOldLength) {
382
						// event extends from before position into it - adjust offset
383
						// and length
384
						// offset becomes end of event, length adjusted accordingly
385
						int newOffset = eventOffset + eventNewLength;
386
						position.setOffset(newOffset);
387
						position.setLength(end - newOffset);
388
					} else {
389
						// event consumes the position - delete it
390
						position.delete();
391
					}
392
				}
393
			} catch (BadPositionCategoryException e) {
394
				// ignore and return
395
			}
396
		}
397
398
		/**
399
		 * Returns the position category.
400
		 *
401
		 * @return the position category
402
		 */
403
		public String getCategory() {
404
			return fCategory;
405
		}
406
	}
407
408
	private class BracketInserter implements VerifyKeyListener, ILinkedModeListener {
409
410
		private boolean fCloseBrackets = true;
411
		private boolean fCloseStrings = true;
412
		private boolean fCloseAngularBrackets = true;
413
		private final String CATEGORY = toString();
414
		private IPositionUpdater fUpdater = new ExclusivePositionUpdater(CATEGORY);
415
		private Stack fBracketLevelStack = new Stack();
416
417
		public void setCloseBracketsEnabled(boolean enabled) {
418
			fCloseBrackets = enabled;
419
		}
420
421
		public void setCloseStringsEnabled(boolean enabled) {
422
			fCloseStrings = enabled;
423
		}
424
425
		public void setCloseAngularBracketsEnabled(boolean enabled) {
426
			fCloseAngularBrackets = enabled;
427
		}
428
429
		private boolean isAngularIntroducer(String identifier) {
430
			return identifier.length() > 0
431
				&& (Character.isUpperCase(identifier.charAt(0))
432
					|| identifier.equals("template") //$NON-NLS-1$
433
					|| identifier.equals("vector") //$NON-NLS-1$
434
					|| identifier.equals("map") //$NON-NLS-1$
435
					|| identifier.equals("set") //$NON-NLS-1$
436
					|| identifier.equals("hash_map") //$NON-NLS-1$
437
					|| identifier.equals("hash_set") //$NON-NLS-1$
438
					|| identifier.equals("pair") //$NON-NLS-1$
439
					|| identifier.endsWith("_ptr") //$NON-NLS-1$
440
					|| identifier.endsWith("include")); //$NON-NLS-1$
441
		}
442
443
		/*
444
		 * @see org.eclipse.swt.custom.VerifyKeyListener#verifyKey(org.eclipse.swt.events.VerifyEvent)
445
		 */
446
		public void verifyKey(VerifyEvent event) {
447
448
			// early pruning to slow down normal typing as little as possible
449
			if (!event.doit || getInsertMode() != SMART_INSERT)
450
				return;
451
			switch (event.character) {
452
				case '(':
453
				case '<':
454
				case '[':
455
				case '\'':
456
				case '\"':
457
					break;
458
				default:
459
					return;
460
			}
461
462
			final ISourceViewer sourceViewer = getSourceViewer();
463
			IDocument document = sourceViewer.getDocument();
464
465
			final Point selection = sourceViewer.getSelectedRange();
466
			final int offset = selection.x;
467
			final int length = selection.y;
468
469
			try {
470
				IRegion startLine = document.getLineInformationOfOffset(offset);
471
				IRegion endLine = document.getLineInformationOfOffset(offset + length);
472
473
				CHeuristicScanner scanner = new CHeuristicScanner(document);
474
				int nextToken = scanner.nextToken(offset + length, endLine.getOffset() + endLine.getLength());
475
				String next = nextToken == Symbols.TokenEOF ? null : document.get(offset, scanner.getPosition() - offset).trim();
476
				int prevToken = scanner.previousToken(offset - 1, startLine.getOffset());
477
				int prevTokenOffset = scanner.getPosition() + 1;
478
				String previous = prevToken == Symbols.TokenEOF ? null : document.get(prevTokenOffset, offset - prevTokenOffset).trim();
479
480
				switch (event.character) {
481
					case '(':
482
						if (!fCloseBrackets
483
								|| nextToken == Symbols.TokenLPAREN
484
								|| nextToken == Symbols.TokenIDENT
485
								|| next != null && next.length() > 1)
486
							return;
487
						break;
488
489
					case '<':
490
						if (!(fCloseAngularBrackets && fCloseBrackets)
491
								|| nextToken == Symbols.TokenLESSTHAN
492
								|| 		   prevToken != Symbols.TokenLBRACE
493
										&& prevToken != Symbols.TokenRBRACE
494
										&& prevToken != Symbols.TokenSEMICOLON
495
										&& prevToken != Symbols.TokenSTATIC
496
										&& (prevToken != Symbols.TokenIDENT || !isAngularIntroducer(previous))
497
										&& prevToken != Symbols.TokenEOF)
498
							return;
499
						break;
500
501
					case '[':
502
						if (!fCloseBrackets
503
								|| nextToken == Symbols.TokenIDENT
504
								|| next != null && next.length() > 1)
505
							return;
506
						break;
507
508
					case '\'':
509
					case '"':
510
						if (!fCloseStrings
511
								|| nextToken == Symbols.TokenIDENT
512
								|| next != null && next.length() > 1
513
								|| (!("include".equals(previous) && event.character == '"') //$NON-NLS-1$
514
										&& (prevToken == Symbols.TokenIDENT
515
												|| previous != null && previous.length() > 1)))
516
							return;
517
						break;
518
519
					default:
520
						return;
521
				}
522
523
				ITypedRegion partition = TextUtilities.getPartition(document, ICPartitions.C_PARTITIONING, offset, true);
524
				if (!IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType()))
525
					return;
526
527
				if (!validateEditorInputState())
528
					return;
529
530
				final char character = event.character;
531
				final char closingCharacter = getPeerCharacter(character);
532
				final StringBuffer buffer = new StringBuffer();
533
				buffer.append(character);
534
				buffer.append(closingCharacter);
535
				if (closingCharacter == '>' && nextToken != Symbols.TokenEOF
536
						&& document.getChar(offset + length) == '>') {
537
					// Insert a space to avoid two consequtive closing angular brackets. 
538
					buffer.append(' ');
539
				}
540
541
				document.replace(offset, length, buffer.toString());
542
543
				BracketLevel level = new BracketLevel();
544
				fBracketLevelStack.push(level);
545
546
				LinkedPositionGroup group = new LinkedPositionGroup();
547
				group.addPosition(new LinkedPosition(document, offset + 1, 0, LinkedPositionGroup.NO_STOP));
548
549
				LinkedModeModel model = new LinkedModeModel();
550
				model.addLinkingListener(this);
551
				model.addGroup(group);
552
				model.forceInstall();
553
554
				level.fOffset = offset;
555
				level.fLength = 2;
556
557
				// set up position tracking for our magic peers
558
				if (fBracketLevelStack.size() == 1) {
559
					document.addPositionCategory(CATEGORY);
560
					document.addPositionUpdater(fUpdater);
561
				}
562
				level.fFirstPosition = new Position(offset, 1);
563
				level.fSecondPosition = new Position(offset + 1, 1);
564
				document.addPosition(CATEGORY, level.fFirstPosition);
565
				document.addPosition(CATEGORY, level.fSecondPosition);
566
567
				level.fUI = new EditorLinkedModeUI(model, sourceViewer);
568
				level.fUI.setSimpleMode(true);
569
				level.fUI.setExitPolicy(new ExitPolicy(closingCharacter, getEscapeCharacter(closingCharacter), fBracketLevelStack));
570
				level.fUI.setExitPosition(sourceViewer, offset + 2, 0, Integer.MAX_VALUE);
571
				level.fUI.setCyclingMode(LinkedModeUI.CYCLE_NEVER);
572
				level.fUI.enter();
573
574
				IRegion newSelection = level.fUI.getSelectedRegion();
575
				sourceViewer.setSelectedRange(newSelection.getOffset(), newSelection.getLength());
576
577
				event.doit = false;
578
579
			} catch (BadLocationException e) {
580
				CUIPlugin.getDefault().log(e);
581
			} catch (BadPositionCategoryException e) {
582
				CUIPlugin.getDefault().log(e);
583
			}
584
		}
585
586
		/*
587
		 * @see org.eclipse.jface.text.link.ILinkedModeListener#left(org.eclipse.jface.text.link.LinkedModeModel, int)
588
		 */
589
		public void left(LinkedModeModel environment, int flags) {
590
591
			final BracketLevel level = (BracketLevel) fBracketLevelStack.pop();
592
593
			if (flags != ILinkedModeListener.EXTERNAL_MODIFICATION)
594
				return;
595
596
			// remove brackets
597
			final ISourceViewer sourceViewer = getSourceViewer();
598
			final IDocument document = sourceViewer.getDocument();
599
			if (document instanceof IDocumentExtension) {
600
				IDocumentExtension extension = (IDocumentExtension) document;
601
				extension.registerPostNotificationReplace(null, new IDocumentExtension.IReplace() {
602
603
					public void perform(IDocument d, IDocumentListener owner) {
604
						if ((level.fFirstPosition.isDeleted || level.fFirstPosition.length == 0)
605
								&& !level.fSecondPosition.isDeleted
606
								&& level.fSecondPosition.offset == level.fFirstPosition.offset)
607
						{
608
							try {
609
								document.replace(level.fSecondPosition.offset,
610
												 level.fSecondPosition.length,
611
												 null);
612
							} catch (BadLocationException e) {
613
								CUIPlugin.getDefault().log(e);
614
							}
615
						}
616
617
						if (fBracketLevelStack.size() == 0) {
618
							document.removePositionUpdater(fUpdater);
619
							try {
620
								document.removePositionCategory(CATEGORY);
621
							} catch (BadPositionCategoryException e) {
622
								CUIPlugin.getDefault().log(e);
623
							}
624
						}
625
					}
626
				});
627
			}
628
		}
629
630
		/*
631
		 * @see org.eclipse.jface.text.link.ILinkedModeListener#suspend(org.eclipse.jface.text.link.LinkedModeModel)
632
		 */
633
		public void suspend(LinkedModeModel environment) {
634
		}
635
636
		/*
637
		 * @see org.eclipse.jface.text.link.ILinkedModeListener#resume(org.eclipse.jface.text.link.LinkedModeModel, int)
638
		 */
639
		public void resume(LinkedModeModel environment, int flags) {
640
		}
641
	}
642
169
	/**
643
	/**
170
	 * Updates the Java outline page selection and this editor's range indicator.
644
	 * Updates the C outline page selection and this editor's range indicator.
171
	 * 
645
	 * 
172
	 * @since 3.0
646
	 * @since 3.0
173
	 */
647
	 */
Lines 221-227 Link Here
221
		/*
695
		/*
222
		 * @see org.eclipse.jface.text.information.IInformationProviderExtension#getInformation2(org.eclipse.jface.text.ITextViewer,
696
		 * @see org.eclipse.jface.text.information.IInformationProviderExtension#getInformation2(org.eclipse.jface.text.ITextViewer,
223
		 *      org.eclipse.jface.text.IRegion)
697
		 *      org.eclipse.jface.text.IRegion)
224
		 * @since 3.2
225
		 */
698
		 */
226
		public Object getInformation2(ITextViewer textViewer, IRegion subject) {
699
		public Object getInformation2(ITextViewer textViewer, IRegion subject) {
227
			return fHoverInfo;
700
			return fHoverInfo;
Lines 484-2092 Link Here
484
			} catch (IllegalArgumentException e) {
957
			} catch (IllegalArgumentException e) {
485
				return -1;
958
				return -1;
486
			}
959
			}
487
488
		}
960
		}
489
	}
961
	}
490
	
962
	
491
	/**
963
	/**
492
	 * The editor selection changed listener.
964
	 * Text navigation action to navigate to the next sub-word.
493
	 * 
965
	 *
494
	 * @since 3.0
966
	 * @since 4.0
495
	 */
967
	 */
496
	private EditorSelectionChangedListener fEditorSelectionChangedListener;
968
	protected abstract class NextSubWordAction extends TextNavigationAction {
497
	
498
969
499
	/** The outline page */
970
		protected CWordIterator fIterator = new CWordIterator();
500
	protected CContentOutlinePage fOutlinePage;
501
	
502
	/** Search actions **/
503
	private ActionGroup fSelectionSearchGroup;
504
	private ActionGroup fTextSearchGroup;
505
    /** Action which shows selected element in CView. */
506
	private ShowInCViewAction fShowInCViewAction;
507
	
508
	/** Activity Listeners **/
509
	protected ISelectionChangedListener fStatusLineClearer;
510
    protected ISelectionChangedListener fSelectionUpdateListener;
511
	
512
	/** Pairs of brackets, used to match. */
513
    protected final static char[] BRACKETS = { '{', '}', '(', ')', '[', ']', '<', '>' };
514
971
515
	/** Matches the brackets. */
972
		/**
516
    protected CPairMatcher fBracketMatcher = new CPairMatcher(BRACKETS);
973
		 * Creates a new next sub-word action.
974
		 *
975
		 * @param code Action code for the default operation. Must be an action code from @see org.eclipse.swt.custom.ST.
976
		 */
977
		protected NextSubWordAction(int code) {
978
			super(getSourceViewer().getTextWidget(), code);
979
		}
517
980
518
	/** The editor's tab converter */
981
		/*
519
	private TabConverter fTabConverter;
982
		 * @see org.eclipse.jface.action.IAction#run()
983
		 */
984
		public void run() {
985
			// Check whether sub word navigation is enabled.
986
			final IPreferenceStore store = getPreferenceStore();
987
			if (!store.getBoolean(SUB_WORD_NAVIGATION)) {
988
				super.run();
989
				return;
990
			}
520
991
521
	/** Listener to annotation model changes that updates the error tick in the tab image */
992
			final ISourceViewer viewer = getSourceViewer();
522
	private CEditorErrorTickUpdater fCEditorErrorTickUpdater;
993
			final IDocument document = viewer.getDocument();
994
			fIterator.setText((CharacterIterator) new DocumentCharacterIterator(document));
995
			int position = widgetOffset2ModelOffset(viewer, viewer.getTextWidget().getCaretOffset());
996
			if (position == -1)
997
				return;
523
998
524
	/** Preference key for sub-word navigation, aka smart caret positioning */
999
			int next = findNextPosition(position);
525
	public final static String SUB_WORD_NAVIGATION= "subWordNavigation"; //$NON-NLS-1$
1000
			if (next != BreakIterator.DONE) {
526
	/** Preference key for matching brackets */
1001
				setCaretPosition(next);
527
	public final static String MATCHING_BRACKETS = "matchingBrackets"; //$NON-NLS-1$
1002
				getTextWidget().showSelection();
528
	/** Preference key for matching brackets color */
1003
				fireSelectionChanged();
529
	public final static String MATCHING_BRACKETS_COLOR = "matchingBracketsColor"; //$NON-NLS-1$
1004
			}
530
	/** Preference key for inactive code painter enablement */
1005
		}
531
	public static final String INACTIVE_CODE_ENABLE = "inactiveCodeEnable"; //$NON-NLS-1$
532
	/** Preference key for inactive code painter color */
533
	public static final String INACTIVE_CODE_COLOR = "inactiveCodeColor"; //$NON-NLS-1$
534
	/** Preference key for inserting spaces rather than tabs */
535
	public final static String SPACES_FOR_TABS = "spacesForTabs"; //$NON-NLS-1$
536
537
    /** Preference key for compiler task tags */
538
    private final static String TRANSLATION_TASK_TAGS= CCorePreferenceConstants.TRANSLATION_TASK_TAGS;
539
540
	/** 
541
	 * This editor's projection support 
542
	 */
543
	private ProjectionSupport fProjectionSupport;
544
	/** 
545
	 * This editor's projection model updater 
546
	 */
547
	private ICFoldingStructureProvider fProjectionModelUpdater;
548
1006
549
	/**
1007
		/**
550
	 * The action group for folding.
1008
		 * Finds the next position after the given position.
551
	 */
1009
		 *
552
	private FoldingActionGroup fFoldingGroup;
1010
		 * @param position the current position
1011
		 * @return the next position
1012
		 */
1013
		protected int findNextPosition(int position) {
1014
			ISourceViewer viewer = getSourceViewer();
1015
			int widget = -1;
1016
			while (position != BreakIterator.DONE && widget == -1) { // TODO: optimize
1017
				position = fIterator.following(position);
1018
				if (position != BreakIterator.DONE)
1019
					widget = modelOffset2WidgetOffset(viewer, position);
1020
			}
1021
			return position;
1022
		}
553
1023
554
	/**
1024
		/**
555
	 * Default constructor.
1025
		 * Sets the caret position to the sub-word boundary given with <code>position</code>.
556
	 */
1026
		 *
557
	public CEditor() {
1027
		 * @param position Position where the action should move the caret
558
		super();
1028
		 */
1029
		protected abstract void setCaretPosition(int position);
559
	}
1030
	}
560
1031
561
	/**
1032
	/**
562
	 * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#initializeEditor()
1033
	 * Text navigation action to navigate to the next sub-word.
1034
	 *
1035
	 * @since 4.0
563
	 */
1036
	 */
564
	protected void initializeEditor() {
1037
	protected class NavigateNextSubWordAction extends NextSubWordAction {
565
		CTextTools textTools = CUIPlugin.getDefault().getTextTools();
566
		setSourceViewerConfiguration(new CSourceViewerConfiguration(textTools, this));
567
		setDocumentProvider(CUIPlugin.getDefault().getDocumentProvider());
568
	
569
		setEditorContextMenuId("#CEditorContext"); //$NON-NLS-1$
570
		setRulerContextMenuId("#CEditorRulerContext"); //$NON-NLS-1$
571
		setOutlinerContextMenuId("#CEditorOutlinerContext"); //$NON-NLS-1$
572
1038
573
		setPreferenceStore(CUIPlugin.getDefault().getCombinedPreferenceStore());
1039
		/**
574
		fCEditorErrorTickUpdater = new CEditorErrorTickUpdater(this);          
1040
		 * Creates a new navigate next sub-word action.
1041
		 */
1042
		public NavigateNextSubWordAction() {
1043
			super(ST.WORD_NEXT);
1044
		}
1045
1046
		/*
1047
		 * @see org.eclipse.cdt.internal.ui.editor.CEditor.NextSubWordAction#setCaretPosition(int)
1048
		 */
1049
		protected void setCaretPosition(final int position) {
1050
			getTextWidget().setCaretOffset(modelOffset2WidgetOffset(getSourceViewer(), position));
1051
		}
575
	}
1052
	}
576
1053
577
	/**
1054
	/**
578
	 * @see org.eclipse.ui.texteditor.AbstractTextEditor#doSetInput(org.eclipse.ui.IEditorInput)
1055
	 * Text operation action to delete the next sub-word.
1056
	 *
1057
	 * @since 4.0
579
	 */
1058
	 */
580
	protected void doSetInput(IEditorInput input) throws CoreException {
1059
	protected class DeleteNextSubWordAction extends NextSubWordAction implements IUpdate {
581
		super.doSetInput(input);
582
		setOutlinePageInput(fOutlinePage, input);
583
1060
584
		if (fProjectionModelUpdater != null) {
1061
		/**
585
			fProjectionModelUpdater.initialize();
1062
		 * Creates a new delete next sub-word action.
586
		}
1063
		 */
587
		if (fCEditorErrorTickUpdater != null) {
1064
		public DeleteNextSubWordAction() {
588
			fCEditorErrorTickUpdater.updateEditorImage(getInputCElement());
1065
			super(ST.DELETE_WORD_NEXT);
589
		}
590
		
591
		if (getSourceViewer() != null) {
592
			CSourceViewerDecorationSupport decoSupport = (CSourceViewerDecorationSupport) getSourceViewerDecorationSupport(getSourceViewer());
593
			decoSupport.editorInputChanged(input);
594
		}
1066
		}
595
	}
596
1067
597
	/**
1068
		/*
598
	 * Update the title image.
1069
		 * @see org.eclipse.cdt.internal.ui.editor.CEditor.NextSubWordAction#setCaretPosition(int)
599
     * @param image Title image.
1070
		 */
600
	 */
1071
		protected void setCaretPosition(final int position) {
601
	public void updatedTitleImage(Image image) {
1072
			if (!validateEditorInputState())
602
		setTitleImage(image);
1073
				return;
603
	}
604
1074
605
	/**
1075
			final ISourceViewer viewer = getSourceViewer();
606
	 * Returns the C element wrapped by this editors input.
1076
			final int caret, length;
607
	 *
1077
			Point selection = viewer.getSelectedRange();
608
	 * @return the C element wrapped by this editors input.
1078
			if (selection.y != 0) {
609
	 * @since 3.0
1079
				caret = selection.x;
610
	 */
1080
				length = selection.y;
611
	public ICElement getInputCElement () {
1081
			} else {
612
		return CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(getEditorInput());
1082
				caret = widgetOffset2ModelOffset(viewer, viewer.getTextWidget().getCaretOffset());
613
	}
1083
				length = position - caret;
1084
			}
614
1085
615
	/**
1086
			try {
616
	 * Gets the current IFile input.
1087
				viewer.getDocument().replace(caret, length, ""); //$NON-NLS-1$
617
	 * This method will be remove after cdt-3.0.
1088
			} catch (BadLocationException exception) {
618
	 * We can not guaranty that the input is an IFile, it may
1089
				// Should not happen
619
	 * an external file.  Clients should test for <code>null<code> or use getInputCElement()
620
	 * @deprecated use <code>CEditor.getInputCElement()</code>.
621
     * @return IFile Input file or null if input is not and IFileEditorInput.
622
	 */
623
	public IFile getInputFile() {		
624
		IEditorInput editorInput = getEditorInput();
625
		if (editorInput != null) {
626
			if ((editorInput instanceof IFileEditorInput)) {
627
				return ((IFileEditorInput) editorInput).getFile();
628
			}
1090
			}
629
		}
1091
		}
630
		return null;
631
	}
632
1092
633
	/**
1093
		/*
634
     * @see org.eclipse.ui.ISaveablePart#isSaveAsAllowed()
1094
		 * @see org.eclipse.cdt.internal.ui.editor.CEditor.NextSubWordAction#findNextPosition(int)
635
	 */
1095
		 */
636
    public boolean isSaveAsAllowed() {
1096
		protected int findNextPosition(int position) {
637
		return true;
1097
			return fIterator.following(position);
638
	}
1098
		}
639
	/**
1099
640
	 * Gets the outline page of the c-editor.
1100
		/*
641
     * @return Outline page.
1101
		 * @see org.eclipse.ui.texteditor.IUpdate#update()
642
	 */
1102
		 */
643
	public CContentOutlinePage getOutlinePage() {
1103
		public void update() {
644
		if (fOutlinePage == null) {
1104
			setEnabled(isEditorInputModifiable());
645
			fOutlinePage = new CContentOutlinePage(this);
646
			fOutlinePage.addSelectionChangedListener(this);
647
		}
1105
		}
648
		setOutlinePageInput(fOutlinePage, getEditorInput());
649
		return fOutlinePage;
650
	}
1106
	}
651
1107
652
	/**
1108
	/**
653
	 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
1109
	 * Text operation action to select the next sub-word.
1110
	 *
1111
	 * @since 4.0
654
	 */
1112
	 */
655
	public Object getAdapter(Class required) {
1113
	protected class SelectNextSubWordAction extends NextSubWordAction {
656
		if (IContentOutlinePage.class.equals(required)) {
657
			return getOutlinePage();
658
		}
659
		if (required == IShowInTargetList.class) {
660
			return new IShowInTargetList() {
661
				public String[] getShowInTargetIds() {
662
					return new String[] { CUIPlugin.CVIEW_ID, IPageLayout.ID_OUTLINE, IPageLayout.ID_RES_NAV };
663
				}
664
1114
665
			};
1115
		/**
1116
		 * Creates a new select next sub-word action.
1117
		 */
1118
		public SelectNextSubWordAction() {
1119
			super(ST.SELECT_WORD_NEXT);
666
		}
1120
		}
667
		if (ProjectionAnnotationModel.class.equals(required)) {
1121
668
			if (fProjectionSupport != null) {
1122
		/*
669
				Object adapter= fProjectionSupport.getAdapter(getSourceViewer(), required);
1123
		 * @see org.eclipse.cdt.internal.ui.editor.CEditor.NextSubWordAction#setCaretPosition(int)
670
				if (adapter != null)
1124
		 */
671
					return adapter;
1125
		protected void setCaretPosition(final int position) {
1126
			final ISourceViewer viewer = getSourceViewer();
1127
1128
			final StyledText text = viewer.getTextWidget();
1129
			if (text != null && !text.isDisposed()) {
1130
1131
				final Point selection = text.getSelection();
1132
				final int caret = text.getCaretOffset();
1133
				final int offset = modelOffset2WidgetOffset(viewer, position);
1134
1135
				if (caret == selection.x)
1136
					text.setSelectionRange(selection.y, offset - selection.y);
1137
				else
1138
					text.setSelectionRange(selection.x, offset - selection.x);
672
			}
1139
			}
673
		}
1140
		}
674
		return super.getAdapter(required);
675
	}
1141
	}
1142
676
	/**
1143
	/**
677
	 * Handles a property change event describing a change
1144
	 * Text navigation action to navigate to the previous sub-word.
678
	 * of the editor's preference store and updates the preference
1145
	 *
679
	 * related editor properties.
1146
	 * @since 4.0
680
	 * 
681
	 * @param event the property change event
682
	 */
1147
	 */
683
	protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
1148
	protected abstract class PreviousSubWordAction extends TextNavigationAction {
684
		CSourceViewer asv = (CSourceViewer) getSourceViewer();
685
686
		try {
687
			if (asv != null) {
688
1149
689
				String property = event.getProperty();
1150
		protected CWordIterator fIterator = new CWordIterator();
690
1151
691
				if (AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH.equals(property)) {
1152
		/**
692
					SourceViewerConfiguration configuration = getSourceViewerConfiguration();
1153
		 * Creates a new previous sub-word action.
693
					String[] types = configuration.getConfiguredContentTypes(asv);
1154
		 *
694
					for (int i = 0; i < types.length; i++) {
1155
		 * @param code Action code for the default operation. Must be an action code from @see org.eclipse.swt.custom.ST.
695
						asv.setIndentPrefixes(configuration.getIndentPrefixes(asv, types[i]), types[i]);
1156
		 */
696
					}
1157
		protected PreviousSubWordAction(final int code) {
1158
			super(getSourceViewer().getTextWidget(), code);
1159
		}
697
1160
698
					if (fTabConverter != null) {
1161
		/*
699
						fTabConverter.setNumberOfSpacesPerTab(configuration.getTabWidth(asv));
1162
		 * @see org.eclipse.jface.action.IAction#run()
700
					}
1163
		 */
701
					// the super class handles the reset of the tabsize.
1164
		public void run() {
702
					return;
1165
			// Check whether sub word navigation is enabled.
703
				}
1166
			final IPreferenceStore store = getPreferenceStore();
704
1167
			if (!store.getBoolean(SUB_WORD_NAVIGATION)) {
705
				if (SPACES_FOR_TABS.equals(property)) {
1168
				super.run();
706
					if (isTabConversionEnabled())
1169
				return;
707
						startTabConversion();
1170
			}
708
					else
709
						stopTabConversion();
710
					return;
711
				}
712
				
713
				// Not implemented ... for the future.
714
				if (TRANSLATION_TASK_TAGS.equals(event.getProperty())) {
715
					ISourceViewer sourceViewer= getSourceViewer();
716
					if (sourceViewer != null && affectsTextPresentation(event))
717
						sourceViewer.invalidateTextPresentation();
718
				}
719
1171
720
				if (PreferenceConstants.EDITOR_FOLDING_PROVIDER.equals(property)) {
1172
			final ISourceViewer viewer = getSourceViewer();
721
					if (fProjectionModelUpdater != null) {
1173
			final IDocument document = viewer.getDocument();
722
						fProjectionModelUpdater.uninstall();
1174
			fIterator.setText((CharacterIterator) new DocumentCharacterIterator(document));
723
					}
1175
			int position = widgetOffset2ModelOffset(viewer, viewer.getTextWidget().getCaretOffset());
724
					// either freshly enabled or provider changed
1176
			if (position == -1)
725
					fProjectionModelUpdater= CUIPlugin.getDefault().getFoldingStructureProviderRegistry().getCurrentFoldingProvider();
1177
				return;
726
					if (fProjectionModelUpdater != null) {
727
						fProjectionModelUpdater.install(this, asv);
728
					}
729
					return;
730
				}
731
1178
732
				IContentAssistant c= asv.getContentAssistant();
1179
			int previous = findPreviousPosition(position);
733
				if (c instanceof ContentAssistant) {
1180
			if (previous != BreakIterator.DONE) {
734
					ContentAssistPreference.changeConfiguration((ContentAssistant) c, getPreferenceStore(), event);
1181
				setCaretPosition(previous);
735
				}
1182
				getTextWidget().showSelection();
736
				
1183
				fireSelectionChanged();
737
			}
1184
			}
738
		} finally {
739
			super.handlePreferenceStoreChanged(event);
740
		}
1185
		}
741
	}
742
743
	/**
744
	 * React to changed selection.
745
	 * 
746
	 * @since 3.0
747
	 */
748
	protected void selectionChanged() {
749
		if (getSelectionProvider() == null)
750
			return;
751
		updateStatusLine();
752
	}
753
1186
754
	/**
1187
		/**
755
	 * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
1188
		 * Finds the previous position before the given position.
756
	 */
1189
		 *
757
	public void selectionChanged(SelectionChangedEvent event) {
1190
		 * @param position the current position
758
		ISelection sel = event.getSelection();
1191
		 * @return the previous position
759
		if (sel instanceof IStructuredSelection) {
1192
		 */
760
			IStructuredSelection selection = (IStructuredSelection) sel;
1193
		protected int findPreviousPosition(int position) {
761
			Object obj = selection.getFirstElement();
1194
			ISourceViewer viewer = getSourceViewer();
762
			if (obj instanceof ISourceReference) {
1195
			int widget = -1;
763
				try {
1196
			while (position != BreakIterator.DONE && widget == -1) { // TODO: optimize
764
					ISourceRange range = ((ISourceReference) obj).getSourceRange();
1197
				position = fIterator.preceding(position);
765
					if (range != null) {
1198
				if (position != BreakIterator.DONE)
766
						setSelection(range, !isActivePart());
1199
					widget = modelOffset2WidgetOffset(viewer, position);
767
					}
768
				} catch (CModelException e) {
769
                    // Selection change not applied.
770
				}
771
			}
1200
			}
1201
			return position;
772
		}
1202
		}
1203
1204
		/**
1205
		 * Sets the caret position to the sub-word boundary given with <code>position</code>.
1206
		 *
1207
		 * @param position Position where the action should move the caret
1208
		 */
1209
		protected abstract void setCaretPosition(int position);
773
	}
1210
	}
774
1211
775
	/**
1212
	/**
776
     * Sets selection for C element. 
1213
	 * Text navigation action to navigate to the previous sub-word.
777
     * @param element Element to select.
1214
	 *
1215
	 * @since 4.0
778
	 */
1216
	 */
779
    public void setSelection(ICElement element) {
1217
	protected class NavigatePreviousSubWordAction extends PreviousSubWordAction {
780
1218
781
		if (element == null || element instanceof ITranslationUnit) {
1219
		/**
782
			/*
1220
		 * Creates a new navigate previous sub-word action.
783
			 * If the element is an ITranslationUnit this unit is either the input
1221
		 */
784
			 * of this editor or not being displayed. In both cases, nothing should
1222
		public NavigatePreviousSubWordAction() {
785
			 * happened.
1223
			super(ST.WORD_PREVIOUS);
786
			 */
787
			return;
788
		}
789
		if (element instanceof ISourceReference) {
790
			ISourceReference reference = (ISourceReference) element;
791
			// set hightlight range
792
			setSelection(reference, true);
793
		}
1224
		}
794
	}
795
1225
796
    /**
1226
		/*
797
     * Sets selection for source reference.
1227
		 * @see org.eclipse.cdt.internal.ui.editor.CEditor.PreviousSubWordAction#setCaretPosition(int)
798
     * @param element Source reference to set.
1228
		 */
799
     * @param moveCursor Should cursor be moved.
1229
		protected void setCaretPosition(final int position) {
800
     */
1230
			getTextWidget().setCaretOffset(modelOffset2WidgetOffset(getSourceViewer(), position));
801
    public void setSelection(ISourceReference element, boolean moveCursor) {
802
		if (element != null) {
803
			StyledText  textWidget= null;
804
			
805
			ISourceViewer sourceViewer= getSourceViewer();
806
			if (sourceViewer != null)
807
				textWidget= sourceViewer.getTextWidget();
808
			
809
			if (textWidget == null)
810
				return;
811
812
			try {
813
				setSelection(element.getSourceRange(), moveCursor);
814
			} catch (CModelException e) {
815
                // Selection not applied.
816
			}
817
		}
1231
		}
818
	}
1232
	}
819
1233
820
	/**
1234
	/**
821
	 * Sets the current editor selection to the source range. Optionally
1235
	 * Text operation action to delete the previous sub-word.
822
	 * sets the current editor position.
823
	 *
1236
	 *
824
	 * @param element the source range to be shown in the editor, can be null.
1237
	 * @since 4.0
825
	 * @param moveCursor if true the editor is scrolled to show the range.
826
	 */
1238
	 */
827
	public void setSelection(ISourceRange element, boolean moveCursor) {
1239
	protected class DeletePreviousSubWordAction extends PreviousSubWordAction implements IUpdate {
828
1240
829
		if (element == null) {
1241
		/**
830
			return;
1242
		 * Creates a new delete previous sub-word action.
1243
		 */
1244
		public DeletePreviousSubWordAction() {
1245
			super(ST.DELETE_WORD_PREVIOUS);
831
		}
1246
		}
832
1247
833
		try {
1248
		/*
834
			IRegion alternateRegion = null;
1249
		 * @see org.eclipse.cdt.internal.ui.editor.CEditor.PreviousSubWordAction#setCaretPosition(int)
835
			int start = element.getStartPos();
1250
		 */
836
			int length = element.getLength();
1251
		protected void setCaretPosition(int position) {
1252
			if (!validateEditorInputState())
1253
				return;
837
1254
838
			// Sanity check sometimes the parser may throw wrong numbers.
1255
			final int length;
839
			if (start < 0 || length < 0) {
1256
			final ISourceViewer viewer = getSourceViewer();
840
				start = 0;
1257
			Point selection = viewer.getSelectedRange();
841
				length = 0;
1258
			if (selection.y != 0) {
1259
				position = selection.x;
1260
				length = selection.y;
1261
			} else {
1262
				length = widgetOffset2ModelOffset(viewer, viewer.getTextWidget().getCaretOffset()) - position;
842
			}
1263
			}
843
1264
844
			// 0 length and start and non-zero start line says we know
1265
			try {
845
			// the line for some reason, but not the offset.
1266
				viewer.getDocument().replace(position, length, ""); //$NON-NLS-1$
846
			if (length == 0 && start == 0 && element.getStartLine() > 0) {
1267
			} catch (BadLocationException exception) {
847
				// We have the information in term of lines, we can work it out.
1268
				// Should not happen
848
				// Binary elements return the first executable statement so we have to substract -1
849
				start = getDocumentProvider().getDocument(getEditorInput()).getLineOffset(element.getStartLine() - 1);
850
				if (element.getEndLine() > 0) {
851
					length = getDocumentProvider().getDocument(getEditorInput()).getLineOffset(element.getEndLine()) - start;
852
				} else {
853
					length = start;
854
				}
855
				// create an alternate region for the keyword highlight.
856
				alternateRegion = getDocumentProvider().getDocument(getEditorInput()).getLineInformation(element.getStartLine() - 1);
857
				if (start == length || length < 0) {
858
					if (alternateRegion != null) {
859
						start = alternateRegion.getOffset();
860
						length = alternateRegion.getLength();
861
					}
862
				}
863
			}
1269
			}
864
			setHighlightRange(start, length, moveCursor);
1270
		}
865
1271
866
			if (moveCursor) {
1272
		/*
867
				start = element.getIdStartPos();
1273
		 * @see org.eclipse.cdt.internal.ui.editor.CEditor.PreviousSubWordAction#findPreviousPosition(int)
868
				length = element.getIdLength();
1274
		 */
869
				if (start == 0 && length == 0 && alternateRegion != null) {
1275
		protected int findPreviousPosition(int position) {
870
					start = alternateRegion.getOffset();
1276
			return fIterator.preceding(position);
871
					length = alternateRegion.getLength();
872
				}
873
				if (start > -1 && getSourceViewer() != null) {
874
					getSourceViewer().revealRange(start, length);
875
					getSourceViewer().setSelectedRange(start, length);
876
				}
877
				updateStatusField(CTextEditorActionConstants.STATUS_CURSOR_POS);
878
			}
879
			return;
880
		} catch (IllegalArgumentException x) {
881
            // No information to the user
882
		} catch (BadLocationException e) {
883
            // No information to the user
884
		}
1277
		}
885
1278
886
		if (moveCursor)
1279
		/*
887
			resetHighlightRange();
1280
		 * @see org.eclipse.ui.texteditor.IUpdate#update()
1281
		 */
1282
		public void update() {
1283
			setEnabled(isEditorInputModifiable());
1284
		}
888
	}
1285
	}
889
1286
890
	/**
1287
	/**
891
     * Checks is the editor active part. 
1288
	 * Text operation action to select the previous sub-word.
892
     * @return <code>true</code> if editor is the active part of the workbench.
1289
	 *
1290
	 * @since 4.0
893
	 */
1291
	 */
894
    private boolean isActivePart() {
1292
	protected class SelectPreviousSubWordAction extends PreviousSubWordAction {
895
		IWorkbenchWindow window = getSite().getWorkbenchWindow();
896
		IPartService service = window.getPartService();
897
		return (this == service.getActivePart());
898
	}
899
1293
900
    /**
1294
		/**
901
     * @see org.eclipse.ui.IWorkbenchPart#dispose()
1295
		 * Creates a new select previous sub-word action.
902
     */
1296
		 */
903
    public void dispose() {
1297
		public SelectPreviousSubWordAction() {
904
1298
			super(ST.SELECT_WORD_PREVIOUS);
905
		if (fProjectionModelUpdater != null) {
906
			fProjectionModelUpdater.uninstall();
907
			fProjectionModelUpdater= null;
908
		}
909
		
910
		if (fProjectionSupport != null) {
911
			fProjectionSupport.dispose();
912
			fProjectionSupport= null;
913
		}
914
915
		if (fCEditorErrorTickUpdater != null) {
916
			fCEditorErrorTickUpdater.dispose();
917
			fCEditorErrorTickUpdater = null;
918
		}
919
		
920
        if (fSelectionUpdateListener != null) {
921
			getSelectionProvider().addSelectionChangedListener(fSelectionUpdateListener);
922
			fSelectionUpdateListener = null;
923
        }
924
        
925
       	if (fStatusLineClearer != null) {
926
			ISelectionProvider provider = getSelectionProvider();
927
       		provider.removeSelectionChangedListener(fStatusLineClearer);
928
			fStatusLineClearer = null;
929
		}
930
        
931
        if (fBracketMatcher != null) {
932
			fBracketMatcher.dispose();
933
			fBracketMatcher = null;
934
		}
935
		
936
		if (fOutlinePage != null) {
937
			fOutlinePage.dispose();
938
			fOutlinePage = null;
939
		}
940
		
941
		if (fShowInCViewAction != null) {
942
			fShowInCViewAction.dispose();
943
			fShowInCViewAction = null;
944
		}
945
		
946
		if (fSelectionSearchGroup != null) {
947
			fSelectionSearchGroup.dispose();
948
			fSelectionSearchGroup = null;
949
		}
950
951
		if (fTextSearchGroup != null) {
952
			fTextSearchGroup.dispose();
953
			fTextSearchGroup = null;
954
		}
1299
		}
955
1300
956
		if (fEditorSelectionChangedListener != null)  {
1301
		/*
957
			fEditorSelectionChangedListener.uninstall(getSelectionProvider());
1302
		 * @see org.eclipse.cdt.internal.ui.editor.CEditor.PreviousSubWordAction#setCaretPosition(int)
958
			fEditorSelectionChangedListener= null;
1303
		 */
959
		}
1304
		protected void setCaretPosition(final int position) {
1305
			final ISourceViewer viewer = getSourceViewer();
960
1306
961
		stopTabConversion();
1307
			final StyledText text = viewer.getTextWidget();
962
		
1308
			if (text != null && !text.isDisposed()) {
963
		super.dispose();
964
	}
965
1309
966
	/**
1310
				final Point selection = text.getSelection();
967
	 * @see org.eclipse.ui.texteditor.AbstractTextEditor#canHandleMove(org.eclipse.ui.IEditorInput, org.eclipse.ui.IEditorInput)
1311
				final int caret = text.getCaretOffset();
968
	 */
1312
				final int offset = modelOffset2WidgetOffset(viewer, position);
969
	protected boolean canHandleMove(IEditorInput originalElement, IEditorInput movedElement) {
970
		String oldLanguage = ""; //$NON-NLS-1$
971
		if (originalElement instanceof IFileEditorInput) {
972
			IFile file= ((IFileEditorInput) originalElement).getFile();
973
			if (file != null) {
974
				IContentType type = CCorePlugin.getContentType(file.getProject(), file.getName());
975
				if (type != null) {
976
					oldLanguage = type.getId();
977
				}
978
				if (oldLanguage == null) {
979
					return false;
980
				}
981
			}
982
		}
983
1313
984
		String newLanguage = ""; //$NON-NLS-1$
1314
				if (caret == selection.x)
985
		if (movedElement instanceof IFileEditorInput) {
1315
					text.setSelectionRange(selection.y, offset - selection.y);
986
			IFile file = ((IFileEditorInput) movedElement).getFile();
1316
				else
987
			if (file != null) {
1317
					text.setSelectionRange(selection.x, offset - selection.x);
988
				IContentType type = CCorePlugin.getContentType(file.getProject(), file.getName());
989
				if (type != null) {
990
					newLanguage = type.getId();
991
				}
992
				if (newLanguage == null) {
993
					return false;
994
				}
995
			}
1318
			}
996
		}
1319
		}
997
		return oldLanguage.equals(newLanguage);
998
	}
1320
	}
1321
	
999
1322
1000
	/**
1323
	/**
1001
	 * @see org.eclipse.ui.texteditor.AbstractTextEditor#createActions()
1324
	 * The information provider used to present focusable information
1325
	 * shells.
1002
	 */
1326
	 */
1003
	protected void createActions() {
1327
	private InformationPresenter fInformationPresenter;
1004
		super.createActions();
1328
	
1005
1329
	/**
1006
		fFoldingGroup= new FoldingActionGroup(this, getSourceViewer());
1330
	 * The editor selection changed listener.
1331
	 * 
1332
	 * @since 3.0
1333
	 */
1334
	private EditorSelectionChangedListener fEditorSelectionChangedListener;
1007
1335
1008
		// Sticky hover support
1336
	/** The outline page */
1009
		ResourceAction resAction= new TextOperationAction(CEditorMessages.getResourceBundle(), "ShowToolTip.", this, ISourceViewer.INFORMATION, true); //$NON-NLS-1$
1337
	protected CContentOutlinePage fOutlinePage;
1010
		ResourceAction resAction2= new InformationDispatchAction(CEditorMessages.getResourceBundle(), "ShowToolTip.", (TextOperationAction) resAction); //$NON-NLS-1$
1338
	
1011
		resAction2.setActionDefinitionId(ICEditorActionDefinitionIds.SHOW_TOOLTIP);
1339
	/** Search actions **/
1012
		setAction("ShowToolTip", resAction2); //$NON-NLS-1$
1340
	private ActionGroup fSelectionSearchGroup;
1013
		PlatformUI.getWorkbench().getHelpSystem().setHelp(resAction2, ICHelpContextIds.SHOW_TOOLTIP_ACTION);
1341
	private ActionGroup fTextSearchGroup;
1014
		
1342
    /** Action which shows selected element in CView. */
1015
		// Default text editing menu items
1343
	private ShowInCViewAction fShowInCViewAction;
1016
		Action action= new GotoMatchingBracketAction(this);
1344
	
1017
		action.setActionDefinitionId(ICEditorActionDefinitionIds.GOTO_MATCHING_BRACKET);				
1345
	/** Activity Listeners **/
1018
		setAction(GotoMatchingBracketAction.GOTO_MATCHING_BRACKET, action);
1346
	protected ISelectionChangedListener fStatusLineClearer;
1019
		
1347
    protected ISelectionChangedListener fSelectionUpdateListener;
1020
		action = new JoinLinesAction(CEditorMessages.getResourceBundle(), "JoinLines.", this); //$NON-NLS-1$
1348
	
1021
		action.setActionDefinitionId(ICEditorActionDefinitionIds.JOIN_LINES);
1349
	/** Pairs of brackets, used to match. */
1022
		setAction("Join Lines", action); //$NON-NLS-1$
1350
    protected final static char[] BRACKETS = { '{', '}', '(', ')', '[', ']', '<', '>' };
1023
		
1024
		action= new ToggleCommentAction(CEditorMessages.getResourceBundle(), "ToggleComment.", this); //$NON-NLS-1$
1025
		action.setActionDefinitionId(ICEditorActionDefinitionIds.TOGGLE_COMMENT);
1026
		setAction("ToggleComment", action); //$NON-NLS-1$
1027
		markAsStateDependentAction("ToggleComment", true); //$NON-NLS-1$
1028
		configureToggleCommentAction();
1029
		
1030
		action= new AddBlockCommentAction(CEditorMessages.getResourceBundle(), "AddBlockComment.", this);  //$NON-NLS-1$
1031
		action.setActionDefinitionId(ICEditorActionDefinitionIds.ADD_BLOCK_COMMENT);		
1032
		setAction("AddBlockComment", action); //$NON-NLS-1$
1033
		markAsStateDependentAction("AddBlockComment", true); //$NON-NLS-1$
1034
		markAsSelectionDependentAction("AddBlockComment", true); //$NON-NLS-1$		
1035
		//WorkbenchHelp.setHelp(action, ICHelpContextIds.ADD_BLOCK_COMMENT_ACTION);
1036
1351
1037
		action= new RemoveBlockCommentAction(CEditorMessages.getResourceBundle(), "RemoveBlockComment.", this);  //$NON-NLS-1$
1352
	/** Matches the brackets. */
1038
		action.setActionDefinitionId(ICEditorActionDefinitionIds.REMOVE_BLOCK_COMMENT);		
1353
    protected CPairMatcher fBracketMatcher = new CPairMatcher(BRACKETS);
1039
		setAction("RemoveBlockComment", action); //$NON-NLS-1$
1040
		markAsStateDependentAction("RemoveBlockComment", true); //$NON-NLS-1$
1041
		markAsSelectionDependentAction("RemoveBlockComment", true); //$NON-NLS-1$		
1042
		//WorkbenchHelp.setHelp(action, ICHelpContextIds.REMOVE_BLOCK_COMMENT_ACTION);
1043
1354
1044
		action = new TextOperationAction(CEditorMessages.getResourceBundle(), "Format.", this, ISourceViewer.FORMAT); //$NON-NLS-1$
1355
	/** The bracket inserter. */
1045
		action.setActionDefinitionId(ICEditorActionDefinitionIds.FORMAT);
1356
	private BracketInserter fBracketInserter = new BracketInserter();
1046
		setAction("Format", action); //$NON-NLS-1$
1047
		markAsStateDependentAction("Format", true); //$NON-NLS-1$
1048
1357
1049
		action = new ContentAssistAction(CEditorMessages.getResourceBundle(), "ContentAssistProposal.", this); //$NON-NLS-1$
1358
	/** The editor's tab converter */
1050
		action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
1359
	private TabConverter fTabConverter;
1051
		setAction("ContentAssistProposal", action); //$NON-NLS-1$
1052
		markAsStateDependentAction("ContentAssistProposal", true); //$NON-NLS-1$
1053
1360
1054
		action = new TextOperationAction(CEditorMessages.getResourceBundle(), "ContentAssistTip.", this, ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION); //$NON-NLS-1$
1361
	/** Listener to annotation model changes that updates the error tick in the tab image */
1055
		action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
1362
	private CEditorErrorTickUpdater fCEditorErrorTickUpdater;
1056
		setAction("ContentAssistTip", action); //$NON-NLS-1$
1057
1363
1058
		action = new AddIncludeOnSelectionAction(this);
1364
	/** Preference key for sub-word navigation, aka smart caret positioning */
1059
		action.setActionDefinitionId(ICEditorActionDefinitionIds.ADD_INCLUDE);
1365
	public final static String SUB_WORD_NAVIGATION = "subWordNavigation"; //$NON-NLS-1$
1060
		setAction("AddIncludeOnSelection", action); //$NON-NLS-1$
1366
	/** Preference key for matching brackets */
1061
	
1367
	public final static String MATCHING_BRACKETS = "matchingBrackets"; //$NON-NLS-1$
1062
		action = new OpenDeclarationsAction(this);
1368
	/** Preference key for matching brackets color */
1063
		action.setActionDefinitionId(ICEditorActionDefinitionIds.OPEN_DECL);
1369
	public final static String MATCHING_BRACKETS_COLOR = "matchingBracketsColor"; //$NON-NLS-1$
1064
		setAction("OpenDeclarations", action); //$NON-NLS-1$
1370
	/** Preference key for inactive code painter enablement */
1371
	public static final String INACTIVE_CODE_ENABLE = "inactiveCodeEnable"; //$NON-NLS-1$
1372
	/** Preference key for inactive code painter color */
1373
	public static final String INACTIVE_CODE_COLOR = "inactiveCodeColor"; //$NON-NLS-1$
1374
	/** Preference key for code formatter tab size */
1375
	private final static String CODE_FORMATTER_TAB_SIZE = DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE;
1376
	/** Preference key for inserting spaces rather than tabs */
1377
	public final static String SPACES_FOR_TABS = "spacesForTabs"; //$NON-NLS-1$
1378
	/** Preference key for automatically closing strings */
1379
	private final static String CLOSE_STRINGS = PreferenceConstants.EDITOR_CLOSE_STRINGS;
1380
	/** Preference key for automatically closing brackets and parenthesis */
1381
	private final static String CLOSE_BRACKETS = PreferenceConstants.EDITOR_CLOSE_BRACKETS;
1382
	/** Preference key for automatically closing angular brackets */
1383
	private final static String CLOSE_ANGULAR_BRACKETS = PreferenceConstants.EDITOR_CLOSE_ANGULAR_BRACKETS;
1065
1384
1066
        action = new OpenDefinitionAction(this);
1385
    /** Preference key for compiler task tags */
1067
        action.setActionDefinitionId(ICEditorActionDefinitionIds.OPEN_DEF);
1386
    private final static String TRANSLATION_TASK_TAGS = CCorePreferenceConstants.TRANSLATION_TASK_TAGS;
1068
        setAction("OpenDefinition", action); //$NON-NLS-1$
1069
        
1070
//		action = new OpenTypeHierarchyAction(this);
1071
//		action.setActionDefinitionId(ICEditorActionDefinitionIds.OPEN_TYPE_HIERARCHY);
1072
//		setAction("OpenTypeHierarchy", action); //$NON-NLS-1$
1073
1387
1074
		fShowInCViewAction = new ShowInCViewAction(this);
1388
	/** 
1075
		action = fShowInCViewAction;
1389
	 * This editor's projection support 
1076
		action.setActionDefinitionId(ICEditorActionDefinitionIds.OPEN_CVIEW);
1390
	 */
1077
		setAction("ShowInCView", action); //$NON-NLS-1$
1391
	private ProjectionSupport fProjectionSupport;
1078
        
1392
	/** 
1079
        action = new TextOperationAction(CEditorMessages.getResourceBundle(), "OpenOutline.", this, CSourceViewer.SHOW_OUTLINE, true); //$NON-NLS-1$
1393
	 * This editor's projection model updater 
1080
        action.setActionDefinitionId(ICEditorActionDefinitionIds.OPEN_OUTLINE);
1394
	 */
1081
        setAction("OpenOutline", action); //$NON-NLS-1$*/
1395
	private ICFoldingStructureProvider fProjectionModelUpdater;
1082
        
1083
        action = new GoToNextPreviousMemberAction(CEditorMessages.getResourceBundle(), "GotoNextMember.", this, true); //$NON-NLS-1$
1084
        action.setActionDefinitionId(ICEditorActionDefinitionIds.GOTO_NEXT_MEMBER);
1085
        setAction("GotoNextMember", action); //$NON-NLS-1$*/
1086
1396
1087
        action = new GoToNextPreviousMemberAction(CEditorMessages.getResourceBundle(), "GotoPrevMember.", this, false); //$NON-NLS-1$
1397
	/**
1088
        action.setActionDefinitionId(ICEditorActionDefinitionIds.GOTO_PREVIOUS_MEMBER);
1398
	 * The action group for folding.
1089
        setAction("GotoPrevMember", action); //$NON-NLS-1$*/
1399
	 */
1400
	private FoldingActionGroup fFoldingGroup;
1090
1401
1091
        //Assorted action groupings
1402
	/**
1092
		fSelectionSearchGroup = new SelectionSearchGroup(this);
1403
	 * Default constructor.
1093
		fTextSearchGroup= new TextSearchGroup(this);
1404
	 */
1405
	public CEditor() {
1406
		super();
1094
	}
1407
	}
1095
1408
1096
	/**
1409
	/**
1097
	 * @see org.eclipse.ui.texteditor.AbstractTextEditor#editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
1410
	 * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#initializeEditor()
1098
	 */
1411
	 */
1099
	public void editorContextMenuAboutToShow(IMenuManager menu) {
1412
	protected void initializeEditor() {
1100
		super.editorContextMenuAboutToShow(menu);
1413
		CTextTools textTools = CUIPlugin.getDefault().getTextTools();
1101
1414
		setSourceViewerConfiguration(new CSourceViewerConfiguration(textTools, this));
1102
		addGroup(menu, ITextEditorActionConstants.GROUP_EDIT, IContextMenuConstants.GROUP_REORGANIZE);
1415
		setDocumentProvider(CUIPlugin.getDefault().getDocumentProvider());
1103
		addGroup(menu, ITextEditorActionConstants.GROUP_EDIT, IContextMenuConstants.GROUP_GENERATE);
1416
	
1104
		addGroup(menu, ITextEditorActionConstants.GROUP_EDIT, IContextMenuConstants.GROUP_NEW);
1417
		setEditorContextMenuId("#CEditorContext"); //$NON-NLS-1$
1105
1418
		setRulerContextMenuId("#CEditorRulerContext"); //$NON-NLS-1$
1106
		// Code formatting menu items -- only show in C perspective
1419
		setOutlinerContextMenuId("#CEditorOutlinerContext"); //$NON-NLS-1$
1107
		addAction(menu, ITextEditorActionConstants.GROUP_EDIT, "ToggleComment"); //$NON-NLS-1$
1108
		addAction(menu, ITextEditorActionConstants.GROUP_EDIT, "AddBlockComment"); //$NON-NLS-1$
1109
		addAction(menu, ITextEditorActionConstants.GROUP_EDIT, "RemoveBlockComment"); //$NON-NLS-1$
1110
1420
1111
		addAction(menu, ITextEditorActionConstants.GROUP_FIND, "OpenDeclarations"); //$NON-NLS-1$
1421
		setPreferenceStore(CUIPlugin.getDefault().getCombinedPreferenceStore());
1112
        addAction(menu, ITextEditorActionConstants.GROUP_FIND, "OpenDefinition"); //$NON-NLS-1$
1422
		fCEditorErrorTickUpdater = new CEditorErrorTickUpdater(this);          
1423
	}
1113
1424
1114
		addAction(menu, ITextEditorActionConstants.GROUP_FIND, "OpenTypeHierarchy"); //$NON-NLS-1$
1425
	/**
1115
        addAction(menu, ITextEditorActionConstants.GROUP_FIND, "GotoNextMember"); //$NON-NLS-1$
1426
	 * @see org.eclipse.ui.texteditor.AbstractTextEditor#doSetInput(org.eclipse.ui.IEditorInput)
1116
        addAction(menu, ITextEditorActionConstants.GROUP_FIND, "GotoPrevMember"); //$NON-NLS-1$
1427
	 */
1428
	protected void doSetInput(IEditorInput input) throws CoreException {
1429
		super.doSetInput(input);
1430
		setOutlinePageInput(fOutlinePage, input);
1117
1431
1118
		addAction(menu, IContextMenuConstants.GROUP_GENERATE, "ContentAssistProposal"); //$NON-NLS-1$
1432
		if (fProjectionModelUpdater != null) {
1119
		addAction(menu, IContextMenuConstants.GROUP_GENERATE, "AddIncludeOnSelection"); //$NON-NLS-1$
1433
			fProjectionModelUpdater.initialize();
1120
		addAction(menu, IContextMenuConstants.GROUP_GENERATE, "Format"); //$NON-NLS-1$
1434
		}
1435
		if (fCEditorErrorTickUpdater != null) {
1436
			fCEditorErrorTickUpdater.updateEditorImage(getInputCElement());
1437
		}
1121
		
1438
		
1122
		addAction(menu, IContextMenuConstants.GROUP_GENERATE, "ShowInCView"); //$NON-NLS-1$
1439
		if (getSourceViewer() != null) {
1440
			CSourceViewerDecorationSupport decoSupport = (CSourceViewerDecorationSupport) getSourceViewerDecorationSupport(getSourceViewer());
1441
			decoSupport.editorInputChanged(input);
1442
		}
1443
	}
1444
1445
	/**
1446
	 * Update the title image.
1447
     * @param image Title image.
1448
	 */
1449
	public void updatedTitleImage(Image image) {
1450
		setTitleImage(image);
1451
	}
1123
1452
1124
		fSelectionSearchGroup.fillContextMenu(menu);
1453
	/**
1125
		fTextSearchGroup.fillContextMenu(menu);
1454
	 * Returns the C element wrapped by this editors input.
1455
	 *
1456
	 * @return the C element wrapped by this editors input.
1457
	 * @since 3.0
1458
	 */
1459
	public ICElement getInputCElement () {
1460
		return CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(getEditorInput());
1126
	}
1461
	}
1127
1462
1128
	/**
1463
	/**
1129
     * Sets an input for the outline page.
1464
	 * Gets the current IFile input.
1130
	 * @param page Page to set the input.
1465
	 * This method will be remove after cdt-3.0.
1131
	 * @param input Input to set.
1466
	 * We can not guaranty that the input is an IFile, it may
1467
	 * an external file.  Clients should test for <code>null<code> or use getInputCElement()
1468
	 * @deprecated use <code>CEditor.getInputCElement()</code>.
1469
     * @return IFile Input file or null if input is not and IFileEditorInput.
1132
	 */
1470
	 */
1133
	public static void setOutlinePageInput(CContentOutlinePage page, IEditorInput input) {
1471
	public IFile getInputFile() {		
1134
		if (page != null) {
1472
		IEditorInput editorInput = getEditorInput();
1135
			IWorkingCopyManager manager = CUIPlugin.getDefault().getWorkingCopyManager();
1473
		if (editorInput != null) {
1136
			page.setInput(manager.getWorkingCopy(input));
1474
			if ((editorInput instanceof IFileEditorInput)) {
1475
				return ((IFileEditorInput) editorInput).getFile();
1476
			}
1137
		}
1477
		}
1478
		return null;
1138
	}
1479
	}
1139
1480
1140
	/**
1481
	/**
1141
     * Determines is folding enabled.
1482
     * @see org.eclipse.ui.ISaveablePart#isSaveAsAllowed()
1142
	 * @return <code>true</code> if folding is enabled, <code>false</code> otherwise.
1143
	 */
1483
	 */
1144
	boolean isFoldingEnabled() {
1484
    public boolean isSaveAsAllowed() {
1145
		return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED);
1485
		return true;
1486
	}
1487
	/**
1488
	 * Gets the outline page of the c-editor.
1489
     * @return Outline page.
1490
	 */
1491
	public CContentOutlinePage getOutlinePage() {
1492
		if (fOutlinePage == null) {
1493
			fOutlinePage = new CContentOutlinePage(this);
1494
			fOutlinePage.addSelectionChangedListener(this);
1495
		}
1496
		setOutlinePageInput(fOutlinePage, getEditorInput());
1497
		return fOutlinePage;
1146
	}
1498
	}
1147
1499
1500
	/**
1501
	 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
1502
	 */
1503
	public Object getAdapter(Class required) {
1504
		if (IContentOutlinePage.class.equals(required)) {
1505
			return getOutlinePage();
1506
		}
1507
		if (required == IShowInTargetList.class) {
1508
			return new IShowInTargetList() {
1509
				public String[] getShowInTargetIds() {
1510
					return new String[] { CUIPlugin.CVIEW_ID, IPageLayout.ID_OUTLINE, IPageLayout.ID_RES_NAV };
1511
				}
1148
1512
1513
			};
1514
		}
1515
		if (ProjectionAnnotationModel.class.equals(required)) {
1516
			if (fProjectionSupport != null) {
1517
				Object adapter = fProjectionSupport.getAdapter(getSourceViewer(), required);
1518
				if (adapter != null)
1519
					return adapter;
1520
			}
1521
		}
1522
		return super.getAdapter(required);
1523
	}
1149
	/**
1524
	/**
1150
	 * The <code>AbstractTextEditor</code> implementation of this 
1525
	 * Handles a property change event describing a change
1151
	 * <code>IWorkbenchPart</code> method creates the vertical ruler and
1526
	 * of the editor's preference store and updates the preference
1152
	 * source viewer. Subclasses may extend.
1527
	 * related editor properties.
1153
	 * 
1528
	 * 
1154
	 * We attach our own mouseDown listener on the menu bar, 
1529
	 * @param event the property change event
1155
	 * and our own listener for cursor/key/selection events to update cursor position in
1156
	 * status bar.
1157
1158
     * @param parent Parent composite of the control.
1159
	 */
1530
	 */
1160
	public void createPartControl(Composite parent) {
1531
	protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
1161
		super.createPartControl(parent);
1532
		CSourceViewer asv = (CSourceViewer) getSourceViewer();
1162
	
1163
		// Sticky hover support
1164
		IInformationControlCreator informationControlCreator = new IInformationControlCreator() {
1165
			public IInformationControl createInformationControl(Shell shell) {
1166
				boolean cutDown = false;
1167
				int style = cutDown ? SWT.NONE : (SWT.V_SCROLL | SWT.H_SCROLL);
1168
				return new DefaultInformationControl(shell, SWT.RESIZE
1169
						| SWT.TOOL, style, new HTMLTextPresenter(cutDown));
1170
			}
1171
		};
1172
1173
		fInformationPresenter = new InformationPresenter(
1174
				informationControlCreator);
1175
		fInformationPresenter.setSizeConstraints(60, 10, true, true);
1176
		fInformationPresenter.install(getSourceViewer());
1177
		fInformationPresenter
1178
				.setDocumentPartitioning(ICPartitions.C_PARTITIONING);
1179
				
1180
		
1181
		ProjectionViewer projectionViewer= (ProjectionViewer) getSourceViewer();
1182
		
1183
		fProjectionSupport= new ProjectionSupport(projectionViewer, getAnnotationAccess(), getSharedColors());
1184
		fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); //$NON-NLS-1$
1185
		fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); //$NON-NLS-1$
1186
		fProjectionSupport.install();
1187
		
1188
		fProjectionModelUpdater= CUIPlugin.getDefault().getFoldingStructureProviderRegistry().getCurrentFoldingProvider();
1189
		if (fProjectionModelUpdater != null)
1190
			fProjectionModelUpdater.install(this, projectionViewer);
1191
1192
		if (isFoldingEnabled())
1193
			projectionViewer.doOperation(ProjectionViewer.TOGGLE);
1194
		
1195
1533
1196
		PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, ICHelpContextIds.CEDITOR_VIEW);
1534
		try {
1535
			if (asv != null) {
1197
1536
1198
		fEditorSelectionChangedListener= new EditorSelectionChangedListener();
1537
				String property = event.getProperty();
1199
		fEditorSelectionChangedListener.install(getSelectionProvider());
1200
		
1201
1538
1202
		if (isTabConversionEnabled())
1539
				if (CODE_FORMATTER_TAB_SIZE.equals(property)) {
1203
			startTabConversion();
1540
					SourceViewerConfiguration configuration = getSourceViewerConfiguration();
1204
			
1541
					String[] types = configuration.getConfiguredContentTypes(asv);
1205
	}
1542
					for (int i = 0; i < types.length; i++) {
1543
						String[] prefixes = configuration.getIndentPrefixes(asv, types[i]);
1544
						if (prefixes != null && prefixes.length > 0)
1545
							asv.setIndentPrefixes(prefixes, types[i]);
1546
					}
1206
1547
1207
	/*
1548
					if (fTabConverter != null) {
1208
	 * @see org.eclipse.ui.texteditor.AbstractTextEditor#initializeDragAndDrop(org.eclipse.jface.text.source.ISourceViewer)
1549
						fTabConverter.setNumberOfSpacesPerTab(getTabSize());
1209
	 */
1550
					}
1210
	protected void initializeDragAndDrop(ISourceViewer viewer) {
1551
					return;
1211
		Control control= viewer.getTextWidget();
1552
				}
1212
		int operations= DND.DROP_MOVE | DND.DROP_COPY;
1213
1553
1214
		DropTarget dropTarget= new DropTarget(control, operations);
1554
				if (CLOSE_BRACKETS.equals(property)) {
1215
		ITextEditorDropTargetListener dropTargetListener= new TextEditorDropAdapter(viewer, this);
1555
					fBracketInserter.setCloseBracketsEnabled(getPreferenceStore().getBoolean(property));
1216
		dropTarget.setTransfer(dropTargetListener.getTransfers());
1556
					return;
1217
		dropTarget.addDropListener(dropTargetListener);
1557
				}
1218
1558
1219
		DragSource dragSource= new DragSource(control, operations);
1559
				if (CLOSE_ANGULAR_BRACKETS.equals(property)) {
1220
		Transfer[] dragTypes= new Transfer[] { TextTransfer.getInstance() };
1560
					fBracketInserter.setCloseAngularBracketsEnabled(getPreferenceStore().getBoolean(property));
1221
		dragSource.setTransfer(dragTypes);
1561
					return;
1222
		DragSourceListener dragSourceListener= new TextViewerDragAdapter(viewer, this);
1562
				}
1223
		dragSource.addDragListener(dragSourceListener);
1563
				
1224
	}
1564
				if (CLOSE_STRINGS.equals(property)) {
1565
					fBracketInserter.setCloseStringsEnabled(getPreferenceStore().getBoolean(property));
1566
					return;
1567
				}
1225
1568
1226
	/*
1569
				if (SPACES_FOR_TABS.equals(property)) {
1227
	 * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#getSourceViewerDecorationSupport(org.eclipse.jface.text.source.ISourceViewer)
1570
					if (isTabConversionEnabled())
1228
	 */
1571
						startTabConversion();
1229
	protected SourceViewerDecorationSupport getSourceViewerDecorationSupport(
1572
					else
1230
			ISourceViewer viewer) {
1573
						stopTabConversion();
1231
		if (fSourceViewerDecorationSupport == null) {
1574
					return;
1232
			fSourceViewerDecorationSupport= new CSourceViewerDecorationSupport(viewer, getOverviewRuler(), getAnnotationAccess(), getSharedColors());
1575
				}
1233
			configureSourceViewerDecorationSupport(fSourceViewerDecorationSupport);
1234
		}
1235
		return fSourceViewerDecorationSupport;
1236
	}
1237
	
1238
	/*
1239
	 * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#configureSourceViewerDecorationSupport(org.eclipse.ui.texteditor.SourceViewerDecorationSupport)
1240
	 */
1241
	protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
1242
		super.configureSourceViewerDecorationSupport(support);
1243
		//Enhance the stock source viewer decorator with a bracket matcher
1244
		support.setCharacterPairMatcher(fBracketMatcher);
1245
		support.setMatchingCharacterPainterPreferenceKeys(MATCHING_BRACKETS, MATCHING_BRACKETS_COLOR);
1246
		((CSourceViewerDecorationSupport)support).setInactiveCodePainterPreferenceKeys(INACTIVE_CODE_ENABLE, INACTIVE_CODE_COLOR);
1247
	}
1248
	
1249
	/**
1250
	 * Jumps to the matching bracket.
1251
	 */
1252
	public void gotoMatchingBracket() {
1253
		
1254
		ISourceViewer sourceViewer= getSourceViewer();
1255
		IDocument document= sourceViewer.getDocument();
1256
		if (document == null)
1257
			return;
1258
		
1259
		IRegion selection= getSignedSelection(sourceViewer);
1260
1576
1261
		int selectionLength= Math.abs(selection.getLength());
1577
				if (PreferenceConstants.EDITOR_SMART_TAB.equals(property)) {
1262
		if (selectionLength > 1) {
1578
					if (getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SMART_TAB)) {
1263
			setStatusLineErrorMessage(CEditorMessages.getString("GotoMatchingBracket.error.invalidSelection"));	//$NON-NLS-1$		
1579
						setActionActivationCode("IndentOnTab", '\t', -1, SWT.NONE); //$NON-NLS-1$
1264
			sourceViewer.getTextWidget().getDisplay().beep();
1580
					} else {
1265
			return;
1581
						removeActionActivationCode("IndentOnTab"); //$NON-NLS-1$
1266
		}
1582
					}
1583
				}
1267
1584
1268
		// #26314
1585
				// Not implemented ... for the future.
1269
		int sourceCaretOffset= selection.getOffset() + selection.getLength();
1586
				if (TRANSLATION_TASK_TAGS.equals(event.getProperty())) {
1270
		if (isSurroundedByBrackets(document, sourceCaretOffset))
1587
					ISourceViewer sourceViewer = getSourceViewer();
1271
			sourceCaretOffset -= selection.getLength();
1588
					if (sourceViewer != null && affectsTextPresentation(event))
1589
						sourceViewer.invalidateTextPresentation();
1590
				}
1272
1591
1273
		IRegion region= fBracketMatcher.match(document, sourceCaretOffset);
1592
				if (PreferenceConstants.EDITOR_FOLDING_PROVIDER.equals(property)) {
1274
		if (region == null) {
1593
					if (fProjectionModelUpdater != null) {
1275
			setStatusLineErrorMessage(CEditorMessages.getString("GotoMatchingBracket.error.noMatchingBracket"));	//$NON-NLS-1$		
1594
						fProjectionModelUpdater.uninstall();
1276
			sourceViewer.getTextWidget().getDisplay().beep();
1595
					}
1277
			return;		
1596
					// either freshly enabled or provider changed
1278
		}
1597
					fProjectionModelUpdater = CUIPlugin.getDefault().getFoldingStructureProviderRegistry().getCurrentFoldingProvider();
1279
		
1598
					if (fProjectionModelUpdater != null) {
1280
		int offset= region.getOffset();
1599
						fProjectionModelUpdater.install(this, asv);
1281
		int length= region.getLength();
1600
					}
1282
		
1601
					return;
1283
		if (length < 1)
1602
				}
1284
			return;
1285
			
1286
		int anchor= fBracketMatcher.getAnchor();
1287
		// http://dev.eclipse.org/bugs/show_bug.cgi?id=34195
1288
		int targetOffset= (ICharacterPairMatcher.RIGHT == anchor) ? offset + 1: offset + length;
1289
		
1290
		boolean visible= false;
1291
		if (sourceViewer instanceof ITextViewerExtension5) {
1292
			ITextViewerExtension5 extension= (ITextViewerExtension5) sourceViewer;
1293
			visible= (extension.modelOffset2WidgetOffset(targetOffset) > -1);
1294
		} else {
1295
			IRegion visibleRegion= sourceViewer.getVisibleRegion();
1296
			// http://dev.eclipse.org/bugs/show_bug.cgi?id=34195
1297
			visible= (targetOffset >= visibleRegion.getOffset() && targetOffset <= visibleRegion.getOffset() + visibleRegion.getLength());
1298
		}
1299
		
1300
		if (!visible) {
1301
			setStatusLineErrorMessage(CEditorMessages.getString("GotoMatchingBracket.error.bracketOutsideSelectedElement"));	//$NON-NLS-1$		
1302
			sourceViewer.getTextWidget().getDisplay().beep();
1303
			return;
1304
		}
1305
		
1306
		if (selection.getLength() < 0)
1307
			targetOffset -= selection.getLength();
1308
			
1309
		sourceViewer.setSelectedRange(targetOffset, selection.getLength());
1310
		sourceViewer.revealRange(targetOffset, selection.getLength());
1311
	}
1312
1603
1313
	protected void updateStatusLine() {
1604
				IContentAssistant c = asv.getContentAssistant();
1314
		ITextSelection selection= (ITextSelection) getSelectionProvider().getSelection();
1605
				if (c instanceof ContentAssistant) {
1315
		Annotation annotation= getAnnotation(selection.getOffset(), selection.getLength());
1606
					ContentAssistPreference.changeConfiguration((ContentAssistant) c, getPreferenceStore(), event);
1316
		setStatusLineErrorMessage(null);
1607
				}
1317
		setStatusLineMessage(null);
1608
			}
1318
		if (annotation != null) {
1609
		} finally {
1319
			updateMarkerViews(annotation);
1610
			super.handlePreferenceStoreChanged(event);
1320
			if (annotation instanceof ICAnnotation && ((ICAnnotation) annotation).isProblem())
1321
				setStatusLineMessage(annotation.getText());
1322
		}
1611
		}
1323
	}
1612
	}
1324
1613
1325
	/**
1614
	/**
1326
	 * Returns the annotation overlapping with the given range or <code>null</code>.
1615
	 * React to changed selection.
1327
	 * 
1616
	 * 
1328
	 * @param offset the region offset
1329
	 * @param length the region length
1330
	 * @return the found annotation or <code>null</code>
1331
	 * @since 3.0
1617
	 * @since 3.0
1332
	 */
1618
	 */
1333
	private Annotation getAnnotation(int offset, int length) {
1619
	protected void selectionChanged() {
1334
		IAnnotationModel model= getDocumentProvider().getAnnotationModel(getEditorInput());
1620
		if (getSelectionProvider() == null)
1335
		Iterator e= new CAnnotationIterator(model, true, true);
1621
			return;
1336
		while (e.hasNext()) {
1622
		updateStatusLine();
1337
			Annotation a= (Annotation) e.next();
1338
			if (!isNavigationTarget(a))
1339
				continue;
1340
				
1341
			Position p= model.getPosition(a);
1342
			if (p != null && p.overlapsWith(offset, length))
1343
				return a;
1344
		}
1345
		
1346
		return null;
1347
	}
1348
	/* (non-Javadoc)
1349
	 * @see org.eclipse.ui.part.IShowInSource#getShowInContext()
1350
	 *
1351
	 * This is required by the IShowInSource interface for the "ShowIn"
1352
 	 * navigation menu generalized in Eclipse.
1353
	 */
1354
	public ShowInContext getShowInContext() {
1355
		return new ShowInContext( getEditorInput(), null );
1356
	}
1623
	}
1357
1624
1358
	/*
1625
	/**
1359
	 * Get the dektop's StatusLineManager
1626
	 * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
1360
	 */
1627
	 */
1361
	protected IStatusLineManager getStatusLineManager() {
1628
	public void selectionChanged(SelectionChangedEvent event) {
1362
		IEditorActionBarContributor contributor = getEditorSite().getActionBarContributor();
1629
		ISelection sel = event.getSelection();
1363
		if (contributor instanceof EditorActionBarContributor) {
1630
		if (sel instanceof IStructuredSelection) {
1364
			return ((EditorActionBarContributor) contributor).getActionBars().getStatusLineManager();
1631
			IStructuredSelection selection = (IStructuredSelection) sel;
1632
			Object obj = selection.getFirstElement();
1633
			if (obj instanceof ISourceReference) {
1634
				try {
1635
					ISourceRange range = ((ISourceReference) obj).getSourceRange();
1636
					if (range != null) {
1637
						setSelection(range, !isActivePart());
1638
					}
1639
				} catch (CModelException e) {
1640
                    // Selection change not applied.
1641
				}
1642
			}
1365
		}
1643
		}
1366
		return null;
1367
	}
1644
	}
1368
	
1645
1369
	/**
1646
	/**
1370
	 * Configures the toggle comment action
1647
     * Sets selection for C element. 
1371
	 *
1648
     * @param element Element to select.
1372
	 * @since 4.0.0
1373
	 */
1649
	 */
1374
	private void configureToggleCommentAction() {
1650
    public void setSelection(ICElement element) {
1375
		IAction action= getAction("ToggleComment"); //$NON-NLS-1$
1376
		if (action instanceof ToggleCommentAction) {
1377
			ISourceViewer sourceViewer= getSourceViewer();
1378
			SourceViewerConfiguration configuration= getSourceViewerConfiguration();
1379
			((ToggleCommentAction)action).configure(sourceViewer, configuration);
1380
		}
1381
	}
1382
1651
1383
	private void configureTabConverter() {
1652
		if (element == null || element instanceof ITranslationUnit) {
1384
		if (fTabConverter != null) {
1653
			/*
1385
			IDocumentProvider provider= getDocumentProvider();
1654
			 * If the element is an ITranslationUnit this unit is either the input
1386
			if (provider instanceof CDocumentProvider) {
1655
			 * of this editor or not being displayed. In both cases, nothing should
1387
				CDocumentProvider prov= (CDocumentProvider) provider;
1656
			 * happened.
1388
				fTabConverter.setLineTracker(prov.createLineTracker(getEditorInput()));
1657
			 */
1389
			} else {
1658
			return;
1390
				fTabConverter.setLineTracker(new DefaultLineTracker());
1391
			}
1392
		}
1659
		}
1393
	}
1660
		if (element instanceof ISourceReference) {
1394
1661
			ISourceReference reference = (ISourceReference) element;
1395
	private void startTabConversion() {
1662
			// set hightlight range
1396
		if (fTabConverter == null) {
1663
			setSelection(reference, true);
1397
			CSourceViewer asv = (CSourceViewer) getSourceViewer();
1398
			SourceViewerConfiguration configuration = getSourceViewerConfiguration();
1399
			fTabConverter = new TabConverter();
1400
			configureTabConverter();
1401
			fTabConverter.setNumberOfSpacesPerTab(configuration.getTabWidth(asv));
1402
			asv.addTextConverter(fTabConverter);
1403
		}
1664
		}
1404
	}
1665
	}
1405
1666
1406
	private void stopTabConversion() {
1667
    /**
1407
		if (fTabConverter != null) {
1668
     * Sets selection for source reference.
1408
			CSourceViewer asv = (CSourceViewer) getSourceViewer();
1669
     * @param element Source reference to set.
1409
			asv.removeTextConverter(fTabConverter);
1670
     * @param moveCursor Should cursor be moved.
1410
			fTabConverter = null;
1671
     */
1411
		}
1672
    public void setSelection(ISourceReference element, boolean moveCursor) {
1412
	}
1673
		if (element != null) {
1674
			StyledText  textWidget = null;
1675
			
1676
			ISourceViewer sourceViewer = getSourceViewer();
1677
			if (sourceViewer != null)
1678
				textWidget = sourceViewer.getTextWidget();
1679
			
1680
			if (textWidget == null)
1681
				return;
1413
1682
1414
	private boolean isTabConversionEnabled() {
1683
			try {
1415
		IPreferenceStore store = getPreferenceStore();
1684
				setSelection(element.getSourceRange(), moveCursor);
1416
		return store.getBoolean(SPACES_FOR_TABS);
1685
			} catch (CModelException e) {
1686
                // Selection not applied.
1687
			}
1688
		}
1417
	}
1689
	}
1418
1690
1419
	/*
1691
	/**
1420
	 * @see org.eclipse.ui.texteditor.AbstractTextEditor#createNavigationActions()
1692
	 * Sets the current editor selection to the source range. Optionally
1693
	 * sets the current editor position.
1694
	 *
1695
	 * @param element the source range to be shown in the editor, can be null.
1696
	 * @param moveCursor if true the editor is scrolled to show the range.
1421
	 */
1697
	 */
1422
	protected void createNavigationActions() {
1698
	public void setSelection(ISourceRange element, boolean moveCursor) {
1423
		super.createNavigationActions();
1424
1699
1425
		final StyledText textWidget = getSourceViewer().getTextWidget();
1700
		if (element == null) {
1701
			return;
1702
		}
1426
1703
1427
		IAction action = new NavigatePreviousSubWordAction();
1704
		try {
1428
		action.setActionDefinitionId(ITextEditorActionDefinitionIds.WORD_PREVIOUS);
1705
			IRegion alternateRegion = null;
1429
		setAction(ITextEditorActionDefinitionIds.WORD_PREVIOUS, action);
1706
			int start = element.getStartPos();
1430
		textWidget.setKeyBinding(SWT.CTRL | SWT.ARROW_LEFT, SWT.NULL);
1707
			int length = element.getLength();
1431
1708
1432
		action = new NavigateNextSubWordAction();
1709
			// Sanity check sometimes the parser may throw wrong numbers.
1433
		action.setActionDefinitionId(ITextEditorActionDefinitionIds.WORD_NEXT);
1710
			if (start < 0 || length < 0) {
1434
		setAction(ITextEditorActionDefinitionIds.WORD_NEXT, action);
1711
				start = 0;
1435
		textWidget.setKeyBinding(SWT.CTRL | SWT.ARROW_RIGHT, SWT.NULL);
1712
				length = 0;
1713
			}
1436
1714
1437
		action = new SelectPreviousSubWordAction();
1715
			// 0 length and start and non-zero start line says we know
1438
		action.setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_WORD_PREVIOUS);
1716
			// the line for some reason, but not the offset.
1439
		setAction(ITextEditorActionDefinitionIds.SELECT_WORD_PREVIOUS, action);
1717
			if (length == 0 && start == 0 && element.getStartLine() > 0) {
1440
		textWidget.setKeyBinding(SWT.CTRL | SWT.SHIFT | SWT.ARROW_LEFT, SWT.NULL);
1718
				// We have the information in term of lines, we can work it out.
1719
				// Binary elements return the first executable statement so we have to substract -1
1720
				start = getDocumentProvider().getDocument(getEditorInput()).getLineOffset(element.getStartLine() - 1);
1721
				if (element.getEndLine() > 0) {
1722
					length = getDocumentProvider().getDocument(getEditorInput()).getLineOffset(element.getEndLine()) - start;
1723
				} else {
1724
					length = start;
1725
				}
1726
				// create an alternate region for the keyword highlight.
1727
				alternateRegion = getDocumentProvider().getDocument(getEditorInput()).getLineInformation(element.getStartLine() - 1);
1728
				if (start == length || length < 0) {
1729
					if (alternateRegion != null) {
1730
						start = alternateRegion.getOffset();
1731
						length = alternateRegion.getLength();
1732
					}
1733
				}
1734
			}
1735
			setHighlightRange(start, length, moveCursor);
1441
1736
1442
		action = new SelectNextSubWordAction();
1737
			if (moveCursor) {
1443
		action.setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_WORD_NEXT);
1738
				start = element.getIdStartPos();
1444
		setAction(ITextEditorActionDefinitionIds.SELECT_WORD_NEXT, action);
1739
				length = element.getIdLength();
1445
		textWidget.setKeyBinding(SWT.CTRL | SWT.SHIFT | SWT.ARROW_RIGHT, SWT.NULL);
1740
				if (start == 0 && length == 0 && alternateRegion != null) {
1446
		
1741
					start = alternateRegion.getOffset();
1447
		action= new DeletePreviousSubWordAction();
1742
					length = alternateRegion.getLength();
1448
		action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_PREVIOUS_WORD);
1743
				}
1449
		setAction(ITextEditorActionDefinitionIds.DELETE_PREVIOUS_WORD, action);
1744
				if (start > -1 && getSourceViewer() != null) {
1450
		textWidget.setKeyBinding(SWT.CTRL | SWT.BS, SWT.NULL);
1745
					getSourceViewer().revealRange(start, length);
1451
		markAsStateDependentAction(ITextEditorActionDefinitionIds.DELETE_PREVIOUS_WORD, true);
1746
					getSourceViewer().setSelectedRange(start, length);
1747
				}
1748
				updateStatusField(CTextEditorActionConstants.STATUS_CURSOR_POS);
1749
			}
1750
			return;
1751
		} catch (IllegalArgumentException x) {
1752
            // No information to the user
1753
		} catch (BadLocationException e) {
1754
            // No information to the user
1755
		}
1452
1756
1453
		action= new DeleteNextSubWordAction();
1757
		if (moveCursor)
1454
		action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_NEXT_WORD);
1758
			resetHighlightRange();
1455
		setAction(ITextEditorActionDefinitionIds.DELETE_NEXT_WORD, action);
1456
		textWidget.setKeyBinding(SWT.CTRL | SWT.DEL, SWT.NULL);
1457
		markAsStateDependentAction(ITextEditorActionDefinitionIds.DELETE_NEXT_WORD, true);
1458
	}
1759
	}
1459
1760
1460
	interface ITextConverter {
1761
	/**
1461
		void customizeDocumentCommand(IDocument document, DocumentCommand command);
1762
     * Checks is the editor active part. 
1763
     * @return <code>true</code> if editor is the active part of the workbench.
1764
	 */
1765
    private boolean isActivePart() {
1766
		IWorkbenchWindow window = getSite().getWorkbenchWindow();
1767
		IPartService service = window.getPartService();
1768
		return (this == service.getActivePart());
1462
	}
1769
	}
1463
1770
1464
	static class TabConverter implements ITextConverter {
1771
    /**
1465
		private int fTabRatio;
1772
     * @see org.eclipse.ui.IWorkbenchPart#dispose()
1466
		private ILineTracker fLineTracker;
1773
     */
1774
    public void dispose() {
1775
1776
		ISourceViewer sourceViewer = getSourceViewer();
1777
		if (sourceViewer instanceof ITextViewerExtension)
1778
			((ITextViewerExtension) sourceViewer).removeVerifyKeyListener(fBracketInserter);
1779
1780
		if (fProjectionModelUpdater != null) {
1781
			fProjectionModelUpdater.uninstall();
1782
			fProjectionModelUpdater = null;
1783
		}
1467
		
1784
		
1468
		public TabConverter() {
1785
		if (fProjectionSupport != null) {
1469
		} 
1786
			fProjectionSupport.dispose();
1787
			fProjectionSupport = null;
1788
		}
1789
1790
		if (fCEditorErrorTickUpdater != null) {
1791
			fCEditorErrorTickUpdater.dispose();
1792
			fCEditorErrorTickUpdater = null;
1793
		}
1794
		
1795
        if (fSelectionUpdateListener != null) {
1796
			getSelectionProvider().addSelectionChangedListener(fSelectionUpdateListener);
1797
			fSelectionUpdateListener = null;
1798
        }
1799
        
1800
       	if (fStatusLineClearer != null) {
1801
			ISelectionProvider provider = getSelectionProvider();
1802
       		provider.removeSelectionChangedListener(fStatusLineClearer);
1803
			fStatusLineClearer = null;
1804
		}
1805
        
1806
        if (fBracketMatcher != null) {
1807
			fBracketMatcher.dispose();
1808
			fBracketMatcher = null;
1809
		}
1470
		
1810
		
1471
		public void setNumberOfSpacesPerTab(int ratio) {
1811
		if (fOutlinePage != null) {
1472
			fTabRatio= ratio;
1812
			fOutlinePage.dispose();
1813
			fOutlinePage = null;
1473
		}
1814
		}
1474
		
1815
		
1475
		public void setLineTracker(ILineTracker lineTracker) {
1816
		if (fShowInCViewAction != null) {
1476
			fLineTracker= lineTracker;
1817
			fShowInCViewAction.dispose();
1818
			fShowInCViewAction = null;
1477
		}
1819
		}
1478
		
1820
		
1479
		private int insertTabString(StringBuffer buffer, int offsetInLine) {
1821
		if (fSelectionSearchGroup != null) {
1480
			
1822
			fSelectionSearchGroup.dispose();
1481
			if (fTabRatio == 0)
1823
			fSelectionSearchGroup = null;
1482
				return 0;
1824
		}
1483
				
1825
1484
			int remainder= offsetInLine % fTabRatio;
1826
		if (fTextSearchGroup != null) {
1485
			remainder= fTabRatio - remainder;
1827
			fTextSearchGroup.dispose();
1486
			for (int i= 0; i < remainder; i++)
1828
			fTextSearchGroup = null;
1487
				buffer.append(' ');
1829
		}
1488
			return remainder;
1830
1831
		if (fEditorSelectionChangedListener != null)  {
1832
			fEditorSelectionChangedListener.uninstall(getSelectionProvider());
1833
			fEditorSelectionChangedListener = null;
1489
		}
1834
		}
1835
1836
		stopTabConversion();
1490
		
1837
		
1491
		public void customizeDocumentCommand(IDocument document, DocumentCommand command) {
1838
		super.dispose();
1492
			String text = command.text;
1839
	}
1493
			if (text == null)
1840
1494
				return;
1841
	/**
1495
				
1842
	 * @see org.eclipse.ui.texteditor.AbstractTextEditor#canHandleMove(org.eclipse.ui.IEditorInput, org.eclipse.ui.IEditorInput)
1496
			int index = text.indexOf('\t');
1843
	 */
1497
			if (index > -1) {
1844
	protected boolean canHandleMove(IEditorInput originalElement, IEditorInput movedElement) {
1498
				StringBuffer buffer = new StringBuffer();
1845
		String oldLanguage = ""; //$NON-NLS-1$
1499
				
1846
		if (originalElement instanceof IFileEditorInput) {
1500
				fLineTracker.set(command.text);
1847
			IFile file = ((IFileEditorInput) originalElement).getFile();
1501
				int lines = fLineTracker.getNumberOfLines();
1848
			if (file != null) {
1502
				
1849
				IContentType type = CCorePlugin.getContentType(file.getProject(), file.getName());
1503
				try {
1850
				if (type != null) {
1504
					for (int i = 0; i < lines; i++) {
1851
					oldLanguage = type.getId();
1505
						int offset = fLineTracker.getLineOffset(i);
1852
				}
1506
						int endOffset = offset + fLineTracker.getLineLength(i);
1853
				if (oldLanguage == null) {
1507
						String line = text.substring(offset, endOffset);
1854
					return false;
1508
						
1855
				}
1509
						int position= 0;
1856
			}
1510
						if (i == 0) {
1857
		}
1511
							IRegion firstLine = document.getLineInformationOfOffset(command.offset);
1858
1512
							position = command.offset - firstLine.getOffset();	
1859
		String newLanguage = ""; //$NON-NLS-1$
1513
						}
1860
		if (movedElement instanceof IFileEditorInput) {
1514
						
1861
			IFile file = ((IFileEditorInput) movedElement).getFile();
1515
						int length = line.length();
1862
			if (file != null) {
1516
						for (int j = 0; j < length; j++) {
1863
				IContentType type = CCorePlugin.getContentType(file.getProject(), file.getName());
1517
							char c = line.charAt(j);
1864
				if (type != null) {
1518
							if (c == '\t') {
1865
					newLanguage = type.getId();
1519
								int oldPosition = position;
1866
				}
1520
								position += insertTabString(buffer, position);
1867
				if (newLanguage == null) {
1521
								if (command.caretOffset > command.offset + oldPosition) {
1868
					return false;
1522
									command.caretOffset += position - oldPosition - 1;
1523
								}
1524
							} else {
1525
								buffer.append(c);
1526
								++position;
1527
							}
1528
						}
1529
					}
1530
						
1531
					command.text = buffer.toString();
1532
				} catch (BadLocationException x) {
1533
				}
1869
				}
1534
			}
1870
			}
1535
		}
1871
		}
1872
		return oldLanguage.equals(newLanguage);
1536
	}
1873
	}
1537
1874
1538
	/*
1875
	/**
1539
	 * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createSourceViewer(org.eclipse.swt.widgets.Composite, org.eclipse.jface.text.source.IVerticalRuler, int)
1876
	 * @see org.eclipse.ui.texteditor.AbstractTextEditor#createActions()
1540
	 */
1877
	 */
1541
	protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
1878
	protected void createActions() {
1542
		ISourceViewer sourceViewer =
1879
		super.createActions();
1543
			new CSourceViewer(
1544
				this, parent,
1545
				ruler,
1546
				styles,
1547
				getOverviewRuler(),
1548
				isOverviewRulerVisible());
1549
1880
1550
		CSourceViewerDecorationSupport decoSupport = (CSourceViewerDecorationSupport) getSourceViewerDecorationSupport(sourceViewer);
1881
		fFoldingGroup = new FoldingActionGroup(this, getSourceViewer());
1551
		decoSupport.editorInputChanged(getEditorInput());
1552
1882
1553
		CUIHelp.setHelp(this, sourceViewer.getTextWidget(), ICHelpContextIds.CEDITOR_VIEW);
1883
		// Sticky hover support
1884
		ResourceAction resAction = new TextOperationAction(CEditorMessages.getResourceBundle(), "ShowToolTip.", this, ISourceViewer.INFORMATION, true); //$NON-NLS-1$
1885
		ResourceAction resAction2 = new InformationDispatchAction(CEditorMessages.getResourceBundle(), "ShowToolTip.", (TextOperationAction) resAction); //$NON-NLS-1$
1886
		resAction2.setActionDefinitionId(ICEditorActionDefinitionIds.SHOW_TOOLTIP);
1887
		setAction("ShowToolTip", resAction2); //$NON-NLS-1$
1888
		PlatformUI.getWorkbench().getHelpSystem().setHelp(resAction2, ICHelpContextIds.SHOW_TOOLTIP_ACTION);
1889
		
1890
		// Default text editing menu items
1891
		Action action = new GotoMatchingBracketAction(this);
1892
		action.setActionDefinitionId(ICEditorActionDefinitionIds.GOTO_MATCHING_BRACKET);				
1893
		setAction(GotoMatchingBracketAction.GOTO_MATCHING_BRACKET, action);
1894
		
1895
		action = new JoinLinesAction(CEditorMessages.getResourceBundle(), "JoinLines.", this); //$NON-NLS-1$
1896
		action.setActionDefinitionId(ICEditorActionDefinitionIds.JOIN_LINES);
1897
		setAction("Join Lines", action); //$NON-NLS-1$
1898
		
1899
		action = new ToggleCommentAction(CEditorMessages.getResourceBundle(), "ToggleComment.", this); //$NON-NLS-1$
1900
		action.setActionDefinitionId(ICEditorActionDefinitionIds.TOGGLE_COMMENT);
1901
		setAction("ToggleComment", action); //$NON-NLS-1$
1902
		markAsStateDependentAction("ToggleComment", true); //$NON-NLS-1$
1903
		configureToggleCommentAction();
1904
		
1905
		action = new AddBlockCommentAction(CEditorMessages.getResourceBundle(), "AddBlockComment.", this);  //$NON-NLS-1$
1906
		action.setActionDefinitionId(ICEditorActionDefinitionIds.ADD_BLOCK_COMMENT);		
1907
		setAction("AddBlockComment", action); //$NON-NLS-1$
1908
		markAsStateDependentAction("AddBlockComment", true); //$NON-NLS-1$
1909
		markAsSelectionDependentAction("AddBlockComment", true); //$NON-NLS-1$		
1910
		//WorkbenchHelp.setHelp(action, ICHelpContextIds.ADD_BLOCK_COMMENT_ACTION);
1554
1911
1555
		return sourceViewer;
1912
		action = new RemoveBlockCommentAction(CEditorMessages.getResourceBundle(), "RemoveBlockComment.", this);  //$NON-NLS-1$
1556
	}
1913
		action.setActionDefinitionId(ICEditorActionDefinitionIds.REMOVE_BLOCK_COMMENT);		
1914
		setAction("RemoveBlockComment", action); //$NON-NLS-1$
1915
		markAsStateDependentAction("RemoveBlockComment", true); //$NON-NLS-1$
1916
		markAsSelectionDependentAction("RemoveBlockComment", true); //$NON-NLS-1$		
1917
		//WorkbenchHelp.setHelp(action, ICHelpContextIds.REMOVE_BLOCK_COMMENT_ACTION);
1557
1918
1558
	/** Outliner context menu Id */
1919
		action = new IndentAction(CEditorMessages.getResourceBundle(), "Indent.", this, false); //$NON-NLS-1$
1559
	protected String fOutlinerContextMenuId;
1920
		action.setActionDefinitionId(ICEditorActionDefinitionIds.INDENT);
1921
		setAction("Indent", action); //$NON-NLS-1$
1922
		markAsStateDependentAction("Indent", true); //$NON-NLS-1$
1923
		markAsSelectionDependentAction("Indent", true); //$NON-NLS-1$
1924
//		PlatformUI.getWorkbench().getHelpSystem().setHelp(action, ICHelpContextIds.INDENT_ACTION);
1925
1926
		action = new IndentAction(CEditorMessages.getResourceBundle(), "Indent.", this, true); //$NON-NLS-1$
1927
		setAction("IndentOnTab", action); //$NON-NLS-1$
1928
		markAsStateDependentAction("IndentOnTab", true); //$NON-NLS-1$
1929
		markAsSelectionDependentAction("IndentOnTab", true); //$NON-NLS-1$
1930
		
1931
		if (getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SMART_TAB)) {
1932
			setActionActivationCode("IndentOnTab", '\t', -1, SWT.NONE); //$NON-NLS-1$
1933
		}
1934
		
1935
		action = new TextOperationAction(CEditorMessages.getResourceBundle(), "Format.", this, ISourceViewer.FORMAT); //$NON-NLS-1$
1936
		action.setActionDefinitionId(ICEditorActionDefinitionIds.FORMAT);
1937
		setAction("Format", action); //$NON-NLS-1$
1938
		markAsStateDependentAction("Format", true); //$NON-NLS-1$
1560
1939
1561
	/**
1940
		action = new ContentAssistAction(CEditorMessages.getResourceBundle(), "ContentAssistProposal.", this); //$NON-NLS-1$
1562
	 * Sets the outliner's context menu ID.
1941
		action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
1563
	 */
1942
		setAction("ContentAssistProposal", action); //$NON-NLS-1$
1564
	protected void setOutlinerContextMenuId(String menuId) {
1943
		markAsStateDependentAction("ContentAssistProposal", true); //$NON-NLS-1$
1565
		fOutlinerContextMenuId = menuId;
1944
1566
	}
1945
		action = new TextOperationAction(CEditorMessages.getResourceBundle(), "ContentAssistTip.", this, ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION); //$NON-NLS-1$
1946
		action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
1947
		setAction("ContentAssistTip", action); //$NON-NLS-1$
1948
1949
		action = new AddIncludeOnSelectionAction(this);
1950
		action.setActionDefinitionId(ICEditorActionDefinitionIds.ADD_INCLUDE);
1951
		setAction("AddIncludeOnSelection", action); //$NON-NLS-1$
1567
	
1952
	
1568
	/* (non-Javadoc)
1953
		action = new OpenDeclarationsAction(this);
1569
	 * @see org.eclipse.ui.editors.text.TextEditor#initializeKeyBindingScopes()
1954
		action.setActionDefinitionId(ICEditorActionDefinitionIds.OPEN_DECL);
1570
	 */
1955
		setAction("OpenDeclarations", action); //$NON-NLS-1$
1571
	protected void initializeKeyBindingScopes() {
1572
		setKeyBindingScopes(new String [] { "org.eclipse.cdt.ui.cEditorScope" } ); //$NON-NLS-1$
1573
	}
1574
1956
1575
	/* (non-Javadoc)
1957
        action = new OpenDefinitionAction(this);
1576
	 * @see AbstractTextEditor#affectsTextPresentation(PropertyChangeEvent)
1958
        action.setActionDefinitionId(ICEditorActionDefinitionIds.OPEN_DEF);
1577
	 */
1959
        setAction("OpenDefinition", action); //$NON-NLS-1$
1578
	protected boolean affectsTextPresentation(PropertyChangeEvent event) {
1960
        
1579
		SourceViewerConfiguration configuration = getSourceViewerConfiguration();
1961
//		action = new OpenTypeHierarchyAction(this);
1580
		if (configuration instanceof CSourceViewerConfiguration) {
1962
//		action.setActionDefinitionId(ICEditorActionDefinitionIds.OPEN_TYPE_HIERARCHY);
1581
			return ((CSourceViewerConfiguration)configuration).affectsBehavior(event);
1963
//		setAction("OpenTypeHierarchy", action); //$NON-NLS-1$
1582
		}
1964
1583
		return false;
1965
		fShowInCViewAction = new ShowInCViewAction(this);
1966
		action = fShowInCViewAction;
1967
		action.setActionDefinitionId(ICEditorActionDefinitionIds.OPEN_CVIEW);
1968
		setAction("ShowInCView", action); //$NON-NLS-1$
1969
        
1970
        action = new TextOperationAction(CEditorMessages.getResourceBundle(), "OpenOutline.", this, CSourceViewer.SHOW_OUTLINE, true); //$NON-NLS-1$
1971
        action.setActionDefinitionId(ICEditorActionDefinitionIds.OPEN_OUTLINE);
1972
        setAction("OpenOutline", action); //$NON-NLS-1$*/
1973
        
1974
        action = new GoToNextPreviousMemberAction(CEditorMessages.getResourceBundle(), "GotoNextMember.", this, true); //$NON-NLS-1$
1975
        action.setActionDefinitionId(ICEditorActionDefinitionIds.GOTO_NEXT_MEMBER);
1976
        setAction("GotoNextMember", action); //$NON-NLS-1$*/
1977
1978
        action = new GoToNextPreviousMemberAction(CEditorMessages.getResourceBundle(), "GotoPrevMember.", this, false); //$NON-NLS-1$
1979
        action.setActionDefinitionId(ICEditorActionDefinitionIds.GOTO_PREVIOUS_MEMBER);
1980
        setAction("GotoPrevMember", action); //$NON-NLS-1$*/
1981
1982
        //Assorted action groupings
1983
		fSelectionSearchGroup = new SelectionSearchGroup(this);
1984
		fTextSearchGroup = new TextSearchGroup(this);
1584
	}
1985
	}
1585
1986
1586
	/**
1987
	/**
1587
	 * Returns the folding action group, or <code>null</code> if there is none.
1988
	 * @see org.eclipse.ui.texteditor.AbstractTextEditor#editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
1588
	 * 
1589
	 * @return the folding action group, or <code>null</code> if there is none
1590
	 */
1989
	 */
1591
	protected FoldingActionGroup getFoldingActionGroup() {
1990
	public void editorContextMenuAboutToShow(IMenuManager menu) {
1592
		return fFoldingGroup;
1991
		super.editorContextMenuAboutToShow(menu);
1992
1993
		addGroup(menu, ITextEditorActionConstants.GROUP_EDIT, IContextMenuConstants.GROUP_REORGANIZE);
1994
		addGroup(menu, ITextEditorActionConstants.GROUP_EDIT, IContextMenuConstants.GROUP_GENERATE);
1995
		addGroup(menu, ITextEditorActionConstants.GROUP_EDIT, IContextMenuConstants.GROUP_NEW);
1996
1997
		// Code formatting menu items -- only show in C perspective
1998
		addAction(menu, ITextEditorActionConstants.GROUP_EDIT, "ToggleComment"); //$NON-NLS-1$
1999
		addAction(menu, ITextEditorActionConstants.GROUP_EDIT, "AddBlockComment"); //$NON-NLS-1$
2000
		addAction(menu, ITextEditorActionConstants.GROUP_EDIT, "RemoveBlockComment"); //$NON-NLS-1$
2001
2002
		addAction(menu, ITextEditorActionConstants.GROUP_FIND, "OpenDeclarations"); //$NON-NLS-1$
2003
        addAction(menu, ITextEditorActionConstants.GROUP_FIND, "OpenDefinition"); //$NON-NLS-1$
2004
2005
		addAction(menu, ITextEditorActionConstants.GROUP_FIND, "OpenTypeHierarchy"); //$NON-NLS-1$
2006
        addAction(menu, ITextEditorActionConstants.GROUP_FIND, "GotoNextMember"); //$NON-NLS-1$
2007
        addAction(menu, ITextEditorActionConstants.GROUP_FIND, "GotoPrevMember"); //$NON-NLS-1$
2008
2009
		addAction(menu, IContextMenuConstants.GROUP_GENERATE, "ContentAssistProposal"); //$NON-NLS-1$
2010
		addAction(menu, IContextMenuConstants.GROUP_GENERATE, "AddIncludeOnSelection"); //$NON-NLS-1$
2011
		addAction(menu, IContextMenuConstants.GROUP_GENERATE, "Format"); //$NON-NLS-1$
2012
		
2013
		addAction(menu, IContextMenuConstants.GROUP_GENERATE, "ShowInCView"); //$NON-NLS-1$
2014
2015
		fSelectionSearchGroup.fillContextMenu(menu);
2016
		fTextSearchGroup.fillContextMenu(menu);
1593
	}
2017
	}
1594
2018
1595
	/*
2019
	/**
1596
	 * @see org.eclipse.ui.texteditor.AbstractTextEditor#performRevert()
2020
     * Sets an input for the outline page.
2021
	 * @param page Page to set the input.
2022
	 * @param input Input to set.
1597
	 */
2023
	 */
1598
	protected void performRevert() {
2024
	public static void setOutlinePageInput(CContentOutlinePage page, IEditorInput input) {
1599
		ProjectionViewer projectionViewer= (ProjectionViewer) getSourceViewer();
2025
		if (page != null) {
1600
		projectionViewer.setRedraw(false);
2026
			IWorkingCopyManager manager = CUIPlugin.getDefault().getWorkingCopyManager();
1601
		try {
2027
			page.setInput(manager.getWorkingCopy(input));
1602
			
1603
			boolean projectionMode= projectionViewer.isProjectionMode();
1604
			if (projectionMode) {
1605
				projectionViewer.disableProjection();				
1606
				if (fProjectionModelUpdater != null)
1607
					fProjectionModelUpdater.uninstall();
1608
			}
1609
			
1610
			super.performRevert();
1611
			
1612
			if (projectionMode) {
1613
				if (fProjectionModelUpdater != null)
1614
					fProjectionModelUpdater.install(this, projectionViewer);	
1615
				projectionViewer.enableProjection();
1616
			}
1617
			
1618
		} finally {
1619
			projectionViewer.setRedraw(true);
1620
		}
2028
		}
1621
	}
2029
	}
1622
2030
1623
    /**
1624
     * Sets the given message as error message to this editor's status line.
1625
     * 
1626
     * @param msg message to be set
1627
     */
1628
    protected void setStatusLineErrorMessage(String msg) {
1629
    	IEditorStatusLine statusLine= (IEditorStatusLine) getAdapter(IEditorStatusLine.class);
1630
    	if (statusLine != null)
1631
    		statusLine.setMessage(true, msg, null);	
1632
1633
    }  
1634
1635
	/**
2031
	/**
1636
	 * Sets the given message as message to this editor's status line.
2032
     * Determines is folding enabled.
1637
	 * 
2033
	 * @return <code>true</code> if folding is enabled, <code>false</code> otherwise.
1638
	 * @param msg message to be set
1639
	 * @since 3.0
1640
	 */
2034
	 */
1641
	protected void setStatusLineMessage(String msg) {
2035
	boolean isFoldingEnabled() {
1642
		IEditorStatusLine statusLine= (IEditorStatusLine) getAdapter(IEditorStatusLine.class);
2036
		return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED);
1643
		if (statusLine != null)
1644
			statusLine.setMessage(false, msg, null);	
1645
	}
2037
	}
1646
2038
2039
1647
	/**
2040
	/**
1648
	 * Returns the signed current selection.
2041
	 * The <code>AbstractTextEditor</code> implementation of this 
1649
	 * The length will be negative if the resulting selection
2042
	 * <code>IWorkbenchPart</code> method creates the vertical ruler and
1650
	 * is right-to-left (RtoL).
2043
	 * source viewer. Subclasses may extend.
1651
	 * <p>
1652
	 * The selection offset is model based.
1653
	 * </p>
1654
	 * 
2044
	 * 
1655
	 * @param sourceViewer the source viewer
2045
	 * We attach our own mouseDown listener on the menu bar, 
1656
	 * @return a region denoting the current signed selection, for a resulting RtoL selections length is < 0 
2046
	 * and our own listener for cursor/key/selection events to update cursor position in
2047
	 * status bar.
2048
2049
     * @param parent Parent composite of the control.
1657
	 */
2050
	 */
1658
	protected IRegion getSignedSelection(ISourceViewer sourceViewer) {
2051
	public void createPartControl(Composite parent) {
1659
		StyledText text= sourceViewer.getTextWidget();
2052
		super.createPartControl(parent);
1660
		Point selection= text.getSelectionRange();
2053
	
2054
		// Sticky hover support
2055
		IInformationControlCreator informationControlCreator = new IInformationControlCreator() {
2056
			public IInformationControl createInformationControl(Shell shell) {
2057
				boolean cutDown = false;
2058
				int style = cutDown ? SWT.NONE : (SWT.V_SCROLL | SWT.H_SCROLL);
2059
				return new DefaultInformationControl(shell, SWT.RESIZE
2060
						| SWT.TOOL, style, new HTMLTextPresenter(cutDown));
2061
			}
2062
		};
2063
2064
		fInformationPresenter = new InformationPresenter(
2065
				informationControlCreator);
2066
		fInformationPresenter.setSizeConstraints(60, 10, true, true);
2067
		fInformationPresenter.install(getSourceViewer());
2068
		fInformationPresenter
2069
				.setDocumentPartitioning(ICPartitions.C_PARTITIONING);
2070
				
1661
		
2071
		
1662
		if (text.getCaretOffset() == selection.x) {
2072
		ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();
1663
			selection.x= selection.x + selection.y;
1664
			selection.y= -selection.y;
1665
		}
1666
		
2073
		
1667
		selection.x= widgetOffset2ModelOffset(sourceViewer, selection.x);
2074
		fProjectionSupport = new ProjectionSupport(projectionViewer, getAnnotationAccess(), getSharedColors());
2075
		fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); //$NON-NLS-1$
2076
		fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); //$NON-NLS-1$
2077
		fProjectionSupport.install();
1668
		
2078
		
1669
		return new Region(selection.x, selection.y);
2079
		fProjectionModelUpdater = CUIPlugin.getDefault().getFoldingStructureProviderRegistry().getCurrentFoldingProvider();
1670
	}
2080
		if (fProjectionModelUpdater != null)
1671
	
2081
			fProjectionModelUpdater.install(this, projectionViewer);
1672
	private static boolean isBracket(char character) {
1673
		for (int i= 0; i != BRACKETS.length; ++i)
1674
			if (character == BRACKETS[i])
1675
				return true;
1676
		return false;
1677
	}
1678
2082
1679
	private static boolean isSurroundedByBrackets(IDocument document, int offset) {
2083
		if (isFoldingEnabled())
1680
		if (offset == 0 || offset == document.getLength())
2084
			projectionViewer.doOperation(ProjectionViewer.TOGGLE);
1681
			return false;
2085
		
2086
		PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, ICHelpContextIds.CEDITOR_VIEW);
1682
2087
1683
		try {
2088
		fEditorSelectionChangedListener = new EditorSelectionChangedListener();
1684
			return
2089
		fEditorSelectionChangedListener.install(getSelectionProvider());
1685
				isBracket(document.getChar(offset - 1)) &&
2090
		
1686
				isBracket(document.getChar(offset));
2091
		if (isTabConversionEnabled())
2092
			startTabConversion();
1687
			
2093
			
1688
		} catch (BadLocationException e) {
2094
		IPreferenceStore preferenceStore = getPreferenceStore();
1689
			return false;	
2095
		boolean closeBrackets = preferenceStore.getBoolean(CLOSE_BRACKETS);
1690
		}
2096
		boolean closeAngularBrackets = preferenceStore.getBoolean(CLOSE_ANGULAR_BRACKETS);
2097
		boolean closeStrings = preferenceStore.getBoolean(CLOSE_STRINGS);
2098
2099
		fBracketInserter.setCloseBracketsEnabled(closeBrackets);
2100
		fBracketInserter.setCloseStringsEnabled(closeStrings);
2101
		fBracketInserter.setCloseAngularBracketsEnabled(closeAngularBrackets);
2102
2103
		ISourceViewer sourceViewer = getSourceViewer();
2104
		if (sourceViewer instanceof ITextViewerExtension)
2105
			((ITextViewerExtension) sourceViewer).prependVerifyKeyListener(fBracketInserter);
1691
	}
2106
	}
1692
		
1693
2107
1694
	/* (non-Javadoc)
2108
	/*
1695
	 * @see org.eclipse.cdt.internal.ui.editor.IReconcilingParticipant#reconciled()
2109
	 * @see org.eclipse.ui.texteditor.AbstractTextEditor#initializeDragAndDrop(org.eclipse.jface.text.source.ISourceViewer)
1696
	 */
2110
	 */
1697
	public void reconciled(boolean somethingHasChanged) {
2111
	protected void initializeDragAndDrop(ISourceViewer viewer) {
1698
		// Do nothing the outliner is listener to the
2112
		Control control = viewer.getTextWidget();
1699
		// CoreModel WorkingCopy changes instead.
2113
		int operations = DND.DROP_MOVE | DND.DROP_COPY;
1700
		// It will allow more fined grained.
2114
1701
		if (somethingHasChanged && getSourceViewer() != null) {
2115
		DropTarget dropTarget = new DropTarget(control, operations);
1702
			CSourceViewerDecorationSupport decoSupport = (CSourceViewerDecorationSupport) getSourceViewerDecorationSupport(getSourceViewer());
2116
		ITextEditorDropTargetListener dropTargetListener = new TextEditorDropAdapter(viewer, this);
1703
			decoSupport.editorInputChanged(getEditorInput());
2117
		dropTarget.setTransfer(dropTargetListener.getTransfers());
1704
		}
2118
		dropTarget.addDropListener(dropTargetListener);
2119
2120
		DragSource dragSource = new DragSource(control, operations);
2121
		Transfer[] dragTypes = new Transfer[] { TextTransfer.getInstance() };
2122
		dragSource.setTransfer(dragTypes);
2123
		DragSourceListener dragSourceListener = new TextViewerDragAdapter(viewer, this);
2124
		dragSource.addDragListener(dragSourceListener);
1705
	}
2125
	}
1706
	
2126
1707
	public CSourceViewer getCSourceViewer()  {
2127
	/*
1708
		ISourceViewer viewer = getSourceViewer();
2128
	 * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#getSourceViewerDecorationSupport(org.eclipse.jface.text.source.ISourceViewer)
1709
		CSourceViewer cViewer = null ;
2129
	 */
1710
		if (viewer instanceof CSourceViewer) {
2130
	protected SourceViewerDecorationSupport getSourceViewerDecorationSupport(
1711
			cViewer = (CSourceViewer) viewer;
2131
			ISourceViewer viewer) {
2132
		if (fSourceViewerDecorationSupport == null) {
2133
			fSourceViewerDecorationSupport = new CSourceViewerDecorationSupport(viewer, getOverviewRuler(), getAnnotationAccess(), getSharedColors());
2134
			configureSourceViewerDecorationSupport(fSourceViewerDecorationSupport);
1712
		}
2135
		}
1713
		return cViewer ;
2136
		return fSourceViewerDecorationSupport;
1714
	}
2137
	}
1715
	
2138
	
1716
	/*
2139
	/*
1717
	 * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#collectContextMenuPreferencePages()
2140
	 * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#configureSourceViewerDecorationSupport(org.eclipse.ui.texteditor.SourceViewerDecorationSupport)
1718
	 */
2141
	 */
1719
	protected String[] collectContextMenuPreferencePages() {
2142
	protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
1720
		// Add C/C++ Editor relevant pages
2143
		super.configureSourceViewerDecorationSupport(support);
1721
		String[] parentPrefPageIds = super.collectContextMenuPreferencePages();
2144
		//Enhance the stock source viewer decorator with a bracket matcher
1722
		String[] prefPageIds = new String[parentPrefPageIds.length + 4];
2145
		support.setCharacterPairMatcher(fBracketMatcher);
1723
		int nIds = 0;
2146
		support.setMatchingCharacterPainterPreferenceKeys(MATCHING_BRACKETS, MATCHING_BRACKETS_COLOR);
1724
		prefPageIds[nIds++] = "org.eclipse.cdt.ui.preferences.CEditorPreferencePage"; //$NON-NLS-1$
2147
		((CSourceViewerDecorationSupport)support).setInactiveCodePainterPreferenceKeys(INACTIVE_CODE_ENABLE, INACTIVE_CODE_COLOR);
1725
		prefPageIds[nIds++] = "org.eclipse.cdt.ui.preferences.CodeAssistPreferencePage"; //$NON-NLS-1$
1726
		prefPageIds[nIds++] = "org.eclipse.cdt.ui.preferences.TemplatePreferencePage"; //$NON-NLS-1$
1727
		prefPageIds[nIds++] = "org.eclipse.cdt.ui.preferences.CodeFormatterPreferencePage"; //$NON-NLS-1$
1728
		System.arraycopy(parentPrefPageIds, 0, prefPageIds, nIds, parentPrefPageIds.length);
1729
		return prefPageIds;
1730
	}
2148
	}
1731
2149
	
1732
	/**
2150
	/**
1733
	 * Text navigation action to navigate to the next sub-word.
2151
	 * Jumps to the matching bracket.
1734
	 *
1735
	 * @since 4.0
1736
	 */
2152
	 */
1737
	protected abstract class NextSubWordAction extends TextNavigationAction {
2153
	public void gotoMatchingBracket() {
1738
2154
		
1739
		protected CWordIterator fIterator = new CWordIterator();
2155
		ISourceViewer sourceViewer = getSourceViewer();
2156
		IDocument document = sourceViewer.getDocument();
2157
		if (document == null)
2158
			return;
2159
		
2160
		IRegion selection = getSignedSelection(sourceViewer);
1740
2161
1741
		/**
2162
		int selectionLength = Math.abs(selection.getLength());
1742
		 * Creates a new next sub-word action.
2163
		if (selectionLength > 1) {
1743
		 *
2164
			setStatusLineErrorMessage(CEditorMessages.getString("GotoMatchingBracket.error.invalidSelection"));	//$NON-NLS-1$		
1744
		 * @param code Action code for the default operation. Must be an action code from @see org.eclipse.swt.custom.ST.
2165
			sourceViewer.getTextWidget().getDisplay().beep();
1745
		 */
2166
			return;
1746
		protected NextSubWordAction(int code) {
1747
			super(getSourceViewer().getTextWidget(), code);
1748
		}
2167
		}
1749
2168
1750
		/*
2169
		// #26314
1751
		 * @see org.eclipse.jface.action.IAction#run()
2170
		int sourceCaretOffset = selection.getOffset() + selection.getLength();
1752
		 */
2171
		if (isSurroundedByBrackets(document, sourceCaretOffset))
1753
		public void run() {
2172
			sourceCaretOffset -= selection.getLength();
1754
			// Check whether sub word navigation is enabled.
1755
			final IPreferenceStore store = getPreferenceStore();
1756
			if (!store.getBoolean(SUB_WORD_NAVIGATION)) {
1757
				super.run();
1758
				return;
1759
			}
1760
1761
			final ISourceViewer viewer = getSourceViewer();
1762
			final IDocument document = viewer.getDocument();
1763
			fIterator.setText((CharacterIterator) new DocumentCharacterIterator(document));
1764
			int position = widgetOffset2ModelOffset(viewer, viewer.getTextWidget().getCaretOffset());
1765
			if (position == -1)
1766
				return;
1767
1768
			int next = findNextPosition(position);
1769
			if (next != BreakIterator.DONE) {
1770
				setCaretPosition(next);
1771
				getTextWidget().showSelection();
1772
				fireSelectionChanged();
1773
			}
1774
2173
2174
		IRegion region = fBracketMatcher.match(document, sourceCaretOffset);
2175
		if (region == null) {
2176
			setStatusLineErrorMessage(CEditorMessages.getString("GotoMatchingBracket.error.noMatchingBracket"));	//$NON-NLS-1$		
2177
			sourceViewer.getTextWidget().getDisplay().beep();
2178
			return;		
1775
		}
2179
		}
1776
2180
		
1777
		/**
2181
		int offset = region.getOffset();
1778
		 * Finds the next position after the given position.
2182
		int length = region.getLength();
1779
		 *
2183
		
1780
		 * @param position the current position
2184
		if (length < 1)
1781
		 * @return the next position
2185
			return;
1782
		 */
2186
			
1783
		protected int findNextPosition(int position) {
2187
		int anchor = fBracketMatcher.getAnchor();
1784
			ISourceViewer viewer = getSourceViewer();
2188
		// http://dev.eclipse.org/bugs/show_bug.cgi?id=34195
1785
			int widget = -1;
2189
		int targetOffset = (ICharacterPairMatcher.RIGHT == anchor) ? offset + 1: offset + length;
1786
			while (position != BreakIterator.DONE && widget == -1) { // TODO: optimize
2190
		
1787
				position = fIterator.following(position);
2191
		boolean visible = false;
1788
				if (position != BreakIterator.DONE)
2192
		if (sourceViewer instanceof ITextViewerExtension5) {
1789
					widget = modelOffset2WidgetOffset(viewer, position);
2193
			ITextViewerExtension5 extension = (ITextViewerExtension5) sourceViewer;
1790
			}
2194
			visible = (extension.modelOffset2WidgetOffset(targetOffset) > -1);
1791
			return position;
2195
		} else {
2196
			IRegion visibleRegion = sourceViewer.getVisibleRegion();
2197
			// http://dev.eclipse.org/bugs/show_bug.cgi?id=34195
2198
			visible = (targetOffset >= visibleRegion.getOffset() && targetOffset <= visibleRegion.getOffset() + visibleRegion.getLength());
2199
		}
2200
		
2201
		if (!visible) {
2202
			setStatusLineErrorMessage(CEditorMessages.getString("GotoMatchingBracket.error.bracketOutsideSelectedElement"));	//$NON-NLS-1$		
2203
			sourceViewer.getTextWidget().getDisplay().beep();
2204
			return;
1792
		}
2205
		}
2206
		
2207
		if (selection.getLength() < 0)
2208
			targetOffset -= selection.getLength();
2209
			
2210
		sourceViewer.setSelectedRange(targetOffset, selection.getLength());
2211
		sourceViewer.revealRange(targetOffset, selection.getLength());
2212
	}
1793
2213
1794
		/**
2214
	protected void updateStatusLine() {
1795
		 * Sets the caret position to the sub-word boundary given with <code>position</code>.
2215
		ITextSelection selection = (ITextSelection) getSelectionProvider().getSelection();
1796
		 *
2216
		Annotation annotation = getAnnotation(selection.getOffset(), selection.getLength());
1797
		 * @param position Position where the action should move the caret
2217
		setStatusLineErrorMessage(null);
1798
		 */
2218
		setStatusLineMessage(null);
1799
		protected abstract void setCaretPosition(int position);
2219
		if (annotation != null) {
2220
			updateMarkerViews(annotation);
2221
			if (annotation instanceof ICAnnotation && ((ICAnnotation) annotation).isProblem())
2222
				setStatusLineMessage(annotation.getText());
2223
		}
1800
	}
2224
	}
1801
2225
1802
	/**
2226
	/**
1803
	 * Text navigation action to navigate to the next sub-word.
2227
	 * Returns the annotation overlapping with the given range or <code>null</code>.
1804
	 *
2228
	 * 
1805
	 * @since 4.0
2229
	 * @param offset the region offset
2230
	 * @param length the region length
2231
	 * @return the found annotation or <code>null</code>
2232
	 * @since 3.0
1806
	 */
2233
	 */
1807
	protected class NavigateNextSubWordAction extends NextSubWordAction {
2234
	private Annotation getAnnotation(int offset, int length) {
1808
2235
		IAnnotationModel model = getDocumentProvider().getAnnotationModel(getEditorInput());
1809
		/**
2236
		Iterator e = new CAnnotationIterator(model, true, true);
1810
		 * Creates a new navigate next sub-word action.
2237
		while (e.hasNext()) {
1811
		 */
2238
			Annotation a = (Annotation) e.next();
1812
		public NavigateNextSubWordAction() {
2239
			if (!isNavigationTarget(a))
1813
			super(ST.WORD_NEXT);
2240
				continue;
2241
				
2242
			Position p = model.getPosition(a);
2243
			if (p != null && p.overlapsWith(offset, length))
2244
				return a;
1814
		}
2245
		}
2246
		
2247
		return null;
2248
	}
2249
	/* (non-Javadoc)
2250
	 * @see org.eclipse.ui.part.IShowInSource#getShowInContext()
2251
	 *
2252
	 * This is required by the IShowInSource interface for the "ShowIn"
2253
 	 * navigation menu generalized in Eclipse.
2254
	 */
2255
	public ShowInContext getShowInContext() {
2256
		return new ShowInContext( getEditorInput(), null );
2257
	}
1815
2258
1816
		/*
2259
	/*
1817
		 * @see org.eclipse.cdt.internal.ui.editor.CEditor.NextSubWordAction#setCaretPosition(int)
2260
	 * Get the dektop's StatusLineManager
1818
		 */
2261
	 */
1819
		protected void setCaretPosition(final int position) {
2262
	protected IStatusLineManager getStatusLineManager() {
1820
			getTextWidget().setCaretOffset(modelOffset2WidgetOffset(getSourceViewer(), position));
2263
		IEditorActionBarContributor contributor = getEditorSite().getActionBarContributor();
2264
		if (contributor instanceof EditorActionBarContributor) {
2265
			return ((EditorActionBarContributor) contributor).getActionBars().getStatusLineManager();
1821
		}
2266
		}
2267
		return null;
1822
	}
2268
	}
1823
2269
	
1824
	/**
2270
	/**
1825
	 * Text operation action to delete the next sub-word.
2271
	 * Configures the toggle comment action
1826
	 *
2272
	 *
1827
	 * @since 4.0
2273
	 * @since 4.0.0
1828
	 */
2274
	 */
1829
	protected class DeleteNextSubWordAction extends NextSubWordAction implements IUpdate {
2275
	private void configureToggleCommentAction() {
1830
2276
		IAction action = getAction("ToggleComment"); //$NON-NLS-1$
1831
		/**
2277
		if (action instanceof ToggleCommentAction) {
1832
		 * Creates a new delete next sub-word action.
2278
			ISourceViewer sourceViewer = getSourceViewer();
1833
		 */
2279
			SourceViewerConfiguration configuration = getSourceViewerConfiguration();
1834
		public DeleteNextSubWordAction() {
2280
			((ToggleCommentAction)action).configure(sourceViewer, configuration);
1835
			super(ST.DELETE_WORD_NEXT);
1836
		}
2281
		}
2282
	}
1837
2283
1838
		/*
2284
	private void configureTabConverter() {
1839
		 * @see org.eclipse.cdt.internal.ui.editor.CEditor.NextSubWordAction#setCaretPosition(int)
2285
		if (fTabConverter != null) {
1840
		 */
2286
			IDocumentProvider provider = getDocumentProvider();
1841
		protected void setCaretPosition(final int position) {
2287
			if (provider instanceof CDocumentProvider) {
1842
			if (!validateEditorInputState())
2288
				CDocumentProvider prov = (CDocumentProvider) provider;
1843
				return;
2289
				fTabConverter.setLineTracker(prov.createLineTracker(getEditorInput()));
1844
1845
			final ISourceViewer viewer = getSourceViewer();
1846
			final int caret, length;
1847
			Point selection = viewer.getSelectedRange();
1848
			if (selection.y != 0) {
1849
				caret = selection.x;
1850
				length = selection.y;
1851
			} else {
2290
			} else {
1852
				caret = widgetOffset2ModelOffset(viewer, viewer.getTextWidget().getCaretOffset());
2291
				fTabConverter.setLineTracker(new DefaultLineTracker());
1853
				length = position - caret;
1854
			}
1855
1856
			try {
1857
				viewer.getDocument().replace(caret, length, ""); //$NON-NLS-1$
1858
			} catch (BadLocationException exception) {
1859
				// Should not happen
1860
			}
2292
			}
1861
		}
2293
		}
2294
	}
1862
2295
1863
		/*
2296
	private int getTabSize() {
1864
		 * @see org.eclipse.cdt.internal.ui.editor.CEditor.NextSubWordAction#findNextPosition(int)
2297
		ICElement element = getInputCElement();
1865
		 */
2298
		ICProject project = element == null ? null : element.getCProject();
1866
		protected int findNextPosition(int position) {
2299
		return CodeFormatterUtil.getTabWidth(project);
1867
			return fIterator.following(position);
2300
	}
1868
		}
1869
2301
1870
		/*
2302
	private void startTabConversion() {
1871
		 * @see org.eclipse.ui.texteditor.IUpdate#update()
2303
		if (fTabConverter == null) {
1872
		 */
2304
			CSourceViewer asv = (CSourceViewer) getSourceViewer();
1873
		public void update() {
2305
			SourceViewerConfiguration configuration = getSourceViewerConfiguration();
1874
			setEnabled(isEditorInputModifiable());
2306
			fTabConverter = new TabConverter();
2307
			configureTabConverter();
2308
			fTabConverter.setNumberOfSpacesPerTab(configuration.getTabWidth(asv));
2309
			asv.addTextConverter(fTabConverter);
1875
		}
2310
		}
1876
	}
2311
	}
1877
2312
1878
	/**
2313
	private void stopTabConversion() {
1879
	 * Text operation action to select the next sub-word.
2314
		if (fTabConverter != null) {
1880
	 *
2315
			CSourceViewer asv = (CSourceViewer) getSourceViewer();
1881
	 * @since 4.0
2316
			asv.removeTextConverter(fTabConverter);
1882
	 */
2317
			fTabConverter = null;
1883
	protected class SelectNextSubWordAction extends NextSubWordAction {
1884
1885
		/**
1886
		 * Creates a new select next sub-word action.
1887
		 */
1888
		public SelectNextSubWordAction() {
1889
			super(ST.SELECT_WORD_NEXT);
1890
		}
2318
		}
2319
	}
1891
2320
1892
		/*
2321
	private boolean isTabConversionEnabled() {
1893
		 * @see org.eclipse.cdt.internal.ui.editor.CEditor.NextSubWordAction#setCaretPosition(int)
2322
		IPreferenceStore store = getPreferenceStore();
1894
		 */
2323
		return store.getBoolean(SPACES_FOR_TABS);
1895
		protected void setCaretPosition(final int position) {
1896
			final ISourceViewer viewer = getSourceViewer();
1897
1898
			final StyledText text = viewer.getTextWidget();
1899
			if (text != null && !text.isDisposed()) {
1900
1901
				final Point selection = text.getSelection();
1902
				final int caret = text.getCaretOffset();
1903
				final int offset = modelOffset2WidgetOffset(viewer, position);
1904
1905
				if (caret == selection.x)
1906
					text.setSelectionRange(selection.y, offset - selection.y);
1907
				else
1908
					text.setSelectionRange(selection.x, offset - selection.x);
1909
			}
1910
		}
1911
	}
2324
	}
1912
2325
1913
	/**
2326
	/*
1914
	 * Text navigation action to navigate to the previous sub-word.
2327
	 * @see org.eclipse.ui.texteditor.AbstractTextEditor#createNavigationActions()
1915
	 *
1916
	 * @since 4.0
1917
	 */
2328
	 */
1918
	protected abstract class PreviousSubWordAction extends TextNavigationAction {
2329
	protected void createNavigationActions() {
1919
2330
		super.createNavigationActions();
1920
		protected CWordIterator fIterator = new CWordIterator();
1921
1922
		/**
1923
		 * Creates a new previous sub-word action.
1924
		 *
1925
		 * @param code Action code for the default operation. Must be an action code from @see org.eclipse.swt.custom.ST.
1926
		 */
1927
		protected PreviousSubWordAction(final int code) {
1928
			super(getSourceViewer().getTextWidget(), code);
1929
		}
1930
2331
1931
		/*
2332
		final StyledText textWidget = getSourceViewer().getTextWidget();
1932
		 * @see org.eclipse.jface.action.IAction#run()
1933
		 */
1934
		public void run() {
1935
			// Check whether sub word navigation is enabled.
1936
			final IPreferenceStore store = getPreferenceStore();
1937
			if (!store.getBoolean(SUB_WORD_NAVIGATION)) {
1938
				super.run();
1939
				return;
1940
			}
1941
2333
1942
			final ISourceViewer viewer = getSourceViewer();
2334
		IAction action = new NavigatePreviousSubWordAction();
1943
			final IDocument document = viewer.getDocument();
2335
		action.setActionDefinitionId(ITextEditorActionDefinitionIds.WORD_PREVIOUS);
1944
			fIterator.setText((CharacterIterator) new DocumentCharacterIterator(document));
2336
		setAction(ITextEditorActionDefinitionIds.WORD_PREVIOUS, action);
1945
			int position = widgetOffset2ModelOffset(viewer, viewer.getTextWidget().getCaretOffset());
2337
		textWidget.setKeyBinding(SWT.CTRL | SWT.ARROW_LEFT, SWT.NULL);
1946
			if (position == -1)
1947
				return;
1948
2338
1949
			int previous = findPreviousPosition(position);
2339
		action = new NavigateNextSubWordAction();
1950
			if (previous != BreakIterator.DONE) {
2340
		action.setActionDefinitionId(ITextEditorActionDefinitionIds.WORD_NEXT);
1951
				setCaretPosition(previous);
2341
		setAction(ITextEditorActionDefinitionIds.WORD_NEXT, action);
1952
				getTextWidget().showSelection();
2342
		textWidget.setKeyBinding(SWT.CTRL | SWT.ARROW_RIGHT, SWT.NULL);
1953
				fireSelectionChanged();
1954
			}
1955
2343
1956
		}
2344
		action = new SelectPreviousSubWordAction();
2345
		action.setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_WORD_PREVIOUS);
2346
		setAction(ITextEditorActionDefinitionIds.SELECT_WORD_PREVIOUS, action);
2347
		textWidget.setKeyBinding(SWT.CTRL | SWT.SHIFT | SWT.ARROW_LEFT, SWT.NULL);
1957
2348
1958
		/**
2349
		action = new SelectNextSubWordAction();
1959
		 * Finds the previous position before the given position.
2350
		action.setActionDefinitionId(ITextEditorActionDefinitionIds.SELECT_WORD_NEXT);
1960
		 *
2351
		setAction(ITextEditorActionDefinitionIds.SELECT_WORD_NEXT, action);
1961
		 * @param position the current position
2352
		textWidget.setKeyBinding(SWT.CTRL | SWT.SHIFT | SWT.ARROW_RIGHT, SWT.NULL);
1962
		 * @return the previous position
2353
		
1963
		 */
2354
		action = new DeletePreviousSubWordAction();
1964
		protected int findPreviousPosition(int position) {
2355
		action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_PREVIOUS_WORD);
1965
			ISourceViewer viewer = getSourceViewer();
2356
		setAction(ITextEditorActionDefinitionIds.DELETE_PREVIOUS_WORD, action);
1966
			int widget = -1;
2357
		textWidget.setKeyBinding(SWT.CTRL | SWT.BS, SWT.NULL);
1967
			while (position != BreakIterator.DONE && widget == -1) { // TODO: optimize
2358
		markAsStateDependentAction(ITextEditorActionDefinitionIds.DELETE_PREVIOUS_WORD, true);
1968
				position = fIterator.preceding(position);
1969
				if (position != BreakIterator.DONE)
1970
					widget = modelOffset2WidgetOffset(viewer, position);
1971
			}
1972
			return position;
1973
		}
1974
2359
1975
		/**
2360
		action = new DeleteNextSubWordAction();
1976
		 * Sets the caret position to the sub-word boundary given with <code>position</code>.
2361
		action.setActionDefinitionId(ITextEditorActionDefinitionIds.DELETE_NEXT_WORD);
1977
		 *
2362
		setAction(ITextEditorActionDefinitionIds.DELETE_NEXT_WORD, action);
1978
		 * @param position Position where the action should move the caret
2363
		textWidget.setKeyBinding(SWT.CTRL | SWT.DEL, SWT.NULL);
1979
		 */
2364
		markAsStateDependentAction(ITextEditorActionDefinitionIds.DELETE_NEXT_WORD, true);
1980
		protected abstract void setCaretPosition(int position);
1981
	}
2365
	}
1982
2366
1983
	/**
2367
	public final ISourceViewer getViewer() {
1984
	 * Text navigation action to navigate to the previous sub-word.
2368
		return getSourceViewer();
1985
	 *
2369
	}
1986
	 * @since 4.0
2370
2371
	/*
2372
	 * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createSourceViewer(org.eclipse.swt.widgets.Composite, org.eclipse.jface.text.source.IVerticalRuler, int)
1987
	 */
2373
	 */
1988
	protected class NavigatePreviousSubWordAction extends PreviousSubWordAction {
2374
	protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
2375
		ISourceViewer sourceViewer =
2376
				new CSourceViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles);
1989
2377
1990
		/**
2378
		CSourceViewerDecorationSupport decoSupport = (CSourceViewerDecorationSupport) getSourceViewerDecorationSupport(sourceViewer);
1991
		 * Creates a new navigate previous sub-word action.
2379
		decoSupport.editorInputChanged(getEditorInput());
1992
		 */
1993
		public NavigatePreviousSubWordAction() {
1994
			super(ST.WORD_PREVIOUS);
1995
		}
1996
2380
1997
		/*
2381
		CUIHelp.setHelp(this, sourceViewer.getTextWidget(), ICHelpContextIds.CEDITOR_VIEW);
1998
		 * @see org.eclipse.cdt.internal.ui.editor.CEditor.PreviousSubWordAction#setCaretPosition(int)
2382
1999
		 */
2383
		return sourceViewer;
2000
		protected void setCaretPosition(final int position) {
2001
			getTextWidget().setCaretOffset(modelOffset2WidgetOffset(getSourceViewer(), position));
2002
		}
2003
	}
2384
	}
2004
2385
2386
	/** Outliner context menu Id */
2387
	protected String fOutlinerContextMenuId;
2388
2005
	/**
2389
	/**
2006
	 * Text operation action to delete the previous sub-word.
2390
	 * Sets the outliner's context menu ID.
2007
	 *
2008
	 * @since 4.0
2009
	 */
2391
	 */
2010
	protected class DeletePreviousSubWordAction extends PreviousSubWordAction implements IUpdate {
2392
	protected void setOutlinerContextMenuId(String menuId) {
2393
		fOutlinerContextMenuId = menuId;
2394
	}
2395
	
2396
	/* (non-Javadoc)
2397
	 * @see org.eclipse.ui.editors.text.TextEditor#initializeKeyBindingScopes()
2398
	 */
2399
	protected void initializeKeyBindingScopes() {
2400
		setKeyBindingScopes(new String [] { "org.eclipse.cdt.ui.cEditorScope" } ); //$NON-NLS-1$
2401
	}
2011
2402
2012
		/**
2403
	/* (non-Javadoc)
2013
		 * Creates a new delete previous sub-word action.
2404
	 * @see AbstractTextEditor#affectsTextPresentation(PropertyChangeEvent)
2014
		 */
2405
	 */
2015
		public DeletePreviousSubWordAction() {
2406
	protected boolean affectsTextPresentation(PropertyChangeEvent event) {
2016
			super(ST.DELETE_WORD_PREVIOUS);
2407
		SourceViewerConfiguration configuration = getSourceViewerConfiguration();
2408
		if (configuration instanceof CSourceViewerConfiguration) {
2409
			return ((CSourceViewerConfiguration)configuration).affectsBehavior(event);
2017
		}
2410
		}
2411
		return false;
2412
	}
2018
2413
2019
		/*
2414
	/**
2020
		 * @see org.eclipse.cdt.internal.ui.editor.CEditor.PreviousSubWordAction#setCaretPosition(int)
2415
	 * Returns the folding action group, or <code>null</code> if there is none.
2021
		 */
2416
	 * 
2022
		protected void setCaretPosition(int position) {
2417
	 * @return the folding action group, or <code>null</code> if there is none
2023
			if (!validateEditorInputState())
2418
	 */
2024
				return;
2419
	protected FoldingActionGroup getFoldingActionGroup() {
2420
		return fFoldingGroup;
2421
	}
2025
2422
2026
			final int length;
2423
	/*
2027
			final ISourceViewer viewer = getSourceViewer();
2424
	 * @see org.eclipse.ui.texteditor.AbstractTextEditor#performRevert()
2028
			Point selection = viewer.getSelectedRange();
2425
	 */
2029
			if (selection.y != 0) {
2426
	protected void performRevert() {
2030
				position = selection.x;
2427
		ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();
2031
				length = selection.y;
2428
		projectionViewer.setRedraw(false);
2032
			} else {
2429
		try {
2033
				length = widgetOffset2ModelOffset(viewer, viewer.getTextWidget().getCaretOffset()) - position;
2430
			
2431
			boolean projectionMode = projectionViewer.isProjectionMode();
2432
			if (projectionMode) {
2433
				projectionViewer.disableProjection();				
2434
				if (fProjectionModelUpdater != null)
2435
					fProjectionModelUpdater.uninstall();
2034
			}
2436
			}
2035
2437
			
2036
			try {
2438
			super.performRevert();
2037
				viewer.getDocument().replace(position, length, ""); //$NON-NLS-1$
2439
			
2038
			} catch (BadLocationException exception) {
2440
			if (projectionMode) {
2039
				// Should not happen
2441
				if (fProjectionModelUpdater != null)
2442
					fProjectionModelUpdater.install(this, projectionViewer);	
2443
				projectionViewer.enableProjection();
2040
			}
2444
			}
2445
			
2446
		} finally {
2447
			projectionViewer.setRedraw(true);
2041
		}
2448
		}
2449
	}
2042
2450
2043
		/*
2451
    /**
2044
		 * @see org.eclipse.cdt.internal.ui.editor.CEditor.PreviousSubWordAction#findPreviousPosition(int)
2452
     * Sets the given message as error message to this editor's status line.
2045
		 */
2453
     * 
2046
		protected int findPreviousPosition(int position) {
2454
     * @param msg message to be set
2047
			return fIterator.preceding(position);
2455
     */
2048
		}
2456
    protected void setStatusLineErrorMessage(String msg) {
2457
    	IEditorStatusLine statusLine = (IEditorStatusLine) getAdapter(IEditorStatusLine.class);
2458
    	if (statusLine != null)
2459
    		statusLine.setMessage(true, msg, null);	
2460
    }  
2049
2461
2050
		/*
2462
	/**
2051
		 * @see org.eclipse.ui.texteditor.IUpdate#update()
2463
	 * Sets the given message as message to this editor's status line.
2052
		 */
2464
	 * 
2053
		public void update() {
2465
	 * @param msg message to be set
2054
			setEnabled(isEditorInputModifiable());
2466
	 * @since 3.0
2055
		}
2467
	 */
2468
	protected void setStatusLineMessage(String msg) {
2469
		IEditorStatusLine statusLine = (IEditorStatusLine) getAdapter(IEditorStatusLine.class);
2470
		if (statusLine != null)
2471
			statusLine.setMessage(false, msg, null);	
2056
	}
2472
	}
2057
2473
2058
	/**
2474
	/**
2059
	 * Text operation action to select the previous sub-word.
2475
	 * Returns the signed current selection.
2060
	 *
2476
	 * The length will be negative if the resulting selection
2061
	 * @since 4.0
2477
	 * is right-to-left (RtoL).
2478
	 * <p>
2479
	 * The selection offset is model based.
2480
	 * </p>
2481
	 * 
2482
	 * @param sourceViewer the source viewer
2483
	 * @return a region denoting the current signed selection, for a resulting RtoL selections length is < 0 
2062
	 */
2484
	 */
2063
	protected class SelectPreviousSubWordAction extends PreviousSubWordAction {
2485
	protected IRegion getSignedSelection(ISourceViewer sourceViewer) {
2486
		StyledText text = sourceViewer.getTextWidget();
2487
		Point selection = text.getSelectionRange();
2488
		
2489
		if (text.getCaretOffset() == selection.x) {
2490
			selection.x = selection.x + selection.y;
2491
			selection.y = -selection.y;
2492
		}
2493
		
2494
		selection.x = widgetOffset2ModelOffset(sourceViewer, selection.x);
2495
		
2496
		return new Region(selection.x, selection.y);
2497
	}
2498
	
2499
	private static boolean isBracket(char character) {
2500
		for (int i = 0; i != BRACKETS.length; ++i) {
2501
			if (character == BRACKETS[i])
2502
				return true;
2503
		}
2504
		return false;
2505
	}
2064
2506
2065
		/**
2507
	private static boolean isSurroundedByBrackets(IDocument document, int offset) {
2066
		 * Creates a new select previous sub-word action.
2508
		if (offset == 0 || offset == document.getLength())
2067
		 */
2509
			return false;
2068
		public SelectPreviousSubWordAction() {
2510
2069
			super(ST.SELECT_WORD_PREVIOUS);
2511
		try {
2512
			return isBracket(document.getChar(offset - 1)) &&
2513
					isBracket(document.getChar(offset));
2514
		} catch (BadLocationException e) {
2515
			return false;	
2070
		}
2516
		}
2517
	}
2518
		
2519
	private static char getEscapeCharacter(char character) {
2520
		switch (character) {
2521
			case '"':
2522
			case '\'':
2523
				return '\\';
2524
			default:
2525
				return 0;
2526
		}
2527
	}
2071
2528
2072
		/*
2529
	private static char getPeerCharacter(char character) {
2073
		 * @see org.eclipse.cdt.internal.ui.editor.CEditor.PreviousSubWordAction#setCaretPosition(int)
2530
		switch (character) {
2074
		 */
2531
			case '(':
2075
		protected void setCaretPosition(final int position) {
2532
				return ')';
2076
			final ISourceViewer viewer = getSourceViewer();
2077
2533
2078
			final StyledText text = viewer.getTextWidget();
2534
			case ')':
2079
			if (text != null && !text.isDisposed()) {
2535
				return '(';
2080
2536
2081
				final Point selection = text.getSelection();
2537
			case '<':
2082
				final int caret = text.getCaretOffset();
2538
				return '>';
2083
				final int offset = modelOffset2WidgetOffset(viewer, position);
2084
2539
2085
				if (caret == selection.x)
2540
			case '>':
2086
					text.setSelectionRange(selection.y, offset - selection.y);
2541
				return '<';
2087
				else
2542
2088
					text.setSelectionRange(selection.x, offset - selection.x);
2543
			case '[':
2089
			}
2544
				return ']';
2545
2546
			case ']':
2547
				return '[';
2548
2549
			case '"':
2550
				return character;
2551
2552
			case '\'':
2553
				return character;
2554
2555
			default:
2556
				throw new IllegalArgumentException();
2557
		}
2558
	}
2559
2560
	/* (non-Javadoc)
2561
	 * @see org.eclipse.cdt.internal.ui.editor.IReconcilingParticipant#reconciled()
2562
	 */
2563
	public void reconciled(boolean somethingHasChanged) {
2564
		// Do nothing the outliner is listener to the
2565
		// CoreModel WorkingCopy changes instead.
2566
		// It will allow more fined grained.
2567
		if (somethingHasChanged && getSourceViewer() != null) {
2568
			CSourceViewerDecorationSupport decoSupport = (CSourceViewerDecorationSupport) getSourceViewerDecorationSupport(getSourceViewer());
2569
			decoSupport.editorInputChanged(getEditorInput());
2570
		}
2571
	}
2572
	
2573
	public CSourceViewer getCSourceViewer()  {
2574
		ISourceViewer viewer = getSourceViewer();
2575
		CSourceViewer cViewer = null ;
2576
		if (viewer instanceof CSourceViewer) {
2577
			cViewer = (CSourceViewer) viewer;
2090
		}
2578
		}
2579
		return cViewer ;
2580
	}
2581
	
2582
	/*
2583
	 * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#collectContextMenuPreferencePages()
2584
	 */
2585
	protected String[] collectContextMenuPreferencePages() {
2586
		// Add C/C++ Editor relevant pages
2587
		String[] parentPrefPageIds = super.collectContextMenuPreferencePages();
2588
		String[] prefPageIds = new String[parentPrefPageIds.length + 4];
2589
		int nIds = 0;
2590
		prefPageIds[nIds++] = "org.eclipse.cdt.ui.preferences.CEditorPreferencePage"; //$NON-NLS-1$
2591
		prefPageIds[nIds++] = "org.eclipse.cdt.ui.preferences.CodeAssistPreferencePage"; //$NON-NLS-1$
2592
		prefPageIds[nIds++] = "org.eclipse.cdt.ui.preferences.TemplatePreferencePage"; //$NON-NLS-1$
2593
		prefPageIds[nIds++] = "org.eclipse.cdt.ui.preferences.CodeFormatterPreferencePage"; //$NON-NLS-1$
2594
		System.arraycopy(parentPrefPageIds, 0, prefPageIds, nIds, parentPrefPageIds.length);
2595
		return prefPageIds;
2091
	}
2596
	}
2092
}
2597
}
(-)src/org/eclipse/cdt/ui/PreferenceConstants.java (+41 lines)
Lines 146-151 Link Here
146
	public final static String EDITOR_EVALUATE_TEMPORARY_PROBLEMS= "handleTemporaryProblems"; //$NON-NLS-1$
146
	public final static String EDITOR_EVALUATE_TEMPORARY_PROBLEMS= "handleTemporaryProblems"; //$NON-NLS-1$
147
147
148
	/**
148
	/**
149
	 * The symbolic font name for the Java editor text font 
150
	 * (value <code>"org.eclipse.cdt.ui.editors.textfont"</code>).
151
	 */
152
	public final static String EDITOR_TEXT_FONT= "org.eclipse.cdt.ui.editors.textfont"; //$NON-NLS-1$
153
154
	/**
149
	 * A named preference that defines the key for the hover modifiers.
155
	 * A named preference that defines the key for the hover modifiers.
150
	 *
156
	 *
151
	 */
157
	 */
Lines 197-202 Link Here
197
	public final static String EDITOR_CLOSE_BRACKETS= "closeBrackets"; //$NON-NLS-1$
203
	public final static String EDITOR_CLOSE_BRACKETS= "closeBrackets"; //$NON-NLS-1$
198
204
199
	/**
205
	/**
206
	 * A named preference that controls whether the 'close angular brackets' feature is
207
	 * enabled.
208
	 * <p>
209
	 * Value is of type <code>Boolean</code>.
210
	 * </p>
211
	 */
212
	public final static String EDITOR_CLOSE_ANGULAR_BRACKETS= "closeAngularBrackets"; //$NON-NLS-1$
213
214
	/**
200
	 * A named preference that controls whether the 'close braces' feature is
215
	 * A named preference that controls whether the 'close braces' feature is
201
	 * enabled.
216
	 * enabled.
202
	 * <p>
217
	 * <p>
Lines 206-211 Link Here
206
	public final static String EDITOR_CLOSE_BRACES= "closeBraces"; //$NON-NLS-1$
221
	public final static String EDITOR_CLOSE_BRACES= "closeBraces"; //$NON-NLS-1$
207
222
208
	/**
223
	/**
224
	 * A named preference that controls whether the 'smart paste' feature is
225
	 * enabled.
226
	 * <p>
227
	 * Value is of type <code>Boolean</code>.
228
	 * </p>
229
	 */
230
	public final static String EDITOR_SMART_PASTE= "smartPaste"; //$NON-NLS-1$
231
232
	/**
233
	 * A named preference that controls the smart tab behavior.
234
	 * <p>
235
	 * Value is of type <code>Boolean</code>.
236
	 */
237
	public static final String EDITOR_SMART_TAB= "smart_tab"; //$NON-NLS-1$
238
239
	/**
209
	 * The id of the best match hover contributed for extension point
240
	 * The id of the best match hover contributed for extension point
210
	 * <code>javaEditorTextHovers</code>.
241
	 * <code>javaEditorTextHovers</code>.
211
	 *
242
	 *
Lines 408-413 Link Here
408
	 */	
439
	 */	
409
	public static final String TEMPLATES_USE_CODEFORMATTER= "org.eclipse.cdt.ui.text.templates.format"; //$NON-NLS-1$
440
	public static final String TEMPLATES_USE_CODEFORMATTER= "org.eclipse.cdt.ui.text.templates.format"; //$NON-NLS-1$
410
441
442
	/**
443
	 * A named preference that controls which profile is used by the code formatter.
444
	 * <p>
445
	 * Value is of type <code>String</code>.
446
	 * </p>
447
	 *
448
	 * @since 4.0
449
	 */	
450
	public static final String FORMATTER_PROFILE = "formatter_profile"; //$NON-NLS-1$
411
451
412
	/** 
452
	/** 
413
	 * Preference key for whether to ensure a newline at the end of files when saving.
453
	 * Preference key for whether to ensure a newline at the end of files when saving.
Lines 467-472 Link Here
467
507
468
		store.setDefault(PreferenceConstants.EDITOR_CLOSE_STRINGS, true);
508
		store.setDefault(PreferenceConstants.EDITOR_CLOSE_STRINGS, true);
469
		store.setDefault(PreferenceConstants.EDITOR_CLOSE_BRACKETS, true);
509
		store.setDefault(PreferenceConstants.EDITOR_CLOSE_BRACKETS, true);
510
		store.setDefault(PreferenceConstants.EDITOR_CLOSE_ANGULAR_BRACKETS, true);
470
		store.setDefault(PreferenceConstants.EDITOR_CLOSE_BRACES, true);
511
		store.setDefault(PreferenceConstants.EDITOR_CLOSE_BRACES, true);
471
		store.setDefault(PreferenceConstants.EDITOR_WRAP_STRINGS, true);
512
		store.setDefault(PreferenceConstants.EDITOR_WRAP_STRINGS, true);
472
		store.setDefault(PreferenceConstants.EDITOR_ESCAPE_STRINGS, false);
513
		store.setDefault(PreferenceConstants.EDITOR_ESCAPE_STRINGS, false);
(-)META-INF/MANIFEST.MF (+1 lines)
Lines 60-65 Link Here
60
 org.eclipse.ui.workbench.texteditor,
60
 org.eclipse.ui.workbench.texteditor,
61
 org.eclipse.ui.editors,
61
 org.eclipse.ui.editors,
62
 org.eclipse.ui,
62
 org.eclipse.ui,
63
 org.eclipse.ui.forms,
63
 org.eclipse.core.resources,
64
 org.eclipse.core.resources,
64
 org.eclipse.search,
65
 org.eclipse.search,
65
 org.eclipse.compare,
66
 org.eclipse.compare,
(-)src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java (+1 lines)
Lines 54-59 Link Here
54
	public static final String C_EDITOR_CONTENT_ASSIST_PREF_PAGE = PREFIX + "c_editor_con_assist"; //$NON-NLS-1$
54
	public static final String C_EDITOR_CONTENT_ASSIST_PREF_PAGE = PREFIX + "c_editor_con_assist"; //$NON-NLS-1$
55
	public static final String C_EDITOR_NAVIGATION_PAGE = PREFIX + "c_editor_navigation"; //$NON-NLS-1$
55
	public static final String C_EDITOR_NAVIGATION_PAGE = PREFIX + "c_editor_navigation"; //$NON-NLS-1$
56
	public static final String C_EDITOR_HOVERS_PAGE = PREFIX + "c_editor_hov"; //$NON-NLS-1$
56
	public static final String C_EDITOR_HOVERS_PAGE = PREFIX + "c_editor_hov"; //$NON-NLS-1$
57
	public static final String C_EDITOR_TYPING_PAGE = PREFIX + "c_editor_typing"; //$NON-NLS-1$;
57
	public static final String FILE_TYPES_STD_PAGE = PREFIX + "std_prop_file_types"; //$NON-NLS-1$
58
	public static final String FILE_TYPES_STD_PAGE = PREFIX + "std_prop_file_types"; //$NON-NLS-1$
58
	public static final String FILE_TYPES_MAN_PAGE = PREFIX + "std_prop_file_types"; //$NON-NLS-1$
59
	public static final String FILE_TYPES_MAN_PAGE = PREFIX + "std_prop_file_types"; //$NON-NLS-1$
59
	public static final String FILE_TYPES_PREF_PAGE = PREFIX + "c_file_types"; //$NON-NLS-1$
60
	public static final String FILE_TYPES_PREF_PAGE = PREFIX + "c_file_types"; //$NON-NLS-1$
(-)src/org/eclipse/cdt/internal/ui/preferences/IPreferenceConfigurationBlock.java (+64 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
13
package org.eclipse.cdt.internal.ui.preferences;
14
15
import org.eclipse.swt.widgets.Composite;
16
import org.eclipse.swt.widgets.Control;
17
18
19
/**
20
 * Interface for preference configuration blocks which can either be
21
 * wrapped by a {@link org.eclipse.cdt.internal.ui.preferences.AbstractConfigurationBlockPreferencePage}
22
 * or be included some preference page.
23
 * <p>
24
 * Clients may implement this interface.
25
 * </p>
26
 * 
27
 * @since 3.0
28
 */
29
public interface IPreferenceConfigurationBlock {
30
	
31
	/**
32
	 * Creates the preference control.
33
	 * 
34
	 * @param parent the parent composite to which to add the preferences control
35
	 * @return the control that was added to <code>parent</code> 
36
	 */
37
	Control createControl(Composite parent);
38
	
39
	/**
40
	 * Called after creating the control. Implementations should load the 
41
	 * preferences values and update the controls accordingly.
42
	 */
43
	void initialize();
44
	
45
	/**
46
	 * Called when the <code>OK</code> button is pressed on the preference
47
	 * page. Implementations should commit the configured preference settings
48
	 * into their form of preference storage.
49
	 */
50
	void performOk();
51
	
52
	/**
53
	 * Called when the <code>Defaults</code> button is pressed on the
54
	 * preference page. Implementation should reset any preference settings to
55
	 * their default values and adjust the controls accordingly.
56
	 */
57
	void performDefaults();
58
	
59
	/**
60
	 * Called when the preference page is being disposed. Implementations should
61
	 * free any resources they are holding on to.
62
	 */
63
	void dispose();
64
}
(-)src/org/eclipse/cdt/internal/ui/text/CStringAutoIndentStrategy.java (+187 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
package org.eclipse.cdt.internal.ui.text;
13
14
import org.eclipse.jface.preference.IPreferenceStore;
15
16
import org.eclipse.jface.text.BadLocationException;
17
import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy;
18
import org.eclipse.jface.text.DocumentCommand;
19
import org.eclipse.jface.text.IDocument;
20
import org.eclipse.jface.text.ITypedRegion;
21
import org.eclipse.jface.text.TextUtilities;
22
23
import org.eclipse.ui.IEditorPart;
24
import org.eclipse.ui.IWorkbenchPage;
25
import org.eclipse.ui.texteditor.ITextEditorExtension3;
26
27
import org.eclipse.cdt.core.model.ICProject;
28
import org.eclipse.cdt.ui.CUIPlugin;
29
import org.eclipse.cdt.ui.PreferenceConstants;
30
31
/**
32
 * Auto indent strategy for C strings
33
 */
34
public class CStringAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy {
35
36
	private String fPartitioning;
37
	private final ICProject fProject;
38
39
	/**
40
	 * The input string doesn't contain any line delimiter.
41
	 *
42
	 * @param inputString the given input string
43
	 * @return the displayable string.
44
	 */
45
	private String displayString(String inputString, CharSequence indentation, String delimiter) {
46
		int length = inputString.length();
47
		StringBuffer buffer = new StringBuffer(length);
48
		java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(inputString, "\n\r", true); //$NON-NLS-1$
49
		while (tokenizer.hasMoreTokens()) {
50
			String token = tokenizer.nextToken();
51
			if (token.equals("\r")) { //$NON-NLS-1$
52
				buffer.append("\\r"); //$NON-NLS-1$
53
				if (tokenizer.hasMoreTokens()) {
54
					token = tokenizer.nextToken();
55
					if (token.equals("\n")) { //$NON-NLS-1$
56
						buffer.append("\\n"); //$NON-NLS-1$
57
						buffer.append("\"" + delimiter); //$NON-NLS-1$
58
						buffer.append(indentation);
59
						buffer.append("\""); //$NON-NLS-1$
60
						continue;
61
					} else {
62
						buffer.append("\"" + delimiter); //$NON-NLS-1$
63
						buffer.append(indentation);
64
						buffer.append("\""); //$NON-NLS-1$
65
					}
66
				} else {
67
					continue;
68
				}
69
			} else if (token.equals("\n")) { //$NON-NLS-1$
70
				buffer.append("\\n"); //$NON-NLS-1$
71
				buffer.append("\"" + delimiter); //$NON-NLS-1$
72
				buffer.append(indentation);
73
				buffer.append("\""); //$NON-NLS-1$
74
				continue;
75
			}
76
77
			StringBuffer tokenBuffer = new StringBuffer();
78
			for (int i = 0; i < token.length(); i++){
79
				char c = token.charAt(i);
80
				switch (c) {
81
					case '\r' :
82
						tokenBuffer.append("\\r"); //$NON-NLS-1$
83
						break;
84
					case '\n' :
85
						tokenBuffer.append("\\n"); //$NON-NLS-1$
86
						break;
87
					case '\b' :
88
						tokenBuffer.append("\\b"); //$NON-NLS-1$
89
						break;
90
					case '\t' :
91
						// keep tabs verbatim
92
						tokenBuffer.append("\t"); //$NON-NLS-1$
93
						break;
94
					case '\f' :
95
						tokenBuffer.append("\\f"); //$NON-NLS-1$
96
						break;
97
					case '\"' :
98
						tokenBuffer.append("\\\""); //$NON-NLS-1$
99
						break;
100
					case '\'' :
101
						tokenBuffer.append("\\'"); //$NON-NLS-1$
102
						break;
103
					case '\\' :
104
						tokenBuffer.append("\\\\"); //$NON-NLS-1$
105
						break;
106
					default :
107
						tokenBuffer.append(c);
108
				}
109
			}
110
			buffer.append(tokenBuffer);
111
		}
112
		return buffer.toString();
113
	}
114
115
	/**
116
	 * Creates a new C string auto indent strategy for the given document partitioning.
117
	 *
118
	 * @param partitioning the document partitioning
119
	 */
120
	public CStringAutoIndentStrategy(String partitioning, ICProject project) {
121
		super();
122
		fPartitioning = partitioning;
123
		fProject = project;
124
	}
125
126
	private boolean isLineDelimiter(IDocument document, String text) {
127
		String[] delimiters= document.getLegalLineDelimiters();
128
		if (delimiters != null)
129
			return TextUtilities.equals(delimiters, text) > -1;
130
		return false;
131
	}
132
133
	private String getModifiedText(String string, CharSequence indentation, String delimiter) {
134
		return displayString(string, indentation, delimiter);
135
	}
136
137
	private void indentStringAfterNewLine(IDocument document, DocumentCommand command) throws BadLocationException {
138
		ITypedRegion partition= TextUtilities.getPartition(document, fPartitioning, command.offset, true);
139
		int offset= partition.getOffset();
140
		int length= partition.getLength();
141
142
		if (command.offset == offset + length && document.getChar(offset + length - 1) == '\"')
143
			return;
144
		
145
		CHeuristicScanner scanner = new CHeuristicScanner(document);
146
		CIndenter indenter = new CIndenter(document, scanner, fProject);
147
		StringBuffer indentation = indenter.computeContinuationLineIndentation(offset);
148
		if (indentation == null)
149
			indentation = new StringBuffer(); 
150
151
		String delimiter= TextUtilities.getDefaultLineDelimiter(document);
152
		IPreferenceStore preferenceStore= CUIPlugin.getDefault().getPreferenceStore();
153
		if (isLineDelimiter(document, command.text))
154
			command.text= "\"" + command.text + indentation + "\"";  //$NON-NLS-1$//$NON-NLS-2$
155
		else if (command.text.length() > 1 && preferenceStore.getBoolean(PreferenceConstants.EDITOR_ESCAPE_STRINGS))
156
			command.text= getModifiedText(command.text, indentation, delimiter);
157
	}
158
159
	private boolean isSmartMode() {
160
		IWorkbenchPage page= CUIPlugin.getActivePage();
161
		if (page != null)  {
162
			IEditorPart part= page.getActiveEditor();
163
			if (part instanceof ITextEditorExtension3) {
164
				ITextEditorExtension3 extension= (ITextEditorExtension3) part;
165
				return extension.getInsertMode() == ITextEditorExtension3.SMART_INSERT;
166
			}
167
		}
168
		return false;
169
	}
170
171
	/*
172
	 * @see org.eclipse.jface.text.IAutoIndentStrategy#customizeDocumentCommand(IDocument, DocumentCommand)
173
	 */
174
	public void customizeDocumentCommand(IDocument document, DocumentCommand command) {
175
		try {
176
			if (command.length != 0 || command.text == null)
177
				return;
178
179
			IPreferenceStore preferenceStore= CUIPlugin.getDefault().getPreferenceStore();
180
181
			if (preferenceStore.getBoolean(PreferenceConstants.EDITOR_WRAP_STRINGS) && isSmartMode()) {
182
				indentStringAfterNewLine(document, command);
183
			}
184
		} catch (BadLocationException e) {
185
		}
186
	}
187
}
(-)src/org/eclipse/cdt/internal/ui/preferences/formatter/ProfileStore.java (+427 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
13
package org.eclipse.cdt.internal.ui.preferences.formatter;
14
15
import java.io.ByteArrayInputStream;
16
import java.io.ByteArrayOutputStream;
17
import java.io.File;
18
import java.io.FileInputStream;
19
import java.io.FileOutputStream;
20
import java.io.FileReader;
21
import java.io.IOException;
22
import java.io.InputStream;
23
import java.io.OutputStream;
24
import java.io.UnsupportedEncodingException;
25
import java.util.ArrayList;
26
import java.util.Collection;
27
import java.util.Collections;
28
import java.util.HashMap;
29
import java.util.Iterator;
30
import java.util.List;
31
import java.util.Map;
32
33
import javax.xml.parsers.DocumentBuilder;
34
import javax.xml.parsers.DocumentBuilderFactory;
35
import javax.xml.parsers.ParserConfigurationException;
36
import javax.xml.parsers.SAXParser;
37
import javax.xml.parsers.SAXParserFactory;
38
import javax.xml.transform.OutputKeys;
39
import javax.xml.transform.Transformer;
40
import javax.xml.transform.TransformerException;
41
import javax.xml.transform.TransformerFactory;
42
import javax.xml.transform.dom.DOMSource;
43
import javax.xml.transform.stream.StreamResult;
44
45
import org.eclipse.core.runtime.CoreException;
46
import org.eclipse.core.runtime.IStatus;
47
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
48
import org.eclipse.core.runtime.preferences.IScopeContext;
49
50
import org.eclipse.core.resources.IProject;
51
import org.eclipse.core.resources.ResourcesPlugin;
52
53
import org.eclipse.cdt.core.CCorePlugin;
54
55
import org.eclipse.cdt.ui.CUIPlugin;
56
import org.eclipse.cdt.internal.ui.CUIException;
57
import org.eclipse.cdt.internal.ui.CUIStatus;
58
import org.eclipse.cdt.internal.ui.preferences.PreferencesAccess;
59
import org.eclipse.cdt.internal.ui.preferences.formatter.ProfileManager.CustomProfile;
60
import org.eclipse.cdt.internal.ui.preferences.formatter.ProfileManager.Profile;
61
62
import org.osgi.service.prefs.BackingStoreException;
63
import org.w3c.dom.Document;
64
import org.w3c.dom.Element;
65
import org.xml.sax.Attributes;
66
import org.xml.sax.InputSource;
67
import org.xml.sax.SAXException;
68
import org.xml.sax.helpers.DefaultHandler;
69
70
71
72
public class ProfileStore {
73
	
74
	/**
75
	 * A SAX event handler to parse the xml format for profiles. 
76
	 */
77
	private final static class ProfileDefaultHandler extends DefaultHandler {
78
		
79
		private List fProfiles;
80
		private int fVersion;
81
		
82
		private String fName;
83
		private Map fSettings;
84
85
86
		public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
87
88
			if (qName.equals(XML_NODE_SETTING)) {
89
90
				final String key= attributes.getValue(XML_ATTRIBUTE_ID);
91
				final String value= attributes.getValue(XML_ATTRIBUTE_VALUE);
92
				fSettings.put(key, value);
93
94
			} else if (qName.equals(XML_NODE_PROFILE)) {
95
96
				fName= attributes.getValue(XML_ATTRIBUTE_NAME);
97
				fSettings= new HashMap(200);
98
99
			}
100
			else if (qName.equals(XML_NODE_ROOT)) {
101
102
				fProfiles= new ArrayList();
103
				try {
104
					fVersion= Integer.parseInt(attributes.getValue(XML_ATTRIBUTE_VERSION));
105
				} catch (NumberFormatException ex) {
106
					throw new SAXException(ex);
107
				}
108
109
			}
110
		}
111
		
112
		public void endElement(String uri, String localName, String qName) {
113
			if (qName.equals(XML_NODE_PROFILE)) {
114
				fProfiles.add(new CustomProfile(fName, fSettings, fVersion));
115
				fName= null;
116
				fSettings= null;
117
			}
118
		}
119
		
120
		public List getProfiles() {
121
			return fProfiles;
122
		}
123
		
124
	}
125
126
	/**
127
	 * Preference key where all profiles are stored
128
	 */
129
	private static final String PREF_FORMATTER_PROFILES= "org.eclipse.cdt.ui.formatterprofiles"; //$NON-NLS-1$
130
	
131
	/**
132
	 * Preference key where all profiles are stored
133
	 */
134
	private static final String PREF_FORMATTER_PROFILES_VERSION= "org.eclipse.cdt.ui.formatterprofiles.version"; //$NON-NLS-1$
135
	
136
	
137
	/**
138
	 * Identifiers for the XML file.
139
	 */
140
	private final static String XML_NODE_ROOT= "profiles"; //$NON-NLS-1$
141
	private final static String XML_NODE_PROFILE= "profile"; //$NON-NLS-1$
142
	private final static String XML_NODE_SETTING= "setting"; //$NON-NLS-1$
143
	
144
	private final static String XML_ATTRIBUTE_VERSION= "version"; //$NON-NLS-1$
145
	private final static String XML_ATTRIBUTE_ID= "id"; //$NON-NLS-1$
146
	private final static String XML_ATTRIBUTE_NAME= "name"; //$NON-NLS-1$
147
	private final static String XML_ATTRIBUTE_VALUE= "value"; //$NON-NLS-1$
148
		
149
	private ProfileStore() {
150
	}
151
	
152
	/**
153
	 * @return Returns the collection of profiles currently stored in the preference store or
154
	 * <code>null</code> if the loading failed. The elements are of type {@link CustomProfile}
155
	 * and are all updated to the latest version.
156
	 * @throws CoreException
157
	 */
158
	public static List readProfiles(IScopeContext scope) throws CoreException {
159
		List res= readProfilesFromPreferences(scope);
160
		if (res == null) {
161
			return readOldForCompatibility(scope);
162
		}
163
		return res;
164
	}
165
	
166
	public static void writeProfiles(Collection profiles, IScopeContext instanceScope) throws CoreException {
167
		ByteArrayOutputStream stream= new ByteArrayOutputStream(2000);
168
		try {
169
			writeProfilesToStream(profiles, stream);
170
			String val;
171
			try {
172
				val= stream.toString("UTF-8"); //$NON-NLS-1$
173
			} catch (UnsupportedEncodingException e) {
174
				val= stream.toString(); 
175
			}
176
			IEclipsePreferences uiPreferences = instanceScope.getNode(CUIPlugin.PLUGIN_ID);
177
			uiPreferences.put(PREF_FORMATTER_PROFILES, val);
178
			uiPreferences.putInt(PREF_FORMATTER_PROFILES_VERSION, ProfileVersioner.CURRENT_VERSION);
179
		} finally {
180
			try { stream.close(); } catch (IOException e) { /* ignore */ }
181
		}
182
	}
183
	
184
	public static List readProfilesFromPreferences(IScopeContext scope) throws CoreException {
185
		String string= scope.getNode(CUIPlugin.PLUGIN_ID).get(PREF_FORMATTER_PROFILES, null);
186
		if (string != null && string.length() > 0) {
187
			byte[] bytes;
188
			try {
189
				bytes= string.getBytes("UTF-8"); //$NON-NLS-1$
190
			} catch (UnsupportedEncodingException e) {
191
				bytes= string.getBytes();
192
			}
193
			InputStream is= new ByteArrayInputStream(bytes);
194
			try {
195
				List res= readProfilesFromStream(new InputSource(is));
196
				if (res != null) {
197
					for (int i= 0; i < res.size(); i++) {
198
						ProfileVersioner.updateAndComplete((CustomProfile) res.get(i));
199
					}
200
				}
201
				return res;
202
			} finally {
203
				try { is.close(); } catch (IOException e) { /* ignore */ }
204
			}
205
		}
206
		return null;
207
	}	
208
209
	/**
210
	 * Read the available profiles from the internal XML file and return them
211
	 * as collection.
212
	 * @return returns a list of <code>CustomProfile</code> or <code>null</code>
213
	 */
214
	private static List readOldForCompatibility(IScopeContext instanceScope) {
215
		
216
		// in 3.0 M9 and less the profiles were stored in a file in the plugin's meta data
217
		final String STORE_FILE= "code_formatter_profiles.xml"; //$NON-NLS-1$
218
219
		File file= CUIPlugin.getDefault().getStateLocation().append(STORE_FILE).toFile();
220
		if (!file.exists())
221
			return null;
222
		
223
		try {
224
			// note that it's wrong to use a file reader when XML declares UTF-8: Kept for compatibility
225
			final FileReader reader= new FileReader(file);
226
			try {
227
				List res= readProfilesFromStream(new InputSource(reader));
228
				if (res != null) {
229
					for (int i= 0; i < res.size(); i++) {
230
						ProfileVersioner.updateAndComplete((CustomProfile) res.get(i));
231
					}
232
					writeProfiles(res, instanceScope);
233
				}
234
				file.delete(); // remove after successful write
235
				return res;
236
			} finally {
237
				reader.close();
238
			}
239
		} catch (CoreException e) {
240
			CUIPlugin.getDefault().log(e); // log but ignore
241
		} catch (IOException e) {
242
			CUIPlugin.getDefault().log(e); // log but ignore
243
		}
244
		return null;
245
	}
246
	
247
	
248
	/**
249
	 * Read the available profiles from the internal XML file and return them
250
	 * as collection or <code>null</code> if the file is not a profile file.
251
	 * @param file The file to read from
252
	 * @return returns a list of <code>CustomProfile</code> or <code>null</code>
253
	 * @throws CoreException
254
	 */
255
	public static List readProfilesFromFile(File file) throws CoreException {
256
		try {
257
			final FileInputStream reader= new FileInputStream(file); 
258
			try {
259
				return readProfilesFromStream(new InputSource(reader));
260
			} finally {
261
				try { reader.close(); } catch (IOException e) { /* ignore */ }
262
			}
263
		} catch (IOException e) {
264
			throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_reading_xml_message);  
265
		}
266
	}
267
	
268
	/**
269
	 * Load profiles from a XML stream and add them to a map or <code>null</code> if the source is not a profile store.
270
	 * @param inputSource The input stream
271
	 * @return returns a list of <code>CustomProfile</code> or <code>null</code>
272
	 * @throws CoreException
273
	 */
274
	private static List readProfilesFromStream(InputSource inputSource) throws CoreException {
275
		
276
		final ProfileDefaultHandler handler= new ProfileDefaultHandler();
277
		try {
278
		    final SAXParserFactory factory= SAXParserFactory.newInstance();
279
			final SAXParser parser= factory.newSAXParser();
280
			parser.parse(inputSource, handler);
281
		} catch (SAXException e) {
282
			throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_reading_xml_message);  
283
		} catch (IOException e) {
284
			throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_reading_xml_message);  
285
		} catch (ParserConfigurationException e) {
286
			throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_reading_xml_message);  
287
		}
288
		return handler.getProfiles();
289
	}
290
	
291
	/**
292
	 * Write the available profiles to the internal XML file.
293
	 * @param profiles List of <code>CustomProfile</code>
294
	 * @param file File to write
295
	 * @throws CoreException
296
	 */
297
	public static void writeProfilesToFile(Collection profiles, File file) throws CoreException {
298
		final OutputStream writer;
299
		try {
300
			writer= new FileOutputStream(file);
301
			try {
302
				writeProfilesToStream(profiles, writer);
303
			} finally {
304
				try { writer.close(); } catch (IOException e) { /* ignore */ }
305
			}
306
		} catch (IOException e) {
307
			throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_serializing_xml_message);  
308
		}
309
	}
310
	
311
	/**
312
	 * Save profiles to an XML stream
313
	 * @param profiles List of <code>CustomProfile</code>
314
	 * @param stream Stream to write
315
	 * @throws CoreException
316
	 */
317
	private static void writeProfilesToStream(Collection profiles, OutputStream stream) throws CoreException {
318
319
		try {
320
			final DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
321
			final DocumentBuilder builder= factory.newDocumentBuilder();		
322
			final Document document= builder.newDocument();
323
			
324
			final Element rootElement = document.createElement(XML_NODE_ROOT);
325
			rootElement.setAttribute(XML_ATTRIBUTE_VERSION, Integer.toString(ProfileVersioner.CURRENT_VERSION));
326
327
			document.appendChild(rootElement);
328
			
329
			for(final Iterator iter= profiles.iterator(); iter.hasNext();) {
330
				final Profile profile= (Profile)iter.next();
331
				if (profile.isProfileToSave()) {
332
					final Element profileElement= createProfileElement(profile, document);
333
					rootElement.appendChild(profileElement);
334
				}
335
			}
336
337
			Transformer transformer=TransformerFactory.newInstance().newTransformer();
338
			transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
339
			transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
340
			transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
341
			transformer.transform(new DOMSource(document), new StreamResult(stream));
342
		} catch (TransformerException e) {
343
			throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_serializing_xml_message);  
344
		} catch (ParserConfigurationException e) {
345
			throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_serializing_xml_message);  
346
		}
347
	}
348
349
	
350
	/*
351
	 * Create a new profile element in the specified document. The profile is not added
352
	 * to the document by this method. 
353
	 */
354
	private static Element createProfileElement(Profile profile, Document document) {
355
		final Element element= document.createElement(XML_NODE_PROFILE);
356
		element.setAttribute(XML_ATTRIBUTE_NAME, profile.getName());
357
		element.setAttribute(XML_ATTRIBUTE_VERSION, Integer.toString(profile.getVersion()));
358
		
359
		final Iterator keyIter= ProfileManager.getKeys().iterator();
360
		
361
		while (keyIter.hasNext()) {
362
			final String key= (String)keyIter.next();
363
			final String value= (String)profile.getSettings().get(key);
364
			if (value != null) {
365
				final Element setting= document.createElement(XML_NODE_SETTING);
366
				setting.setAttribute(XML_ATTRIBUTE_ID, key);
367
				setting.setAttribute(XML_ATTRIBUTE_VALUE, value);
368
				element.appendChild(setting);
369
			} else {
370
				CUIPlugin.getDefault().logErrorMessage("ProfileStore: Profile does not contain value for key " + key); //$NON-NLS-1$
371
			}
372
		}
373
		return element;
374
	}
375
	
376
	public static void checkCurrentOptionsVersion() {
377
		PreferencesAccess access= PreferencesAccess.getOriginalPreferences();
378
		
379
		IScopeContext instanceScope= access.getInstanceScope();
380
		IEclipsePreferences uiPreferences= instanceScope.getNode(CUIPlugin.PLUGIN_ID);
381
		int version= uiPreferences.getInt(PREF_FORMATTER_PROFILES_VERSION, 0);
382
		if (version >= ProfileVersioner.CURRENT_VERSION) {
383
			return; // is up to date
384
		}
385
		try {
386
			List profiles= ProfileStore.readProfiles(instanceScope);
387
			if (profiles == null) {
388
				profiles= Collections.EMPTY_LIST;
389
			}
390
			ProfileManager manager= new ProfileManager(profiles, instanceScope, access);
391
			if (manager.getSelected() instanceof CustomProfile) {
392
				manager.commitChanges(instanceScope); // updates CCorePlugin options
393
			}
394
			uiPreferences.putInt(PREF_FORMATTER_PROFILES_VERSION, ProfileVersioner.CURRENT_VERSION);
395
			savePreferences(instanceScope);
396
						
397
			IProject[] projects= ResourcesPlugin.getWorkspace().getRoot().getProjects();
398
			for (int i= 0; i < projects.length; i++) {
399
				IScopeContext scope= access.getProjectScope(projects[i]);
400
				if (ProfileManager.hasProjectSpecificSettings(scope)) {
401
					manager= new ProfileManager(profiles, scope, access);
402
					manager.commitChanges(scope); // updates CCorePlugin project options
403
					savePreferences(scope);
404
				}
405
			}
406
		} catch (CoreException e) {
407
			CUIPlugin.getDefault().log(e);
408
		} catch (BackingStoreException e) {
409
			CUIPlugin.getDefault().log(e);
410
		}
411
	}
412
	
413
	private static void savePreferences(final IScopeContext context) throws BackingStoreException {
414
		try {
415
			context.getNode(CUIPlugin.PLUGIN_ID).flush();
416
		} finally {
417
			context.getNode(CCorePlugin.PLUGIN_ID).flush();
418
		}
419
	}
420
	
421
	/*
422
	 * Creates a UI exception for logging purposes
423
	 */
424
	private static CUIException createException(Throwable t, String message) {
425
		return new CUIException(CUIStatus.createError(IStatus.ERROR, message, t));
426
	}
427
}
(-)src/org/eclipse/cdt/internal/ui/preferences/formatter/CreateProfileDialog.java (+197 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
package org.eclipse.cdt.internal.ui.preferences.formatter;
13
14
import java.util.HashMap;
15
import java.util.List;
16
import java.util.Map;
17
18
import org.eclipse.core.runtime.IStatus;
19
20
import org.eclipse.swt.SWT;
21
import org.eclipse.swt.events.ModifyEvent;
22
import org.eclipse.swt.events.ModifyListener;
23
import org.eclipse.swt.events.SelectionEvent;
24
import org.eclipse.swt.events.SelectionListener;
25
import org.eclipse.swt.layout.GridData;
26
import org.eclipse.swt.layout.GridLayout;
27
import org.eclipse.swt.widgets.Button;
28
import org.eclipse.swt.widgets.Combo;
29
import org.eclipse.swt.widgets.Composite;
30
import org.eclipse.swt.widgets.Control;
31
import org.eclipse.swt.widgets.Label;
32
import org.eclipse.swt.widgets.Shell;
33
import org.eclipse.swt.widgets.Text;
34
35
import org.eclipse.jface.dialogs.IDialogConstants;
36
import org.eclipse.jface.dialogs.IDialogSettings;
37
import org.eclipse.jface.dialogs.StatusDialog;
38
39
import org.eclipse.cdt.ui.CUIPlugin;
40
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
41
import org.eclipse.cdt.internal.ui.preferences.formatter.ProfileManager.CustomProfile;
42
import org.eclipse.cdt.internal.ui.preferences.formatter.ProfileManager.Profile;
43
44
/**
45
 * The dialog to create a new profile. 
46
 */
47
public class CreateProfileDialog extends StatusDialog {
48
    
49
    private static final String PREF_OPEN_EDIT_DIALOG= CUIPlugin.PLUGIN_ID + ".codeformatter.create_profile_dialog.open_edit"; //$NON-NLS-1$
50
    
51
	private Text fNameText;
52
	private Combo fProfileCombo;
53
	private Button fEditCheckbox;
54
	
55
	private final static StatusInfo fOk= new StatusInfo();
56
	private final static StatusInfo fEmpty= new StatusInfo(IStatus.ERROR, FormatterMessages.CreateProfileDialog_status_message_profile_name_is_empty); 
57
	private final static StatusInfo fDuplicate= new StatusInfo(IStatus.ERROR, FormatterMessages.CreateProfileDialog_status_message_profile_with_this_name_already_exists); 
58
59
	private final ProfileManager fProfileManager;
60
	private final List fSortedProfiles;
61
	private final String [] fSortedNames;
62
	
63
	private CustomProfile fCreatedProfile;
64
	protected boolean fOpenEditDialog;
65
	
66
	public CreateProfileDialog(Shell parentShell, ProfileManager profileManager) {
67
		super(parentShell);
68
		fProfileManager= profileManager;
69
		fSortedProfiles= fProfileManager.getSortedProfiles();
70
		fSortedNames= fProfileManager.getSortedDisplayNames();
71
	}
72
	
73
	
74
	public void create() {
75
		super.create();
76
		setTitle(FormatterMessages.CreateProfileDialog_dialog_title); 
77
	}
78
	
79
	public Control createDialogArea(Composite parent) {
80
				
81
		final int numColumns= 2;
82
		
83
		GridData gd;
84
		
85
		final GridLayout layout= new GridLayout(numColumns, false);
86
		layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
87
		layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
88
		layout.verticalSpacing= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
89
		layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
90
91
		final Composite composite= new Composite(parent, SWT.NONE);
92
		composite.setLayout(layout);
93
		
94
		// Create "Profile name:" label
95
		gd = new GridData(GridData.FILL_HORIZONTAL);
96
		gd.horizontalSpan = numColumns;
97
		gd.widthHint= convertWidthInCharsToPixels(60);
98
		final Label nameLabel = new Label(composite, SWT.WRAP);
99
		nameLabel.setText(FormatterMessages.CreateProfileDialog_profile_name_label_text); 
100
		nameLabel.setLayoutData(gd);
101
		
102
		// Create text field to enter name
103
		gd = new GridData( GridData.FILL_HORIZONTAL);
104
		gd.horizontalSpan= numColumns;
105
		fNameText= new Text(composite, SWT.SINGLE | SWT.BORDER);
106
		fNameText.setLayoutData(gd);
107
		fNameText.addModifyListener( new ModifyListener() {
108
			public void modifyText(ModifyEvent e) {
109
				doValidation();
110
			}
111
		});
112
		
113
		// Create "Initialize settings ..." label
114
		gd = new GridData();
115
		gd.horizontalSpan = numColumns;
116
		Label profileLabel = new Label(composite, SWT.WRAP);
117
		profileLabel.setText(FormatterMessages.CreateProfileDialog_base_profile_label_text); 
118
		profileLabel.setLayoutData(gd);
119
		
120
		gd= new GridData(GridData.FILL_HORIZONTAL);
121
		gd.horizontalSpan= numColumns;
122
		fProfileCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
123
		fProfileCombo.setLayoutData(gd);
124
		
125
		
126
		// "Open the edit dialog now" checkbox
127
		gd= new GridData();
128
		gd.horizontalSpan= numColumns;
129
		fEditCheckbox= new Button(composite, SWT.CHECK);
130
		fEditCheckbox.setText(FormatterMessages.CreateProfileDialog_open_edit_dialog_checkbox_text); 
131
		fEditCheckbox.addSelectionListener(new SelectionListener() {
132
			public void widgetSelected(SelectionEvent e) {
133
				fOpenEditDialog= ((Button)e.widget).getSelection();
134
			}
135
			public void widgetDefaultSelected(SelectionEvent e) {
136
			}
137
		});
138
		
139
		final IDialogSettings dialogSettings= CUIPlugin.getDefault().getDialogSettings();//.get(PREF_OPEN_EDIT_DIALOG);
140
		if (dialogSettings.get(PREF_OPEN_EDIT_DIALOG) != null) {
141
		    fOpenEditDialog= dialogSettings.getBoolean(PREF_OPEN_EDIT_DIALOG);
142
		} else {
143
		    fOpenEditDialog= true;
144
		}
145
		fEditCheckbox.setSelection(fOpenEditDialog);
146
		
147
		fProfileCombo.setItems(fSortedNames);
148
		fProfileCombo.setText(fProfileManager.getProfile(ProfileManager.DEFAULT_PROFILE).getName());
149
		updateStatus(fEmpty);
150
		
151
		applyDialogFont(composite);
152
		
153
		fNameText.setFocus();
154
		
155
		return composite;
156
	}
157
158
159
	/**
160
	 * Validate the current settings
161
	 */
162
	protected void doValidation() {
163
		final String name= fNameText.getText().trim();
164
		
165
		if (fProfileManager.containsName(name)) {
166
			updateStatus(fDuplicate);
167
			return;
168
		}
169
		if (name.length() == 0) {
170
			updateStatus(fEmpty);
171
			return;
172
		}
173
		updateStatus(fOk);
174
	}
175
	
176
	protected void okPressed() {
177
		if (!getStatus().isOK()) 
178
			return;
179
180
		CUIPlugin.getDefault().getDialogSettings().put(PREF_OPEN_EDIT_DIALOG, fOpenEditDialog);
181
182
		final Map baseSettings= new HashMap(((Profile)fSortedProfiles.get(fProfileCombo.getSelectionIndex())).getSettings());
183
		final String profileName= fNameText.getText();
184
		
185
		fCreatedProfile= new CustomProfile(profileName, baseSettings, ProfileVersioner.CURRENT_VERSION);
186
		fProfileManager.addProfile(fCreatedProfile);
187
		super.okPressed();
188
	}
189
	
190
	public final CustomProfile getCreatedProfile() {
191
		return fCreatedProfile;
192
	}
193
	
194
	public final boolean openEditDialog() {
195
		return fOpenEditDialog;
196
	}
197
}
(-)src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterMessages.properties (+535 lines)
Added Link Here
1
###############################################################################
2
# Copyright (c) 2000, 2006 IBM Corporation and others.
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
6
# http://www.eclipse.org/legal/epl-v10.html
7
#
8
# Contributors:
9
#     IBM Corporation - initial API and implementation
10
#     istvan@benedek-home.de - 103706 [formatter] indent empty lines
11
#     Aaron Luchko, aluchko@redhat.com - 105926 [Formatter] Exporting Unnamed profile fails silently
12
#     Sergey Prigogin, Google
13
###############################################################################
14
15
16
#WhiteSpaceTabPage_assignments=Assignments
17
#WhiteSpaceTabPage_assignments_before_assignment_operator=before assignment operator
18
#WhiteSpaceTabPage_assignments_after_assignment_operator=after assignment operator
19
20
#WhiteSpaceTabPage_operators=Operators
21
#WhiteSpaceTabPage_operators_before_binary_operators=before binary operators
22
#WhiteSpaceTabPage_operators_after_binary_operators=after binary operators
23
#WhiteSpaceTabPage_operators_before_unary_operators=before unary operators
24
#WhiteSpaceTabPage_operators_after_unary_operators=after unary operators
25
#WhiteSpaceTabPage_operators_before_prefix_operators=before prefix operators
26
#WhiteSpaceTabPage_operators_after_prefix_operators=after prefix operators
27
#WhiteSpaceTabPage_operators_before_postfix_operators=before postfix operators
28
#WhiteSpaceTabPage_operators_after_postfix_operators=after postfix operators
29
30
#WhiteSpaceTabPage_classes=Classes
31
#WhiteSpaceTabPage_classes_before_opening_brace_of_a_class=before opening brace of a class
32
#WhiteSpaceTabPage_classes_before_opening_brace_of_anon_class=before opening brace of an anonymous class
33
#WhiteSpaceTabPage_classes_before_comma_implements=before comma in implements clause
34
#WhiteSpaceTabPage_classes_after_comma_implements=after comma in implements clause
35
36
#WhiteSpaceTabPage_methods=Methods
37
#WhiteSpaceTabPage_constructors=Constructors
38
39
#WhiteSpaceTabPage_fields=Fields
40
#WhiteSpaceTabPage_fields_before_comma=before comma in multiple field declarations
41
#WhiteSpaceTabPage_fields_after_comma=after comma in multiple field declarations
42
43
#WhiteSpaceTabPage_localvars=Local variables
44
#WhiteSpaceTabPage_localvars_before_comma=before comma in multiple local declarations
45
#WhiteSpaceTabPage_localvars_after_comma=after comma in multiple local declarations
46
47
#WhiteSpaceTabPage_arrayinit=Array initializers
48
#WhiteSpaceTabPage_arraydecls=Array declarations
49
#WhiteSpaceTabPage_arrayelem=Array element access
50
#WhiteSpaceTabPage_arrayalloc=Array allocation
51
52
#WhiteSpaceTabPage_calls=Function invocations
53
54
#WhiteSpaceTabPage_calls_before_comma_in_method_args=before comma in method arguments
55
#WhiteSpaceTabPage_calls_after_comma_in_method_args=after comma in method arguments
56
#WhiteSpaceTabPage_calls_before_comma_in_alloc=before comma in object allocation arguments
57
#WhiteSpaceTabPage_calls_after_comma_in_alloc=after comma in object allocation arguments
58
#WhiteSpaceTabPage_calls_before_comma_in_qalloc=before comma in explicit constructor call
59
#WhiteSpaceTabPage_calls_after_comma_in_qalloc=after comma in explicit constructor call
60
61
#WhiteSpaceTabPage_statements=Control statements
62
63
#WhiteSpaceTabPage_blocks=Blocks
64
65
#WhiteSpaceTabPage_switch='switch'
66
#WhiteSpaceTabPage_switch_before_case_colon=before colon in case
67
#WhiteSpaceTabPage_switch_before_default_colon=before colon in default
68
69
#WhiteSpaceTabPage_do='while' & 'do while'
70
71
#WhiteSpaceTabPage_synchronized='synchronized'
72
73
#WhiteSpaceTabPage_try='catch'
74
75
#WhiteSpaceTabPage_if='if else'
76
#WhiteSpaceTabPage_assert='assert'
77
78
#WhiteSpaceTabPage_for='for'
79
#WhiteSpaceTabPage_for_before_comma_init=before comma in initialization
80
#WhiteSpaceTabPage_for_after_comma_init=after comma in initialization
81
#WhiteSpaceTabPage_for_before_comma_inc=before comma in increments
82
#WhiteSpaceTabPage_for_after_comma_inc=after comma in increments
83
84
85
#WhiteSpaceTabPage_labels=Labels
86
#WhiteSpaceTabPage_annotations=Annotations
87
#WhiteSpaceTabPage_annotation_types=Annotation types
88
#WhiteSpaceTabPage_enums=Enum types
89
#WhiteSpaceTabPage_wildcardtype=Wildcard type
90
#WhiteSpaceTabPage_param_type_ref=Type reference
91
#WhiteSpaceTabPage_type_arguments=Type arguments
92
#WhiteSpaceTabPage_type_parameters=Type parameters
93
94
#WhiteSpaceTabPage_conditionals=Conditionals
95
96
#WhiteSpaceTabPage_typecasts=Type casts
97
98
#WhiteSpaceTabPage_parenexpr=Parenthesized expressions
99
#WhiteSpaceTabPage_declarations=Declarations
100
#WhiteSpaceTabPage_expressions=Expressions
101
#WhiteSpaceTabPage_arrays=Arrays
102
#WhiteSpaceTabPage_parameterized_types=Parameterized types
103
104
#WhiteSpaceTabPage_after_opening_brace=after opening brace
105
#WhiteSpaceTabPage_after_closing_brace=after closing brace
106
#WhiteSpaceTabPage_before_opening_brace=before opening brace
107
#WhiteSpaceTabPage_before_closing_brace=before closing brace
108
#WhiteSpaceTabPage_between_empty_braces=between empty braces
109
110
111
#WhiteSpaceTabPage_after_opening_paren=after opening parenthesis
112
#WhiteSpaceTabPage_after_closing_paren=after closing parenthesis
113
#WhiteSpaceTabPage_before_opening_paren=before opening parenthesis
114
#WhiteSpaceTabPage_before_closing_paren=before closing parenthesis
115
#WhiteSpaceTabPage_between_empty_parens=between empty parenthesis
116
117
#WhiteSpaceTabPage_after_opening_bracket=after opening bracket
118
#WhiteSpaceTabPage_before_opening_bracket=before opening bracket
119
#WhiteSpaceTabPage_before_closing_bracket=before closing bracket
120
#WhiteSpaceTabPage_between_empty_brackets=between empty brackets
121
122
#WhiteSpaceTabPage_before_comma_in_params=before comma in parameters
123
#WhiteSpaceTabPage_after_comma_in_params=after comma in parameters
124
#WhiteSpaceTabPage_before_comma_in_throws=before comma in 'throws' clause
125
#WhiteSpaceTabPage_after_comma_in_throws=after comma in 'throws' clause
126
127
#WhiteSpaceTabPage_before_ellipsis=before ellipsis in vararg parameters
128
#WhiteSpaceTabPage_after_ellipsis=after ellipsis in vararg parameters
129
130
#WhiteSpaceTabPage_before_comma=before comma
131
#WhiteSpaceTabPage_after_comma=after comma
132
133
#WhiteSpaceTabPage_after_semicolon=after semicolon
134
#WhiteSpaceTabPage_before_semicolon=before semicolon
135
136
#WhiteSpaceTabPage_before_colon=before colon
137
#WhiteSpaceTabPage_after_colon=after colon
138
139
#WhiteSpaceTabPage_before_question=before question mark
140
#WhiteSpaceTabPage_after_question=after question mark
141
142
#WhiteSpaceTabPage_before_at=before @
143
#WhiteSpaceTabPage_after_at=after @
144
145
#WhiteSpaceTabPage_after_opening_angle_bracket=after opening angle bracket
146
#WhiteSpaceTabPage_after_closing_angle_bracket=after closing angle bracket
147
#WhiteSpaceTabPage_before_opening_angle_bracket=before opening angle bracket
148
#WhiteSpaceTabPage_before_closing_angle_bracket=before closing angle bracket
149
#WhiteSpaceTabPage_before_parenthesized_expressions=before parenthesized expressions
150
151
#WhiteSpaceTabPage_before_and_list=before '&' in type bounds
152
#WhiteSpaceTabPage_after_and_list=after '&' in type bounds
153
154
#WhiteSpaceTabPage_enum_decl_before_opening_brace=before opening brace in declaration
155
#WhiteSpaceTabPage_enum_decl_before_comma=before comma between constants
156
#WhiteSpaceTabPage_enum_decl_after_comma=after comma between constants
157
158
#WhiteSpaceTabPage_enum_const_arg_before_opening_paren=before opening parenthesis in constant arguments
159
#WhiteSpaceTabPage_enum_const_arg_after_opening_paren=after opening parenthesis in constant arguments
160
#WhiteSpaceTabPage_enum_const_arg_between_empty_parens=between empty parenthesis in constant arguments
161
#WhiteSpaceTabPage_enum_const_arg_before_comma=before comma in constant arguments
162
#WhiteSpaceTabPage_enum_const_arg_after_comma=after comma in constant arguments
163
#WhiteSpaceTabPage_enum_const_arg_before_closing_paren=before closing parenthesis in constant arguments
164
165
#WhiteSpaceTabPage_enum_const_before_opening_brace=before opening brace of constant body
166
167
#WhiteSpaceTabPage_annot_type_method_before_opening_paren=before opening parenthesis in annotation type members
168
#WhiteSpaceTabPage_annot_type_method_between_empty_parens=between parenthesis in annotation type members
169
170
#WhiteSpaceTabPage_sort_by_c_element=Sort options by C element
171
#WhiteSpaceTabPage_sort_by_syntax_element=Sort options by Syntax element
172
173
#WhiteSpaceOptions_before=Before
174
#WhiteSpaceOptions_after=After
175
176
#WhiteSpaceOptions_operator=Operator
177
#WhiteSpaceOptions_assignment_operator=Assignment operator
178
#WhiteSpaceOptions_binary_operator=Binary operator
179
#WhiteSpaceOptions_unary_operator=Unary operator
180
#WhiteSpaceOptions_prefix_operator=Prefix operator
181
#WhiteSpaceOptions_postfix_operator=Postfix operator
182
183
184
#WhiteSpaceOptions_opening_paren=Opening parenthesis
185
#WhiteSpaceOptions_catch='catch'
186
#WhiteSpaceOptions_for='for'
187
#WhiteSpaceOptions_if='if'
188
#WhiteSpaceOptions_switch='switch'
189
#WhiteSpaceOptions_synchronized='synchronized'
190
#WhiteSpaceOptions_while='while'
191
#WhiteSpaceOptions_assert='assert'
192
#WhiteSpaceOptions_member_function_declaration=Member function declaration
193
#WhiteSpaceOptions_constructor=Constructor
194
#WhiteSpaceOptions_method=Method
195
#WhiteSpaceOptions_method_call=Method call
196
#WhiteSpaceOptions_paren_expr=Parenthesized expression
197
#WhiteSpaceOptions_enum_constant_body=Enum constant body
198
#WhiteSpaceOptions_enum_constant_arguments=Enum constant arguments
199
#WhiteSpaceOptions_enum_declaration=Enum declaration
200
#WhiteSpaceOptions_annotation_modifier=Annotation
201
#WhiteSpaceOptions_annotation_modifier_args=Annotation arguments
202
#WhiteSpaceOptions_annotation_type_member=Annotation type member
203
#WhiteSpaceOptions_annotation_type=Annotation type
204
205
#WhiteSpaceOptions_type_cast=Type cast
206
#WhiteSpaceOptions_parameterized_type=Parameterized type
207
#WhiteSpaceOptions_type_arguments=Type arguments
208
#WhiteSpaceOptions_type_parameters=Type parameters
209
#WhiteSpaceOptions_vararg_parameter=Vararg parameters
210
211
#WhiteSpaceOptions_closing_paren=Closing parenthesis
212
213
#WhiteSpaceOptions_opening_brace=Opening brace
214
#WhiteSpaceOptions_closing_brace=Closing brace
215
#WhiteSpaceOptions_opening_bracket=Opening bracket
216
#WhiteSpaceOptions_closing_bracket=Closing bracket
217
#WhiteSpaceOptions_class_decl=Type declaration
218
#WhiteSpaceOptions_anon_class_decl=Anonymous type declaration
219
#WhiteSpaceOptions_initializer=Array initializer
220
#WhiteSpaceOptions_block=Block
221
222
#WhiteSpaceOptions_array_decl=Array declaration
223
#WhiteSpaceOptions_array_element_access=Array element access
224
#WhiteSpaceOptions_array_alloc=Array allocation
225
#WhiteSpaceOptions_array_init=Array initializer
226
227
#WhiteSpaceOptions_arguments=Arguments
228
#WhiteSpaceOptions_initialization=Initialization
229
#WhiteSpaceOptions_incrementation=Increment
230
#WhiteSpaceOptions_parameters=Parameters
231
232
#WhiteSpaceOptions_explicit_constructor_call=Explicit constructor call
233
#WhiteSpaceOptions_alloc_expr=Allocation expression
234
#WhiteSpaceOptions_throws='throws' clause
235
#WhiteSpaceOptions_mult_decls=Multiple declarations
236
#WhiteSpaceOptions_local_vars=Local variables
237
#WhiteSpaceOptions_fields=Fields
238
#WhiteSpaceOptions_return='return'
239
#WhiteSpaceOptions_implements_clause='extends'/'implements' clause
240
#WhiteSpaceOptions_colon=Colon
241
#WhiteSpaceOptions_conditional=Conditional
242
#WhiteSpaceOptions_wildcard=Wildcard type
243
#WhiteSpaceOptions_label=Label
244
#WhiteSpaceOptions_comma=Comma
245
246
#WhiteSpaceOptions_semicolon=Semicolon
247
#WhiteSpaceOptions_question_mark=Question mark
248
#WhiteSpaceOptions_between_empty_parens=Between empty parenthesis
249
#WhiteSpaceOptions_between_empty_braces=Between empty braces
250
#WhiteSpaceOptions_between_empty_brackets=Between empty brackets
251
#WhiteSpaceOptions_constructor_decl=Constructor declaration
252
#WhiteSpaceOptions_method_decl=Method declaration
253
#WhiteSpaceOptions_case='case'
254
#WhiteSpaceOptions_default='default'
255
#WhiteSpaceOptions_statements=Statements
256
257
258
259
#WhiteSpaceOptions_before_opening_paren=Before opening parenthesis
260
#WhiteSpaceOptions_after_opening_paren=After opening parenthesis
261
#WhiteSpaceOptions_before_closing_paren=Before closing parenthesis
262
263
#WhiteSpaceOptions_after_closing_paren=After closing parenthesis
264
#WhiteSpaceOptions_before_opening_brace=Before opening brace
265
#WhiteSpaceOptions_after_opening_brace=After opening brace
266
#WhiteSpaceOptions_after_closing_brace=After closing brace
267
#WhiteSpaceOptions_before_closing_brace=Before closing brace
268
#WhiteSpaceOptions_before_opening_bracket=Before opening bracket
269
#WhiteSpaceOptions_after_opening_bracket=After opening bracket
270
#WhiteSpaceOptions_before_closing_bracket=Before closing bracket
271
272
#WhiteSpaceOptions_before_opening_angle_bracket=Before opening angle bracket
273
#WhiteSpaceOptions_after_opening_angle_bracket=After opening angle bracket
274
#WhiteSpaceOptions_before_closing_angle_bracket=Before closing angle bracket
275
#WhiteSpaceOptions_return_with_parenthesized_expression=parenthesized expression
276
#WhiteSpaceOptions_after_closing_angle_bracket=After closing angle bracket
277
278
#WhiteSpaceOptions_before_operator=Before operator
279
#WhiteSpaceOptions_after_operator=After operator
280
#WhiteSpaceOptions_before_comma=Before comma
281
#WhiteSpaceOptions_after_comma=After comma
282
#WhiteSpaceOptions_after_colon=After colon
283
#WhiteSpaceOptions_before_colon=Before colon
284
#WhiteSpaceOptions_before_semicolon=Before semicolon
285
#WhiteSpaceOptions_after_semicolon=After semicolon
286
#WhiteSpaceOptions_before_question_mark=Before question mark
287
#WhiteSpaceOptions_after_question_mark=After question mark
288
#WhiteSpaceOptions_before_at=Before @
289
#WhiteSpaceOptions_after_at=After @
290
291
#WhiteSpaceOptions_before_and=Before & list
292
#WhiteSpaceOptions_after_and=After & list
293
294
#WhiteSpaceOptions_before_ellipsis=Before Ellipsis
295
#WhiteSpaceOptions_after_ellipsis=After Ellipsis
296
297
#WhiteSpaceTabPage_insert_space=&Insert space:
298
299
300
#LineWrappingTabPage_compact_if_else=Compact 'if else'
301
#LineWrappingTabPage_extends_clause='extends' clause
302
#LineWrappingTabPage_enum_constant_arguments=Constant arguments
303
#LineWrappingTabPage_enum_constants=Constants
304
#LineWrappingTabPage_implements_clause='implements' clause
305
#LineWrappingTabPage_parameters=Parameters
306
#LineWrappingTabPage_arguments=Arguments
307
#LineWrappingTabPage_qualified_invocations=Qualified invocations
308
#LineWrappingTabPage_throws_clause='throws' clause
309
#LineWrappingTabPage_object_allocation=Object allocation arguments
310
#LineWrappingTabPage_qualified_object_allocation=Qualified object allocation arguments
311
#LineWrappingTabPage_array_init=Array initializers
312
#LineWrappingTabPage_explicit_constructor_invocations=Explicit constructor invocations
313
#LineWrappingTabPage_conditionals=Conditionals
314
#LineWrappingTabPage_binary_exprs=Binary expressions
315
#LineWrappingTabPage_indentation_default=Default indentation
316
#LineWrappingTabPage_indentation_on_column=Indent on column
317
#LineWrappingTabPage_indentation_by_one=Indent by one
318
#LineWrappingTabPage_class_decls=Class Declarations
319
#LineWrappingTabPage_method_decls=Method Declarations
320
#LineWrappingTabPage_constructor_decls=Constructor declarations
321
#LineWrappingTabPage_function_calls=Function Calls
322
#LineWrappingTabPage_expressions=Expressions
323
#LineWrappingTabPage_statements=Statements
324
#LineWrappingTabPage_enum_decls='enum' declaration
325
#LineWrappingTabPage_wrapping_policy_label_text=Lin&e wrapping policy:
326
#LineWrappingTabPage_indentation_policy_label_text=Indent&ation policy:
327
#LineWrappingTabPage_force_split_checkbox_text=&Force split
328
#LineWrappingTabPage_force_split_checkbox_multi_text=&Force split
329
#LineWrappingTabPage_line_width_for_preview_label_text=&Set line width for preview window:
330
#LineWrappingTabPage_group=Settings for {0}
331
#LineWrappingTabPage_multi_group=Settings for {0} ({1} items)
332
#LineWrappingTabPage_multiple_selections=Settings for multiple selections ({0} items)
333
#LineWrappingTabPage_occurences={0} ({1} of {2})
334
#LineWrappingTabPage_splitting_do_not_split=Do not wrap
335
#LineWrappingTabPage_splitting_wrap_when_necessary=Wrap only when necessary
336
#LineWrappingTabPage_splitting_always_wrap_first_others_when_necessary=Always wrap first element, others when necessary
337
#LineWrappingTabPage_splitting_wrap_always=Wrap all elements, every element on a new line
338
#LineWrappingTabPage_splitting_wrap_always_indent_all_but_first=Wrap all elements, indent all but the first element
339
#LineWrappingTabPage_splitting_wrap_always_except_first_only_if_necessary=Wrap all elements, except first element if not necessary
340
#LineWrappingTabPage_width_indent=Line width and indentation levels
341
#LineWrappingTabPage_width_indent_option_max_line_width=Ma&ximum line width:
342
#LineWrappingTabPage_width_indent_option_default_indent_wrapped=Defa&ult indentation for wrapped lines:
343
#LineWrappingTabPage_width_indent_option_default_indent_array=Default indentation for arra&y initializers:
344
#LineWrappingTabPage_error_invalid_value=The key ''{0}'' contained an invalid value; resetting to defaults.
345
#LineWrappingTabPage_enum_superinterfaces='implements' clause
346
#LineWrappingTabPage_assignment_alignment=Assignments
347
348
349
AlreadyExistsDialog_message_profile_already_exists=A profile with this name already exists.
350
AlreadyExistsDialog_message_profile_name_empty=Profile name is empty
351
AlreadyExistsDialog_dialog_title=Load Profile
352
AlreadyExistsDialog_dialog_label=A profile with the name ''{0}'' already exists in this workspace. What would you like to do?
353
AlreadyExistsDialog_rename_radio_button_desc=&Rename the imported profile:
354
AlreadyExistsDialog_overwrite_radio_button_desc=&Overwrite the existing profile.
355
356
357
#BlankLinesTabPage_preview_header=Blank Lines
358
#BlankLinesTabPage_compilation_unit_group_title=Blank lines in compilation unit
359
#BlankLinesTabPage_compilation_unit_option_before_package=Before p&ackage declaration:
360
#BlankLinesTabPage_compilation_unit_option_after_package=After packa&ge declaration:
361
#BlankLinesTabPage_compilation_unit_option_before_import=&Before import declaration:
362
#BlankLinesTabPage_compilation_unit_option_after_import=After import de&claration:
363
#BlankLinesTabPage_compilation_unit_option_between_type_declarations=Between class declarat&ions:
364
365
#BlankLinesTabPage_class_group_title=Blank lines within class declarations
366
#BlankLinesTabPage_class_option_before_first_decl=Before &first declaration:
367
#BlankLinesTabPage_class_option_before_decls_of_same_kind=Before declarations of the same &kind:
368
#BlankLinesTabPage_class_option_before_member_class_decls=Before member cla&ss declarations:
369
#BlankLinesTabPage_class_option_before_field_decls=B&efore field declarations:
370
#BlankLinesTabPage_class_option_before_method_decls=Before met&hod declarations:
371
#BlankLinesTabPage_class_option_at_beginning_of_method_body= At beginning of method bod&y:
372
373
#BlankLinesTabPage_blank_lines_group_title=Existing blank lines
374
#BlankLinesTabPage_blank_lines_option_empty_lines_to_preserve=N&umber of empty lines to preserve:
375
376
#BracesTabPage_preview_header=Braces
377
#BracesTabPage_position_same_line=Same line
378
#BracesTabPage_position_next_line=Next line
379
#BracesTabPage_position_next_line_indented=Next line indented
380
#BracesTabPage_position_next_line_on_wrap=Next line on wrap
381
382
#BracesTabPage_group_brace_positions_title=Brace positions
383
#BracesTabPage_option_class_declaration=&Class or interface declaration:
384
#BracesTabPage_option_anonymous_class_declaration=Anon&ymous class declaration:
385
#BracesTabPage_option_method_declaration=Met&hod declaration:
386
#BracesTabPage_option_constructor_declaration=Constr&uctor declaration:
387
#BracesTabPage_option_blocks=&Blocks:
388
#BracesTabPage_option_blocks_in_case=Bloc&ks in case statement:
389
#BracesTabPage_option_switch_case='&switch' statement:
390
#BracesTabPage_option_array_initializer=Array initiali&zer:
391
#BracesTabPage_option_keep_empty_array_initializer_on_one_line=Keep empty array &initializer on one line
392
#BracesTabPage_option_enum_declaration=&Enum declaration:
393
#BracesTabPage_option_enumconst_declaration=Enum c&onstant body:
394
#BracesTabPage_option_annotation_type_declaration=&Annotation type declaration:
395
CodingStyleConfigurationBlock_save_profile_dialog_title=Export Profile
396
CodingStyleConfigurationBlock_save_profile_error_title=Export Profile
397
CodingStyleConfigurationBlock_save_profile_error_message=Could not export the profiles.
398
CodingStyleConfigurationBlock_load_profile_dialog_title=Import Profile
399
CodingStyleConfigurationBlock_load_profile_error_title=Import Profile
400
CodingStyleConfigurationBlock_load_profile_error_message=Import failed. Not a valid profile.
401
CodingStyleConfigurationBlock_load_profile_error_too_new_title=Importing Profile
402
CodingStyleConfigurationBlock_load_profile_error_too_new_message=This profile has been created with \
403
a more recent CDT build than the one you are using. Due to changes in the code formatter, \
404
some older settings might be reset to their default values and newer settings are ignored. Please note \
405
that upgrading profiles from older to newer builds is fully supported.
406
CodingStyleConfigurationBlock_preview_title=A sample source file for the code formatter preview
407
CodingStyleConfigurationBlock_save_profile_overwrite_title=Export Profile
408
CodingStyleConfigurationBlock_save_profile_overwrite_message={0} " already exists.\nDo you want to replace it?"
409
CodingStyleConfigurationBlock_edit_button_desc=&Edit...
410
CodingStyleConfigurationBlock_show_button_desc=&Show...
411
CodingStyleConfigurationBlock_rename_button_desc=Re&name...
412
CodingStyleConfigurationBlock_remove_button_desc=&Remove
413
CodingStyleConfigurationBlock_new_button_desc=Ne&w...
414
CodingStyleConfigurationBlock_load_button_desc=I&mport...
415
CodingStyleConfigurationBlock_save_button_desc=E&xport...
416
CodingStyleConfigurationBlock_preview_label_text=Prev&iew:
417
CodingStyleConfigurationBlock_error_reading_xml_message=Problems reading profiles from XML
418
CodingStyleConfigurationBlock_error_serializing_xml_message=Problems serializing the profiles to XML
419
CodingStyleConfigurationBlock_delete_confirmation_title=Confirm Remove
420
CodingStyleConfigurationBlock_delete_confirmation_question=Are you sure you want to remove profile ''{0}''?
421
422
CustomCodeFormatterBlock_formatter_name=Code &Formatter:
423
CustomCodeFormatterBlock_no_formatter=(NONE)
424
425
#CommentsTabPage_group1_title=General settings
426
#CommentsTabPage_enable_comment_formatting=Enable &comment formatting
427
#CommentsTabPage_format_header=Format &header comment
428
#CommentsTabPage_format_html=Format HTML ta&gs
429
#CommentsTabPage_format_code_snippets=Format &C code snippets
430
431
#CommentsTabPage_clear_blank_lines=Clear &blank lines in comments
432
#CommentsTabPage_group3_title=Line width
433
#CommentsTabPage_line_width=Ma&ximum line width for comments:
434
435
436
#ControlStatementsTabPage_preview_header=If...else
437
#ControlStatementsTabPage_general_group_title=General
438
#ControlStatementsTabPage_general_group_insert_new_line_before_else_statements=Insert new line before '&else' in an 'if' statement
439
#ControlStatementsTabPage_general_group_insert_new_line_before_catch_statements=Insert new line before '&catch' in a 'try' statement
440
#ControlStatementsTabPage_general_group_insert_new_line_before_finally_statements=Insert new line before '&finally' in a 'try' statement
441
#ControlStatementsTabPage_general_group_insert_new_line_before_while_in_do_statements=Insert new line before 'w&hile' in a 'do' statement
442
443
#ControlStatementsTabPage_if_else_group_title='if else'
444
#ControlStatementsTabPage_if_else_group_keep_then_on_same_line=Keep 'then' statement &on same line
445
#ControlStatementsTabPage_if_else_group_keep_simple_if_on_one_line=Keep &simple 'if' on one line
446
#ControlStatementsTabPage_if_else_group_keep_else_on_same_line=Keep 'else' st&atement on same line
447
#ControlStatementsTabPage_if_else_group_keep_else_if_on_one_line=&Keep 'else if' on one line
448
#ControlStatementsTabPage_if_else_group_keep_guardian_clause_on_one_line=Keep 'return' or 'throw' cla&use on one line
449
450
CreateProfileDialog_status_message_profile_with_this_name_already_exists=A profile with this name already exists.
451
CreateProfileDialog_status_message_profile_name_is_empty=Profile name is empty
452
CreateProfileDialog_dialog_title=New Code Formatter Profile
453
CreateProfileDialog_profile_name_label_text=&Profile name:
454
CreateProfileDialog_base_profile_label_text=I&nitialize settings with the following profile:
455
CreateProfileDialog_open_edit_dialog_checkbox_text=&Open the edit dialog now
456
457
IndentationTabPage_preview_header=Indentation
458
459
IndentationTabPage_general_group_title=General settings
460
IndentationTabPage_general_group_option_tab_policy=Tab polic&y:
461
IndentationTabPage_general_group_option_tab_policy_SPACE=Spaces only
462
IndentationTabPage_general_group_option_tab_policy_TAB=Tabs only
463
IndentationTabPage_general_group_option_tab_policy_MIXED=Mixed
464
IndentationTabPage_general_group_option_tab_size=Tab &size:
465
IndentationTabPage_general_group_option_indent_size=&Indentation size:
466
467
IndentationTabPage_field_alignment_group_title=Alignment of fields in class declarations
468
IndentationTabPage_field_alignment_group_align_fields_in_columns=&Align fields in columns
469
470
IndentationTabPage_indent_group_title=Indent
471
472
IndentationTabPage_class_group_option_indent_declarations_within_class_body=Declarations within class &body
473
IndentationTabPage_class_group_option_indent_declarations_within_enum_const=Declarations within en&um constants
474
IndentationTabPage_class_group_option_indent_declarations_within_enum_decl=De&clarations within enum declaration
475
IndentationTabPage_block_group_option_indent_statements_compare_to_body=Stat&ements within method/constructor body
476
IndentationTabPage_block_group_option_indent_statements_compare_to_block=Statements within bl&ocks
477
IndentationTabPage_indent_empty_lines=Empty lines
478
479
IndentationTabPage_switch_group_option_indent_statements_within_switch_body=Statements wit&hin 'switch' body
480
IndentationTabPage_switch_group_option_indent_statements_within_case_body=Statements within 'case' bo&dy
481
IndentationTabPage_switch_group_option_indent_break_statements='brea&k' statements
482
483
IndentationTabPage_use_tabs_only_for_leading_indentations=Use tabs only for leading indentations
484
485
ModifyDialog_dialog_title=Edit Profile ''{0}''
486
ModifyDialog_apply_button=Apply
487
ModifyDialog_dialog_show_title=Show Profile ''{0}''
488
ModifyDialog_dialog_show_warning_builtin=This is a built-in profile, you will be prompted to enter a new name after closing this dialog.
489
ModifyDialog_tabpage_braces_title=B&races
490
ModifyDialog_tabpage_indentation_title=In&dentation
491
ModifyDialog_tabpage_whitespace_title=&White Space
492
ModifyDialog_tabpage_blank_lines_title=Bla&nk Lines
493
ModifyDialog_tabpage_new_lines_title=New &Lines
494
ModifyDialog_tabpage_control_statements_title=Con&trol Statements
495
ModifyDialog_tabpage_line_wrapping_title=Line Wra&pping
496
ModifyDialog_tabpage_comments_title=Co&mments
497
498
ModifyDialogTabPage_preview_label_text=Pre&view:
499
ModifyDialogTabPage_error_msg_values_text_unassigned=Values and text must be assigned.
500
ModifyDialogTabPage_error_msg_values_items_text_unassigned=Values, items and text must be assigned.
501
ModifyDialogTabPage_NumberPreference_error_invalid_key=The key {0} does not yield a valid integer value.
502
ModifyDialogTabPage_NumberPreference_error_invalid_value=Invalid value: Please enter a number between {0} and {1}.
503
504
#NewLinesTabPage_preview_header=New Lines
505
#NewLinesTabPage_newlines_group_title=Insert new line
506
507
#NewLinesTabPage_newlines_group_option_empty_class_body=in empty &class body
508
#NewLinesTabPage_newlines_group_option_empty_annotation_decl_body=in empty annotation body
509
#NewLinesTabPage_newlines_group_option_empty_anonymous_class_body=in empty &anonymous class body
510
#NewLinesTabPage_newlines_group_option_empty_enum_declaration=in empty &enum declaration
511
#NewLinesTabPage_newlines_group_option_empty_enum_constant=in empty enum c&onstant body
512
#NewLinesTabPage_newlines_group_option_empty_method_body=in empt&y method body
513
#NewLinesTabPage_newlines_group_option_empty_block=in empty &block
514
#NewLinesTabPage_newlines_group_option_empty_end_of_file=at end of &file
515
#NewLinesTabPage_empty_statement_group_title=Empty statements
516
#NewLinesTabPage_emtpy_statement_group_option_empty_statement_on_new_line=Put empty &statement on new line
517
518
#NewLinesTabPage_arrayInitializer_group_title=Array initializers
519
#NewLinesTabPage_array_group_option_after_opening_brace_of_array_initializer=Insert new line after openin&g brace of array initializer
520
#NewLinesTabPage_array_group_option_before_closing_brace_of_array_initializer=Insert new line before closing brace of array initiali&zer
521
522
#NewLinesTabPage_annotations_group_title=Annotations
523
#NewLinesTabPage_annotations_group_option_after_annotation=&Insert new line after annotations
524
525
ProfileManager_default_profile_name=Default [built-in]
526
527
ProfileManager_unmanaged_profile=Unmanaged profile
528
ProfileManager_unmanaged_profile_with_name=Unmanaged profile "{0}"
529
530
RenameProfileDialog_status_message_profile_with_this_name_already_exists=A profile with this name already exists.
531
RenameProfileDialog_status_message_profile_name_empty=Profile name is empty
532
RenameProfileDialog_dialog_title=Rename Profile
533
RenameProfileDialog_dialog_label_enter_a_new_name=Please &enter a new name:
534
535
CPreview_formatter_exception=The formatter threw an unhandled exception while formatting the preview.
(-)src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterMessages.java (+459 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
package org.eclipse.cdt.internal.ui.preferences.formatter;
13
14
import org.eclipse.osgi.util.NLS;
15
16
/**
17
 * Helper class to get NLSed messages.
18
 */
19
final class FormatterMessages extends NLS {
20
21
	private static final String BUNDLE_NAME= FormatterMessages.class.getName(); 
22
23
	private FormatterMessages() {
24
		// Do not instantiate
25
	}
26
27
//	public static String WhiteSpaceTabPage_assignments;
28
//	public static String WhiteSpaceTabPage_assignments_before_assignment_operator;
29
//	public static String WhiteSpaceTabPage_assignments_after_assignment_operator;
30
//	public static String WhiteSpaceTabPage_operators;
31
//	public static String WhiteSpaceTabPage_operators_before_binary_operators;
32
//	public static String WhiteSpaceTabPage_operators_after_binary_operators;
33
//	public static String WhiteSpaceTabPage_operators_before_unary_operators;
34
//	public static String WhiteSpaceTabPage_operators_after_unary_operators;
35
//	public static String WhiteSpaceTabPage_operators_before_prefix_operators;
36
//	public static String WhiteSpaceTabPage_operators_after_prefix_operators;
37
//	public static String WhiteSpaceTabPage_operators_before_postfix_operators;
38
//	public static String WhiteSpaceTabPage_operators_after_postfix_operators;
39
//	public static String WhiteSpaceTabPage_classes;
40
//	public static String WhiteSpaceTabPage_classes_before_opening_brace_of_a_class;
41
//	public static String WhiteSpaceTabPage_classes_before_opening_brace_of_anon_class;
42
//	public static String WhiteSpaceTabPage_classes_before_comma_implements;
43
//	public static String WhiteSpaceTabPage_classes_after_comma_implements;
44
//	public static String WhiteSpaceTabPage_methods;
45
//	public static String WhiteSpaceTabPage_constructors;
46
//	public static String WhiteSpaceTabPage_fields;
47
//	public static String WhiteSpaceTabPage_fields_before_comma;
48
//	public static String WhiteSpaceTabPage_fields_after_comma;
49
//	public static String WhiteSpaceTabPage_localvars;
50
//	public static String WhiteSpaceTabPage_localvars_before_comma;
51
//	public static String WhiteSpaceTabPage_localvars_after_comma;
52
//	public static String WhiteSpaceTabPage_arrayinit;
53
//	public static String WhiteSpaceTabPage_arraydecls;
54
//	public static String WhiteSpaceTabPage_arrayelem;
55
//	public static String WhiteSpaceTabPage_arrayalloc;
56
//	public static String WhiteSpaceTabPage_calls;
57
//	public static String WhiteSpaceTabPage_calls_before_comma_in_method_args;
58
//	public static String WhiteSpaceTabPage_calls_after_comma_in_method_args;
59
//	public static String WhiteSpaceTabPage_calls_before_comma_in_alloc;
60
//	public static String WhiteSpaceTabPage_calls_after_comma_in_alloc;
61
//	public static String WhiteSpaceTabPage_calls_before_comma_in_qalloc;
62
//	public static String WhiteSpaceTabPage_calls_after_comma_in_qalloc;
63
//	public static String WhiteSpaceTabPage_statements;
64
//	public static String WhiteSpaceTabPage_blocks;
65
//	public static String WhiteSpaceTabPage_switch;
66
//	public static String WhiteSpaceTabPage_switch_before_case_colon;
67
//	public static String WhiteSpaceTabPage_switch_before_default_colon;
68
//	public static String WhiteSpaceTabPage_do;
69
//	public static String WhiteSpaceTabPage_synchronized;
70
//	public static String WhiteSpaceTabPage_try;
71
//	public static String WhiteSpaceTabPage_if;
72
//	public static String WhiteSpaceTabPage_assert;
73
//	public static String WhiteSpaceTabPage_for;
74
//	public static String WhiteSpaceTabPage_for_before_comma_init;
75
//	public static String WhiteSpaceTabPage_for_after_comma_init;
76
//	public static String WhiteSpaceTabPage_for_before_comma_inc;
77
//	public static String WhiteSpaceTabPage_for_after_comma_inc;
78
//	public static String WhiteSpaceTabPage_labels;
79
//	public static String WhiteSpaceTabPage_annotations;
80
//	public static String WhiteSpaceTabPage_annotation_types;
81
//	public static String WhiteSpaceTabPage_enums;
82
//	public static String WhiteSpaceTabPage_wildcardtype;
83
//	public static String WhiteSpaceTabPage_param_type_ref;
84
//	public static String WhiteSpaceTabPage_type_arguments;
85
//	public static String WhiteSpaceTabPage_type_parameters;
86
//	public static String WhiteSpaceTabPage_conditionals;
87
//	public static String WhiteSpaceTabPage_typecasts;
88
//	public static String WhiteSpaceTabPage_parenexpr;
89
//	public static String WhiteSpaceTabPage_declarations;
90
//	public static String WhiteSpaceTabPage_expressions;
91
//	public static String WhiteSpaceTabPage_arrays;
92
//	public static String WhiteSpaceTabPage_parameterized_types;
93
//	public static String WhiteSpaceTabPage_after_opening_brace;
94
//	public static String WhiteSpaceTabPage_after_closing_brace;
95
//	public static String WhiteSpaceTabPage_before_opening_brace;
96
//	public static String WhiteSpaceTabPage_before_closing_brace;
97
//	public static String WhiteSpaceTabPage_between_empty_braces;
98
//	public static String WhiteSpaceTabPage_after_opening_paren;
99
//	public static String WhiteSpaceTabPage_after_closing_paren;
100
//	public static String WhiteSpaceTabPage_before_opening_paren;
101
//	public static String WhiteSpaceTabPage_before_closing_paren;
102
//	public static String WhiteSpaceTabPage_between_empty_parens;
103
//	public static String WhiteSpaceTabPage_after_opening_bracket;
104
//	public static String WhiteSpaceTabPage_before_opening_bracket;
105
//	public static String WhiteSpaceTabPage_before_closing_bracket;
106
//	public static String WhiteSpaceTabPage_between_empty_brackets;
107
//	public static String WhiteSpaceTabPage_before_comma_in_params;
108
//	public static String WhiteSpaceTabPage_after_comma_in_params;
109
//	public static String WhiteSpaceTabPage_before_comma_in_throws;
110
//	public static String WhiteSpaceTabPage_after_comma_in_throws;
111
//	public static String WhiteSpaceTabPage_before_ellipsis;
112
//	public static String WhiteSpaceTabPage_after_ellipsis;
113
//	public static String WhiteSpaceTabPage_before_comma;
114
//	public static String WhiteSpaceTabPage_after_comma;
115
//	public static String WhiteSpaceTabPage_after_semicolon;
116
//	public static String WhiteSpaceTabPage_before_semicolon;
117
//	public static String WhiteSpaceTabPage_before_colon;
118
//	public static String WhiteSpaceTabPage_after_colon;
119
//	public static String WhiteSpaceTabPage_before_question;
120
//	public static String WhiteSpaceTabPage_after_question;
121
//	public static String WhiteSpaceTabPage_before_at;
122
//	public static String WhiteSpaceTabPage_after_at;
123
//	public static String WhiteSpaceTabPage_after_opening_angle_bracket;
124
//	public static String WhiteSpaceTabPage_after_closing_angle_bracket;
125
//	public static String WhiteSpaceTabPage_before_opening_angle_bracket;
126
//	public static String WhiteSpaceTabPage_before_closing_angle_bracket;
127
//	public static String WhiteSpaceTabPage_before_and_list;
128
//	public static String WhiteSpaceTabPage_after_and_list;
129
//	public static String WhiteSpaceTabPage_enum_decl_before_opening_brace;
130
//	public static String WhiteSpaceTabPage_enum_decl_before_comma;
131
//	public static String WhiteSpaceTabPage_enum_decl_after_comma;
132
//	public static String WhiteSpaceTabPage_enum_const_arg_before_opening_paren;
133
//	public static String WhiteSpaceTabPage_enum_const_arg_after_opening_paren;
134
//	public static String WhiteSpaceTabPage_enum_const_arg_between_empty_parens;
135
//	public static String WhiteSpaceTabPage_enum_const_arg_before_comma;
136
//	public static String WhiteSpaceTabPage_enum_const_arg_after_comma;
137
//	public static String WhiteSpaceTabPage_enum_const_arg_before_closing_paren;
138
//	public static String WhiteSpaceTabPage_enum_const_before_opening_brace;
139
//	public static String WhiteSpaceTabPage_annot_type_method_before_opening_paren;
140
//	public static String WhiteSpaceTabPage_annot_type_method_between_empty_parens;
141
//	public static String WhiteSpaceTabPage_before_parenthesized_expressions;
142
//	public static String WhiteSpaceTabPage_insert_space;
143
//	public static String WhiteSpaceTabPage_sort_by_c_element;
144
//	public static String WhiteSpaceTabPage_sort_by_syntax_element;
145
//	public static String WhiteSpaceOptions_return;
146
//	public static String WhiteSpaceOptions_before;
147
//	public static String WhiteSpaceOptions_after;
148
//	public static String WhiteSpaceOptions_operator;
149
//	public static String WhiteSpaceOptions_assignment_operator;
150
//	public static String WhiteSpaceOptions_binary_operator;
151
//	public static String WhiteSpaceOptions_unary_operator;
152
//	public static String WhiteSpaceOptions_prefix_operator;
153
//	public static String WhiteSpaceOptions_postfix_operator;
154
//	public static String WhiteSpaceOptions_opening_paren;
155
//	public static String WhiteSpaceOptions_catch;
156
//	public static String WhiteSpaceOptions_for;
157
//	public static String WhiteSpaceOptions_if;
158
//	public static String WhiteSpaceOptions_switch;
159
//	public static String WhiteSpaceOptions_synchronized;
160
//	public static String WhiteSpaceOptions_while;
161
//	public static String WhiteSpaceOptions_assert;
162
//	public static String WhiteSpaceOptions_member_function_declaration;
163
//	public static String WhiteSpaceOptions_constructor;
164
//	public static String WhiteSpaceOptions_method;
165
//	public static String WhiteSpaceOptions_method_call;
166
//	public static String WhiteSpaceOptions_paren_expr;
167
//	public static String WhiteSpaceOptions_enum_constant_body;
168
//	public static String WhiteSpaceOptions_enum_constant_arguments;
169
//	public static String WhiteSpaceOptions_enum_declaration;
170
//	public static String WhiteSpaceOptions_annotation_modifier;
171
//	public static String WhiteSpaceOptions_annotation_modifier_args;
172
//	public static String WhiteSpaceOptions_annotation_type_member;
173
//	public static String WhiteSpaceOptions_annotation_type;
174
//	public static String WhiteSpaceOptions_type_cast;
175
//	public static String WhiteSpaceOptions_parameterized_type;
176
//	public static String WhiteSpaceOptions_type_arguments;
177
//	public static String WhiteSpaceOptions_type_parameters;
178
//	public static String WhiteSpaceOptions_vararg_parameter;
179
//	public static String WhiteSpaceOptions_closing_paren;
180
//	public static String WhiteSpaceOptions_opening_brace;
181
//	public static String WhiteSpaceOptions_closing_brace;
182
//	public static String WhiteSpaceOptions_opening_bracket;
183
//	public static String WhiteSpaceOptions_closing_bracket;
184
//	public static String WhiteSpaceOptions_class_decl;
185
//	public static String WhiteSpaceOptions_anon_class_decl;
186
//	public static String WhiteSpaceOptions_initializer;
187
//	public static String WhiteSpaceOptions_block;
188
//	public static String WhiteSpaceOptions_array_decl;
189
//	public static String WhiteSpaceOptions_array_element_access;
190
//	public static String WhiteSpaceOptions_array_alloc;
191
//	public static String WhiteSpaceOptions_array_init;
192
//	public static String WhiteSpaceOptions_arguments;
193
//	public static String WhiteSpaceOptions_initialization;
194
//	public static String WhiteSpaceOptions_incrementation;
195
//	public static String WhiteSpaceOptions_parameters;
196
//	public static String WhiteSpaceOptions_explicit_constructor_call;
197
//	public static String WhiteSpaceOptions_alloc_expr;
198
//	public static String WhiteSpaceOptions_throws;
199
//	public static String WhiteSpaceOptions_mult_decls;
200
//	public static String WhiteSpaceOptions_local_vars;
201
//	public static String WhiteSpaceOptions_fields;
202
//	public static String WhiteSpaceOptions_implements_clause;
203
//	public static String WhiteSpaceOptions_colon;
204
//	public static String WhiteSpaceOptions_conditional;
205
//	public static String WhiteSpaceOptions_wildcard;
206
//	public static String WhiteSpaceOptions_label;
207
//	public static String WhiteSpaceOptions_comma;
208
//	public static String WhiteSpaceOptions_semicolon;
209
//	public static String WhiteSpaceOptions_question_mark;
210
//	public static String WhiteSpaceOptions_between_empty_parens;
211
//	public static String WhiteSpaceOptions_between_empty_braces;
212
//	public static String WhiteSpaceOptions_between_empty_brackets;
213
//	public static String WhiteSpaceOptions_constructor_decl;
214
//	public static String WhiteSpaceOptions_method_decl;
215
//	public static String WhiteSpaceOptions_case;
216
//	public static String WhiteSpaceOptions_default;
217
//	public static String WhiteSpaceOptions_statements;
218
//	public static String WhiteSpaceOptions_before_opening_paren;
219
//	public static String WhiteSpaceOptions_after_opening_paren;
220
//	public static String WhiteSpaceOptions_before_closing_paren;
221
//	public static String WhiteSpaceOptions_after_closing_paren;
222
//	public static String WhiteSpaceOptions_before_opening_brace;
223
//	public static String WhiteSpaceOptions_after_opening_brace;
224
//	public static String WhiteSpaceOptions_after_closing_brace;
225
//	public static String WhiteSpaceOptions_before_closing_brace;
226
//	public static String WhiteSpaceOptions_before_opening_bracket;
227
//	public static String WhiteSpaceOptions_after_opening_bracket;
228
//	public static String WhiteSpaceOptions_before_closing_bracket;
229
//	public static String WhiteSpaceOptions_before_opening_angle_bracket;
230
//	public static String WhiteSpaceOptions_after_opening_angle_bracket;
231
//	public static String WhiteSpaceOptions_before_closing_angle_bracket;
232
//	public static String WhiteSpaceOptions_after_closing_angle_bracket;
233
//	public static String WhiteSpaceOptions_before_operator;
234
//	public static String WhiteSpaceOptions_after_operator;
235
//	public static String WhiteSpaceOptions_before_comma;
236
//	public static String WhiteSpaceOptions_after_comma;
237
//	public static String WhiteSpaceOptions_after_colon;
238
//	public static String WhiteSpaceOptions_before_colon;
239
//	public static String WhiteSpaceOptions_before_semicolon;
240
//	public static String WhiteSpaceOptions_after_semicolon;
241
//	public static String WhiteSpaceOptions_before_question_mark;
242
//	public static String WhiteSpaceOptions_after_question_mark;
243
//	public static String WhiteSpaceOptions_before_at;
244
//	public static String WhiteSpaceOptions_after_at;
245
//	public static String WhiteSpaceOptions_before_and;
246
//	public static String WhiteSpaceOptions_after_and;
247
//	public static String WhiteSpaceOptions_before_ellipsis;
248
//	public static String WhiteSpaceOptions_after_ellipsis;
249
//	public static String WhiteSpaceOptions_return_with_parenthesized_expression;
250
//	public static String LineWrappingTabPage_compact_if_else;
251
//	public static String LineWrappingTabPage_extends_clause;
252
//	public static String LineWrappingTabPage_enum_constant_arguments;
253
//	public static String LineWrappingTabPage_enum_constants;
254
//	public static String LineWrappingTabPage_implements_clause;
255
//	public static String LineWrappingTabPage_parameters;
256
//	public static String LineWrappingTabPage_arguments;
257
//	public static String LineWrappingTabPage_qualified_invocations;
258
//	public static String LineWrappingTabPage_throws_clause;
259
//	public static String LineWrappingTabPage_object_allocation;
260
//	public static String LineWrappingTabPage_qualified_object_allocation;
261
//	public static String LineWrappingTabPage_array_init;
262
//	public static String LineWrappingTabPage_explicit_constructor_invocations;
263
//	public static String LineWrappingTabPage_conditionals;
264
//	public static String LineWrappingTabPage_binary_exprs;
265
//	public static String LineWrappingTabPage_indentation_default;
266
//	public static String LineWrappingTabPage_indentation_on_column;
267
//	public static String LineWrappingTabPage_indentation_by_one;
268
//	public static String LineWrappingTabPage_class_decls;
269
//	public static String LineWrappingTabPage_method_decls;
270
//	public static String LineWrappingTabPage_constructor_decls;
271
//	public static String LineWrappingTabPage_function_calls;
272
//	public static String LineWrappingTabPage_expressions;
273
//	public static String LineWrappingTabPage_statements;
274
//	public static String LineWrappingTabPage_enum_decls;
275
//	public static String LineWrappingTabPage_wrapping_policy_label_text;
276
//	public static String LineWrappingTabPage_indentation_policy_label_text;
277
//	public static String LineWrappingTabPage_force_split_checkbox_text;
278
//	public static String LineWrappingTabPage_force_split_checkbox_multi_text;
279
//	public static String LineWrappingTabPage_line_width_for_preview_label_text;
280
//	public static String LineWrappingTabPage_group;
281
//	public static String LineWrappingTabPage_multi_group;
282
//	public static String LineWrappingTabPage_multiple_selections;
283
//	public static String LineWrappingTabPage_occurences;
284
//	public static String LineWrappingTabPage_splitting_do_not_split;
285
//	public static String LineWrappingTabPage_splitting_wrap_when_necessary;
286
//	public static String LineWrappingTabPage_splitting_always_wrap_first_others_when_necessary;
287
//	public static String LineWrappingTabPage_splitting_wrap_always;
288
//	public static String LineWrappingTabPage_splitting_wrap_always_indent_all_but_first;
289
//	public static String LineWrappingTabPage_splitting_wrap_always_except_first_only_if_necessary;
290
//	public static String LineWrappingTabPage_width_indent;
291
//	public static String LineWrappingTabPage_width_indent_option_max_line_width;
292
//	public static String LineWrappingTabPage_width_indent_option_default_indent_wrapped;
293
//	public static String LineWrappingTabPage_width_indent_option_default_indent_array;
294
//	public static String LineWrappingTabPage_error_invalid_value;
295
//	public static String LineWrappingTabPage_enum_superinterfaces;
296
//	public static String LineWrappingTabPage_assignment_alignment;
297
	public static String AlreadyExistsDialog_message_profile_already_exists;
298
	public static String AlreadyExistsDialog_message_profile_name_empty;
299
	public static String AlreadyExistsDialog_dialog_title;
300
	public static String AlreadyExistsDialog_dialog_label;
301
	public static String AlreadyExistsDialog_rename_radio_button_desc;
302
	public static String AlreadyExistsDialog_overwrite_radio_button_desc;
303
//	public static String BlankLinesTabPage_preview_header;
304
//	public static String BlankLinesTabPage_compilation_unit_group_title;
305
//	public static String BlankLinesTabPage_compilation_unit_option_before_package;
306
//	public static String BlankLinesTabPage_compilation_unit_option_after_package;
307
//	public static String BlankLinesTabPage_compilation_unit_option_before_import;
308
//	public static String BlankLinesTabPage_compilation_unit_option_after_import;
309
//	public static String BlankLinesTabPage_compilation_unit_option_between_type_declarations;
310
//	public static String BlankLinesTabPage_class_group_title;
311
//	public static String BlankLinesTabPage_class_option_before_first_decl;
312
//	public static String BlankLinesTabPage_class_option_before_decls_of_same_kind;
313
//	public static String BlankLinesTabPage_class_option_before_member_class_decls;
314
//	public static String BlankLinesTabPage_class_option_before_field_decls;
315
//	public static String BlankLinesTabPage_class_option_before_method_decls;
316
//	public static String BlankLinesTabPage_class_option_at_beginning_of_method_body;
317
//	public static String BlankLinesTabPage_blank_lines_group_title;
318
//	public static String BlankLinesTabPage_blank_lines_option_empty_lines_to_preserve;
319
//	public static String BracesTabPage_preview_header;
320
//	public static String BracesTabPage_position_same_line;
321
//	public static String BracesTabPage_position_next_line;
322
//	public static String BracesTabPage_position_next_line_indented;
323
//	public static String BracesTabPage_position_next_line_on_wrap;
324
//	public static String BracesTabPage_group_brace_positions_title;
325
//	public static String BracesTabPage_option_class_declaration;
326
//	public static String BracesTabPage_option_anonymous_class_declaration;
327
//	public static String BracesTabPage_option_method_declaration;
328
//	public static String BracesTabPage_option_constructor_declaration;
329
//	public static String BracesTabPage_option_blocks;
330
//	public static String BracesTabPage_option_blocks_in_case;
331
//	public static String BracesTabPage_option_switch_case;
332
//	public static String BracesTabPage_option_array_initializer;
333
//	public static String BracesTabPage_option_keep_empty_array_initializer_on_one_line;
334
//	public static String BracesTabPage_option_enum_declaration;
335
//	public static String BracesTabPage_option_enumconst_declaration;
336
//	public static String BracesTabPage_option_annotation_type_declaration;
337
	public static String CodingStyleConfigurationBlock_save_profile_dialog_title;
338
	public static String CodingStyleConfigurationBlock_save_profile_error_title;
339
	public static String CodingStyleConfigurationBlock_save_profile_error_message;
340
	public static String CodingStyleConfigurationBlock_load_profile_dialog_title;
341
	public static String CodingStyleConfigurationBlock_load_profile_error_title;
342
	public static String CodingStyleConfigurationBlock_load_profile_error_message;
343
	public static String CodingStyleConfigurationBlock_load_profile_error_too_new_title;
344
	public static String CodingStyleConfigurationBlock_load_profile_error_too_new_message;
345
	public static String CodingStyleConfigurationBlock_preview_title;
346
	public static String CodingStyleConfigurationBlock_save_profile_overwrite_title;
347
	public static String CodingStyleConfigurationBlock_save_profile_overwrite_message;
348
	public static String CodingStyleConfigurationBlock_edit_button_desc;
349
	public static String CodingStyleConfigurationBlock_show_button_desc;
350
	public static String CodingStyleConfigurationBlock_rename_button_desc;
351
	public static String CodingStyleConfigurationBlock_remove_button_desc;
352
	public static String CodingStyleConfigurationBlock_new_button_desc;
353
	public static String CodingStyleConfigurationBlock_load_button_desc;
354
	public static String CodingStyleConfigurationBlock_save_button_desc;
355
	public static String CodingStyleConfigurationBlock_preview_label_text;
356
	public static String CodingStyleConfigurationBlock_error_reading_xml_message;
357
	public static String CodingStyleConfigurationBlock_error_serializing_xml_message;
358
	public static String CodingStyleConfigurationBlock_delete_confirmation_title;
359
	public static String CodingStyleConfigurationBlock_delete_confirmation_question;
360
	public static String CustomCodeFormatterBlock_formatter_name;
361
	public static String CustomCodeFormatterBlock_no_formatter;
362
//	public static String CommentsTabPage_group1_title;
363
//	public static String CommentsTabPage_enable_comment_formatting;
364
//	public static String CommentsTabPage_format_header;
365
//	public static String CommentsTabPage_format_html;
366
//	public static String CommentsTabPage_format_code_snippets;
367
//	public static String CommentsTabPage_group2_title;
368
//	public static String CommentsTabPage_clear_blank_lines;
369
//	public static String CommentsTabPage_indent_description_after_param;
370
//	public static String CommentsTabPage_new_line_after_param_tags;
371
//	public static String CommentsTabPage_group3_title;
372
//	public static String CommentsTabPage_line_width;
373
//	public static String ControlStatementsTabPage_preview_header;
374
//	public static String ControlStatementsTabPage_general_group_title;
375
//	public static String ControlStatementsTabPage_general_group_insert_new_line_before_else_statements;
376
//	public static String ControlStatementsTabPage_general_group_insert_new_line_before_catch_statements;
377
//	public static String ControlStatementsTabPage_general_group_insert_new_line_before_finally_statements;
378
//	public static String ControlStatementsTabPage_general_group_insert_new_line_before_while_in_do_statements;
379
//	public static String ControlStatementsTabPage_if_else_group_title;
380
//	public static String ControlStatementsTabPage_if_else_group_keep_then_on_same_line;
381
//	public static String ControlStatementsTabPage_if_else_group_keep_simple_if_on_one_line;
382
//	public static String ControlStatementsTabPage_if_else_group_keep_else_on_same_line;
383
//	public static String ControlStatementsTabPage_if_else_group_keep_else_if_on_one_line;
384
//	public static String ControlStatementsTabPage_if_else_group_keep_guardian_clause_on_one_line;
385
	public static String CreateProfileDialog_status_message_profile_with_this_name_already_exists;
386
	public static String CreateProfileDialog_status_message_profile_name_is_empty;
387
	public static String CreateProfileDialog_dialog_title;
388
	public static String CreateProfileDialog_profile_name_label_text;
389
	public static String CreateProfileDialog_base_profile_label_text;
390
	public static String CreateProfileDialog_open_edit_dialog_checkbox_text;
391
	public static String IndentationTabPage_preview_header;
392
	public static String IndentationTabPage_general_group_title;
393
	public static String IndentationTabPage_general_group_option_tab_policy;
394
	public static String IndentationTabPage_general_group_option_tab_policy_SPACE;
395
	public static String IndentationTabPage_general_group_option_tab_policy_TAB;
396
	public static String IndentationTabPage_general_group_option_tab_policy_MIXED;
397
	public static String IndentationTabPage_general_group_option_tab_size;
398
	public static String IndentationTabPage_general_group_option_indent_size;
399
	public static String IndentationTabPage_field_alignment_group_title;
400
	public static String IndentationTabPage_field_alignment_group_align_fields_in_columns;
401
	public static String IndentationTabPage_indent_group_title;
402
	public static String IndentationTabPage_class_group_option_indent_declarations_within_class_body;
403
	public static String IndentationTabPage_class_group_option_indent_declarations_within_enum_const;
404
	public static String IndentationTabPage_class_group_option_indent_declarations_within_enum_decl;
405
	public static String IndentationTabPage_block_group_option_indent_statements_compare_to_body;
406
	public static String IndentationTabPage_block_group_option_indent_statements_compare_to_block;
407
	public static String IndentationTabPage_switch_group_option_indent_statements_within_switch_body;
408
	public static String IndentationTabPage_switch_group_option_indent_statements_within_case_body;
409
	public static String IndentationTabPage_switch_group_option_indent_break_statements;
410
    public static String IndentationTabPage_indent_empty_lines;
411
	public static String IndentationTabPage_use_tabs_only_for_leading_indentations;
412
	public static String ModifyDialog_dialog_title;
413
	public static String ModifyDialog_apply_button;
414
	public static String ModifyDialog_dialog_show_title;
415
	public static String ModifyDialog_dialog_show_warning_builtin;
416
	public static String ModifyDialog_tabpage_braces_title;
417
	public static String ModifyDialog_tabpage_indentation_title;
418
	public static String ModifyDialog_tabpage_whitespace_title;
419
	public static String ModifyDialog_tabpage_blank_lines_title;
420
	public static String ModifyDialog_tabpage_new_lines_title;
421
	public static String ModifyDialog_tabpage_control_statements_title;
422
	public static String ModifyDialog_tabpage_line_wrapping_title;
423
	public static String ModifyDialog_tabpage_comments_title;
424
	public static String ModifyDialogTabPage_preview_label_text;
425
	public static String ModifyDialogTabPage_error_msg_values_text_unassigned;
426
	public static String ModifyDialogTabPage_error_msg_values_items_text_unassigned;
427
	public static String ModifyDialogTabPage_NumberPreference_error_invalid_key;
428
	public static String ModifyDialogTabPage_NumberPreference_error_invalid_value;
429
//	public static String NewLinesTabPage_preview_header;
430
//	public static String NewLinesTabPage_newlines_group_title;
431
//	public static String NewLinesTabPage_newlines_group_option_empty_class_body;
432
//	public static String NewLinesTabPage_newlines_group_option_empty_annotation_decl_body;
433
//	public static String NewLinesTabPage_newlines_group_option_empty_anonymous_class_body;
434
//	public static String NewLinesTabPage_newlines_group_option_empty_enum_declaration;
435
//	public static String NewLinesTabPage_newlines_group_option_empty_enum_constant;
436
//	public static String NewLinesTabPage_newlines_group_option_empty_method_body;
437
//	public static String NewLinesTabPage_newlines_group_option_empty_block;
438
//	public static String NewLinesTabPage_newlines_group_option_empty_end_of_file;
439
//	public static String NewLinesTabPage_empty_statement_group_title;
440
//	public static String NewLinesTabPage_emtpy_statement_group_option_empty_statement_on_new_line;
441
//	public static String NewLinesTabPage_arrayInitializer_group_title;
442
//	public static String NewLinesTabPage_array_group_option_after_opening_brace_of_array_initializer;
443
//	public static String NewLinesTabPage_array_group_option_before_closing_brace_of_array_initializer;
444
//	public static String NewLinesTabPage_annotations_group_title;
445
//	public static String NewLinesTabPage_annotations_group_option_after_annotation;
446
	public static String ProfileManager_default_profile_name;
447
	public static String ProfileManager_unmanaged_profile;
448
	public static String ProfileManager_unmanaged_profile_with_name;
449
	public static String RenameProfileDialog_status_message_profile_with_this_name_already_exists;
450
	public static String RenameProfileDialog_status_message_profile_name_empty;
451
	public static String RenameProfileDialog_dialog_title;
452
	public static String RenameProfileDialog_dialog_label_enter_a_new_name;
453
454
	public static String CPreview_formatter_exception;
455
456
	static {
457
		NLS.initializeMessages(BUNDLE_NAME, FormatterMessages.class);
458
	}
459
}
(-)src/org/eclipse/cdt/internal/ui/preferences/formatter/CompilationUnitPreview.java (+79 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
13
package org.eclipse.cdt.internal.ui.preferences.formatter;
14
15
import java.util.Map;
16
17
import org.eclipse.core.runtime.IStatus;
18
import org.eclipse.core.runtime.Status;
19
20
import org.eclipse.swt.widgets.Composite;
21
22
import org.eclipse.jface.text.Region;
23
import org.eclipse.jface.text.formatter.FormattingContextProperties;
24
import org.eclipse.jface.text.formatter.IContentFormatter;
25
import org.eclipse.jface.text.formatter.IContentFormatterExtension;
26
import org.eclipse.jface.text.formatter.IFormattingContext;
27
28
import org.eclipse.cdt.internal.ui.ICStatusConstants;
29
import org.eclipse.cdt.internal.ui.text.comment.CommentFormattingContext;
30
31
import org.eclipse.cdt.ui.CUIPlugin;
32
33
34
public class CompilationUnitPreview extends CPreview {
35
36
    private String fPreviewText;
37
38
    /**
39
     * @param workingValues
40
     * @param parent
41
     */
42
    public CompilationUnitPreview(Map workingValues, Composite parent) {
43
        super(workingValues, parent);
44
    }
45
46
    protected void doFormatPreview() {
47
        if (fPreviewText == null) {
48
            fPreviewDocument.set(""); //$NON-NLS-1$
49
            return;
50
        }
51
        fPreviewDocument.set(fPreviewText);
52
		
53
		fSourceViewer.setRedraw(false);
54
		final IFormattingContext context = new CommentFormattingContext();
55
		try {
56
			final IContentFormatter formatter =	fViewerConfiguration.getContentFormatter(fSourceViewer);
57
			if (formatter instanceof IContentFormatterExtension) {
58
				final IContentFormatterExtension extension = (IContentFormatterExtension) formatter;
59
				context.setProperty(FormattingContextProperties.CONTEXT_PREFERENCES, fWorkingValues);
60
				context.setProperty(FormattingContextProperties.CONTEXT_DOCUMENT, Boolean.valueOf(true));
61
				extension.format(fPreviewDocument, context);
62
			} else
63
				formatter.format(fPreviewDocument, new Region(0, fPreviewDocument.getLength()));
64
		} catch (Exception e) {
65
			final IStatus status= new Status(IStatus.ERROR, CUIPlugin.getPluginId(), ICStatusConstants.INTERNAL_ERROR, 
66
				FormatterMessages.CPreview_formatter_exception, e); 
67
			CUIPlugin.getDefault().log(status);
68
		} finally {
69
		    context.dispose();
70
		    fSourceViewer.setRedraw(true);
71
		}
72
    }
73
    
74
    public void setPreviewText(String previewText) {
75
//        if (previewText == null) throw new IllegalArgumentException();
76
        fPreviewText= previewText;
77
        update();
78
    }
79
}
(-)src/org/eclipse/cdt/internal/ui/text/comment/CommentFormattingContext.java (+52 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
13
package org.eclipse.cdt.internal.ui.text.comment;
14
15
import org.eclipse.jface.text.formatter.FormattingContext;
16
17
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
18
19
/**
20
 * Formatting context for the comment formatter.
21
 *
22
 * @since 4.0
23
 */
24
public class CommentFormattingContext extends FormattingContext {
25
26
	/*
27
	 * @see org.eclipse.jface.text.formatter.IFormattingContext#getPreferenceKeys()
28
	 */
29
	public String[] getPreferenceKeys() {
30
		return new String[] {
31
			    DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT,
32
			    DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HEADER,
33
			    DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_SOURCE,
34
			    DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH,
35
			    DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES};
36
	}
37
38
39
	/*
40
	 * @see org.eclipse.jface.text.formatter.IFormattingContext#isBooleanPreference(java.lang.String)
41
	 */
42
	public boolean isBooleanPreference(String key) {
43
		return !key.equals(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH);
44
	}
45
46
	/*
47
	 * @see org.eclipse.jface.text.formatter.IFormattingContext#isIntegerPreference(java.lang.String)
48
	 */
49
	public boolean isIntegerPreference(String key) {
50
		return key.equals(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH);
51
	}
52
}
(-)src/org/eclipse/cdt/internal/ui/preferences/SmartTypingPreferencePage.java (+59 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporatio - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
13
package org.eclipse.cdt.internal.ui.preferences;
14
15
import org.eclipse.swt.widgets.Composite;
16
import org.eclipse.swt.widgets.Label;
17
18
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
19
import org.eclipse.cdt.ui.CUIPlugin;
20
21
/**
22
 * The page for setting the editor options.
23
 */
24
public final class SmartTypingPreferencePage extends AbstractConfigurationBlockPreferencePage {
25
	
26
	/*
27
	 * @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#getHelpId()
28
	 */
29
	protected String getHelpId() {
30
		return ICHelpContextIds.C_EDITOR_TYPING_PAGE;
31
	}
32
33
	/*
34
	 * @see org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setDescription()
35
	 */
36
	protected void setDescription() {
37
		String description= PreferencesMessages.CEditorPreferencePage_typing_tabTitle; 
38
		setDescription(description);
39
	}
40
	
41
	/*
42
	 * @see org.org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setPreferenceStore()
43
	 */
44
	protected void setPreferenceStore() {
45
		setPreferenceStore(CUIPlugin.getDefault().getPreferenceStore());
46
	}
47
	
48
	
49
	protected Label createDescriptionLabel(Composite parent) {
50
		return null; // no description for new look.
51
	}
52
	
53
	/*
54
	 * @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#createConfigurationBlock(org.eclipse.ui.internal.editors.text.OverlayPreferenceStore)
55
	 */
56
	protected IPreferenceConfigurationBlock createConfigurationBlock(OverlayPreferenceStore overlayPreferenceStore) {
57
		return new SmartTypingConfigurationBlock(overlayPreferenceStore);
58
	}
59
}
(-)src/org/eclipse/cdt/internal/ui/preferences/formatter/ProfileVersioner.java (+63 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
13
package org.eclipse.cdt.internal.ui.preferences.formatter;
14
15
import java.util.Iterator;
16
import java.util.Map;
17
18
import org.eclipse.cdt.internal.ui.preferences.formatter.ProfileManager.CustomProfile;
19
20
21
public class ProfileVersioner {
22
	
23
	public static final int VERSION_1= 1; // < 20040113 (includes M6)
24
	
25
	public static final int CURRENT_VERSION= VERSION_1;
26
	
27
	public static int getVersionStatus(CustomProfile profile) {
28
		final int version= profile.getVersion();
29
		if (version < CURRENT_VERSION) 
30
			return -1;
31
		else if (version > CURRENT_VERSION)
32
			return 1;
33
		else 
34
			return 0;
35
	}
36
	
37
	public static void updateAndComplete(CustomProfile profile) {
38
		final Map oldSettings= profile.getSettings();
39
		Map newSettings= updateAndComplete(oldSettings, profile.getVersion());
40
		profile.setVersion(CURRENT_VERSION);
41
		profile.setSettings(newSettings);
42
	}
43
	
44
	public static Map updateAndComplete(Map oldSettings, int version) {
45
		final Map newSettings= ProfileManager.getDefaultSettings();
46
		
47
		switch (version) {
48
		    
49
		default:
50
		    for (final Iterator iter= oldSettings.keySet().iterator(); iter.hasNext(); ) {
51
		        final String key= (String)iter.next();
52
		        if (!newSettings.containsKey(key)) 
53
		            continue;
54
		        
55
		        final String value= (String)oldSettings.get(key);
56
		        if (value != null) {
57
		            newSettings.put(key, value);
58
		        }
59
		    }
60
		}
61
		return newSettings;
62
	}
63
 }
(-)src/org/eclipse/cdt/internal/ui/preferences/formatter/IndentationTabPage.java (+180 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     istvan@benedek-home.de - 103706 [formatter] indent empty lines
11
 *     Sergey Prigogin, Google
12
 *******************************************************************************/
13
package org.eclipse.cdt.internal.ui.preferences.formatter;
14
15
import java.util.Map;
16
import java.util.Observable;
17
import java.util.Observer;
18
19
import org.eclipse.swt.widgets.Composite;
20
import org.eclipse.swt.widgets.Group;
21
22
import org.eclipse.jface.text.Assert;
23
24
import org.eclipse.cdt.core.CCorePlugin;
25
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
26
27
28
public class IndentationTabPage extends ModifyDialogTabPage {
29
	
30
//	private final String PREVIEW=
31
//	createPreviewHeader(FormatterMessages.IndentationTabPage_preview_header) + 
32
//	"class Example {" +	//$NON-NLS-1$
33
//	"  int [] myArray= {1,2,3,4,5,6};" + //$NON-NLS-1$
34
//	"  int theInt= 1;" + //$NON-NLS-1$
35
//	"  String someString= \"Hello\";" + //$NON-NLS-1$
36
//	"  double aDouble= 3.0;" + //$NON-NLS-1$
37
//	"  void foo(int a, int b, int c, int d, int e, int f) {" + //$NON-NLS-1$
38
//	"    switch(a) {" + //$NON-NLS-1$
39
//	"    case 0: " + //$NON-NLS-1$
40
//	"      Other.doFoo();" + //$NON-NLS-1$
41
//	"      break;" + //$NON-NLS-1$
42
//	"    default:" + //$NON-NLS-1$
43
//	"      Other.doBaz();" + //$NON-NLS-1$
44
//	"    }" + //$NON-NLS-1$
45
//	"  }" + //$NON-NLS-1$
46
//	"  void bar(List v) {" + //$NON-NLS-1$
47
//	"    for (int i= 0; i < 10; i++) {" + //$NON-NLS-1$
48
// 	"      v.add(new Integer(i));" + //$NON-NLS-1$
49
// 	"    }" + //$NON-NLS-1$
50
//	"  }" + //$NON-NLS-1$
51
//	"}" + //$NON-NLS-1$
52
//	"\n" + //$NON-NLS-1$
53
//	"enum MyEnum {" + //$NON-NLS-1$
54
//	"    UNDEFINED(0) {" + //$NON-NLS-1$
55
//	"        void foo() {}" + //$NON-NLS-1$
56
//	"    }" + //$NON-NLS-1$
57
//	"}" + //$NON-NLS-1$
58
//	"@interface MyAnnotation {" + //$NON-NLS-1$
59
//	"    int count() default 1;" + //$NON-NLS-1$
60
//	"}";//$NON-NLS-1$
61
	
62
//	private CompilationUnitPreview fPreview;
63
	private String fOldTabChar= null;
64
	
65
	public IndentationTabPage(ModifyDialog modifyDialog, Map workingValues) {
66
		super(modifyDialog, workingValues);
67
	}
68
69
	protected void doCreatePreferences(Composite composite, int numColumns) {
70
71
		final Group generalGroup= createGroup(numColumns, composite, FormatterMessages.IndentationTabPage_general_group_title); 
72
		
73
		final String[] tabPolicyValues= new String[] {CCorePlugin.SPACE, CCorePlugin.TAB, DefaultCodeFormatterConstants.MIXED};
74
		final String[] tabPolicyLabels= new String[] {
75
				FormatterMessages.IndentationTabPage_general_group_option_tab_policy_SPACE, 
76
				FormatterMessages.IndentationTabPage_general_group_option_tab_policy_TAB, 
77
				FormatterMessages.IndentationTabPage_general_group_option_tab_policy_MIXED
78
		};
79
		final ComboPreference tabPolicy= createComboPref(generalGroup, numColumns, FormatterMessages.IndentationTabPage_general_group_option_tab_policy, DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, tabPolicyValues, tabPolicyLabels);
80
		final CheckboxPreference onlyForLeading= createCheckboxPref(generalGroup, numColumns, FormatterMessages.IndentationTabPage_use_tabs_only_for_leading_indentations, DefaultCodeFormatterConstants.FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS, FALSE_TRUE);
81
		final NumberPreference indentSize= createNumberPref(generalGroup, numColumns, FormatterMessages.IndentationTabPage_general_group_option_indent_size, DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, 0, 32); 
82
		final NumberPreference tabSize= createNumberPref(generalGroup, numColumns, FormatterMessages.IndentationTabPage_general_group_option_tab_size, DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, 0, 32);
83
		
84
		String tabchar= (String) fWorkingValues.get(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR);
85
		updateTabPreferences(tabchar, tabSize, indentSize, onlyForLeading);
86
		tabPolicy.addObserver(new Observer() {
87
			public void update(Observable o, Object arg) {
88
				updateTabPreferences((String) arg, tabSize, indentSize, onlyForLeading);
89
			}
90
		});
91
		tabSize.addObserver(new Observer() {
92
			public void update(Observable o, Object arg) {
93
				indentSize.updateWidget();
94
			}
95
		});
96
		
97
//		final Group typeMemberGroup= createGroup(numColumns, composite, FormatterMessages.IndentationTabPage_field_alignment_group_title); 
98
//		createCheckboxPref(typeMemberGroup, numColumns, FormatterMessages.IndentationTabPage_field_alignment_group_align_fields_in_columns, DefaultCodeFormatterConstants.FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS, FALSE_TRUE); 
99
		
100
		final Group classGroup = createGroup(numColumns, composite, FormatterMessages.IndentationTabPage_indent_group_title); 
101
		createCheckboxPref(classGroup, numColumns, FormatterMessages.IndentationTabPage_class_group_option_indent_declarations_within_class_body, DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_TYPE_HEADER, FALSE_TRUE); 
102
		createCheckboxPref(classGroup, numColumns, FormatterMessages.IndentationTabPage_class_group_option_indent_declarations_within_enum_decl, DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_DECLARATION_HEADER, FALSE_TRUE);
103
		createCheckboxPref(classGroup, numColumns, FormatterMessages.IndentationTabPage_class_group_option_indent_declarations_within_enum_const, DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_CONSTANT_HEADER, FALSE_TRUE); 
104
105
		createCheckboxPref(classGroup, numColumns, FormatterMessages.IndentationTabPage_block_group_option_indent_statements_compare_to_body, DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY, FALSE_TRUE); 
106
		createCheckboxPref(classGroup, numColumns, FormatterMessages.IndentationTabPage_block_group_option_indent_statements_compare_to_block, DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK, FALSE_TRUE); 
107
108
		createCheckboxPref(classGroup, numColumns, FormatterMessages.IndentationTabPage_switch_group_option_indent_statements_within_switch_body, DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH, FALSE_TRUE); 
109
		createCheckboxPref(classGroup, numColumns, FormatterMessages.IndentationTabPage_switch_group_option_indent_statements_within_case_body, DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES, FALSE_TRUE); 
110
		createCheckboxPref(classGroup, numColumns, FormatterMessages.IndentationTabPage_switch_group_option_indent_break_statements, DefaultCodeFormatterConstants.FORMATTER_INDENT_BREAKS_COMPARE_TO_CASES, FALSE_TRUE); 
111
        createCheckboxPref(classGroup, numColumns, FormatterMessages.IndentationTabPage_indent_empty_lines, DefaultCodeFormatterConstants.FORMATTER_INDENT_EMPTY_LINES, FALSE_TRUE); 
112
	}
113
	
114
	public void initializePage() {
115
//	    fPreview.setPreviewText(PREVIEW);
116
	}
117
	
118
    /* (non-Javadoc)
119
     * @see org.eclipse.cdt.internal.ui.preferences.formatter.ModifyDialogTabPage#doCreateCPreview(org.eclipse.swt.widgets.Composite)
120
     */
121
    protected CPreview doCreateCPreview(Composite parent) {
122
//        fPreview= new CompilationUnitPreview(fWorkingValues, parent);
123
//        return fPreview;
124
    	return null;
125
    }
126
127
    /* (non-Javadoc)
128
     * @see org.eclipse.cdt.internal.ui.preferences.formatter.ModifyDialogTabPage#doUpdatePreview()
129
     */
130
    protected void doUpdatePreview() {
131
//        fPreview.update();
132
    }
133
134
	private void updateTabPreferences(String tabPolicy, NumberPreference tabPreference, NumberPreference indentPreference, CheckboxPreference onlyForLeading) {
135
		/*
136
		 * If the tab-char is SPACE (or TAB), INDENTATION_SIZE
137
		 * preference is not used by the core formatter. We piggy back the
138
		 * visual tab length setting in that preference in that case. If the
139
		 * user selects MIXED, we use the previous TAB_SIZE preference as the
140
		 * new INDENTATION_SIZE (as this is what it really is) and set the 
141
		 * visual tab size to the value piggy backed in the INDENTATION_SIZE
142
		 * preference. See also CodeFormatterUtil. 
143
		 */
144
		if (DefaultCodeFormatterConstants.MIXED.equals(tabPolicy)) {
145
			if (CCorePlugin.SPACE.equals(fOldTabChar) || CCorePlugin.TAB.equals(fOldTabChar))
146
				swapTabValues();
147
			tabPreference.setEnabled(true);
148
			tabPreference.setKey(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE);
149
			indentPreference.setEnabled(true);
150
			indentPreference.setKey(DefaultCodeFormatterConstants.FORMATTER_INDENTATION_SIZE);
151
			onlyForLeading.setEnabled(true);
152
		} else if (CCorePlugin.SPACE.equals(tabPolicy)) {
153
			if (DefaultCodeFormatterConstants.MIXED.equals(fOldTabChar))
154
				swapTabValues();
155
			tabPreference.setEnabled(true);
156
			tabPreference.setKey(DefaultCodeFormatterConstants.FORMATTER_INDENTATION_SIZE);
157
			indentPreference.setEnabled(true);
158
			indentPreference.setKey(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE);
159
			onlyForLeading.setEnabled(false);
160
		} else if (CCorePlugin.TAB.equals(tabPolicy)) {
161
			if (DefaultCodeFormatterConstants.MIXED.equals(fOldTabChar))
162
				swapTabValues();
163
			tabPreference.setEnabled(true);
164
			tabPreference.setKey(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE);
165
			indentPreference.setEnabled(false);
166
			indentPreference.setKey(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE);
167
			onlyForLeading.setEnabled(true);
168
		} else {
169
			Assert.isTrue(false);
170
		}
171
		fOldTabChar= tabPolicy;
172
	}
173
174
	private void swapTabValues() {
175
		Object tabSize= fWorkingValues.get(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE);
176
		Object indentSize= fWorkingValues.get(DefaultCodeFormatterConstants.FORMATTER_INDENTATION_SIZE);
177
		fWorkingValues.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, indentSize);
178
		fWorkingValues.put(DefaultCodeFormatterConstants.FORMATTER_INDENTATION_SIZE, tabSize);
179
	}
180
}
(-)src/org/eclipse/cdt/internal/ui/preferences/formatter/ModifyDialog.java (+267 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
package org.eclipse.cdt.internal.ui.preferences.formatter;
13
14
import java.util.ArrayList;
15
import java.util.HashMap;
16
import java.util.List;
17
import java.util.Map;
18
19
import org.eclipse.core.runtime.IStatus;
20
import org.eclipse.core.runtime.Status;
21
22
import org.eclipse.swt.SWT;
23
import org.eclipse.swt.graphics.Point;
24
import org.eclipse.swt.graphics.Rectangle;
25
import org.eclipse.swt.layout.GridData;
26
import org.eclipse.swt.layout.GridLayout;
27
import org.eclipse.swt.widgets.Composite;
28
import org.eclipse.swt.widgets.Control;
29
import org.eclipse.swt.widgets.Label;
30
import org.eclipse.swt.widgets.Shell;
31
32
import org.eclipse.jface.dialogs.IDialogConstants;
33
import org.eclipse.jface.dialogs.IDialogSettings;
34
import org.eclipse.jface.dialogs.StatusDialog;
35
import org.eclipse.jface.window.Window;
36
37
import org.eclipse.cdt.internal.ui.util.Messages;
38
39
import org.eclipse.cdt.ui.CUIPlugin;
40
import org.eclipse.cdt.internal.ui.preferences.formatter.ProfileManager.Profile;
41
42
public class ModifyDialog extends StatusDialog {
43
    
44
    /**
45
     * The keys to retrieve the preferred area from the dialog settings.
46
     */
47
    private static final String DS_KEY_PREFERRED_WIDTH= CUIPlugin.PLUGIN_ID + "formatter_page.modify_dialog.preferred_width"; //$NON-NLS-1$
48
    private static final String DS_KEY_PREFERRED_HEIGHT= CUIPlugin.PLUGIN_ID + "formatter_page.modify_dialog.preferred_height"; //$NON-NLS-1$
49
    private static final String DS_KEY_PREFERRED_X= CUIPlugin.PLUGIN_ID + "formatter_page.modify_dialog.preferred_x"; //$NON-NLS-1$
50
    private static final String DS_KEY_PREFERRED_Y= CUIPlugin.PLUGIN_ID + "formatter_page.modify_dialog.preferred_y"; //$NON-NLS-1$
51
    
52
    /**
53
     * The key to store the number (beginning at 0) of the tab page which had the 
54
     * focus last time.
55
     */
56
    private static final String DS_KEY_LAST_FOCUS= CUIPlugin.PLUGIN_ID + "formatter_page.modify_dialog.last_focus"; //$NON-NLS-1$ 
57
58
	private final String fTitle;
59
	
60
	private final boolean fNewProfile;
61
62
	private Profile fProfile;
63
	private final Map fWorkingValues;
64
	
65
	private IStatus fStandardStatus;
66
	
67
	protected final List fTabPages;
68
	
69
	final IDialogSettings fDialogSettings;
70
//	private TabFolder fTabFolder;
71
	private ProfileManager fProfileManager;
72
//	private Button fApplyButton;
73
		
74
	protected ModifyDialog(Shell parentShell, Profile profile, ProfileManager profileManager, boolean newProfile) {
75
		super(parentShell);
76
		fProfileManager= profileManager;
77
		fNewProfile= newProfile;
78
		setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX );
79
				
80
		fProfile= profile;
81
		if (fProfile.isBuiltInProfile()) {
82
		    fStandardStatus= new Status(IStatus.INFO, CUIPlugin.getPluginId(), IStatus.OK, FormatterMessages.ModifyDialog_dialog_show_warning_builtin, null); 
83
		    fTitle= Messages.format(FormatterMessages.ModifyDialog_dialog_show_title, profile.getName()); 
84
		} else {
85
		    fStandardStatus= new Status(IStatus.OK, CUIPlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$
86
		    fTitle= Messages.format(FormatterMessages.ModifyDialog_dialog_title, profile.getName()); 
87
		}
88
		fWorkingValues= new HashMap(fProfile.getSettings());
89
		updateStatus(fStandardStatus);
90
		setStatusLineAboveButtons(false);
91
		fTabPages= new ArrayList();
92
		fDialogSettings= CUIPlugin.getDefault().getDialogSettings();	
93
	}
94
	
95
	public void create() {
96
		super.create();
97
		int lastFocusNr= 0;
98
		try {
99
			lastFocusNr= fDialogSettings.getInt(DS_KEY_LAST_FOCUS);
100
			if (lastFocusNr < 0) lastFocusNr= 0;
101
			if (lastFocusNr > fTabPages.size() - 1) lastFocusNr= fTabPages.size() - 1;
102
		} catch (NumberFormatException x) {
103
			lastFocusNr= 0;
104
		}
105
		
106
		if (!fNewProfile) {
107
//			fTabFolder.setSelection(lastFocusNr);
108
//			((ModifyDialogTabPage)fTabFolder.getSelection()[0].getData()).setInitialFocus();
109
		}
110
	}
111
	
112
	protected void configureShell(Shell shell) {
113
		super.configureShell(shell);
114
		shell.setText(fTitle);
115
	}
116
117
	protected Control createDialogArea(Composite parent) {
118
		
119
		final Composite composite= (Composite)super.createDialogArea(parent);
120
121
		ModifyDialogTabPage tabPage = new IndentationTabPage(this, fWorkingValues);
122
		tabPage.createContents(composite);
123
//		fTabFolder = new TabFolder(composite, SWT.NONE);
124
//		fTabFolder.setFont(composite.getFont());
125
//		fTabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
126
//
127
//		addTabPage(fTabFolder, FormatterMessages.ModifyDialog_tabpage_indentation_title, new IndentationTabPage(this, fWorkingValues)); 
128
//		addTabPage(fTabFolder, FormatterMessages.ModifyDialog_tabpage_braces_title, new BracesTabPage(this, fWorkingValues)); 
129
//		addTabPage(fTabFolder, FormatterMessages.ModifyDialog_tabpage_whitespace_title, new WhiteSpaceTabPage(this, fWorkingValues)); 
130
//		addTabPage(fTabFolder, FormatterMessages.ModifyDialog_tabpage_blank_lines_title, new BlankLinesTabPage(this, fWorkingValues)); 
131
//		addTabPage(fTabFolder, FormatterMessages.ModifyDialog_tabpage_new_lines_title, new NewLinesTabPage(this, fWorkingValues)); 
132
//		addTabPage(fTabFolder, FormatterMessages.ModifyDialog_tabpage_control_statements_title, new ControlStatementsTabPage(this, fWorkingValues)); 
133
//		addTabPage(fTabFolder, FormatterMessages.ModifyDialog_tabpage_line_wrapping_title, new LineWrappingTabPage(this, fWorkingValues)); 
134
//		addTabPage(fTabFolder, FormatterMessages.ModifyDialog_tabpage_comments_title, new CommentsTabPage(this, fWorkingValues)); 
135
		
136
		applyDialogFont(composite);
137
		
138
//		fTabFolder.addSelectionListener(new SelectionListener() {
139
//			public void widgetDefaultSelected(SelectionEvent e) {}
140
//			public void widgetSelected(SelectionEvent e) {
141
//				final TabItem tabItem= (TabItem)e.item;
142
//				final ModifyDialogTabPage page= (ModifyDialogTabPage)tabItem.getData();
143
////				page.fSashForm.setWeights();
144
//				fDialogSettings.put(DS_KEY_LAST_FOCUS, fTabPages.indexOf(page));
145
//				page.makeVisible();
146
//			}
147
//		});
148
		return composite;
149
	}
150
	
151
	public void updateStatus(IStatus status) {
152
	    super.updateStatus(status != null ? status : fStandardStatus);    
153
	}
154
155
	/* (non-Javadoc)
156
	 * @see org.eclipse.jface.window.Window#getInitialSize()
157
	 */
158
	protected Point getInitialSize() {
159
    	Point initialSize= super.getInitialSize();
160
        try {
161
        	int lastWidth= fDialogSettings.getInt(DS_KEY_PREFERRED_WIDTH);
162
        	if (initialSize.x > lastWidth)
163
        		lastWidth= initialSize.x;
164
        	int lastHeight= fDialogSettings.getInt(DS_KEY_PREFERRED_HEIGHT);
165
        	if (initialSize.y > lastHeight)
166
        		lastHeight= initialSize.x;
167
       		return new Point(lastWidth, lastHeight);
168
        } catch (NumberFormatException ex) {
169
        }
170
        return initialSize;
171
	}
172
	
173
	/* (non-Javadoc)
174
	 * @see org.eclipse.jface.window.Window#getInitialLocation(org.eclipse.swt.graphics.Point)
175
	 */
176
	protected Point getInitialLocation(Point initialSize) {
177
        try {
178
        	return new Point(fDialogSettings.getInt(DS_KEY_PREFERRED_X), fDialogSettings.getInt(DS_KEY_PREFERRED_Y));
179
        } catch (NumberFormatException ex) {
180
        	return super.getInitialLocation(initialSize);
181
        }
182
	}
183
	    
184
	public boolean close() {
185
		final Rectangle shell= getShell().getBounds();
186
		
187
		fDialogSettings.put(DS_KEY_PREFERRED_WIDTH, shell.width);
188
		fDialogSettings.put(DS_KEY_PREFERRED_HEIGHT, shell.height);
189
		fDialogSettings.put(DS_KEY_PREFERRED_X, shell.x);
190
		fDialogSettings.put(DS_KEY_PREFERRED_Y, shell.y);
191
		
192
		return super.close();
193
	}
194
	
195
	/* (non-Javadoc)
196
	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
197
	 */
198
	protected void okPressed() {
199
		applyPressed();
200
		super.okPressed();
201
	}
202
	
203
    protected void buttonPressed(int buttonId) {
204
		if (buttonId == IDialogConstants.CLIENT_ID) {
205
			applyPressed();
206
		} else {
207
			super.buttonPressed(buttonId);
208
		}
209
    }
210
	
211
	private void applyPressed() {
212
		 if (fProfile.isBuiltInProfile() || fProfile.isSharedProfile()) {
213
		 	RenameProfileDialog dialog= new RenameProfileDialog(getShell(), fProfile, fProfileManager);
214
		 	if (dialog.open() != Window.OK) {
215
		 		return;
216
		 	}
217
218
			fProfile= dialog.getRenamedProfile();
219
			
220
		    fStandardStatus= new Status(IStatus.OK, CUIPlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$
221
			updateStatus(fStandardStatus);
222
		 }
223
		 fProfile.setSettings(new HashMap(fWorkingValues));
224
//		 fApplyButton.setEnabled(false);
225
	}
226
    
227
    protected void createButtonsForButtonBar(Composite parent) {
228
//	    fApplyButton= createButton(parent, IDialogConstants.CLIENT_ID, FormatterMessages.ModifyDialog_apply_button, false); 
229
//		fApplyButton.setEnabled(false);
230
		
231
		GridLayout layout= (GridLayout) parent.getLayout();
232
		layout.numColumns++;
233
		layout.makeColumnsEqualWidth= false;
234
		Label label= new Label(parent, SWT.NONE);
235
		GridData data= new GridData();
236
		data.widthHint= layout.horizontalSpacing;
237
		label.setLayoutData(data);
238
		super.createButtonsForButtonBar(parent);
239
    }
240
    
241
	
242
//	private final void addTabPage(TabFolder tabFolder, String title, ModifyDialogTabPage tabPage) {
243
//		final TabItem tabItem= new TabItem(tabFolder, SWT.NONE);
244
//		applyDialogFont(tabItem.getControl());
245
//		tabItem.setText(title);
246
//		tabItem.setData(tabPage);
247
//		tabItem.setControl(tabPage.createContents(tabFolder));
248
//		fTabPages.add(tabPage);
249
//	}
250
251
	public void valuesModified() {
252
//		if (fApplyButton != null && !fApplyButton.isDisposed()) {
253
//			fApplyButton.setEnabled(hasChanges());
254
//		}
255
	}
256
257
//	private boolean hasChanges() {
258
//		Iterator iter= fProfile.getSettings().entrySet().iterator();
259
//		for (;iter.hasNext();) {
260
//			Map.Entry curr= (Map.Entry) iter.next();
261
//			if (!fWorkingValues.get(curr.getKey()).equals(curr.getValue())) {
262
//				return true;
263
//			}
264
//		}
265
//		return false;
266
//	}
267
}
(-)src/org/eclipse/cdt/internal/ui/preferences/formatter/CodeFormatterConfigurationBlock.java (+548 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Aaron Luchko, aluchko@redhat.com - 105926 [Formatter] Exporting Unnamed profile fails silently
11
 *     Sergey Prigogin, Google
12
 *******************************************************************************/
13
package org.eclipse.cdt.internal.ui.preferences.formatter;
14
15
import java.io.File;
16
import java.util.ArrayList;
17
import java.util.Collection;
18
import java.util.List;
19
import java.util.Observable;
20
import java.util.Observer;
21
22
import org.eclipse.core.runtime.CoreException;
23
import org.eclipse.core.runtime.preferences.DefaultScope;
24
import org.eclipse.core.runtime.preferences.IScopeContext;
25
26
import org.eclipse.core.resources.IProject;
27
import org.eclipse.core.resources.ProjectScope;
28
29
import org.eclipse.swt.SWT;
30
import org.eclipse.swt.events.SelectionEvent;
31
import org.eclipse.swt.events.SelectionListener;
32
import org.eclipse.swt.layout.GridData;
33
import org.eclipse.swt.layout.GridLayout;
34
import org.eclipse.swt.widgets.Button;
35
import org.eclipse.swt.widgets.Combo;
36
import org.eclipse.swt.widgets.Composite;
37
import org.eclipse.swt.widgets.FileDialog;
38
import org.eclipse.swt.widgets.Label;
39
40
import org.eclipse.jface.dialogs.MessageDialog;
41
import org.eclipse.jface.window.Window;
42
43
import org.eclipse.cdt.core.CCorePlugin;
44
45
import org.eclipse.cdt.internal.ui.util.Messages;
46
47
import org.eclipse.cdt.ui.CUIPlugin;
48
49
import org.eclipse.cdt.internal.ui.preferences.PreferencesAccess;
50
import org.eclipse.cdt.internal.ui.preferences.formatter.ProfileManager.CustomProfile;
51
import org.eclipse.cdt.internal.ui.preferences.formatter.ProfileManager.Profile;
52
import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
53
import org.eclipse.cdt.internal.ui.util.PixelConverter;
54
import org.eclipse.cdt.internal.ui.util.SWTUtil;
55
56
import org.osgi.service.prefs.BackingStoreException;
57
58
59
/**
60
 * The code formatter preference page. 
61
 */
62
public class CodeFormatterConfigurationBlock {
63
    
64
    private static final String DIALOGSTORE_LASTLOADPATH= CUIPlugin.PLUGIN_ID + ".codeformatter.loadpath"; //$NON-NLS-1$
65
	private static final String DIALOGSTORE_LASTSAVEPATH= CUIPlugin.PLUGIN_ID + ".codeformatter.savepath"; //$NON-NLS-1$
66
	
67
	private class StoreUpdater implements Observer {
68
		
69
		public StoreUpdater() {
70
			fProfileManager.addObserver(this);
71
		}
72
73
		public void update(Observable o, Object arg) {
74
			final int value= ((Integer)arg).intValue();
75
			switch (value) {
76
			case ProfileManager.PROFILE_DELETED_EVENT:
77
			case ProfileManager.PROFILE_RENAMED_EVENT:
78
			case ProfileManager.PROFILE_CREATED_EVENT:
79
			case ProfileManager.SETTINGS_CHANGED_EVENT:
80
				try {
81
					ProfileStore.writeProfiles(fProfileManager.getSortedProfiles(), fInstanceScope); // update profile store
82
					fProfileManager.commitChanges(fCurrContext); // update formatter settings with curently selected profile 
83
				} catch (CoreException x) {
84
					CUIPlugin.getDefault().log(x);
85
				}
86
				break;
87
			case ProfileManager.SELECTION_CHANGED_EVENT:
88
				fProfileManager.commitChanges(fCurrContext); // update formatter settings with curently selected profile
89
				break;
90
			}
91
		}
92
	}
93
94
	private class ProfileComboController implements Observer, SelectionListener {
95
		
96
		private final List fSortedProfiles;
97
		
98
		public ProfileComboController() {
99
			fSortedProfiles= fProfileManager.getSortedProfiles();
100
			fProfileCombo.addSelectionListener(this);
101
			fProfileManager.addObserver(this);
102
			updateProfiles();
103
			updateSelection();
104
		}
105
		
106
		public void widgetSelected(SelectionEvent e) {
107
			final int index= fProfileCombo.getSelectionIndex();
108
			fProfileManager.setSelected((Profile)fSortedProfiles.get(index));
109
		}
110
111
		public void widgetDefaultSelected(SelectionEvent e) {}
112
113
		public void update(Observable o, Object arg) {
114
			if (arg == null) return;
115
			final int value= ((Integer)arg).intValue();
116
			switch (value) {
117
				case ProfileManager.PROFILE_CREATED_EVENT:
118
				case ProfileManager.PROFILE_DELETED_EVENT:
119
				case ProfileManager.PROFILE_RENAMED_EVENT:
120
					updateProfiles();
121
					updateSelection();
122
					break;
123
				case ProfileManager.SELECTION_CHANGED_EVENT:
124
					updateSelection();
125
					break;
126
			}
127
		}
128
		
129
		private void updateProfiles() {
130
			fProfileCombo.setItems(fProfileManager.getSortedDisplayNames());
131
		}
132
133
		private void updateSelection() {
134
			fProfileCombo.setText(fProfileManager.getSelected().getName());
135
		}
136
	}
137
	
138
	private class ButtonController implements Observer, SelectionListener {
139
		
140
		public ButtonController() {
141
			fProfileManager.addObserver(this);
142
			fNewButton.addSelectionListener(this);
143
			fRenameButton.addSelectionListener(this);
144
			fEditButton.addSelectionListener(this);
145
			fDeleteButton.addSelectionListener(this);
146
			fSaveButton.addSelectionListener(this);
147
			fLoadButton.addSelectionListener(this);
148
			update(fProfileManager, null);
149
		}
150
151
		public void update(Observable o, Object arg) {
152
			Profile selected= ((ProfileManager)o).getSelected();
153
			final boolean notBuiltIn= !selected.isBuiltInProfile();
154
			fEditButton.setText(notBuiltIn ? FormatterMessages.CodingStyleConfigurationBlock_edit_button_desc
155
			    : FormatterMessages.CodingStyleConfigurationBlock_show_button_desc); 
156
			fDeleteButton.setEnabled(notBuiltIn);
157
			fSaveButton.setEnabled(notBuiltIn);
158
			fRenameButton.setEnabled(notBuiltIn);
159
		}
160
161
		public void widgetSelected(SelectionEvent e) {
162
			final Button button= (Button)e.widget;
163
			if (button == fSaveButton)
164
				saveButtonPressed();
165
			else if (button == fEditButton)
166
				modifyButtonPressed();
167
			else if (button == fDeleteButton) 
168
				deleteButtonPressed();
169
			else if (button == fNewButton)
170
				newButtonPressed();
171
			else if (button == fLoadButton)
172
				loadButtonPressed();
173
			else if (button == fRenameButton) 
174
				renameButtonPressed();
175
		}
176
		
177
		public void widgetDefaultSelected(SelectionEvent e) {
178
		}
179
		
180
		private void renameButtonPressed() {
181
			if (fProfileManager.getSelected().isBuiltInProfile())
182
				return;
183
			final CustomProfile profile= (CustomProfile) fProfileManager.getSelected();
184
			final RenameProfileDialog renameDialog= new RenameProfileDialog(fComposite.getShell(), profile, fProfileManager);
185
			if (renameDialog.open() == Window.OK) {
186
				fProfileManager.setSelected(renameDialog.getRenamedProfile());
187
			}
188
		}
189
		
190
		private void modifyButtonPressed() {
191
			final ModifyDialog modifyDialog= new ModifyDialog(fComposite.getShell(), fProfileManager.getSelected(), fProfileManager, false);
192
			modifyDialog.open();
193
		}
194
		
195
		private void deleteButtonPressed() {
196
			if (MessageDialog.openQuestion(
197
				fComposite.getShell(), 
198
				FormatterMessages.CodingStyleConfigurationBlock_delete_confirmation_title, 
199
				Messages.format(FormatterMessages.CodingStyleConfigurationBlock_delete_confirmation_question, fProfileManager.getSelected().getName()))) { 
200
				fProfileManager.deleteSelected();
201
			}
202
		}
203
		
204
		private void newButtonPressed() {
205
			final CreateProfileDialog p= new CreateProfileDialog(fComposite.getShell(), fProfileManager);
206
			if (p.open() != Window.OK) 
207
				return;
208
			if (!p.openEditDialog()) 
209
				return;
210
			final ModifyDialog modifyDialog= new ModifyDialog(fComposite.getShell(), p.getCreatedProfile(), fProfileManager, true);
211
			modifyDialog.open();
212
		}
213
		
214
		private void saveButtonPressed() {
215
			Profile selected= fProfileManager.getSelected();
216
			if (selected.isSharedProfile()) {
217
				final RenameProfileDialog renameDialog= new RenameProfileDialog(fComposite.getShell(), selected, fProfileManager);
218
				if (renameDialog.open() != Window.OK) {
219
					return;
220
				}
221
					
222
				selected= renameDialog.getRenamedProfile();
223
				fProfileManager.setSelected(selected);
224
			}
225
			
226
			final FileDialog dialog= new FileDialog(fComposite.getShell(), SWT.SAVE);
227
			dialog.setText(FormatterMessages.CodingStyleConfigurationBlock_save_profile_dialog_title); 
228
			dialog.setFilterExtensions(new String [] {"*.xml"}); //$NON-NLS-1$
229
			
230
			final String lastPath= CUIPlugin.getDefault().getDialogSettings().get(DIALOGSTORE_LASTSAVEPATH);
231
			if (lastPath != null) {
232
				dialog.setFilterPath(lastPath);
233
			}
234
			final String path= dialog.open();
235
			if (path == null) 
236
				return;
237
			
238
			CUIPlugin.getDefault().getDialogSettings().put(DIALOGSTORE_LASTSAVEPATH, dialog.getFilterPath());
239
			
240
			final File file= new File(path);
241
			if (file.exists() && !MessageDialog.openQuestion(fComposite.getShell(), FormatterMessages.CodingStyleConfigurationBlock_save_profile_overwrite_title, Messages.format(FormatterMessages.CodingStyleConfigurationBlock_save_profile_overwrite_message, path))) { 
242
				return;
243
			}
244
			
245
			final Collection profiles= new ArrayList();
246
247
			profiles.add(selected);
248
			try {
249
				ProfileStore.writeProfilesToFile(profiles, file);
250
			} catch (CoreException e) {
251
				final String title= FormatterMessages.CodingStyleConfigurationBlock_save_profile_error_title; 
252
				final String message= FormatterMessages.CodingStyleConfigurationBlock_save_profile_error_message; 
253
				ExceptionHandler.handle(e, fComposite.getShell(), title, message);
254
			}
255
		}
256
		
257
		private void loadButtonPressed() {
258
			final FileDialog dialog= new FileDialog(fComposite.getShell(), SWT.OPEN);
259
			dialog.setText(FormatterMessages.CodingStyleConfigurationBlock_load_profile_dialog_title); 
260
			dialog.setFilterExtensions(new String [] {"*.xml"}); //$NON-NLS-1$
261
			final String lastPath= CUIPlugin.getDefault().getDialogSettings().get(DIALOGSTORE_LASTLOADPATH);
262
			if (lastPath != null) {
263
				dialog.setFilterPath(lastPath);
264
			}
265
			final String path= dialog.open();
266
			if (path == null) 
267
				return;
268
			CUIPlugin.getDefault().getDialogSettings().put(DIALOGSTORE_LASTLOADPATH, dialog.getFilterPath());
269
			
270
			final File file= new File(path);
271
			Collection profiles= null;
272
			try {
273
				profiles= ProfileStore.readProfilesFromFile(file);
274
			} catch (CoreException e) {
275
				final String title= FormatterMessages.CodingStyleConfigurationBlock_load_profile_error_title; 
276
				final String message= FormatterMessages.CodingStyleConfigurationBlock_load_profile_error_message; 
277
				ExceptionHandler.handle(e, fComposite.getShell(), title, message);
278
			}
279
			if (profiles == null || profiles.isEmpty())
280
				return;
281
			
282
			final CustomProfile profile= (CustomProfile)profiles.iterator().next();
283
			
284
			if (ProfileVersioner.getVersionStatus(profile) > 0) {
285
				final String title= FormatterMessages.CodingStyleConfigurationBlock_load_profile_error_too_new_title; 
286
				final String message= FormatterMessages.CodingStyleConfigurationBlock_load_profile_error_too_new_message; 
287
			    MessageDialog.openWarning(fComposite.getShell(), title, message);
288
			}
289
			
290
			if (fProfileManager.containsName(profile.getName())) {
291
				final AlreadyExistsDialog aeDialog= new AlreadyExistsDialog(fComposite.getShell(), profile, fProfileManager);
292
				if (aeDialog.open() != Window.OK) 
293
					return;
294
			}
295
			ProfileVersioner.updateAndComplete(profile);
296
			fProfileManager.addProfile(profile);
297
		}
298
	}
299
	
300
//	private class PreviewController implements Observer {
301
//
302
//		public PreviewController() {
303
//			fProfileManager.addObserver(this);
304
//			fCodeStylePreview.setWorkingValues(fProfileManager.getSelected().getSettings());
305
//			fCodeStylePreview.update();
306
//		}
307
//		
308
//		public void update(Observable o, Object arg) {
309
//			final int value= ((Integer)arg).intValue();
310
//			switch (value) {
311
//				case ProfileManager.PROFILE_CREATED_EVENT:
312
//				case ProfileManager.PROFILE_DELETED_EVENT:
313
//				case ProfileManager.SELECTION_CHANGED_EVENT:
314
//				case ProfileManager.SETTINGS_CHANGED_EVENT:
315
//					fCodeStylePreview.setWorkingValues(((ProfileManager)o).getSelected().getSettings());
316
//					fCodeStylePreview.update();
317
//			}
318
//		}
319
//	}
320
	
321
//	/**
322
//	 * Some C source code used for preview.
323
//	 */
324
//	private final static String PREVIEW=
325
//		"/*\n* " + //$NON-NLS-1$
326
//		FormatterMessages.CodingStyleConfigurationBlock_preview_title + 
327
//		"\n*/\n\n" + //$NON-NLS-1$
328
//		"#include <math.h>\n" + //$NON-NLS-1$
329
//		"class Point {" +  //$NON-NLS-1$
330
//		"public:" +  //$NON-NLS-1$
331
//		"Point(double xc, double yc) : x(xc), y(yc) {}" + //$NON-NLS-1$ 
332
//		"double distance(const Point& other) const;" + //$NON-NLS-1$
333
//		"double x;" +  //$NON-NLS-1$
334
//		"double y;" +  //$NON-NLS-1$
335
//		"};" +  //$NON-NLS-1$
336
//		"float Point::distance(const Point& other) const {" + //$NON-NLS-1$
337
//		"double dx = x - other.x;" + //$NON-NLS-1$
338
//		"double dy = y - other.y;" + //$NON-NLS-1$
339
//		"return sqrt(dx * dx + dy * dy);" + //$NON-NLS-1$
340
//		"}"; //$NON-NLS-1$
341
342
	/**
343
	 * The GUI controls
344
	 */
345
	protected Composite fComposite;
346
	protected Combo fProfileCombo;
347
	protected Button fEditButton;
348
	protected Button fRenameButton;
349
	protected Button fDeleteButton;
350
	protected Button fNewButton;
351
	protected Button fLoadButton;
352
	protected Button fSaveButton;
353
	
354
	/**
355
	 * The ProfileManager, the model of this page.
356
	 */
357
	protected final ProfileManager fProfileManager;
358
	private CustomCodeFormatterBlock fCustomCodeFormatterBlock;
359
	
360
	/**
361
	 * The CPreview.
362
	 */
363
//	protected CompilationUnitPreview fCodeStylePreview;
364
	private PixelConverter fPixConv;
365
366
	private IScopeContext fCurrContext;
367
	private IScopeContext fInstanceScope;
368
	
369
	/**
370
	 * Create a new <code>CodeFormatterConfigurationBlock</code>.
371
	 */
372
	public CodeFormatterConfigurationBlock(IProject project, PreferencesAccess access) {
373
		fInstanceScope= access.getInstanceScope();
374
		List profiles= null;
375
		try {
376
		    profiles= ProfileStore.readProfiles(fInstanceScope);
377
		} catch (CoreException e) {
378
			CUIPlugin.getDefault().log(e);
379
		}
380
		if (profiles == null) {
381
			try {
382
				// bug 129427
383
			    profiles= ProfileStore.readProfilesFromPreferences(new DefaultScope());
384
			} catch (CoreException e) {
385
				CUIPlugin.getDefault().log(e);
386
			}
387
		}
388
		
389
		if (profiles == null) 
390
		    profiles= new ArrayList();
391
		
392
		if (project != null) {
393
			fCurrContext= access.getProjectScope(project);
394
		} else {
395
			fCurrContext= fInstanceScope;
396
		}
397
		
398
		fProfileManager= new ProfileManager(profiles, fCurrContext, access);
399
		fCustomCodeFormatterBlock= new CustomCodeFormatterBlock(CUIPlugin.getDefault().getPluginPreferences());
400
401
		new StoreUpdater();
402
	}
403
404
	/**
405
	 * Create the contents
406
	 * @param parent Parent composite
407
	 * @return Created control
408
	 */
409
	public Composite createContents(Composite parent) {
410
411
		final int numColumns = 5;
412
		
413
		fPixConv = new PixelConverter(parent);
414
		fComposite = createComposite(parent, numColumns);
415
416
		fProfileCombo= createProfileCombo(fComposite, numColumns - 3, fPixConv.convertWidthInCharsToPixels(20));
417
		fEditButton= createButton(fComposite, FormatterMessages.CodingStyleConfigurationBlock_edit_button_desc, GridData.HORIZONTAL_ALIGN_BEGINNING); 
418
		fRenameButton= createButton(fComposite, FormatterMessages.CodingStyleConfigurationBlock_rename_button_desc, GridData.HORIZONTAL_ALIGN_BEGINNING); 
419
		fDeleteButton= createButton(fComposite, FormatterMessages.CodingStyleConfigurationBlock_remove_button_desc, GridData.HORIZONTAL_ALIGN_BEGINNING); 
420
421
		final Composite group= createComposite(fComposite, 4);
422
		final GridData groupData= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
423
		groupData.horizontalSpan= numColumns;
424
		group.setLayoutData(groupData);
425
426
		fNewButton= createButton(group, FormatterMessages.CodingStyleConfigurationBlock_new_button_desc, GridData.HORIZONTAL_ALIGN_BEGINNING); 
427
		((GridData)createLabel(group, "", 1).getLayoutData()).grabExcessHorizontalSpace= true; //$NON-NLS-1$
428
		fLoadButton= createButton(group, FormatterMessages.CodingStyleConfigurationBlock_load_button_desc, GridData.HORIZONTAL_ALIGN_END); 
429
		fSaveButton= createButton(group, FormatterMessages.CodingStyleConfigurationBlock_save_button_desc, GridData.HORIZONTAL_ALIGN_END); 
430
431
		fCustomCodeFormatterBlock.createControl(fComposite);
432
		
433
//		createLabel(fComposite, FormatterMessages.CodingStyleConfigurationBlock_preview_label_text, numColumns); 
434
//		configurePreview(fComposite, numColumns);
435
		
436
		new ButtonController();
437
		new ProfileComboController();
438
//		new PreviewController();
439
		
440
		return fComposite;
441
	}
442
443
	
444
	private static Button createButton(Composite composite, String text, final int style) {
445
		final Button button= new Button(composite, SWT.PUSH);
446
		button.setFont(composite.getFont());
447
		button.setText(text);
448
449
		final GridData gd= new GridData(style);
450
		gd.widthHint= SWTUtil.getButtonWidthHint(button);
451
		button.setLayoutData(gd);
452
		return button;
453
	}
454
	
455
	private static Combo createProfileCombo(Composite composite, int span, int widthHint) {
456
		final GridData gd = new GridData(GridData.FILL_HORIZONTAL);
457
		gd.horizontalSpan = span;
458
		gd.widthHint= widthHint;
459
460
		final Combo combo= new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
461
		combo.setFont(composite.getFont());
462
		combo.setLayoutData(gd);
463
		return combo;
464
	}
465
	
466
	private Label createLabel(Composite composite, String text, int numColumns) {
467
		final GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
468
		gd.horizontalSpan = numColumns;
469
		gd.widthHint= 0;
470
471
		final Label label = new Label(composite, SWT.WRAP);
472
		label.setFont(composite.getFont());
473
		label.setText(text);
474
		label.setLayoutData(gd);
475
		return label;		
476
	}
477
	
478
	private Composite createComposite(Composite parent, int numColumns) {
479
		final Composite composite = new Composite(parent, SWT.NONE);
480
		composite.setFont(parent.getFont());
481
		
482
		final GridLayout layout = new GridLayout(numColumns, false);
483
		layout.marginHeight = 0;
484
		layout.marginWidth = 0;
485
		composite.setLayout(layout);
486
		return composite;
487
	}
488
	
489
//	private void configurePreview(Composite composite, int numColumns) {
490
//		fCodeStylePreview= new CompilationUnitPreview(fProfileManager.getSelected().getSettings(), composite);
491
//		fCodeStylePreview.setPreviewText(PREVIEW);
492
//	    
493
//		final GridData gd = new GridData(GridData.FILL_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL);
494
//		gd.horizontalSpan = numColumns;
495
//		gd.verticalSpan= 7;
496
//		gd.widthHint = 0;
497
//		gd.heightHint = 0;
498
//		fCodeStylePreview.getControl().setLayoutData(gd);
499
//	}
500
501
	public final boolean hasProjectSpecificOptions(IProject project) {
502
		if (project != null) {
503
			return ProfileManager.hasProjectSpecificSettings(new ProjectScope(project));
504
		}
505
		return false;
506
	}
507
	
508
	public boolean performOk() {
509
		fCustomCodeFormatterBlock.performOk();
510
		return true;
511
	}
512
	
513
	public void performApply() {
514
		try {
515
			fCurrContext.getNode(CUIPlugin.PLUGIN_ID).flush();
516
			fCurrContext.getNode(CCorePlugin.PLUGIN_ID).flush();
517
			if (fCurrContext != fInstanceScope) {
518
				fInstanceScope.getNode(CUIPlugin.PLUGIN_ID).flush();
519
				fInstanceScope.getNode(CCorePlugin.PLUGIN_ID).flush();
520
			}
521
			fCustomCodeFormatterBlock.performOk();
522
		} catch (BackingStoreException e) {
523
			CUIPlugin.getDefault().log(e);
524
		}
525
	}
526
	
527
	public void performDefaults() {
528
		Profile profile= fProfileManager.getProfile(ProfileManager.DEFAULT_PROFILE);
529
		if (profile != null) {
530
			int defaultIndex= fProfileManager.getSortedProfiles().indexOf(profile);
531
			if (defaultIndex != -1) {
532
				fProfileManager.setSelected(profile);
533
			}
534
		}
535
		fCustomCodeFormatterBlock.performDefaults();
536
	}
537
	
538
	public void dispose() {
539
	}
540
541
	public void enableProjectSpecificSettings(boolean useProjectSpecificSettings) {
542
		if (useProjectSpecificSettings) {
543
			fProfileManager.commitChanges(fCurrContext);
544
		} else {
545
			fProfileManager.clearAllSettings(fCurrContext);
546
		}
547
	}
548
}
(-)src/org/eclipse/cdt/internal/ui/actions/IndentAction.java (+573 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
package org.eclipse.cdt.internal.ui.actions;
13
14
import java.util.ResourceBundle;
15
16
import org.eclipse.core.runtime.IStatus;
17
import org.eclipse.core.runtime.Status;
18
19
import org.eclipse.swt.custom.BusyIndicator;
20
import org.eclipse.swt.widgets.Display;
21
22
import org.eclipse.jface.viewers.ISelection;
23
import org.eclipse.jface.viewers.ISelectionProvider;
24
25
import org.eclipse.jface.text.Assert;
26
import org.eclipse.jface.text.BadLocationException;
27
import org.eclipse.jface.text.IDocument;
28
import org.eclipse.jface.text.IRegion;
29
import org.eclipse.jface.text.IRewriteTarget;
30
import org.eclipse.jface.text.ITextSelection;
31
import org.eclipse.jface.text.ITypedRegion;
32
import org.eclipse.jface.text.Position;
33
import org.eclipse.jface.text.TextSelection;
34
import org.eclipse.jface.text.TextUtilities;
35
import org.eclipse.jface.text.source.ISourceViewer;
36
37
import org.eclipse.ui.IEditorInput;
38
import org.eclipse.ui.texteditor.IDocumentProvider;
39
import org.eclipse.ui.texteditor.ITextEditor;
40
import org.eclipse.ui.texteditor.ITextEditorExtension3;
41
import org.eclipse.ui.texteditor.TextEditorAction;
42
43
import org.eclipse.cdt.core.CCorePlugin;
44
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
45
import org.eclipse.cdt.core.model.ICProject;
46
import org.eclipse.cdt.core.model.ITranslationUnit;
47
48
import org.eclipse.cdt.ui.CUIPlugin;
49
import org.eclipse.cdt.ui.text.ICPartitions;
50
51
import org.eclipse.cdt.internal.ui.editor.CEditor;
52
import org.eclipse.cdt.internal.ui.text.CHeuristicScanner;
53
import org.eclipse.cdt.internal.ui.text.CIndenter;
54
55
56
/**
57
 * Indents a line or range of lines in a C document to its correct position. No complete
58
 * AST must be present, the indentation is computed using heuristics. The algorithm used is fast for
59
 * single lines, but does not store any information and therefore not so efficient for large line
60
 * ranges.
61
 * 
62
 * @see org.eclipse.cdt.internal.ui.text.CHeuristicScanner
63
 * @see org.eclipse.cdt.internal.ui.text.CIndenter
64
 */
65
public class IndentAction extends TextEditorAction {
66
	
67
	/** The caret offset after an indent operation. */
68
	private int fCaretOffset;
69
	
70
	/** 
71
	 * Whether this is the action invoked by TAB. When <code>true</code>, indentation behaves 
72
	 * differently to accommodate normal TAB operation.
73
	 */
74
	private final boolean fIsTabAction;
75
	
76
	/**
77
	 * Creates a new instance.
78
	 * 
79
	 * @param bundle the resource bundle
80
	 * @param prefix the prefix to use for keys in <code>bundle</code>
81
	 * @param editor the text editor
82
	 * @param isTabAction whether the action should insert tabs if over the indentation
83
	 */
84
	public IndentAction(ResourceBundle bundle, String prefix, ITextEditor editor, boolean isTabAction) {
85
		super(bundle, prefix, editor);
86
		fIsTabAction= isTabAction;
87
	}
88
	
89
	/*
90
	 * @see org.eclipse.jface.action.Action#run()
91
	 */
92
	public void run() {
93
		// update has been called by the framework
94
		if (!isEnabled() || !validateEditorInputState())
95
			return;
96
		
97
		ITextSelection selection= getSelection();
98
		final IDocument document= getDocument();
99
		
100
		if (document != null) {
101
			final int offset= selection.getOffset();
102
			final int length= selection.getLength();
103
			final Position end= new Position(offset + length);
104
			final int firstLine, nLines;
105
			fCaretOffset= -1;
106
			
107
			try {
108
				document.addPosition(end);
109
				firstLine= document.getLineOfOffset(offset);
110
				// check for marginal (zero-length) lines
111
				int minusOne= length == 0 ? 0 : 1;
112
				nLines= document.getLineOfOffset(offset + length - minusOne) - firstLine + 1;
113
			} catch (BadLocationException e) {
114
				// will only happen on concurrent modification
115
				CUIPlugin.getDefault().log(new Status(IStatus.ERROR, CUIPlugin.getPluginId(), IStatus.OK, "", e)); //$NON-NLS-1$
116
				return;
117
			}
118
			
119
			Runnable runnable= new Runnable() {
120
				public void run() {
121
					IRewriteTarget target= (IRewriteTarget)getTextEditor().getAdapter(IRewriteTarget.class);
122
					if (target != null)
123
						target.beginCompoundChange();
124
					
125
					try {
126
						CHeuristicScanner scanner= new CHeuristicScanner(document);
127
						CIndenter indenter= new CIndenter(document, scanner, getCProject());
128
						final boolean multiLine= nLines > 1;
129
						boolean hasChanged= false;
130
						for (int i= 0; i < nLines; i++) {
131
							hasChanged |= indentLine(document, firstLine + i, offset, indenter, scanner, multiLine);
132
						}
133
						
134
						// update caret position: move to new position when indenting just one line
135
						// keep selection when indenting multiple
136
						int newOffset, newLength;
137
						if (!fIsTabAction && multiLine) {
138
							newOffset= offset;
139
							newLength= end.getOffset() - offset;
140
						} else {
141
							newOffset= fCaretOffset;
142
							newLength= 0;
143
						}
144
						
145
						// always reset the selection if anything was replaced
146
						// but not when we had a single line non-tab invocation
147
						if (newOffset != -1 && (hasChanged || newOffset != offset || newLength != length))
148
							selectAndReveal(newOffset, newLength);
149
						
150
						document.removePosition(end);
151
					} catch (BadLocationException e) {
152
						// will only happen on concurrent modification
153
						CUIPlugin.getDefault().log(new Status(IStatus.ERROR, CUIPlugin.getPluginId(), IStatus.OK, "ConcurrentModification in IndentAction", e)); //$NON-NLS-1$
154
					} finally {
155
						if (target != null)
156
							target.endCompoundChange();
157
					}
158
				}
159
			};
160
			
161
			if (nLines > 50) {
162
				Display display= getTextEditor().getEditorSite().getWorkbenchWindow().getShell().getDisplay();
163
				BusyIndicator.showWhile(display, runnable);
164
			} else {
165
				runnable.run();
166
			}
167
		}
168
	}
169
	
170
	/**
171
	 * Selects the given range on the editor.
172
	 * 
173
	 * @param newOffset the selection offset
174
	 * @param newLength the selection range
175
	 */
176
	private void selectAndReveal(int newOffset, int newLength) {
177
		Assert.isTrue(newOffset >= 0); 
178
		Assert.isTrue(newLength >= 0); 
179
		ITextEditor editor= getTextEditor();
180
		if (editor instanceof CEditor) {
181
			ISourceViewer viewer= ((CEditor)editor).getViewer();
182
			if (viewer != null)
183
				viewer.setSelectedRange(newOffset, newLength);
184
		} else {
185
			// this is too intrusive, but will never get called anyway
186
			getTextEditor().selectAndReveal(newOffset, newLength);
187
		}
188
	}
189
190
	/**
191
	 * Indents a single line using the java heuristic scanner. Cdoc and multiline comments are 
192
	 * indented as specified by the <code>CDocAutoIndentStrategy</code>.
193
	 * 
194
	 * @param document the document
195
	 * @param line the line to be indented
196
	 * @param caret the caret position
197
	 * @param indenter the java indenter
198
	 * @param scanner the heuristic scanner
199
	 * @param multiLine <code>true</code> if more than one line is being indented 
200
	 * @return <code>true</code> if <code>document</code> was modified, <code>false</code> otherwise
201
	 * @throws BadLocationException if the document got changed concurrently 
202
	 */
203
	private boolean indentLine(IDocument document, int line, int caret, CIndenter indenter, CHeuristicScanner scanner, boolean multiLine) throws BadLocationException {
204
		IRegion currentLine= document.getLineInformation(line);
205
		int offset= currentLine.getOffset();
206
		int wsStart= offset; // where we start searching for non-WS; after the "//" in single line comments
207
		
208
		String indent= null;
209
		if (offset < document.getLength()) {
210
			ITypedRegion partition= TextUtilities.getPartition(document, ICPartitions.C_PARTITIONING, offset, true);
211
			ITypedRegion startingPartition= TextUtilities.getPartition(document, ICPartitions.C_PARTITIONING, offset, false);
212
			String type= partition.getType();
213
			if (type.equals(ICPartitions.C_MULTI_LINE_COMMENT)) {
214
				indent= computeDocIndent(document, line, scanner, startingPartition);
215
			} else if (!fIsTabAction && startingPartition.getOffset() == offset && startingPartition.getType().equals(ICPartitions.C_SINGLE_LINE_COMMENT)) {
216
				// line comment starting at position 0 -> indent inside
217
				int max= document.getLength() - offset;
218
				int slashes= 2;
219
				while (slashes < max - 1 && document.get(offset + slashes, 2).equals("//")) //$NON-NLS-1$
220
					slashes+= 2;
221
				
222
				wsStart= offset + slashes;
223
				
224
				StringBuffer computed= indenter.computeIndentation(offset);
225
				if (computed == null)
226
					computed= new StringBuffer(0);
227
				int tabSize= getTabSize();
228
				while (slashes > 0 && computed.length() > 0) {
229
					char c= computed.charAt(0);
230
					if (c == '\t') {
231
						if (slashes > tabSize)
232
							slashes-= tabSize;
233
						else
234
							break;
235
					} else if (c == ' ') {
236
						slashes--;
237
					} else {
238
						break;
239
					}
240
					
241
					computed.deleteCharAt(0);
242
				}
243
				
244
				indent= document.get(offset, wsStart - offset) + computed;
245
			}
246
		} 
247
		
248
		// standard java indentation
249
		if (indent == null) {
250
			StringBuffer computed= indenter.computeIndentation(offset);
251
			if (computed != null)
252
				indent= computed.toString();
253
			else
254
				indent= ""; //$NON-NLS-1$
255
		}
256
		
257
		// change document:
258
		// get current white space
259
		int lineLength= currentLine.getLength();
260
		int end= scanner.findNonWhitespaceForwardInAnyPartition(wsStart, offset + lineLength);
261
		if (end == CHeuristicScanner.NOT_FOUND) {
262
			// an empty line
263
			end= offset + lineLength;
264
			if (multiLine && !indentEmptyLines())
265
				indent= ""; //$NON-NLS-1$
266
		}
267
		int length= end - offset;
268
		String currentIndent= document.get(offset, length);
269
		
270
		// if we are right before the text start / line end, and already after the insertion point
271
		// then just insert a tab.
272
		if (fIsTabAction && caret == end && whiteSpaceLength(currentIndent) >= whiteSpaceLength(indent)) {
273
			String tab= getTabEquivalent();
274
			document.replace(caret, 0, tab);
275
			fCaretOffset= caret + tab.length();
276
			return true;
277
		}
278
		
279
		// set the caret offset so it can be used when setting the selection
280
		if (caret >= offset && caret <= end)
281
			fCaretOffset= offset + indent.length();
282
		else
283
			fCaretOffset= -1;
284
		
285
		// only change the document if it is a real change
286
		if (!indent.equals(currentIndent)) {
287
			document.replace(offset, length, indent);
288
			return true;
289
		} else {
290
			return false;
291
		}
292
	}
293
294
	/**
295
	 * Computes and returns the indentation for a javadoc line. The line
296
	 * must be inside a javadoc comment.
297
	 * 
298
	 * @param document the document
299
	 * @param line the line in document
300
	 * @param scanner the scanner
301
	 * @param partition the javadoc partition
302
	 * @return the indent, or <code>null</code> if not computable
303
	 * @throws BadLocationException
304
	 */
305
	private String computeDocIndent(IDocument document, int line, CHeuristicScanner scanner, ITypedRegion partition) throws BadLocationException {
306
		if (line == 0) // impossible - the first line is never inside a javadoc comment
307
			return null;
308
		
309
		// don't make any assumptions if the line does not start with \s*\* - it might be
310
		// commented out code, for which we don't want to change the indent
311
		final IRegion lineInfo= document.getLineInformation(line);
312
		final int lineStart= lineInfo.getOffset();
313
		final int lineLength= lineInfo.getLength();
314
		final int lineEnd= lineStart + lineLength;
315
		int nonWS= scanner.findNonWhitespaceForwardInAnyPartition(lineStart, lineEnd);
316
		if (nonWS == CHeuristicScanner.NOT_FOUND || document.getChar(nonWS) != '*') {
317
			if (nonWS == CHeuristicScanner.NOT_FOUND)
318
				return document.get(lineStart, lineLength);
319
			return document.get(lineStart, nonWS - lineStart);
320
		}
321
		
322
		// take the indent from the previous line and reuse
323
		IRegion previousLine= document.getLineInformation(line - 1);
324
		int previousLineStart= previousLine.getOffset();
325
		int previousLineLength= previousLine.getLength();
326
		int previousLineEnd= previousLineStart + previousLineLength;
327
		
328
		StringBuffer buf= new StringBuffer();
329
		int previousLineNonWS= scanner.findNonWhitespaceForwardInAnyPartition(previousLineStart, previousLineEnd);
330
		if (previousLineNonWS == CHeuristicScanner.NOT_FOUND || document.getChar(previousLineNonWS) != '*') {
331
			// align with the comment start if the previous line is not an asterisked line
332
			previousLine= document.getLineInformationOfOffset(partition.getOffset());
333
			previousLineStart= previousLine.getOffset();
334
			previousLineLength= previousLine.getLength();
335
			previousLineEnd= previousLineStart + previousLineLength;
336
			previousLineNonWS= scanner.findNonWhitespaceForwardInAnyPartition(previousLineStart, previousLineEnd);
337
			if (previousLineNonWS == CHeuristicScanner.NOT_FOUND)
338
				previousLineNonWS= previousLineEnd;
339
			
340
			// add the initial space 
341
			// TODO this may be controlled by a formatter preference in the future
342
			buf.append(' ');
343
		}
344
		
345
		String indentation= document.get(previousLineStart, previousLineNonWS - previousLineStart);
346
		buf.insert(0, indentation);
347
		return buf.toString();
348
	}
349
	
350
	/**
351
	 * Returns the size in characters of a string. All characters count one, tabs count the editor's
352
	 * preference for the tab display 
353
	 * 
354
	 * @param indent the string to be measured.
355
	 * @return the size in characters of a string
356
	 */
357
	private int whiteSpaceLength(String indent) {
358
		if (indent == null)
359
			return 0;
360
		else {
361
			int size= 0;
362
			int l= indent.length();
363
			int tabSize= getTabSize();
364
			
365
			for (int i= 0; i < l; i++)
366
				size += indent.charAt(i) == '\t' ? tabSize : 1;
367
			return size;
368
		}
369
	}
370
371
	/**
372
	 * Returns a tab equivalent, either as a tab character or as spaces, depending on the editor and
373
	 * formatter preferences.
374
	 * 
375
	 * @return a string representing one tab in the editor, never <code>null</code>
376
	 */
377
	private String getTabEquivalent() {
378
		String tab;
379
		if (CCorePlugin.SPACE.equals(getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR))) {
380
			int size= getTabSize();
381
			StringBuffer buf= new StringBuffer();
382
			for (int i= 0; i< size; i++)
383
				buf.append(' ');
384
			tab= buf.toString();
385
		} else {
386
			tab= "\t"; //$NON-NLS-1$
387
		}
388
	
389
		return tab;
390
	}
391
	
392
	/**
393
	 * Returns the tab size used by the java editor, which is deduced from the
394
	 * formatter preferences.
395
	 * 
396
	 * @return the tab size as defined in the current formatter preferences
397
	 */
398
	private int getTabSize() {
399
		return getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, 4);
400
	}
401
402
	/**
403
	 * Returns <code>true</code> if empty lines should be indented, false otherwise.
404
	 * 
405
	 * @return <code>true</code> if empty lines should be indented, false otherwise
406
	 */
407
	private boolean indentEmptyLines() {
408
		return DefaultCodeFormatterConstants.TRUE.equals(getCoreFormatterOption(DefaultCodeFormatterConstants.FORMATTER_INDENT_EMPTY_LINES));
409
	}
410
	
411
	/**
412
	 * Returns the possibly project-specific core preference defined under <code>key</code>.
413
	 * 
414
	 * @param key the key of the preference
415
	 * @return the value of the preference
416
	 */
417
	private String getCoreFormatterOption(String key) {
418
		ICProject project= getCProject();
419
		if (project == null)
420
			return CCorePlugin.getOption(key);
421
		return project.getOption(key, true);
422
	}
423
424
	/**
425
	 * Returns the possibly project-specific core preference defined under <code>key</code>, or
426
	 * <code>def</code> if the value is not a integer.
427
	 * 
428
	 * @param key the key of the preference
429
	 * @param def the default value
430
	 * @return the value of the preference
431
	 */
432
	private int getCoreFormatterOption(String key, int def) {
433
		try {
434
			return Integer.parseInt(getCoreFormatterOption(key));
435
		} catch (NumberFormatException e) {
436
			return def;
437
		}
438
	}
439
440
	/**
441
	 * Returns the <code>ICProject</code> of the current editor input, or
442
	 * <code>null</code> if it cannot be found.
443
	 * 
444
	 * @return the <code>ICProject</code> of the current editor input, or
445
	 *         <code>null</code> if it cannot be found
446
	 */
447
	private ICProject getCProject() {
448
		ITextEditor editor= getTextEditor();
449
		if (editor == null)
450
			return null;
451
		
452
		ITranslationUnit cu= CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(editor.getEditorInput());
453
		if (cu == null)
454
			return null;
455
		return cu.getCProject();
456
	}
457
458
	/**
459
	 * Returns the editor's selection provider.
460
	 * 
461
	 * @return the editor's selection provider or <code>null</code>
462
	 */
463
	private ISelectionProvider getSelectionProvider() {
464
		ITextEditor editor= getTextEditor();
465
		if (editor != null) {
466
			return editor.getSelectionProvider();
467
		}
468
		return null;
469
	}
470
	
471
	/*
472
	 * @see org.eclipse.ui.texteditor.IUpdate#update()
473
	 */
474
	public void update() {
475
		super.update();
476
		
477
		if (isEnabled()) {
478
			if (fIsTabAction)
479
				setEnabled(canModifyEditor() && isSmartMode() && isValidSelection());
480
			else
481
				setEnabled(canModifyEditor() && !getSelection().isEmpty());
482
		}
483
	}
484
	
485
	/**
486
	 * Returns if the current selection is valid, i.e. whether it is empty and the caret in the 
487
	 * whitespace at the start of a line, or covers multiple lines.
488
	 * 
489
	 * @return <code>true</code> if the selection is valid for an indent operation
490
	 */
491
	private boolean isValidSelection() {
492
		ITextSelection selection= getSelection();
493
		if (selection.isEmpty())
494
			return false;
495
		
496
		int offset= selection.getOffset();
497
		int length= selection.getLength();
498
		
499
		IDocument document= getDocument();
500
		if (document == null)
501
			return false;
502
		
503
		try {
504
			IRegion firstLine= document.getLineInformationOfOffset(offset);
505
			int lineOffset= firstLine.getOffset();
506
			
507
			// either the selection has to be empty and the caret in the WS at the line start
508
			// or the selection has to extend over multiple lines
509
			if (length == 0) {
510
				return document.get(lineOffset, offset - lineOffset).trim().length() == 0;
511
			} else {
512
//				return lineOffset + firstLine.getLength() < offset + length;
513
				return false; // only enable for empty selections for now
514
			}
515
		} catch (BadLocationException e) {
516
		}
517
		
518
		return false;
519
	}
520
	
521
	/**
522
	 * Returns the smart preference state.
523
	 * 
524
	 * @return <code>true</code> if smart mode is on, <code>false</code> otherwise
525
	 */
526
	private boolean isSmartMode() {
527
		ITextEditor editor= getTextEditor();
528
		
529
		if (editor instanceof ITextEditorExtension3)
530
			return ((ITextEditorExtension3) editor).getInsertMode() == ITextEditorExtension3.SMART_INSERT;
531
		
532
		return false;
533
	}
534
	
535
	/**
536
	 * Returns the document currently displayed in the editor, or <code>null</code> if none can be 
537
	 * obtained.
538
	 * 
539
	 * @return the current document or <code>null</code>
540
	 */
541
	private IDocument getDocument() {
542
		
543
		ITextEditor editor= getTextEditor();
544
		if (editor != null) {
545
			
546
			IDocumentProvider provider= editor.getDocumentProvider();
547
			IEditorInput input= editor.getEditorInput();
548
			if (provider != null && input != null)
549
				return provider.getDocument(input);
550
			
551
		}
552
		return null;
553
	}
554
	
555
	/**
556
	 * Returns the selection on the editor or an invalid selection if none can be obtained. Returns
557
	 * never <code>null</code>.
558
	 * 
559
	 * @return the current selection, never <code>null</code>
560
	 */
561
	private ITextSelection getSelection() {
562
		ISelectionProvider provider= getSelectionProvider();
563
		if (provider != null) {
564
			
565
			ISelection selection= provider.getSelection();
566
			if (selection instanceof ITextSelection)
567
				return (ITextSelection) selection;
568
		}
569
		
570
		// null object
571
		return TextSelection.emptySelection();
572
	}
573
}
(-)src/org/eclipse/cdt/internal/ui/preferences/PreferencesAccess.java (+124 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
13
package org.eclipse.cdt.internal.ui.preferences;
14
15
import org.eclipse.core.runtime.IPath;
16
import org.eclipse.core.runtime.preferences.DefaultScope;
17
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
18
import org.eclipse.core.runtime.preferences.IScopeContext;
19
import org.eclipse.core.runtime.preferences.InstanceScope;
20
21
import org.eclipse.core.resources.IProject;
22
import org.eclipse.core.resources.ProjectScope;
23
24
import org.eclipse.ui.preferences.IWorkingCopyManager;
25
26
import org.osgi.service.prefs.BackingStoreException;
27
28
/**
29
 * 
30
 */
31
public class PreferencesAccess {
32
	
33
	public static PreferencesAccess getOriginalPreferences() {
34
		return new PreferencesAccess();
35
	}
36
	
37
	public static PreferencesAccess getWorkingCopyPreferences(IWorkingCopyManager workingCopyManager) {
38
		return new WorkingCopyPreferencesAccess(workingCopyManager);
39
	}
40
		
41
	private PreferencesAccess() {
42
		// can only extends in this file
43
	}
44
	
45
	public IScopeContext getDefaultScope() {
46
		return new DefaultScope();
47
	}
48
	
49
	public IScopeContext getInstanceScope() {
50
		return new InstanceScope();
51
	}
52
	
53
	public IScopeContext getProjectScope(IProject project) {
54
		return new ProjectScope(project);
55
	}
56
	
57
	public void applyChanges() throws BackingStoreException {
58
	}
59
	
60
	
61
	private static class WorkingCopyPreferencesAccess extends PreferencesAccess {
62
		
63
		private final IWorkingCopyManager fWorkingCopyManager;
64
65
		private WorkingCopyPreferencesAccess(IWorkingCopyManager workingCopyManager) {
66
			fWorkingCopyManager= workingCopyManager;
67
		}
68
		
69
		private final IScopeContext getWorkingCopyScopeContext(IScopeContext original) {
70
			return new WorkingCopyScopeContext(fWorkingCopyManager, original);
71
		}
72
		
73
		public IScopeContext getDefaultScope() {
74
			return getWorkingCopyScopeContext(super.getDefaultScope());
75
		}
76
		
77
		public IScopeContext getInstanceScope() {
78
			return getWorkingCopyScopeContext(super.getInstanceScope());
79
		}
80
		
81
		public IScopeContext getProjectScope(IProject project) {
82
			return getWorkingCopyScopeContext(super.getProjectScope(project));
83
		}
84
		
85
		/* (non-Javadoc)
86
		 * @see org.eclipse.cdt.internal.ui.preferences.PreferencesAccess#applyChanges()
87
		 */
88
		public void applyChanges() throws BackingStoreException {
89
			fWorkingCopyManager.applyChanges();
90
		}
91
	}
92
	
93
	private static class WorkingCopyScopeContext implements IScopeContext {
94
		
95
		private final IWorkingCopyManager fWorkingCopyManager;
96
		private final IScopeContext fOriginal;
97
98
		public WorkingCopyScopeContext(IWorkingCopyManager workingCopyManager, IScopeContext original) {
99
			fWorkingCopyManager= workingCopyManager;
100
			fOriginal= original;	
101
		}
102
103
		/* (non-Javadoc)
104
		 * @see org.eclipse.core.runtime.preferences.IScopeContext#getName()
105
		 */
106
		public String getName() {
107
			return fOriginal.getName();
108
		}
109
110
		/* (non-Javadoc)
111
		 * @see org.eclipse.core.runtime.preferences.IScopeContext#getNode(java.lang.String)
112
		 */
113
		public IEclipsePreferences getNode(String qualifier) {
114
			return fWorkingCopyManager.getWorkingCopy(fOriginal.getNode(qualifier));
115
		}
116
117
		/* (non-Javadoc)
118
		 * @see org.eclipse.core.runtime.preferences.IScopeContext#getLocation()
119
		 */
120
		public IPath getLocation() {
121
			return fOriginal.getLocation();
122
		}
123
	}
124
}
(-)src/org/eclipse/cdt/internal/ui/preferences/formatter/CustomCodeFormatterBlock.java (+175 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 QNX Software Systems and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     QNX Software Systems - Initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
13
package org.eclipse.cdt.internal.ui.preferences.formatter;
14
15
import java.util.HashMap;
16
import java.util.Iterator;
17
import java.util.Map;
18
19
import org.eclipse.core.runtime.IConfigurationElement;
20
import org.eclipse.core.runtime.IExtension;
21
import org.eclipse.core.runtime.IExtensionPoint;
22
import org.eclipse.core.runtime.Platform;
23
import org.eclipse.core.runtime.Preferences;
24
import org.eclipse.swt.SWT;
25
import org.eclipse.swt.events.SelectionAdapter;
26
import org.eclipse.swt.events.SelectionEvent;
27
import org.eclipse.swt.layout.GridData;
28
import org.eclipse.swt.layout.GridLayout;
29
import org.eclipse.swt.widgets.Combo;
30
import org.eclipse.swt.widgets.Composite;
31
import org.eclipse.swt.widgets.Control;
32
import org.eclipse.swt.widgets.Label;
33
import org.eclipse.ui.PlatformUI;
34
35
import org.eclipse.cdt.core.CCorePlugin;
36
import org.eclipse.cdt.core.CCorePreferenceConstants;
37
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
38
39
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
40
41
/**
42
 * 
43
 */
44
public class CustomCodeFormatterBlock {
45
46
	private HashMap idMap = new HashMap();
47
	Preferences fPrefs;
48
	protected Combo fFormatterCombo;
49
	private static final String ATTR_NAME = "name"; //$NON-NLS-1$
50
	private static final String ATTR_ID="id"; //$NON-NLS-1$
51
	// This is a hack until we have a default Formatter.
52
	// For now it is comment out in the plugin.xml
53
	private static final String NONE=FormatterMessages.CustomCodeFormatterBlock_no_formatter;
54
55
56
	public CustomCodeFormatterBlock(Preferences prefs) {
57
		fPrefs = prefs;
58
		initializeFormatters();
59
	}
60
61
	public void performOk() {
62
		String text = fFormatterCombo.getText();
63
		String selection = (String)idMap.get(text);
64
		if (selection != null && selection.length() > 0) {
65
			HashMap options = CCorePlugin.getOptions();
66
			String formatterID = (String)options.get(CCorePreferenceConstants.CODE_FORMATTER);
67
			if (formatterID == null || !formatterID.equals(selection)) {
68
				options.put(CCorePreferenceConstants.CODE_FORMATTER, selection);
69
				CCorePlugin.setOptions(options);
70
			}
71
		} else {
72
			// simply reset to the default one.
73
			performDefaults();
74
		}
75
	}
76
77
	public void performDefaults() {
78
		HashMap optionsDefault = CCorePlugin.getDefaultOptions();
79
		HashMap options = CCorePlugin.getOptions();
80
		String formatterID = (String)optionsDefault.get(CCorePreferenceConstants.CODE_FORMATTER);
81
		options.put(CCorePreferenceConstants.CODE_FORMATTER, formatterID);
82
		CCorePlugin.setOptions(options);
83
84
		fFormatterCombo.clearSelection();
85
		fFormatterCombo.setText(NONE);
86
		Iterator iterator = idMap.entrySet().iterator();
87
		while (iterator.hasNext()) {
88
			Map.Entry entry = (Map.Entry)iterator.next();
89
			String val = (String)entry.getValue();
90
			if (val != null && val.equals(formatterID)) {
91
				fFormatterCombo.setText((String)entry.getKey());
92
			}
93
		}
94
	}
95
96
	/* (non-Javadoc)
97
	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
98
	 */
99
	public Control createControl(Composite parent) {
100
		Composite control = ControlFactory.createComposite(parent, 1);
101
		((GridLayout)control.getLayout()).marginWidth = 0;
102
		((GridData)control.getLayoutData()).horizontalSpan = 2;
103
104
		PlatformUI.getWorkbench().getHelpSystem().setHelp(control, ICHelpContextIds.CODEFORMATTER_PREFERENCE_PAGE);
105
106
		ControlFactory.createEmptySpace(control, 1);
107
108
		Label label = ControlFactory.createLabel(control, FormatterMessages.CustomCodeFormatterBlock_formatter_name);
109
		label.setLayoutData(new GridData());
110
		fFormatterCombo = new Combo(control, SWT.DROP_DOWN | SWT.READ_ONLY);
111
		fFormatterCombo.setFont(parent.getFont());
112
		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
113
		fFormatterCombo.setLayoutData(gd);
114
		fFormatterCombo.addSelectionListener(new SelectionAdapter() {
115
			public void widgetSelected(SelectionEvent e) {
116
				handleFormatterChanged();
117
			}
118
		});
119
		Iterator items = idMap.keySet().iterator();
120
		while (items.hasNext()) {
121
			fFormatterCombo.add((String) items.next());
122
		}
123
124
		initDefault();
125
		handleFormatterChanged();
126
		
127
		if (getNumberOfAvailableFormatters() == 0) {
128
			control.setVisible(false);
129
		}
130
		return control;
131
	}
132
133
	private void handleFormatterChanged() {	
134
		// TODO: UI part.
135
	}
136
137
	private void initDefault() {
138
		boolean init = false;
139
		String selection = CCorePlugin.getOption(CCorePreferenceConstants.CODE_FORMATTER);
140
		if (selection != null) {
141
			Iterator iterator = idMap.entrySet().iterator();
142
			while (iterator.hasNext()) {
143
				Map.Entry entry = (Map.Entry)iterator.next();
144
				String val = (String)entry.getValue();
145
				if (val != null && val.equals(selection)) {
146
					fFormatterCombo.setText((String)entry.getKey());
147
					init = true;
148
				}
149
			}
150
		}
151
		if (!init) {
152
			fFormatterCombo.setText(NONE);
153
		}
154
	}
155
156
	private void initializeFormatters() {
157
		idMap = new HashMap();
158
		idMap.put(NONE, null);
159
		IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, CCorePlugin.FORMATTER_EXTPOINT_ID);
160
		if (point != null) {
161
			IExtension[] exts = point.getExtensions();
162
			for (int i = 0; i < exts.length; i++) {
163
		 		IConfigurationElement[] elements = exts[i].getConfigurationElements();
164
		 		for (int j = 0; j < elements.length; ++j) {
165
		 			String name = elements[j].getAttribute(ATTR_NAME);
166
		 			idMap.put(name, elements[j].getAttribute(ATTR_ID));
167
		 		}
168
			}
169
		}
170
	}
171
	
172
	private final int getNumberOfAvailableFormatters() {
173
		return idMap.size() - 1;
174
	}
175
}
(-)src/org/eclipse/cdt/internal/ui/text/SimpleCSourceViewerConfiguration.java (+141 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
package org.eclipse.cdt.internal.ui.text;
13
14
import org.eclipse.jface.preference.IPreferenceStore;
15
16
import org.eclipse.jface.text.IAutoEditStrategy;
17
import org.eclipse.jface.text.IInformationControlCreator;
18
import org.eclipse.jface.text.ITextHover;
19
import org.eclipse.jface.text.formatter.IContentFormatter;
20
import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
21
import org.eclipse.jface.text.information.IInformationPresenter;
22
import org.eclipse.jface.text.source.IAnnotationHover;
23
import org.eclipse.jface.text.source.ISourceViewer;
24
25
import org.eclipse.ui.texteditor.ITextEditor;
26
27
28
/**
29
 * A simple {@linkplain org.eclipse.cdt.internal.ui.text.CSourceViewerConfiguration C source viewer configuration}.
30
 * <p>
31
 * This simple source viewer configuration basically provides syntax coloring
32
 * and disables all other features like code assist, quick outlines, hyperlinking, etc.
33
 * </p>
34
 */
35
public class SimpleCSourceViewerConfiguration extends CSourceViewerConfiguration {
36
37
38
	private boolean fConfigureFormatter;
39
40
	/**
41
	 * Creates a new C source viewer configuration for viewers in the given editor
42
	 * using the given preference store, the color manager and the specified document partitioning.
43
	 *
44
	 * @param colorManager the color manager
45
	 * @param preferenceStore the preference store, can be read-only
46
	 * @param editor the editor in which the configured viewer(s) will reside, or <code>null</code> if none
47
	 * @param partitioning the document partitioning for this configuration, or <code>null</code> for the default partitioning
48
	 * @param configureFormatter <code>true</code> if a content formatter should be configured
49
	 */
50
	public SimpleCSourceViewerConfiguration(IColorManager colorManager, IPreferenceStore preferenceStore, ITextEditor editor, String partitioning, boolean configureFormatter) {
51
		super(colorManager, preferenceStore, editor, partitioning);
52
		fConfigureFormatter= configureFormatter;
53
	}
54
	
55
	/*
56
	 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAutoEditStrategies(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
57
	 */
58
	public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) {
59
		return null;
60
	}
61
62
	/*
63
	 * @see SourceViewerConfiguration#getAnnotationHover(ISourceViewer)
64
	 */
65
	public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
66
		return null;
67
	}
68
69
	/*
70
	 * @see SourceViewerConfiguration#getOverviewRulerAnnotationHover(ISourceViewer)
71
	 */
72
	public IAnnotationHover getOverviewRulerAnnotationHover(ISourceViewer sourceViewer) {
73
		return null;
74
	}
75
76
	/*
77
	 * @see SourceViewerConfiguration#getConfiguredTextHoverStateMasks(ISourceViewer, String)
78
	 */
79
	public int[] getConfiguredTextHoverStateMasks(ISourceViewer sourceViewer, String contentType) {
80
		return null;
81
	}
82
83
	/*
84
	 * @see SourceViewerConfiguration#getTextHover(ISourceViewer, String, int)
85
	 */
86
	public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask) {
87
		return null;
88
	}
89
90
	/*
91
	 * @see SourceViewerConfiguration#getTextHover(ISourceViewer, String)
92
	 */
93
	public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
94
		return null;
95
	}
96
97
	/*
98
	 * @see SourceViewerConfiguration#getContentFormatter(ISourceViewer)
99
	 */
100
	public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
101
		if (fConfigureFormatter)
102
			return super.getContentFormatter(sourceViewer);
103
		else
104
			return null;
105
	}
106
107
	/*
108
	 * @see SourceViewerConfiguration#getInformationControlCreator(ISourceViewer)
109
	 */
110
	public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer) {
111
		return null;
112
	}
113
114
	/*
115
	 * @see SourceViewerConfiguration#getInformationPresenter(ISourceViewer)
116
	 */
117
	public IInformationPresenter getInformationPresenter(ISourceViewer sourceViewer) {
118
		return null;
119
	}
120
121
	/*
122
	 * @see org.eclipse.cdt.ui.text.CSourceViewerConfiguration#getOutlinePresenter(org.eclipse.jface.text.source.ISourceViewer, boolean)
123
	 */
124
	public IInformationPresenter getOutlinePresenter(ISourceViewer sourceViewer, boolean doCodeResolve) {
125
		return null;
126
	}
127
128
	/*
129
	 * @see org.eclipse.cdt.ui.text.CSourceViewerConfiguration#getHierarchyPresenter(org.eclipse.jface.text.source.ISourceViewer, boolean)
130
	 */
131
	public IInformationPresenter getHierarchyPresenter(ISourceViewer sourceViewer, boolean doCodeResolve) {
132
		return null;
133
	}
134
135
	/*
136
	 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getHyperlinkDetectors(org.eclipse.jface.text.source.ISourceViewer)
137
	 */
138
	public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
139
		return null;
140
	}
141
}
(-)src/org/eclipse/cdt/internal/ui/preferences/ScrolledPageContent.java (+65 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
package org.eclipse.cdt.internal.ui.preferences;
13
14
import org.eclipse.swt.SWT;
15
import org.eclipse.swt.widgets.Composite;
16
import org.eclipse.swt.widgets.Control;
17
18
import org.eclipse.ui.forms.FormColors;
19
import org.eclipse.ui.forms.widgets.FormToolkit;
20
import org.eclipse.ui.forms.widgets.SharedScrolledComposite;
21
22
23
public class ScrolledPageContent extends SharedScrolledComposite {
24
25
	private FormToolkit fToolkit;
26
	
27
	public ScrolledPageContent(Composite parent) {
28
		this(parent, SWT.V_SCROLL | SWT.H_SCROLL);
29
	}
30
	
31
	public ScrolledPageContent(Composite parent, int style) {
32
		super(parent, style);
33
		
34
		setFont(parent.getFont());
35
		
36
		FormColors colors= new FormColors(parent.getDisplay());
37
		colors.setBackground(null);
38
		colors.setForeground(null);
39
		
40
		fToolkit= new FormToolkit(colors);
41
		
42
		setExpandHorizontal(true);
43
		setExpandVertical(true);
44
		
45
		Composite body= new Composite(this, SWT.NONE);
46
		body.setFont(parent.getFont());
47
		setContent(body);
48
	}
49
	
50
	/* (non-Javadoc)
51
	 * @see org.eclipse.swt.widgets.Widget#dispose()
52
	 */
53
	public void dispose() {
54
		fToolkit.dispose();
55
		super.dispose();
56
	}
57
	
58
	public void adaptChild(Control childControl) {
59
		fToolkit.adapt(childControl, true, true);
60
	}
61
	
62
	public Composite getBody() {
63
		return (Composite) getContent();
64
	}
65
}
(-)src/org/eclipse/cdt/internal/ui/preferences/formatter/ProfileManager.java (+793 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
package org.eclipse.cdt.internal.ui.preferences.formatter;
13
14
import java.util.ArrayList;
15
import java.util.Collections;
16
import java.util.HashMap;
17
import java.util.Iterator;
18
import java.util.List;
19
import java.util.Map;
20
import java.util.Observable;
21
22
import org.eclipse.core.runtime.preferences.DefaultScope;
23
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
24
import org.eclipse.core.runtime.preferences.IScopeContext;
25
import org.eclipse.core.runtime.preferences.InstanceScope;
26
27
import org.eclipse.core.resources.IProject;
28
import org.eclipse.core.resources.ProjectScope;
29
import org.eclipse.core.resources.ResourcesPlugin;
30
31
import org.eclipse.cdt.core.CCorePlugin;
32
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
33
34
import org.eclipse.cdt.internal.ui.util.Messages;
35
36
import org.eclipse.cdt.ui.CUIPlugin;
37
import org.eclipse.cdt.ui.PreferenceConstants;
38
39
import org.eclipse.cdt.internal.ui.preferences.PreferencesAccess;
40
41
import org.osgi.service.prefs.BackingStoreException;
42
43
44
/**
45
 * The model for the set of profiles which are available in the workbench.
46
 */
47
public class ProfileManager extends Observable {
48
	
49
    /**
50
     * A prefix which is prepended to every ID of a user-defined profile, in order
51
     * to differentiate it from a built-in profile.
52
     */
53
	private final static String ID_PREFIX= "_"; //$NON-NLS-1$
54
	
55
	/**
56
	 * Represents a profile with a unique ID, a name and a map 
57
	 * containing the code formatter settings.
58
	 */
59
	public static abstract class Profile implements Comparable {
60
		
61
		public abstract String getName();
62
		public abstract Profile rename(String name, ProfileManager manager);
63
		
64
		public abstract Map getSettings();
65
		public abstract void setSettings(Map settings);
66
		
67
		public int getVersion() {
68
			return ProfileVersioner.CURRENT_VERSION;
69
		}
70
		
71
		public boolean hasEqualSettings(Map otherMap, List allKeys) {
72
			Map settings= getSettings();
73
			for (Iterator iter= allKeys.iterator(); iter.hasNext(); ){
74
				String key= (String) iter.next();
75
				Object other= otherMap.get(key);
76
				Object curr= settings.get(key);
77
				if (other == null) {
78
					if (curr != null) {
79
						return false;
80
					}
81
				} else if (!other.equals(curr)) {
82
					return false;
83
				}
84
			}
85
			return true;
86
		}
87
		
88
		public abstract boolean isProfileToSave();
89
		
90
		public abstract String getID();
91
		
92
		public boolean isSharedProfile() {
93
			return false;
94
		}
95
		
96
		public boolean isBuiltInProfile() {
97
			return false;
98
		}
99
	}
100
	
101
	/**
102
	 * Represents a built-in profile. The state of a built-in profile 
103
	 * cannot be changed after instantiation.
104
	 */
105
	public final static class BuiltInProfile extends Profile {
106
		private final String fName;
107
		private final String fID;
108
		private final Map fSettings;
109
		private final int fOrder;
110
		
111
		protected BuiltInProfile(String ID, String name, Map settings, int order) {
112
			fName= name;
113
			fID= ID;
114
			fSettings= settings;
115
			fOrder= order;
116
		}
117
		
118
		public String getName() { 
119
			return fName;	
120
		}
121
		
122
		public Profile rename(String name, ProfileManager manager) {
123
			final String trimmed= name.trim();
124
		 	CustomProfile newProfile= new CustomProfile(trimmed, fSettings, ProfileVersioner.CURRENT_VERSION);
125
		 	manager.addProfile(newProfile);
126
			return newProfile;
127
		}
128
		
129
		public Map getSettings() {
130
			return fSettings;
131
		}
132
	
133
		public void setSettings(Map settings) {
134
		}
135
	
136
		public String getID() { 
137
			return fID; 
138
		}
139
		
140
		public final int compareTo(Object o) {
141
			if (o instanceof BuiltInProfile) {
142
				return fOrder - ((BuiltInProfile)o).fOrder;
143
			}
144
			return -1;
145
		}
146
147
		public boolean isProfileToSave() {
148
			return false;
149
		}
150
		
151
		public boolean isBuiltInProfile() {
152
			return true;
153
		}
154
	
155
	}
156
157
	/**
158
	 * Represents a user-defined profile. A custom profile can be modified after instantiation.
159
	 */
160
	public static class CustomProfile extends Profile {
161
		private String fName;
162
		private Map fSettings;
163
		protected ProfileManager fManager;
164
		private int fVersion;
165
166
		public CustomProfile(String name, Map settings, int version) {
167
			fName= name;
168
			fSettings= settings;
169
			fVersion= version;
170
		}
171
		
172
		public String getName() {
173
			return fName;
174
		}
175
		
176
		public Profile rename(String name, ProfileManager manager) {
177
			final String trimmed= name.trim();
178
			if (trimmed.equals(getName())) 
179
				return this;
180
			
181
			String oldID= getID(); // remember old id before changing name
182
			fName= trimmed;
183
			
184
			manager.profileRenamed(this, oldID);
185
			return this;
186
		}
187
188
		public Map getSettings() { 
189
			return fSettings;
190
		}
191
		
192
		public void setSettings(Map settings) {
193
			if (settings == null)
194
				throw new IllegalArgumentException();
195
			fSettings= settings;
196
			if (fManager != null) {
197
				fManager.profileChanged(this);
198
			}
199
		}
200
		
201
		public String getID() { 
202
			return ID_PREFIX + fName;
203
		}
204
		
205
		public void setManager(ProfileManager profileManager) {
206
			fManager= profileManager;
207
		}
208
		
209
		public ProfileManager getManager() {
210
			return fManager;
211
		}
212
213
		public int getVersion() {
214
			return fVersion;
215
		}
216
		
217
		public void setVersion(int version)	{
218
			fVersion= version;
219
		}
220
		
221
		public int compareTo(Object o) {
222
			if (o instanceof SharedProfile) {
223
				return -1;
224
			}
225
			if (o instanceof CustomProfile) {
226
				return getName().compareToIgnoreCase(((Profile)o).getName());
227
			}
228
			return 1;
229
		}
230
		
231
		public boolean isProfileToSave() {
232
			return true;
233
		}
234
235
	}
236
	
237
	public final static class SharedProfile extends CustomProfile {
238
		
239
		public SharedProfile(String oldName, Map options) {
240
			super(oldName, options, ProfileVersioner.CURRENT_VERSION);
241
		}
242
		
243
		public Profile rename(String name, ProfileManager manager) {
244
			CustomProfile profile= new CustomProfile(name.trim(), getSettings(), getVersion());
245
246
			manager.profileReplaced(this, profile);
247
			return profile;
248
		}
249
				
250
		public String getID() { 
251
			return SHARED_PROFILE;
252
		}
253
		
254
		public final int compareTo(Object o) {
255
			return 1;
256
		}
257
		
258
		public boolean isProfileToSave() {
259
			return false;
260
		}
261
		
262
		public boolean isSharedProfile() {
263
			return true;
264
		}
265
	}
266
	
267
268
	/**
269
	 * The possible events for observers listening to this class.
270
	 */
271
	public final static int SELECTION_CHANGED_EVENT= 1;
272
	public final static int PROFILE_DELETED_EVENT= 2;
273
	public final static int PROFILE_RENAMED_EVENT= 3;
274
	public final static int PROFILE_CREATED_EVENT= 4;
275
	public final static int SETTINGS_CHANGED_EVENT= 5;
276
	
277
	/**
278
	 * The key of the preference where the selected profile is stored.
279
	 */
280
	private final static String PROFILE_KEY= PreferenceConstants.FORMATTER_PROFILE;
281
	
282
	/**
283
	 * The key of the preference where the version of the current settings is stored
284
	 */
285
	private final static String FORMATTER_SETTINGS_VERSION= "formatter_settings_version";  //$NON-NLS-1$
286
287
	/**
288
	 * The keys of the built-in profiles
289
	 */
290
	public final static String ECLIPSE_PROFILE= "org.eclipse.cdt.ui.default.eclipse_profile"; //$NON-NLS-1$
291
	public final static String SHARED_PROFILE= "org.eclipse.cdt.ui.default.shared"; //$NON-NLS-1$
292
	
293
	public final static String DEFAULT_PROFILE= ECLIPSE_PROFILE;
294
	
295
	/**
296
	 * A map containing the available profiles, using the IDs as keys.
297
	 */
298
	private final Map fProfiles;
299
	
300
	/**
301
	 * The available profiles, sorted by name.
302
	 */
303
	private final List fProfilesByName;
304
	
305
306
	/**
307
	 * The currently selected profile. 
308
	 */
309
	private Profile fSelected;
310
	
311
	/**
312
	 * The keys of the options to be saved with each profile
313
	 */
314
	private final static List fUIKeys= Collections.EMPTY_LIST; 
315
	private final static List fCoreKeys= new ArrayList(DefaultCodeFormatterConstants.getEclipseDefaultSettings().keySet());
316
317
	/**
318
	 * All keys appearing in a profile, sorted alphabetically
319
	 */
320
	private final static List fKeys;
321
	private final PreferencesAccess fPreferencesAccess;
322
	
323
	static {
324
	    fKeys= new ArrayList();
325
	    fKeys.addAll(fUIKeys);
326
	    fKeys.addAll(fCoreKeys);
327
	    Collections.sort(fKeys);
328
	}
329
	
330
331
	/**
332
	 * Create and initialize a new profile manager.
333
	 * @param profiles Initial custom profiles (List of type <code>CustomProfile</code>)
334
	 */
335
	public ProfileManager(List profiles, IScopeContext context, PreferencesAccess preferencesAccess) {
336
		fPreferencesAccess= preferencesAccess;
337
		
338
		fProfiles= new HashMap();
339
		fProfilesByName= new ArrayList();
340
	
341
		addBuiltinProfiles(fProfiles, fProfilesByName);
342
		
343
		for (final Iterator iter = profiles.iterator(); iter.hasNext();) {
344
			final CustomProfile profile= (CustomProfile) iter.next();
345
			profile.setManager(this);
346
			fProfiles.put(profile.getID(), profile);
347
			fProfilesByName.add(profile);
348
		}
349
		
350
		Collections.sort(fProfilesByName);
351
		
352
		IScopeContext instanceScope= fPreferencesAccess.getInstanceScope(); 
353
		String profileId= instanceScope.getNode(CUIPlugin.PLUGIN_ID).get(PROFILE_KEY, null);
354
		if (profileId == null) {
355
			profileId= new DefaultScope().getNode(CUIPlugin.PLUGIN_ID).get(PROFILE_KEY, null);
356
		}
357
		
358
		Profile profile= (Profile) fProfiles.get(profileId);
359
		if (profile == null) {
360
			profile= (Profile) fProfiles.get(DEFAULT_PROFILE);
361
		}
362
		fSelected= profile;
363
		
364
		if (context.getName() == ProjectScope.SCOPE && hasProjectSpecificSettings(context)) {
365
			Map map= readFromPreferenceStore(context, profile);
366
			if (map != null) {
367
				Profile matching= null;
368
			
369
				String projProfileId= context.getNode(CUIPlugin.PLUGIN_ID).get(PROFILE_KEY, null);
370
				if (projProfileId != null) {
371
					Profile curr= (Profile) fProfiles.get(projProfileId);
372
					if (curr != null && (curr.isBuiltInProfile() || curr.hasEqualSettings(map, getKeys()))) {
373
						matching= curr;
374
					}
375
				} else {
376
					// old version: look for similar
377
					for (final Iterator iter = fProfilesByName.iterator(); iter.hasNext();) {
378
						Profile curr= (Profile) iter.next();
379
						if (curr.hasEqualSettings(map, getKeys())) {
380
							matching= curr;
381
							break;
382
						}
383
					}
384
				}
385
				if (matching == null) {
386
					String name;
387
					if (projProfileId != null && !fProfiles.containsKey(projProfileId)) {
388
						name= Messages.format(FormatterMessages.ProfileManager_unmanaged_profile_with_name, projProfileId.substring(ID_PREFIX.length()));
389
					} else {
390
						name= FormatterMessages.ProfileManager_unmanaged_profile;
391
					}
392
					// current settings do not correspond to any profile -> create a 'team' profile
393
					SharedProfile shared= new SharedProfile(name, map);
394
					shared.setManager(this);
395
					fProfiles.put(shared.getID(), shared);
396
					fProfilesByName.add(shared); // add last
397
					matching= shared;
398
				}
399
				fSelected= matching;
400
			}
401
		}
402
	}
403
	
404
405
406
407
408
	/**
409
	 * Notify observers with a message. The message must be one of the following:
410
	 * @param message Message to send out
411
	 * 
412
	 * @see #SELECTION_CHANGED_EVENT
413
	 * @see #PROFILE_DELETED_EVENT
414
	 * @see #PROFILE_RENAMED_EVENT
415
	 * @see #PROFILE_CREATED_EVENT
416
	 * @see #SETTINGS_CHANGED_EVENT
417
	 */
418
	protected void notifyObservers(int message) {
419
		setChanged();
420
		notifyObservers(new Integer(message));
421
	}
422
	
423
	public static boolean hasProjectSpecificSettings(IScopeContext context) {
424
		IEclipsePreferences corePrefs= context.getNode(CCorePlugin.PLUGIN_ID);
425
		for (final Iterator keyIter = fCoreKeys.iterator(); keyIter.hasNext(); ) {
426
			final String key= (String) keyIter.next();
427
			Object val= corePrefs.get(key, null);
428
			if (val != null) {
429
				return true;
430
			}
431
		}
432
		
433
		IEclipsePreferences uiPrefs= context.getNode(CUIPlugin.PLUGIN_ID);
434
		for (final Iterator keyIter = fUIKeys.iterator(); keyIter.hasNext(); ) {
435
			final String key= (String) keyIter.next();
436
			Object val= uiPrefs.get(key, null);
437
			if (val != null) {
438
				return true;
439
			}
440
		}
441
		return false;
442
	}
443
444
	
445
	/**
446
	 * Only to read project specific settings to find out to what profile it matches.
447
	 * @param context The project context
448
	 */
449
	public Map readFromPreferenceStore(IScopeContext context, Profile workspaceProfile) {
450
		final Map profileOptions= new HashMap();
451
		IEclipsePreferences uiPrefs= context.getNode(CUIPlugin.PLUGIN_ID);
452
		IEclipsePreferences corePrefs= context.getNode(CCorePlugin.PLUGIN_ID);
453
				
454
		int version= uiPrefs.getInt(FORMATTER_SETTINGS_VERSION, ProfileVersioner.VERSION_1);
455
		if (version != ProfileVersioner.CURRENT_VERSION) {
456
			Map allOptions= new HashMap();
457
			addAll(uiPrefs, allOptions);
458
			addAll(corePrefs, allOptions);
459
			return ProfileVersioner.updateAndComplete(allOptions, version);
460
		}
461
		
462
		boolean hasValues= false;
463
		for (final Iterator keyIter = fCoreKeys.iterator(); keyIter.hasNext(); ) {
464
			final String key= (String) keyIter.next();
465
			Object val= corePrefs.get(key, null);
466
			if (val != null) {
467
				hasValues= true;
468
			} else {
469
				val= workspaceProfile.getSettings().get(key);
470
			}
471
			profileOptions.put(key, val);
472
		}
473
		
474
		for (final Iterator keyIter = fUIKeys.iterator(); keyIter.hasNext(); ) {
475
			final String key= (String) keyIter.next();
476
			Object val= uiPrefs.get(key, null);
477
			if (val != null) {
478
				hasValues= true;
479
			} else {
480
				val= workspaceProfile.getSettings().get(key);
481
			}
482
			profileOptions.put(key, val);
483
		}
484
		
485
		if (!hasValues) {
486
			return null;
487
		}
488
489
		return profileOptions;
490
	}
491
	
492
	/**
493
	 * @param uiPrefs
494
	 * @param allOptions
495
	 */
496
	private void addAll(IEclipsePreferences uiPrefs, Map allOptions) {
497
		try {
498
			String[] keys= uiPrefs.keys();
499
			for (int i= 0; i < keys.length; i++) {
500
				String key= keys[i];
501
				String val= uiPrefs.get(key, null);
502
				if (val != null) {
503
					allOptions.put(key, val);
504
				}
505
			}
506
		} catch (BackingStoreException e) {
507
			// ignore
508
		}
509
		
510
	}
511
512
	private boolean updatePreferences(IEclipsePreferences prefs, List keys, Map profileOptions) {
513
		boolean hasChanges= false;
514
		for (final Iterator keyIter = keys.iterator(); keyIter.hasNext(); ) {
515
			final String key= (String) keyIter.next();
516
			final String oldVal= prefs.get(key, null);
517
			final String val= (String) profileOptions.get(key);
518
			if (val == null) {
519
				if (oldVal != null) {
520
					prefs.remove(key);
521
					hasChanges= true;
522
				}
523
			} else if (!val.equals(oldVal)) {
524
				prefs.put(key, val);
525
				hasChanges= true;
526
			}
527
		}
528
		return hasChanges;
529
	}
530
	
531
	
532
	/**
533
	 * Update all formatter settings with the settings of the specified profile. 
534
	 * @param profile The profile to write to the preference store
535
	 */
536
	private void writeToPreferenceStore(Profile profile, IScopeContext context) {
537
		final Map profileOptions= profile.getSettings();
538
		
539
		final IEclipsePreferences corePrefs= context.getNode(CCorePlugin.PLUGIN_ID);
540
		updatePreferences(corePrefs, fCoreKeys, profileOptions);
541
		
542
		final IEclipsePreferences uiPrefs= context.getNode(CUIPlugin.PLUGIN_ID);
543
		updatePreferences(uiPrefs, fUIKeys, profileOptions);
544
		
545
		if (uiPrefs.getInt(FORMATTER_SETTINGS_VERSION, 0) != ProfileVersioner.CURRENT_VERSION) {
546
			uiPrefs.putInt(FORMATTER_SETTINGS_VERSION, ProfileVersioner.CURRENT_VERSION);
547
		}
548
		
549
		if (context.getName() == InstanceScope.SCOPE) {
550
			uiPrefs.put(PROFILE_KEY, profile.getID());
551
		} else if (context.getName() == ProjectScope.SCOPE && !profile.isSharedProfile()) {
552
			uiPrefs.put(PROFILE_KEY, profile.getID());
553
		}
554
	}
555
	
556
	/**
557
	 * Add all the built-in profiles to the map and to the list.
558
	 * @param profiles The map to add the profiles to
559
	 * @param profilesByName List of profiles by
560
	 */
561
	private void addBuiltinProfiles(Map profiles, List profilesByName) {
562
		final Profile eclipseProfile= new BuiltInProfile(ECLIPSE_PROFILE, FormatterMessages.ProfileManager_default_profile_name, getEclipseSettings(), 2); 
563
		profiles.put(eclipseProfile.getID(), eclipseProfile);
564
		profilesByName.add(eclipseProfile);
565
	}
566
	
567
	/**
568
	 * @return Returns the settings for the new eclipse profile.
569
	 */	
570
	public static Map getEclipseSettings() {
571
		return DefaultCodeFormatterConstants.getEclipseDefaultSettings();
572
	}
573
574
	/** 
575
	 * @return Returns the default settings.
576
	 */
577
	public static Map getDefaultSettings() {
578
		return getEclipseSettings();
579
	}
580
	
581
	/**
582
	 * @return All keys appearing in a profile, sorted alphabetically.
583
	 */
584
	public static List getKeys() {
585
	    return fKeys;
586
	}
587
	
588
	/** 
589
	 * Get an immutable list as view on all profiles, sorted alphabetically. Unless the set 
590
	 * of profiles has been modified between the two calls, the sequence is guaranteed to 
591
	 * correspond to the one returned by <code>getSortedNames</code>.
592
	 * @return a list of elements of type <code>Profile</code>
593
	 * 
594
	 * @see #getSortedDisplayNames()
595
	 */
596
	public List getSortedProfiles() {
597
		return Collections.unmodifiableList(fProfilesByName);
598
	}
599
600
	/**
601
	 * Get the names of all profiles stored in this profile manager, sorted alphabetically. Unless the set of 
602
	 * profiles has been modified between the two calls, the sequence is guaranteed to correspond to the one 
603
	 * returned by <code>getSortedProfiles</code>.
604
	 * @return All names, sorted alphabetically
605
	 * @see #getSortedProfiles()  
606
	 */	
607
	public String[] getSortedDisplayNames() {
608
		final String[] sortedNames= new String[fProfilesByName.size()];
609
		int i= 0;
610
		for (final Iterator iter = fProfilesByName.iterator(); iter.hasNext();) {
611
			Profile curr= (Profile) iter.next();
612
			sortedNames[i++]= curr.getName();
613
		}
614
		return sortedNames;
615
	}
616
	
617
	/**
618
	 * Get the profile for this profile id.
619
	 * @param ID The profile ID
620
	 * @return The profile with the given ID or <code>null</code> 
621
	 */
622
	public Profile getProfile(String ID) {
623
		return (Profile)fProfiles.get(ID);
624
	}
625
	
626
	/**
627
	 * Activate the selected profile, update all necessary options in
628
	 * preferences and save profiles to disk.
629
	 */
630
	public void commitChanges(IScopeContext scopeContext) {
631
		if (fSelected != null) {
632
			writeToPreferenceStore(fSelected, scopeContext);
633
		}
634
	}
635
	
636
	public void clearAllSettings(IScopeContext context) {
637
		final IEclipsePreferences corePrefs= context.getNode(CCorePlugin.PLUGIN_ID);
638
		updatePreferences(corePrefs, fCoreKeys, Collections.EMPTY_MAP);
639
		
640
		final IEclipsePreferences uiPrefs= context.getNode(CUIPlugin.PLUGIN_ID);
641
		updatePreferences(uiPrefs, fUIKeys, Collections.EMPTY_MAP);
642
		
643
		uiPrefs.remove(PROFILE_KEY);
644
	}
645
	
646
	/**
647
	 * Get the currently selected profile.
648
	 * @return The currently selected profile.
649
	 */
650
	public Profile getSelected() {
651
		return fSelected;
652
	}
653
654
	/**
655
	 * Set the selected profile. The profile must already be contained in this profile manager.
656
	 * @param profile The profile to select
657
	 */
658
	public void setSelected(Profile profile) {
659
		final Profile newSelected= (Profile)fProfiles.get(profile.getID());
660
		if (newSelected != null && !newSelected.equals(fSelected)) {
661
			fSelected= newSelected;
662
			notifyObservers(SELECTION_CHANGED_EVENT);
663
		}
664
	}
665
666
	/**
667
	 * Check whether a user-defined profile in this profile manager
668
	 * already has this name.
669
	 * @param name The name to test for
670
	 * @return Returns <code>true</code> if a profile with the given name exists
671
	 */
672
	public boolean containsName(String name) {
673
		for (final Iterator iter = fProfilesByName.iterator(); iter.hasNext();) {
674
			Profile curr= (Profile) iter.next();
675
			if (name.equals(curr.getName())) {
676
				return true;
677
			}
678
		}
679
		return false;
680
	}
681
	
682
	/**
683
	 * Add a new custom profile to this profile manager.
684
	 * @param profile The profile to add
685
	 */	
686
	public void addProfile(CustomProfile profile) {
687
		profile.setManager(this);
688
		final CustomProfile oldProfile= (CustomProfile)fProfiles.get(profile.getID());
689
		if (oldProfile != null) {
690
			fProfiles.remove(oldProfile.getID());
691
			fProfilesByName.remove(oldProfile);
692
			oldProfile.setManager(null);
693
		}
694
		fProfiles.put(profile.getID(), profile);
695
		fProfilesByName.add(profile);
696
		Collections.sort(fProfilesByName);
697
		fSelected= profile;
698
		notifyObservers(PROFILE_CREATED_EVENT);
699
	}
700
	
701
	/**
702
	 * Delete the currently selected profile from this profile manager. The next profile
703
	 * in the list is selected.
704
	 * @return true if the profile has been successfully removed, false otherwise.
705
	 */
706
	public boolean deleteSelected() {
707
		if (!(fSelected instanceof CustomProfile)) 
708
			return false;
709
		
710
		Profile removedProfile= fSelected;
711
		
712
		int index= fProfilesByName.indexOf(removedProfile);
713
		
714
		fProfiles.remove(removedProfile.getID());
715
		fProfilesByName.remove(removedProfile);
716
		
717
		((CustomProfile)removedProfile).setManager(null);
718
		
719
		if (index >= fProfilesByName.size())
720
			index--;
721
		fSelected= (Profile) fProfilesByName.get(index);
722
723
		if (!removedProfile.isSharedProfile()) {
724
			updateProfilesWithName(removedProfile.getID(), null, false);
725
		}
726
		
727
		notifyObservers(PROFILE_DELETED_EVENT);
728
		return true;
729
	}
730
	
731
	public void profileRenamed(CustomProfile profile, String oldID) {
732
		fProfiles.remove(oldID);
733
		fProfiles.put(profile.getID(), profile);
734
735
		if (!profile.isSharedProfile()) {
736
			updateProfilesWithName(oldID, profile, false);
737
		}
738
		
739
		Collections.sort(fProfilesByName);
740
		notifyObservers(PROFILE_RENAMED_EVENT);
741
	}
742
	
743
	public void profileReplaced(CustomProfile oldProfile, CustomProfile newProfile) {
744
		fProfiles.remove(oldProfile.getID());
745
		fProfiles.put(newProfile.getID(), newProfile);
746
		fProfilesByName.remove(oldProfile);
747
		fProfilesByName.add(newProfile);
748
		Collections.sort(fProfilesByName);
749
		
750
		if (!oldProfile.isSharedProfile()) {
751
			updateProfilesWithName(oldProfile.getID(), null, false);
752
		}
753
		
754
		setSelected(newProfile);
755
		notifyObservers(PROFILE_CREATED_EVENT);
756
		notifyObservers(SELECTION_CHANGED_EVENT);
757
	}
758
	
759
	public void profileChanged(CustomProfile profile) {
760
		if (!profile.isSharedProfile()) {
761
			updateProfilesWithName(profile.getID(), profile, true);
762
		}
763
		
764
		notifyObservers(SETTINGS_CHANGED_EVENT);
765
	}
766
	
767
	
768
	private void updateProfilesWithName(String oldName, Profile newProfile, boolean applySettings) {
769
		IProject[] projects= ResourcesPlugin.getWorkspace().getRoot().getProjects();
770
		for (int i= 0; i < projects.length; i++) {
771
			IScopeContext projectScope= fPreferencesAccess.getProjectScope(projects[i]);
772
			IEclipsePreferences node= projectScope.getNode(CUIPlugin.PLUGIN_ID);
773
			String profileId= node.get(PROFILE_KEY, null);
774
			if (oldName.equals(profileId)) {
775
				if (newProfile == null) {
776
					node.remove(PROFILE_KEY);
777
				} else {
778
					if (applySettings) {
779
						writeToPreferenceStore(newProfile, projectScope);
780
					} else {
781
						node.put(PROFILE_KEY, newProfile.getID());
782
					}
783
				}
784
			}
785
		}
786
		
787
		IScopeContext instanceScope= fPreferencesAccess.getInstanceScope();
788
		final IEclipsePreferences uiPrefs= instanceScope.getNode(CUIPlugin.PLUGIN_ID);
789
		if (newProfile != null && oldName.equals(uiPrefs.get(PROFILE_KEY, null))) {
790
			writeToPreferenceStore(newProfile, instanceScope);
791
		}
792
	}
793
}
(-)src/org/eclipse/cdt/internal/ui/preferences/formatter/ModifyDialogTabPage.java (+802 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
package org.eclipse.cdt.internal.ui.preferences.formatter;
13
14
import java.util.ArrayList;
15
import java.util.HashMap;
16
import java.util.List;
17
import java.util.Map;
18
import java.util.Observable;
19
import java.util.Observer;
20
21
import org.eclipse.core.runtime.IStatus;
22
import org.eclipse.core.runtime.Status;
23
24
import org.eclipse.swt.SWT;
25
import org.eclipse.swt.events.FocusAdapter;
26
import org.eclipse.swt.events.FocusEvent;
27
import org.eclipse.swt.events.FocusListener;
28
import org.eclipse.swt.events.ModifyEvent;
29
import org.eclipse.swt.events.ModifyListener;
30
import org.eclipse.swt.events.SelectionAdapter;
31
import org.eclipse.swt.events.SelectionEvent;
32
import org.eclipse.swt.layout.GridData;
33
import org.eclipse.swt.layout.GridLayout;
34
import org.eclipse.swt.widgets.Button;
35
import org.eclipse.swt.widgets.Combo;
36
import org.eclipse.swt.widgets.Composite;
37
import org.eclipse.swt.widgets.Control;
38
import org.eclipse.swt.widgets.Group;
39
import org.eclipse.swt.widgets.Label;
40
import org.eclipse.swt.widgets.Text;
41
42
import org.eclipse.jface.dialogs.IDialogConstants;
43
import org.eclipse.jface.dialogs.IDialogSettings;
44
45
import org.eclipse.cdt.core.CCorePlugin;
46
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
47
48
import org.eclipse.cdt.ui.CUIPlugin;
49
50
import org.eclipse.cdt.internal.ui.util.Messages;
51
import org.eclipse.cdt.internal.ui.util.PixelConverter;
52
53
54
public abstract class ModifyDialogTabPage {
55
	
56
	/**
57
	 * This is the default listener for any of the Preference
58
	 * classes. It is added by the respective factory methods and
59
	 * updates the page's preview on each change. 
60
	 */
61
	protected final Observer fUpdater= new Observer() {
62
		public void update(Observable o, Object arg) {
63
			doUpdatePreview();
64
			notifyValuesModified();
65
		}
66
	};
67
	
68
	/**
69
	 * The base class of all Preference classes. A preference class provides a wrapper
70
	 * around one or more SWT widgets and handles the input of values for some key.
71
	 * On each change, the new value is written to the map and the listeners are notified.
72
	 */
73
	protected abstract class Preference extends Observable {
74
	    private final Map fPreferences;
75
	    private boolean fEnabled;
76
	    private String fKey;
77
	    
78
	    /**
79
	     * Create a new Preference.
80
	     * @param preferences The map where the value is written.
81
	     * @param key The key for which a value is managed.
82
	     */
83
	    public Preference(Map preferences, String key) {
84
	        fPreferences= preferences;
85
	        fEnabled= true;
86
	        fKey= key;
87
	    }
88
	    /**
89
	     * @return Gets the map of this Preference.
90
	     */
91
	    protected final Map getPreferences() {
92
	        return fPreferences;
93
	    }
94
95
	    /**
96
	     * Set the enabled state of all SWT widgets of this preference. 
97
	     * @param enabled new value
98
	     */
99
	    public final void setEnabled(boolean enabled) {
100
	        fEnabled= enabled;
101
	        updateWidget();
102
	    }
103
	    
104
	    /**
105
	     * @return Gets the enabled state of all SWT widgets of this Preference.
106
	     */
107
	    public final boolean getEnabled() {
108
	        return fEnabled;
109
	    }
110
	    
111
	    /**
112
	     * Set the key which is used to store the value.
113
	     * @param key New value
114
	     */
115
	    public final void setKey(String key) {
116
	        if (key == null || !fKey.equals(key)) {
117
	            fKey= key;
118
	            updateWidget();
119
	        }
120
	    }
121
	    /**
122
	     * @return Gets the currently used key which is used to store the value.
123
	     */	    
124
	    public final String getKey() {
125
	        return fKey;
126
	    }
127
	    
128
	    /**
129
	     * Returns the main control of a preference, which is mainly used to 
130
	     * manage the focus. This may be <code>null</code> if the preference doesn't
131
	     * have a control which is able to have the focus. 
132
	     * @return The main control
133
	     */
134
	    public abstract Control getControl();
135
	    
136
	    /**
137
	     * To be implemented in subclasses. Update the SWT widgets when the state 
138
	     * of this object has changed (enabled, key, ...).
139
	     */
140
	    protected abstract void updateWidget();
141
	}
142
	
143
	/**
144
	 * Wrapper around a checkbox and a label. 
145
	 */	
146
	protected final class CheckboxPreference extends Preference {
147
		private final String[] fValues;
148
		private final Button fCheckbox;
149
		
150
		/**
151
		 * Create a new CheckboxPreference.
152
		 * @param composite The composite on which the SWT widgets are added.
153
		 * @param numColumns The number of columns in the composite's GridLayout.
154
		 * @param preferences The map to store the values.
155
		 * @param key The key to store the values.
156
		 * @param values An array of two elements indicating the values to store on unchecked/checked.
157
		 * @param text The label text for this Preference.
158
		 */
159
		public CheckboxPreference(Composite composite, int numColumns,
160
								  Map preferences, String key, 
161
								  String [] values, String text) {
162
		    super(preferences, key);
163
		    if (values == null || text == null) 
164
		        throw new IllegalArgumentException(FormatterMessages.ModifyDialogTabPage_error_msg_values_text_unassigned); 
165
			fValues= values;
166
167
			fCheckbox= new Button(composite, SWT.CHECK);
168
			fCheckbox.setText(text);
169
			fCheckbox.setLayoutData(createGridData(numColumns, GridData.FILL_HORIZONTAL, SWT.DEFAULT));
170
			fCheckbox.setFont(composite.getFont());
171
			
172
			updateWidget();
173
174
			fCheckbox.addSelectionListener(new SelectionAdapter() {
175
				public void widgetSelected(SelectionEvent e) {
176
					checkboxChecked(((Button)e.widget).getSelection());
177
				}
178
			});
179
		}
180
		
181
		protected void checkboxChecked(boolean state) {
182
			getPreferences().put(getKey(), state ? fValues[1] : fValues[0]);
183
			setChanged();
184
			notifyObservers();
185
		}
186
		
187
		protected void updateWidget() {
188
			if (getKey() != null) {
189
				fCheckbox.setEnabled(getEnabled());
190
				fCheckbox.setSelection(getChecked());
191
			} else {
192
				fCheckbox.setSelection(false);
193
				fCheckbox.setEnabled(false);
194
			}
195
		}
196
		
197
		public boolean getChecked() {
198
			return fValues[1].equals(getPreferences().get(getKey()));
199
		}
200
		
201
		public Control getControl() {
202
			return fCheckbox;
203
		}
204
	}
205
	
206
	
207
	/**
208
	 * Wrapper around a Combo box.
209
	 */
210
	protected final class ComboPreference extends Preference {
211
		private final String [] fItems;
212
		private final String[] fValues;
213
		private final Combo fCombo;
214
		
215
		/**
216
		 * Create a new ComboPreference.
217
		 * @param composite The composite on which the SWT widgets are added.
218
		 * @param numColumns The number of columns in the composite's GridLayout.
219
		 * @param preferences The map to store the values.
220
		 * @param key The key to store the values.
221
		 * @param values An array of n elements indicating the values to store for each selection.
222
		 * @param text The label text for this Preference.
223
		 * @param items An array of n elements indicating the text to be written in the combo box.
224
		 */
225
		public ComboPreference(Composite composite, int numColumns,
226
								  Map preferences, String key, 
227
								  String [] values, String text, String [] items) {
228
		    super(preferences, key);
229
		    if (values == null || items == null || text == null) 
230
		        throw new IllegalArgumentException(FormatterMessages.ModifyDialogTabPage_error_msg_values_items_text_unassigned); 
231
			fValues= values;
232
			fItems= items;
233
			createLabel(numColumns - 1, composite, text);
234
			fCombo= new Combo(composite, SWT.SINGLE | SWT.READ_ONLY);
235
			fCombo.setFont(composite.getFont());
236
			fCombo.setItems(items);
237
			
238
			int max= 0;
239
			for (int i= 0; i < items.length; i++)
240
			    if (items[i].length() > max) max= items[i].length();
241
			
242
			fCombo.setLayoutData(createGridData(1, GridData.HORIZONTAL_ALIGN_FILL, fCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT).x));			
243
244
			updateWidget();
245
246
			fCombo.addSelectionListener(new SelectionAdapter() {
247
				public void widgetSelected(SelectionEvent e) {
248
					comboSelected(((Combo)e.widget).getSelectionIndex());
249
				}
250
			});
251
		}
252
		
253
		protected void comboSelected(int index) {
254
			getPreferences().put(getKey(), fValues[index]);
255
			setChanged();
256
			notifyObservers(fValues[index]);
257
		}
258
		
259
		protected void updateWidget() {
260
			if (getKey() != null) {
261
				fCombo.setEnabled(getEnabled());
262
				fCombo.setText(getSelectedItem());
263
			} else {
264
				fCombo.setText(""); //$NON-NLS-1$
265
				fCombo.setEnabled(false);
266
			}
267
		}
268
		
269
		public String getSelectedItem() {
270
			final String selected= (String)getPreferences().get(getKey());
271
			for (int i= 0; i < fValues.length; i++) {
272
				if (fValues[i].equals(selected)) {
273
					return fItems[i];
274
				}
275
			}
276
			return ""; //$NON-NLS-1$
277
		}
278
		
279
		public boolean hasValue(String value) {
280
			return value.equals(getPreferences().get(getKey()));
281
		}
282
		
283
		public Control getControl() {
284
			return fCombo;
285
		}
286
	}
287
	
288
	/**
289
	 * Wrapper around a textfied which requests an integer input of a given range.
290
	 */
291
	protected final class NumberPreference extends Preference {
292
		
293
		private final int fMinValue, fMaxValue;
294
		private final Label fNumberLabel;
295
		private final Text fNumberText;
296
297
		protected int fSelected;
298
        protected int fOldSelected;
299
        
300
        
301
		/**
302
		 * Create a new NumberPreference.
303
		 * @param composite The composite on which the SWT widgets are added.
304
		 * @param numColumns The number of columns in the composite's GridLayout.
305
		 * @param preferences The map to store the values.
306
		 * @param key The key to store the values.
307
		 * @param minValue The minimum value which is valid input.
308
		 * @param maxValue The maximum value which is valid input.
309
		 * @param text The label text for this Preference.
310
		 */
311
		public NumberPreference(Composite composite, int numColumns,
312
							   Map preferences, String key, 
313
							   int minValue, int maxValue, String text) {
314
		    super(preferences, key);
315
		    
316
			fNumberLabel= createLabel(numColumns - 1, composite, text, GridData.FILL_HORIZONTAL);
317
			fNumberText= new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.RIGHT);
318
			fNumberText.setFont(composite.getFont());
319
320
			final int length= Integer.toString(maxValue).length() + 3; 
321
			fNumberText.setLayoutData(createGridData(1, GridData.HORIZONTAL_ALIGN_END, fPixelConverter.convertWidthInCharsToPixels(length)));
322
			
323
			fMinValue= minValue;
324
			fMaxValue= maxValue;
325
			
326
			updateWidget();
327
			
328
			fNumberText.addFocusListener(new FocusListener() {
329
				public void focusGained(FocusEvent e) {
330
				    NumberPreference.this.focusGained();
331
				}
332
                public void focusLost(FocusEvent e) {
333
				    NumberPreference.this.focusLost();
334
				}
335
			});
336
			
337
			fNumberText.addModifyListener(new ModifyListener() {
338
				public void modifyText(ModifyEvent e) {
339
					fieldModified();
340
				}
341
			});
342
		}
343
		
344
		private IStatus createErrorStatus() {
345
		    return new Status(IStatus.ERROR, CUIPlugin.getPluginId(), 0, Messages.format(FormatterMessages.ModifyDialogTabPage_NumberPreference_error_invalid_value, new String [] {Integer.toString(fMinValue), Integer.toString(fMaxValue)}), null); 
346
		}
347
348
		protected void focusGained() {
349
		    fOldSelected= fSelected;
350
		    fNumberText.setSelection(0, fNumberText.getCharCount());
351
		}
352
		
353
		protected void focusLost() {
354
		    updateStatus(null);
355
		    final String input= fNumberText.getText();
356
		    if (!validInput(input))
357
		        fSelected= fOldSelected;
358
		    else
359
		        fSelected= Integer.parseInt(input);
360
		    if (fSelected != fOldSelected) {
361
		    	saveSelected();
362
		    	fNumberText.setText(Integer.toString(fSelected));
363
		    }
364
		}
365
		
366
		
367
		protected void fieldModified() {
368
		    final String trimInput= fNumberText.getText().trim();
369
		    final boolean valid= validInput(trimInput);
370
		    
371
		    updateStatus(valid ? null : createErrorStatus());
372
373
		    if (valid) {
374
		        final int number= Integer.parseInt(trimInput);
375
		        if (fSelected != number) {
376
		            fSelected= number;
377
		            saveSelected();
378
		        }
379
		    }
380
		}
381
		
382
		private boolean validInput(String trimInput) {
383
		    int number;
384
		    
385
		    try {
386
		        number= Integer.parseInt(trimInput);
387
		    } catch (NumberFormatException x) {
388
		        return false;
389
		    }
390
		    
391
		    if (number < fMinValue) return false;
392
		    if (number > fMaxValue) return false;
393
		    return true;
394
		}
395
		
396
		private void saveSelected() {
397
			getPreferences().put(getKey(), Integer.toString(fSelected));
398
			setChanged();
399
			notifyObservers();
400
		}
401
		
402
		protected void updateWidget() {
403
		    final boolean hasKey= getKey() != null;
404
405
		    fNumberLabel.setEnabled(hasKey && getEnabled());
406
			fNumberText.setEnabled(hasKey && getEnabled());
407
408
			if (hasKey) {
409
			    String s= (String)getPreferences().get(getKey());
410
			    try {
411
			        fSelected= Integer.parseInt(s);
412
			    } catch (NumberFormatException e) {
413
			        final String message= Messages.format(FormatterMessages.ModifyDialogTabPage_NumberPreference_error_invalid_key, getKey()); 
414
			        CUIPlugin.getDefault().log(new Status(IStatus.ERROR, CUIPlugin.getPluginId(), IStatus.OK, message, e));
415
			        s= ""; //$NON-NLS-1$
416
			    }
417
			    fNumberText.setText(s);
418
			} else {
419
			    fNumberText.setText(""); //$NON-NLS-1$
420
			}
421
		}
422
		
423
		public Control getControl() {
424
			return fNumberText;
425
		}
426
	}
427
428
	
429
	/**
430
	 * This class provides the default way to preserve and re-establish the focus
431
	 * over multiple modify sessions. Each ModifyDialogTabPage has its own instance,
432
	 * and it should add all relevant controls upon creation, always in the same sequence.
433
	 * This established a mapping of controls to indexes, which allows to restore the focus
434
	 * in a later session. 
435
	 * The index is saved in the dialog settings, and there is only one common preference for 
436
	 * all tab pages. It is always the currently active tab page which stores its focus
437
	 * index. 
438
	 */
439
	protected final static class DefaultFocusManager extends FocusAdapter {
440
		
441
		private final static String PREF_LAST_FOCUS_INDEX= CUIPlugin.PLUGIN_ID + "formatter_page.modify_dialog_tab_page.last_focus_index"; //$NON-NLS-1$ 
442
		
443
		private final IDialogSettings fDialogSettings;
444
		
445
		private final Map fItemMap;
446
		private final List fItemList;
447
		
448
		private int fIndex;
449
		
450
		public DefaultFocusManager() {
451
			fDialogSettings= CUIPlugin.getDefault().getDialogSettings();
452
			fItemMap= new HashMap();
453
			fItemList= new ArrayList();
454
			fIndex= 0;
455
		}
456
457
		public void focusGained(FocusEvent e) {
458
			fDialogSettings.put(PREF_LAST_FOCUS_INDEX, ((Integer)fItemMap.get(e.widget)).intValue());
459
		}
460
		
461
		public void add(Control control) {
462
			control.addFocusListener(this);
463
			fItemList.add(fIndex, control);
464
			fItemMap.put(control, new Integer(fIndex++));
465
		}
466
		
467
		public void add(Preference preference) {
468
			final Control control= preference.getControl();
469
			if (control != null) 
470
				add(control);
471
		}
472
		
473
		public boolean isUsed() {
474
			return fIndex != 0;
475
		}
476
		
477
		public void restoreFocus() {
478
			int index= 0;
479
			try {
480
				index= fDialogSettings.getInt(PREF_LAST_FOCUS_INDEX);
481
				// make sure the value is within the range
482
				if ((index >= 0) && (index <= fItemList.size() - 1)) {
483
					((Control)fItemList.get(index)).setFocus();
484
				}
485
			} catch (NumberFormatException ex) {
486
				// this is the first time
487
			}
488
		}
489
		
490
		public void resetFocus() {
491
			fDialogSettings.put(PREF_LAST_FOCUS_INDEX, -1);
492
		}
493
	}
494
495
	/**
496
	 * The default focus manager. This widget knows all widgets which can have the focus
497
	 * and listens for focusGained events, on which it stores the index of the current
498
	 * focus holder. When the dialog is restarted, <code>restoreFocus()</code> sets the 
499
	 * focus to the last control which had it.
500
	 * 
501
	 * The standard Preference object are managed by this focus manager if they are created
502
	 * using the respective factory methods. Other SWT widgets can be added in subclasses 
503
	 * when they are created.
504
	 */
505
	protected final DefaultFocusManager fDefaultFocusManager;
506
	
507
	
508
	
509
	/**
510
	 * Constant array for boolean selection 
511
	 */
512
	protected static String[] FALSE_TRUE = {
513
		DefaultCodeFormatterConstants.FALSE,
514
		DefaultCodeFormatterConstants.TRUE
515
	};	
516
	
517
    /**
518
     * Constant array for insert / not_insert. 
519
     */
520
    protected static String[] DO_NOT_INSERT_INSERT = {
521
        CCorePlugin.DO_NOT_INSERT,
522
        CCorePlugin.INSERT
523
    };
524
525
	/**
526
	 * A pixel converter for layout calculations
527
	 */
528
	protected PixelConverter fPixelConverter;
529
	
530
	
531
	/**
532
	 * The map where the current settings are stored.
533
	 */
534
	protected final Map fWorkingValues;
535
	
536
	/**
537
	 * The modify dialog where we can display status messages.
538
	 */
539
	private final ModifyDialog fModifyDialog;
540
541
542
	/*
543
	 * Create a new <code>ModifyDialogTabPage</code>
544
	 */
545
	public ModifyDialogTabPage(ModifyDialog modifyDialog, Map workingValues) {
546
		fWorkingValues= workingValues;
547
		fModifyDialog= modifyDialog;
548
		fDefaultFocusManager= new DefaultFocusManager();
549
	}
550
	
551
	/**
552
	 * Create the contents of this tab page. Subclasses cannot override this, 
553
	 * instead they must implement <code>doCreatePreferences</code>. <code>doCreatePreview</code> may also
554
	 * be overridden as necessary.
555
	 * @param parent The parent composite
556
	 * @return Created content control
557
	 */
558
	public final Composite createContents(Composite parent) {
559
		final int numColumns= 4;
560
		
561
		if (fPixelConverter == null) {
562
		    fPixelConverter= new PixelConverter(parent);
563
		}
564
		
565
//		final SashForm fSashForm = new SashForm(parent, SWT.HORIZONTAL);
566
//		fSashForm.setFont(parent.getFont());
567
		
568
//		final Composite settingsPane= new Composite(fSashForm, SWT.NONE);
569
//		settingsPane.setFont(fSashForm.getFont());
570
		
571
		final Composite settingsPane= new Composite(parent, SWT.NONE);
572
		settingsPane.setFont(parent.getFont());
573
		settingsPane.setLayoutData(new GridData(GridData.FILL_BOTH));
574
		
575
		final GridLayout layout= new GridLayout(numColumns, false);
576
		layout.verticalSpacing= (int)(1.5 * fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING));
577
		layout.horizontalSpacing= fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
578
		layout.marginHeight= fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
579
		layout.marginWidth= fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
580
		settingsPane.setLayout(layout);
581
		doCreatePreferences(settingsPane, numColumns);
582
583
		return settingsPane;
584
//		final Composite previewPane= new Composite(fSashForm, SWT.NONE);
585
//		previewPane.setLayout(createGridLayout(numColumns, true));
586
//		previewPane.setFont(fSashForm.getFont());
587
//		doCreatePreviewPane(previewPane, numColumns);
588
//
589
//		initializePage();
590
//	
591
//		fSashForm.setWeights(new int [] {3, 3});
592
//		return fSashForm;
593
	}
594
	
595
	/**
596
	 * This method is called after all controls have been alloated, including the preview. 
597
	 * It can be used to set the preview text and to create listeners.
598
	 *
599
	 */
600
	protected abstract void initializePage();
601
	
602
603
	/**
604
	 * Create the left side of the modify dialog. This is meant to be implemented by subclasses. 
605
	 * @param composite Composite to create in
606
	 * @param numColumns Number of columns to use
607
	 */
608
	protected abstract void doCreatePreferences(Composite composite, int numColumns);
609
	
610
611
	/**
612
	 * Create the right side of the modify dialog. By default, the preview is displayed there.
613
	 * Subclasses can override this method in order to customize the right-hand side of the 
614
	 * dialog.
615
	 * @param composite Composite to create in
616
	 * @param numColumns Number of columns to use
617
	 * @return Created composite
618
	 */
619
	protected Composite doCreatePreviewPane(Composite composite, int numColumns) {
620
		createLabel(numColumns, composite, FormatterMessages.ModifyDialogTabPage_preview_label_text);  
621
		
622
		final CPreview preview= doCreateCPreview(composite);
623
		fDefaultFocusManager.add(preview.getControl());
624
		
625
		final GridData gd= createGridData(numColumns, GridData.FILL_BOTH, 0);
626
		gd.widthHint= 0;
627
		gd.heightHint=0;
628
		preview.getControl().setLayoutData(gd);
629
		
630
		return composite;
631
	}
632
633
	/**
634
	 * To be implemented by subclasses. This method should return an instance of CPreview.
635
	 * Currently, the choice is between CompilationUnitPreview which contains a valid compilation
636
	 * unit, or a SnippetPreview which formats several independent code snippets and displays them 
637
	 * in the same window.
638
	 * @param parent Parent composite
639
	 * @return Created preview
640
	 */
641
	protected abstract CPreview doCreateCPreview(Composite parent);
642
	
643
	/**
644
	 * This is called when the page becomes visible. 
645
	 * Common tasks to do include:
646
	 * <ul><li>Updating the preview.</li>
647
	 * <li>Setting the focus</li>
648
	 * </ul>
649
	 */
650
	final public void makeVisible() {
651
		fDefaultFocusManager.resetFocus();
652
		doUpdatePreview();
653
	}
654
	
655
	/**
656
	 * Update the preview. To be implemented by subclasses.
657
	 */
658
	protected abstract void doUpdatePreview();
659
	
660
	protected void notifyValuesModified() {
661
		fModifyDialog.valuesModified();
662
	}
663
    /**
664
     * Each tab page should remember where its last focus was, and reset it
665
     * correctly within this method. This method is only called after
666
     * initialization on the first tab page to be displayed in order to restore
667
     * the focus of the last session.
668
     */
669
    public void setInitialFocus() {
670
		if (fDefaultFocusManager.isUsed()) {
671
			fDefaultFocusManager.restoreFocus();
672
		}
673
	}
674
	
675
676
    /**
677
     * Set the status field on the dialog. This can be used by tab pages to report 
678
     * inconsistent input. The OK button is disabled if the kind is IStatus.ERROR. 
679
     * @param status Status describing the current page error state
680
     */
681
	protected void updateStatus(IStatus status) {
682
	    fModifyDialog.updateStatus(status);
683
	}
684
	
685
	/*
686
	 * Factory methods to make GUI construction easier
687
	 */
688
	
689
	/*
690
	 * Create a GridLayout with the default margin and spacing settings, as
691
	 * well as the specified number of columns.
692
	 */
693
	protected GridLayout createGridLayout(int numColumns, boolean margins) {
694
		final GridLayout layout= new GridLayout(numColumns, false);
695
		layout.verticalSpacing= fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
696
		layout.horizontalSpacing= fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
697
		if (margins) {
698
			layout.marginHeight= fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
699
			layout.marginWidth= fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
700
		} else {
701
			layout.marginHeight= 0;
702
			layout.marginWidth= 0;
703
		}
704
		return layout;
705
	}
706
707
	/*
708
	 * Convenience method to create a GridData.
709
	 */
710
	protected static GridData createGridData(int numColumns, int style, int widthHint) {
711
		final GridData gd= new GridData(style);
712
		gd.horizontalSpan= numColumns;
713
		gd.widthHint= widthHint;
714
		return gd;		
715
	}
716
717
718
	/* 
719
	 * Convenience method to create a label.  
720
	 */
721
	protected static Label createLabel(int numColumns, Composite parent, String text) {
722
		return createLabel(numColumns, parent, text, GridData.FILL_HORIZONTAL);
723
	}
724
	
725
	/*
726
	 * Convenience method to create a label
727
	 */
728
	protected static Label createLabel(int numColumns, Composite parent, String text, int gridDataStyle) {
729
		final Label label= new Label(parent, SWT.WRAP);
730
		label.setFont(parent.getFont());
731
		label.setText(text);
732
		label.setLayoutData(createGridData(numColumns, gridDataStyle, SWT.DEFAULT));
733
		return label;
734
	}
735
736
	/*
737
	 * Convenience method to create a group
738
	 */
739
	protected Group createGroup(int numColumns, Composite parent, String text ) {
740
		final Group group= new Group(parent, SWT.NONE);
741
		group.setFont(parent.getFont());
742
		group.setLayoutData(createGridData(numColumns, GridData.FILL_HORIZONTAL, SWT.DEFAULT));
743
		
744
		final GridLayout layout= new GridLayout(numColumns, false);
745
		layout.verticalSpacing=  fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
746
		layout.horizontalSpacing= fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
747
		layout.marginHeight=  fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
748
749
		//layout.marginHeight= fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
750
		//layout.marginWidth= fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
751
		
752
		group.setLayout(layout);//createGridLayout(numColumns, true));
753
		group.setText(text);
754
		return group;
755
	}
756
	
757
	/*
758
	 * Convenience method to create a NumberPreference. The widget is registered as 
759
	 * a potential focus holder, and the default updater is added.
760
	 */
761
	protected NumberPreference createNumberPref(Composite composite, int numColumns, String name, String key,
762
												int minValue, int maxValue) {
763
		final NumberPreference pref= new NumberPreference(composite, numColumns, fWorkingValues, 
764
			key, minValue, maxValue, name);
765
		fDefaultFocusManager.add(pref);
766
		pref.addObserver(fUpdater);
767
		return pref;
768
	}
769
	
770
	/*
771
	 * Convenience method to create a ComboPreference. The widget is registered as 
772
	 * a potential focus holder, and the default updater is added.
773
	 */
774
	protected ComboPreference createComboPref(Composite composite, int numColumns, String name, 
775
											  String key, String [] values, String [] items) {
776
		final ComboPreference pref= new ComboPreference(composite, numColumns, 
777
			fWorkingValues, key, values, name, items);
778
		fDefaultFocusManager.add(pref);
779
		pref.addObserver(fUpdater);
780
		return pref;
781
	}
782
783
	/*
784
	 * Convenience method to create a CheckboxPreference. The widget is registered as 
785
	 * a potential focus holder, and the default updater is added.
786
	 */
787
	protected CheckboxPreference createCheckboxPref(Composite composite, int numColumns, String name, String key,
788
													String [] values) {
789
		final CheckboxPreference pref= new CheckboxPreference(composite, numColumns, 
790
			fWorkingValues, key, values, name);
791
		fDefaultFocusManager.add(pref);
792
		pref.addObserver(fUpdater);
793
		return pref;
794
	}
795
	
796
	/*
797
	 * Create a nice javadoc comment for some string.
798
	 */
799
	protected static String createPreviewHeader(String title) {
800
		return "/**\n* " + title + "\n*/\n"; //$NON-NLS-1$ //$NON-NLS-2$
801
	}
802
}
(-)src/org/eclipse/cdt/internal/ui/preferences/AbstractConfigurationBlock.java (+476 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
13
package org.eclipse.cdt.internal.ui.preferences;
14
15
import java.util.ArrayList;
16
import java.util.HashMap;
17
import java.util.HashSet;
18
import java.util.Iterator;
19
import java.util.Map;
20
import java.util.Set;
21
22
import org.eclipse.core.runtime.IStatus;
23
24
import org.eclipse.swt.SWT;
25
import org.eclipse.swt.events.ModifyEvent;
26
import org.eclipse.swt.events.ModifyListener;
27
import org.eclipse.swt.events.SelectionEvent;
28
import org.eclipse.swt.events.SelectionListener;
29
import org.eclipse.swt.layout.GridData;
30
import org.eclipse.swt.layout.GridLayout;
31
import org.eclipse.swt.widgets.Button;
32
import org.eclipse.swt.widgets.Composite;
33
import org.eclipse.swt.widgets.Control;
34
import org.eclipse.swt.widgets.Group;
35
import org.eclipse.swt.widgets.Label;
36
import org.eclipse.swt.widgets.Text;
37
38
import org.eclipse.jface.preference.IPreferenceStore;
39
import org.eclipse.jface.preference.PreferencePage;
40
import org.eclipse.jface.resource.JFaceResources;
41
42
import org.eclipse.jface.text.Assert;
43
44
import org.eclipse.ui.forms.events.ExpansionAdapter;
45
import org.eclipse.ui.forms.events.ExpansionEvent;
46
import org.eclipse.ui.forms.widgets.ExpandableComposite;
47
48
import org.eclipse.cdt.internal.ui.util.Messages;
49
50
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
51
import org.eclipse.cdt.internal.ui.dialogs.StatusUtil;
52
import org.eclipse.cdt.internal.ui.util.PixelConverter;
53
54
/**
55
 * Configures Java Editor typing preferences.
56
 * 
57
 * @since 3.1
58
 */
59
abstract class AbstractConfigurationBlock implements IPreferenceConfigurationBlock {
60
61
	/**
62
	 * Use as follows:
63
	 * 
64
	 * <pre>
65
	 * SectionManager manager= new SectionManager();
66
	 * Composite composite= manager.createSectionComposite(parent);
67
	 * 
68
	 * Composite xSection= manager.createSection("section X"));
69
	 * xSection.setLayout(new FillLayout());
70
	 * new Button(xSection, SWT.PUSH); // add controls to section..
71
	 * 
72
	 * [...]
73
	 * 
74
	 * return composite; // return main composite
75
	 * </pre>
76
	 */
77
	protected final class SectionManager {
78
		/** The preference setting for keeping no section open. */
79
		private static final String __NONE= "__none"; //$NON-NLS-1$
80
		private Set fSections= new HashSet();
81
		private boolean fIsBeingManaged= false;
82
		private ExpansionAdapter fListener= new ExpansionAdapter() {
83
			public void expansionStateChanged(ExpansionEvent e) {
84
				ExpandableComposite source= (ExpandableComposite) e.getSource();
85
				updateSectionStyle(source);
86
				if (fIsBeingManaged)
87
					return;
88
				if (e.getState()) {
89
					try {
90
						fIsBeingManaged= true;
91
						for (Iterator iter= fSections.iterator(); iter.hasNext();) {
92
							ExpandableComposite composite= (ExpandableComposite) iter.next();
93
							if (composite != source)
94
								composite.setExpanded(false);
95
						}
96
					} finally {
97
						fIsBeingManaged= false;
98
					}
99
					if (fLastOpenKey != null && fDialogSettingsStore != null)
100
						fDialogSettingsStore.setValue(fLastOpenKey, source.getText());
101
				} else {
102
					if (!fIsBeingManaged && fLastOpenKey != null && fDialogSettingsStore != null)
103
						fDialogSettingsStore.setValue(fLastOpenKey, __NONE);
104
				}
105
				ExpandableComposite exComp= getParentExpandableComposite(source);
106
				if (exComp != null)
107
					exComp.layout(true, true);
108
				ScrolledPageContent parentScrolledComposite= getParentScrolledComposite(source);
109
				if (parentScrolledComposite != null) {
110
					parentScrolledComposite.reflow(true);
111
				}
112
			}
113
		};
114
		private Composite fBody;
115
		private final String fLastOpenKey;
116
		private final IPreferenceStore fDialogSettingsStore;
117
		private ExpandableComposite fFirstChild= null;
118
		/**
119
		 * Creates a new section manager.
120
		 */
121
		public SectionManager() {
122
			this(null, null);
123
		}
124
		/**
125
		 * Creates a new section manager.
126
		 */
127
		public SectionManager(IPreferenceStore dialogSettingsStore, String lastOpenKey) {
128
			fDialogSettingsStore= dialogSettingsStore;
129
			fLastOpenKey= lastOpenKey;
130
		}
131
		private void manage(ExpandableComposite section) {
132
			if (section == null)
133
				throw new NullPointerException();
134
			if (fSections.add(section))
135
				section.addExpansionListener(fListener);
136
			makeScrollableCompositeAware(section);
137
		}
138
		
139
		/**
140
		 * Creates a new composite that can contain a set of expandable
141
		 * sections. A <code>ScrolledPageComposite</code> is created and a new
142
		 * composite within that, to ensure that expanding the sections will
143
		 * always have enough space, unless there already is a
144
		 * <code>ScrolledComposite</code> along the parent chain of
145
		 * <code>parent</code>, in which case a normal <code>Composite</code>
146
		 * is created.
147
		 * <p>
148
		 * The receiver keeps a reference to the inner body composite, so that
149
		 * new sections can be added via <code>createSection</code>.
150
		 * </p>
151
		 * 
152
		 * @param parent the parent composite
153
		 * @return the newly created composite
154
		 */
155
		public Composite createSectionComposite(Composite parent) {
156
			Assert.isTrue(fBody == null);
157
			boolean isNested= isNestedInScrolledComposite(parent);
158
			Composite composite;
159
			if (isNested) {
160
				composite= new Composite(parent, SWT.NONE);
161
				fBody= composite;
162
			} else {
163
				composite= new ScrolledPageContent(parent);
164
				fBody= ((ScrolledPageContent) composite).getBody();
165
			}
166
			
167
			fBody.setLayout(new GridLayout());
168
			
169
			return composite;
170
		}
171
		
172
		/**
173
		 * Creates an expandable section within the parent created previously by
174
		 * calling <code>createSectionComposite</code>. Controls can be added 
175
		 * directly to the returned composite, which has no layout initially.
176
		 * 
177
		 * @param label the display name of the section
178
		 * @return a composite within the expandable section
179
		 */
180
		public Composite createSection(String label) {
181
			Assert.isNotNull(fBody);
182
			final ExpandableComposite excomposite= new ExpandableComposite(fBody, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.COMPACT);
183
			if (fFirstChild == null)
184
				fFirstChild= excomposite;
185
			excomposite.setText(label);
186
			String last= null;
187
			if (fLastOpenKey != null && fDialogSettingsStore != null)
188
				last= fDialogSettingsStore.getString(fLastOpenKey);
189
			
190
			if (fFirstChild == excomposite && !__NONE.equals(last) || label.equals(last)) {
191
				excomposite.setExpanded(true);
192
				if (fFirstChild != excomposite)
193
					fFirstChild.setExpanded(false);
194
			} else {
195
				excomposite.setExpanded(false);
196
			}
197
			excomposite.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));
198
			
199
			updateSectionStyle(excomposite);
200
			manage(excomposite);
201
			
202
			Composite contents= new Composite(excomposite, SWT.NONE);
203
			excomposite.setClient(contents);
204
			
205
			return contents;
206
		}
207
	}
208
209
	protected static final int INDENT= 20;
210
	private OverlayPreferenceStore fStore;
211
	
212
	private Map fCheckBoxes= new HashMap();
213
	private SelectionListener fCheckBoxListener= new SelectionListener() {
214
		public void widgetDefaultSelected(SelectionEvent e) {
215
		}
216
		public void widgetSelected(SelectionEvent e) {
217
			Button button= (Button) e.widget;
218
			fStore.setValue((String) fCheckBoxes.get(button), button.getSelection());
219
		}
220
	};
221
	
222
	
223
	private Map fTextFields= new HashMap();
224
	private ModifyListener fTextFieldListener= new ModifyListener() {
225
		public void modifyText(ModifyEvent e) {
226
			Text text= (Text) e.widget;
227
			fStore.setValue((String) fTextFields.get(text), text.getText());
228
		}
229
	};
230
231
	private ArrayList fNumberFields= new ArrayList();
232
	private ModifyListener fNumberFieldListener= new ModifyListener() {
233
		public void modifyText(ModifyEvent e) {
234
			numberFieldChanged((Text) e.widget);
235
		}
236
	};
237
	
238
	/**
239
	 * List of master/slave listeners when there's a dependency.
240
	 * 
241
	 * @see #createDependency(Button, Control)
242
	 * @since 3.0
243
	 */
244
	private ArrayList fMasterSlaveListeners= new ArrayList();
245
	
246
	private StatusInfo fStatus;
247
	private final PreferencePage fMainPage;
248
249
	public AbstractConfigurationBlock(OverlayPreferenceStore store) {
250
		Assert.isNotNull(store);
251
		fStore= store;
252
		fMainPage= null;
253
	}
254
	
255
	public AbstractConfigurationBlock(OverlayPreferenceStore store, PreferencePage mainPreferencePage) {
256
		Assert.isNotNull(store);
257
		Assert.isNotNull(mainPreferencePage);
258
		fStore= store;
259
		fMainPage= mainPreferencePage;
260
	}
261
262
	protected final ScrolledPageContent getParentScrolledComposite(Control control) {
263
		Control parent= control.getParent();
264
		while (!(parent instanceof ScrolledPageContent) && parent != null) {
265
			parent= parent.getParent();
266
		}
267
		if (parent instanceof ScrolledPageContent) {
268
			return (ScrolledPageContent) parent;
269
		}
270
		return null;
271
	}
272
273
	private final ExpandableComposite getParentExpandableComposite(Control control) {
274
		Control parent= control.getParent();
275
		while (!(parent instanceof ExpandableComposite) && parent != null) {
276
			parent= parent.getParent();
277
		}
278
		if (parent instanceof ExpandableComposite) {
279
			return (ExpandableComposite) parent;
280
		}
281
		return null;
282
	}
283
284
	protected void updateSectionStyle(ExpandableComposite excomposite) {
285
		excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
286
	}
287
	
288
	private void makeScrollableCompositeAware(Control control) {
289
		ScrolledPageContent parentScrolledComposite= getParentScrolledComposite(control);
290
		if (parentScrolledComposite != null) {
291
			parentScrolledComposite.adaptChild(control);
292
		}
293
	}
294
	
295
	private boolean isNestedInScrolledComposite(Composite parent) {
296
		return getParentScrolledComposite(parent) != null;
297
	}
298
	
299
	protected Button addCheckBox(Composite parent, String label, String key, int indentation) {		
300
		Button checkBox= new Button(parent, SWT.CHECK);
301
		checkBox.setText(label);
302
		
303
		GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
304
		gd.horizontalIndent= indentation;
305
		gd.horizontalSpan= 2;
306
		checkBox.setLayoutData(gd);
307
		checkBox.addSelectionListener(fCheckBoxListener);
308
		makeScrollableCompositeAware(checkBox);
309
310
		fCheckBoxes.put(checkBox, key);
311
		
312
		return checkBox;
313
	}
314
315
	/**
316
	 * Returns an array of size 2:
317
	 *  - first element is of type <code>Label</code>
318
	 *  - second element is of type <code>Text</code>
319
	 * Use <code>getLabelControl</code> and <code>getTextControl</code> to get the 2 controls.
320
	 * 
321
	 * @param composite 	the parent composite
322
	 * @param label			the text field's label
323
	 * @param key			the preference key
324
	 * @param textLimit		the text limit
325
	 * @param indentation	the field's indentation
326
	 * @param isNumber		<code>true</code> iff this text field is used to e4dit a number
327
	 * @return the controls added
328
	 */
329
	protected Control[] addLabelledTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
330
		
331
		PixelConverter pixelConverter= new PixelConverter(composite);
332
		
333
		Label labelControl= new Label(composite, SWT.NONE);
334
		labelControl.setText(label);
335
		GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
336
		gd.horizontalIndent= indentation;
337
		labelControl.setLayoutData(gd);
338
		
339
		Text textControl= new Text(composite, SWT.BORDER | SWT.SINGLE);		
340
		gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
341
		gd.widthHint= pixelConverter.convertWidthInCharsToPixels(textLimit + 1);
342
		textControl.setLayoutData(gd);
343
		textControl.setTextLimit(textLimit);
344
		fTextFields.put(textControl, key);
345
		if (isNumber) {
346
			fNumberFields.add(textControl);
347
			textControl.addModifyListener(fNumberFieldListener);
348
		} else {
349
			textControl.addModifyListener(fTextFieldListener);
350
		}
351
			
352
		return new Control[]{labelControl, textControl};
353
	}
354
355
	protected void createDependency(final Button master, final Control slave) {
356
		createDependency(master, new Control[] {slave});
357
	}
358
	
359
	protected void createDependency(final Button master, final Control[] slaves) {
360
		Assert.isTrue(slaves.length > 0);
361
		indent(slaves[0]);
362
		SelectionListener listener= new SelectionListener() {
363
			public void widgetSelected(SelectionEvent e) {
364
				boolean state= master.getSelection();
365
				for (int i= 0; i < slaves.length; i++) {
366
					slaves[i].setEnabled(state);
367
				}
368
			}
369
370
			public void widgetDefaultSelected(SelectionEvent e) {}
371
		};
372
		master.addSelectionListener(listener);
373
		fMasterSlaveListeners.add(listener);
374
	}
375
376
	protected static void indent(Control control) {
377
		((GridData) control.getLayoutData()).horizontalIndent+= INDENT;
378
	}
379
380
	public void initialize() {
381
		initializeFields();
382
	}
383
384
	private void initializeFields() {
385
		
386
		Iterator iter= fCheckBoxes.keySet().iterator();
387
		while (iter.hasNext()) {
388
			Button b= (Button) iter.next();
389
			String key= (String) fCheckBoxes.get(b);
390
			b.setSelection(fStore.getBoolean(key));
391
		}
392
		
393
		iter= fTextFields.keySet().iterator();
394
		while (iter.hasNext()) {
395
			Text t= (Text) iter.next();
396
			String key= (String) fTextFields.get(t);
397
			t.setText(fStore.getString(key));
398
		}
399
		
400
        // Update slaves
401
        iter= fMasterSlaveListeners.iterator();
402
        while (iter.hasNext()) {
403
            SelectionListener listener= (SelectionListener)iter.next();
404
            listener.widgetSelected(null);
405
        }
406
     
407
        updateStatus(new StatusInfo());
408
	}
409
410
	public void performOk() {
411
	}
412
413
	public void performDefaults() {
414
		initializeFields();
415
	}
416
417
	IStatus getStatus() {
418
		if (fStatus == null)
419
			fStatus= new StatusInfo();
420
		return fStatus;
421
	}
422
423
	/*
424
	 * @see org.eclipse.jdt.internal.ui.preferences.IPreferenceConfigurationBlock#dispose()
425
	 * @since 3.0
426
	 */
427
	public void dispose() {
428
	}
429
	
430
	private void numberFieldChanged(Text textControl) {
431
		String number= textControl.getText();
432
		IStatus status= validatePositiveNumber(number);
433
		if (!status.matches(IStatus.ERROR))
434
			fStore.setValue((String) fTextFields.get(textControl), number);
435
		updateStatus(status);
436
	}
437
	
438
	private IStatus validatePositiveNumber(String number) {
439
		StatusInfo status= new StatusInfo();
440
		if (number.length() == 0) {
441
			status.setError(PreferencesMessages.CEditorPreferencePage_empty_input); 
442
		} else {
443
			try {
444
				int value= Integer.parseInt(number);
445
				if (value < 0)
446
					status.setError(Messages.format(PreferencesMessages.CEditorPreferencePage_invalid_input, number)); 
447
			} catch (NumberFormatException e) {
448
				status.setError(Messages.format(PreferencesMessages.CEditorPreferencePage_invalid_input, number)); 
449
			}
450
		}
451
		return status;
452
	}
453
454
	protected void updateStatus(IStatus status) {
455
		if (fMainPage == null)
456
			return;
457
		fMainPage.setValid(status.isOK());
458
		StatusUtil.applyToStatusLine(fMainPage, status);
459
	}
460
	
461
	protected final OverlayPreferenceStore getPreferenceStore() {
462
		return fStore;
463
	}
464
465
	protected Composite createSubsection(Composite parent, SectionManager manager, String label) {
466
		if (manager != null) {
467
			return manager.createSection(label);
468
		} else {
469
			Group group= new Group(parent, SWT.SHADOW_NONE);
470
			group.setText(label);
471
			GridData data= new GridData(SWT.FILL, SWT.CENTER, true, false);
472
			group.setLayoutData(data);
473
			return group;
474
		}
475
	}
476
}
(-)src/org/eclipse/cdt/internal/ui/preferences/formatter/RenameProfileDialog.java (+142 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Aaron Luchko, aluchko@redhat.com - 105926 [Formatter] Exporting Unnamed profile fails silently
11
 *     Sergey Prigogin, Google
12
 *******************************************************************************/
13
package org.eclipse.cdt.internal.ui.preferences.formatter;
14
15
import org.eclipse.core.runtime.IStatus;
16
17
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.events.ModifyEvent;
19
import org.eclipse.swt.events.ModifyListener;
20
import org.eclipse.swt.layout.GridData;
21
import org.eclipse.swt.layout.GridLayout;
22
import org.eclipse.swt.widgets.Composite;
23
import org.eclipse.swt.widgets.Control;
24
import org.eclipse.swt.widgets.Label;
25
import org.eclipse.swt.widgets.Shell;
26
import org.eclipse.swt.widgets.Text;
27
28
import org.eclipse.jface.dialogs.IDialogConstants;
29
import org.eclipse.jface.dialogs.StatusDialog;
30
31
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
32
import org.eclipse.cdt.internal.ui.preferences.formatter.ProfileManager.Profile;
33
import org.eclipse.cdt.internal.ui.preferences.formatter.ProfileManager.SharedProfile;
34
35
/**
36
 * The dialog to rename a new profile. 
37
 */
38
public class RenameProfileDialog extends StatusDialog {
39
	
40
	private Label fNameLabel;
41
	private Text fNameText;
42
	
43
	private final StatusInfo fOk;
44
	private final StatusInfo fEmpty;
45
	private final StatusInfo fDuplicate;
46
	private final StatusInfo fNoMessage;
47
48
	private final Profile fProfile;
49
	private final ProfileManager fManager;
50
	private Profile fRenamedProfile;
51
	
52
	public RenameProfileDialog(Shell parentShell, Profile profile, ProfileManager manager) {
53
		super(parentShell);
54
		fManager= manager;
55
		setTitle(FormatterMessages.RenameProfileDialog_dialog_title); 
56
		fProfile= profile;
57
		fOk= new StatusInfo();
58
		fDuplicate= new StatusInfo(IStatus.ERROR, FormatterMessages.RenameProfileDialog_status_message_profile_with_this_name_already_exists); 
59
		fEmpty= new StatusInfo(IStatus.ERROR, FormatterMessages.RenameProfileDialog_status_message_profile_name_empty);
60
		fNoMessage= new StatusInfo(IStatus.ERROR, new String());
61
	}
62
	
63
	public Control createDialogArea(Composite parent) {
64
				
65
		final int numColumns= 2;
66
		
67
		GridLayout layout= new GridLayout();
68
		layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
69
		layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
70
		layout.verticalSpacing= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
71
		layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
72
		layout.numColumns= numColumns;
73
		
74
		final Composite composite= new Composite(parent, SWT.NULL);
75
		composite.setLayout(layout);
76
		
77
		// Create "Please enter a new name:" label
78
		GridData gd = new GridData();
79
		gd.horizontalSpan = numColumns;
80
		gd.widthHint= convertWidthInCharsToPixels(60);
81
		fNameLabel = new Label(composite, SWT.NONE);
82
		fNameLabel.setText(FormatterMessages.RenameProfileDialog_dialog_label_enter_a_new_name); 
83
		fNameLabel.setLayoutData(gd);
84
		
85
		// Create text field to enter name
86
		gd = new GridData( GridData.FILL_HORIZONTAL);
87
		gd.horizontalSpan= numColumns;
88
		fNameText= new Text(composite, SWT.SINGLE | SWT.BORDER);
89
		if (fProfile instanceof SharedProfile) {
90
			fNameText.setText(fProfile.getName());
91
		}
92
		fNameText.setSelection(0, fProfile.getName().length());
93
		fNameText.setLayoutData(gd);
94
		fNameText.addModifyListener( new ModifyListener() {
95
			public void modifyText(ModifyEvent e) {
96
				doValidation();
97
			}
98
		});
99
		fNameText.setText(fProfile.getName());
100
		fNameText.selectAll();
101
		
102
		applyDialogFont(composite);
103
		
104
		return composite;
105
	}
106
107
108
	/**
109
	 * Validate the current settings.
110
	 */
111
	protected void doValidation() {
112
		final String name= fNameText.getText().trim();
113
		
114
		if (name.length() == 0) {
115
			updateStatus(fEmpty);
116
			return;
117
		}
118
		
119
		if (name.equals(fProfile.getName())) {
120
			updateStatus(fNoMessage);
121
			return;
122
		}
123
		
124
		if (fManager.containsName(name)) {
125
			updateStatus(fDuplicate);
126
			return;
127
		}
128
		
129
		updateStatus(fOk);
130
	}
131
	
132
	public Profile getRenamedProfile() {
133
		return fRenamedProfile;
134
	}
135
	
136
	protected void okPressed() {
137
		if (!getStatus().isOK()) 
138
			return;
139
		fRenamedProfile= fProfile.rename(fNameText.getText(), fManager);
140
		super.okPressed();
141
	}
142
}
(-)src/org/eclipse/cdt/internal/ui/preferences/SmartTypingConfigurationBlock.java (+250 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
13
package org.eclipse.cdt.internal.ui.preferences;
14
15
import org.eclipse.jface.dialogs.Dialog;
16
import org.eclipse.jface.preference.IPreferenceStore;
17
import org.eclipse.jface.text.Assert;
18
import org.eclipse.jface.util.IPropertyChangeListener;
19
import org.eclipse.jface.util.PropertyChangeEvent;
20
import org.eclipse.swt.SWT;
21
import org.eclipse.swt.events.DisposeListener;
22
import org.eclipse.swt.events.SelectionAdapter;
23
import org.eclipse.swt.events.SelectionEvent;
24
import org.eclipse.swt.graphics.Point;
25
import org.eclipse.swt.layout.GridData;
26
import org.eclipse.swt.layout.GridLayout;
27
import org.eclipse.swt.widgets.Button;
28
import org.eclipse.swt.widgets.Composite;
29
import org.eclipse.swt.widgets.Control;
30
import org.eclipse.swt.widgets.Link;
31
import org.eclipse.ui.dialogs.PreferencesUtil;
32
33
import org.eclipse.cdt.core.CCorePlugin;
34
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
35
import org.eclipse.cdt.ui.CUIPlugin;
36
import org.eclipse.cdt.ui.PreferenceConstants;
37
38
import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil;
39
40
import org.eclipse.cdt.internal.ui.util.Messages;
41
42
/**
43
 * Configures C Editor typing preferences.
44
 */
45
class SmartTypingConfigurationBlock extends AbstractConfigurationBlock {
46
47
	public SmartTypingConfigurationBlock(OverlayPreferenceStore store) {
48
		super(store);
49
		
50
		store.addKeys(createOverlayStoreKeys());
51
	}
52
	
53
	private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
54
		return new OverlayPreferenceStore.OverlayKey[] {
55
			new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SMART_PASTE),
56
			
57
			new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_STRINGS),
58
			new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_BRACKETS),
59
			new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_ANGULAR_BRACKETS),
60
			new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_CLOSE_BRACES),
61
			new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_WRAP_STRINGS),
62
			new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_ESCAPE_STRINGS),
63
			
64
//			new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SMART_SEMICOLON),
65
			new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SMART_TAB),
66
//			new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SMART_OPENING_BRACE),
67
		};
68
	}	
69
70
	/**
71
	 * Creates page for mark occurrences preferences.
72
	 * 
73
	 * @param parent the parent composite
74
	 * @return the control for the preference page
75
	 */
76
	public Control createControl(Composite parent) {
77
		ScrolledPageContent scrolled= new ScrolledPageContent(parent, SWT.H_SCROLL | SWT.V_SCROLL);
78
		scrolled.setExpandHorizontal(true);
79
		scrolled.setExpandVertical(true);
80
		
81
		Composite control= new Composite(scrolled, SWT.NONE);
82
		GridLayout layout= new GridLayout();
83
		control.setLayout(layout);
84
85
		Composite composite;
86
		
87
		composite= createSubsection(control, null, PreferencesMessages.SmartTypingConfigurationBlock_autoclose_title); 
88
		addAutoclosingSection(composite);
89
		
90
//		composite= createSubsection(control, null, PreferencesMessages.SmartTypingConfigurationBlock_automove_title); 
91
//		addAutopositionSection(composite);
92
		
93
		composite= createSubsection(control, null, PreferencesMessages.SmartTypingConfigurationBlock_tabs_title); 
94
		addTabSection(composite);
95
96
		composite= createSubsection(control, null, PreferencesMessages.SmartTypingConfigurationBlock_pasting_title); 
97
		addPasteSection(composite);
98
		
99
		composite= createSubsection(control, null, PreferencesMessages.SmartTypingConfigurationBlock_strings_title); 
100
		addStringsSection(composite);
101
102
		scrolled.setContent(control);
103
		final Point size= control.computeSize(SWT.DEFAULT, SWT.DEFAULT);
104
		scrolled.setMinSize(size.x, size.y);
105
		return scrolled;
106
	}
107
108
	private void addStringsSection(Composite composite) {
109
		GridLayout layout= new GridLayout();
110
		composite.setLayout(layout);
111
112
		String label;
113
		Button master, slave;
114
		label= PreferencesMessages.CEditorPreferencePage_wrapStrings; 
115
		master= addCheckBox(composite, label, PreferenceConstants.EDITOR_WRAP_STRINGS, 0);
116
		
117
		label= PreferencesMessages.CEditorPreferencePage_escapeStrings; 
118
		slave= addCheckBox(composite, label, PreferenceConstants.EDITOR_ESCAPE_STRINGS, 0);
119
		createDependency(master, slave);
120
	}
121
122
	private void addPasteSection(Composite composite) {
123
		GridLayout layout= new GridLayout();
124
		composite.setLayout(layout);
125
126
		String label;
127
		label= PreferencesMessages.CEditorPreferencePage_smartPaste; 
128
		addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_PASTE, 0);
129
	}
130
131
	private void addTabSection(Composite composite) {
132
		GridLayout layout= new GridLayout();
133
		composite.setLayout(layout);
134
135
		String label;
136
		label= PreferencesMessages.CEditorPreferencePage_typing_smartTab; 
137
		addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_TAB, 0);
138
		
139
		createMessage(composite);
140
	}
141
142
//	private void addAutopositionSection(Composite composite) {
143
//		GridLayout layout= new GridLayout();
144
//		composite.setLayout(layout);
145
//
146
//		String label;
147
//		
148
//		label= PreferencesMessages.CEditorPreferencePage_typing_smartSemicolon; 
149
//		addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_SEMICOLON, 0);
150
//		
151
//		label= PreferencesMessages.CEditorPreferencePage_typing_smartOpeningBrace; 
152
//		addCheckBox(composite, label, PreferenceConstants.EDITOR_SMART_OPENING_BRACE, 0);
153
//	}
154
155
	private void addAutoclosingSection(Composite composite) {
156
		
157
		GridLayout layout= new GridLayout();
158
		layout.numColumns= 1;
159
		composite.setLayout(layout);
160
161
		String label;
162
163
		label= PreferencesMessages.CEditorPreferencePage_closeStrings;
164
		addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_STRINGS, 0);
165
166
		label= PreferencesMessages.CEditorPreferencePage_closeBrackets; 
167
		addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACKETS, 0);
168
169
		label= PreferencesMessages.CEditorPreferencePage_closeAngularBrackets; 
170
		addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_ANGULAR_BRACKETS, 0);
171
172
		label= PreferencesMessages.CEditorPreferencePage_closeBraces; 
173
		addCheckBox(composite, label, PreferenceConstants.EDITOR_CLOSE_BRACES, 0);
174
	}
175
	
176
	private void createMessage(final Composite composite) {
177
		// TODO create a link with an argument, so the formatter preference page can open the 
178
		// current profile automatically.
179
		String linkTooltip= PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_tooltip; 
180
		String text;
181
		String indentMode= CUIPlugin.getDefault().getCombinedPreferenceStore().getString(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR);
182
		if (CCorePlugin.TAB.equals(indentMode))
183
			text= Messages.format(PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_tab_text, new String[] {Integer.toString(getTabDisplaySize())});
184
		else
185
			text= Messages.format(PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_others_text, new String[] {Integer.toString(getTabDisplaySize()), Integer.toString(getIndentSize()), getIndentMode()}); 
186
		
187
		final Link link= new Link(composite, SWT.NONE);
188
		link.setText(text);
189
		link.setToolTipText(linkTooltip);
190
		GridData gd= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
191
		gd.widthHint= 300; // don't get wider initially
192
		link.setLayoutData(gd);
193
		link.addSelectionListener(new SelectionAdapter() {
194
			public void widgetSelected(SelectionEvent e) {
195
				PreferencesUtil.createPreferenceDialogOn(link.getShell(), "org.eclipse.cdt.ui.preferences.CodeFormatterPreferencePage", null, null); //$NON-NLS-1$
196
			}
197
		});
198
		
199
		final IPreferenceStore combinedStore= CUIPlugin.getDefault().getCombinedPreferenceStore();
200
		final IPropertyChangeListener propertyChangeListener= new IPropertyChangeListener() {
201
			private boolean fHasRun= false;
202
			public void propertyChange(PropertyChangeEvent event) {
203
				if (fHasRun)
204
					return;
205
				if (composite.isDisposed())
206
					return;
207
				String property= event.getProperty();
208
				if (DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR.equals(property)
209
						|| DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE.equals(property)) {
210
					fHasRun= true;
211
					link.dispose();
212
					createMessage(composite);
213
					Dialog.applyDialogFont(composite);
214
					composite.redraw();
215
					composite.layout();
216
				}
217
			}
218
		};
219
		combinedStore.addPropertyChangeListener(propertyChangeListener);
220
		link.addDisposeListener(new DisposeListener() {
221
			public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e) {
222
				combinedStore.removePropertyChangeListener(propertyChangeListener);
223
			}
224
		});
225
	}
226
227
	private String getIndentMode() {
228
		String indentMode= CUIPlugin.getDefault().getCombinedPreferenceStore().getString(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR);
229
		
230
		if (CCorePlugin.SPACE.equals(indentMode))
231
			return PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_spaces; 
232
		
233
		if (CCorePlugin.TAB.equals(indentMode))
234
			return PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_tabs;
235
		
236
		if (DefaultCodeFormatterConstants.MIXED.equals(indentMode))
237
			return PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_tabsAndSpaces;
238
239
		Assert.isTrue(false, "Illegal indent mode - must not happen"); //$NON-NLS-1$
240
		return null;
241
	}
242
243
	private int getIndentSize() {
244
		return CodeFormatterUtil.getIndentWidth(null);
245
	}
246
	
247
	private int getTabDisplaySize() {
248
		return CodeFormatterUtil.getTabWidth(null);
249
	}
250
}
(-)src/org/eclipse/cdt/internal/ui/preferences/AbstractConfigurationBlockPreferencePage.java (+128 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
13
package org.eclipse.cdt.internal.ui.preferences;
14
15
import org.eclipse.swt.widgets.Composite;
16
import org.eclipse.swt.widgets.Control;
17
18
import org.eclipse.jface.dialogs.Dialog;
19
import org.eclipse.jface.preference.PreferencePage;
20
21
import org.eclipse.ui.IWorkbench;
22
import org.eclipse.ui.IWorkbenchPreferencePage;
23
import org.eclipse.ui.PlatformUI;
24
25
import org.eclipse.cdt.ui.CUIPlugin;
26
27
/**
28
 * Abstract preference page which is used to wrap a
29
 * {@link org.eclipse.cdt.internal.ui.preferences.IPreferenceConfigurationBlock}.
30
 * 
31
 * @since 3.0
32
 */
33
public abstract class AbstractConfigurationBlockPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
34
	
35
	
36
	private IPreferenceConfigurationBlock fConfigurationBlock;
37
	private OverlayPreferenceStore fOverlayStore;
38
	
39
40
	/**
41
	 * Creates a new preference page.
42
	 */
43
	public AbstractConfigurationBlockPreferencePage() {
44
		setDescription();
45
		setPreferenceStore();
46
		fOverlayStore= new OverlayPreferenceStore(getPreferenceStore(), new OverlayPreferenceStore.OverlayKey[] {});
47
		fConfigurationBlock= createConfigurationBlock(fOverlayStore);
48
	}
49
		
50
	protected abstract IPreferenceConfigurationBlock createConfigurationBlock(OverlayPreferenceStore overlayPreferenceStore);
51
	protected abstract String getHelpId();
52
	protected abstract void setDescription();
53
	protected abstract void setPreferenceStore();
54
	
55
	/*
56
	 * @see IWorkbenchPreferencePage#init()
57
	 */	
58
	public void init(IWorkbench workbench) {
59
	}
60
61
	/*
62
	 * @see PreferencePage#createControl(Composite)
63
	 */
64
	public void createControl(Composite parent) {
65
		super.createControl(parent);
66
		PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), getHelpId());
67
	}
68
	
69
	/*
70
	 * @see PreferencePage#createContents(Composite)
71
	 */
72
	protected Control createContents(Composite parent) {
73
		
74
		fOverlayStore.load();
75
		fOverlayStore.start();
76
		
77
		Control content= fConfigurationBlock.createControl(parent);
78
		
79
		initialize();
80
		
81
		Dialog.applyDialogFont(content);
82
		return content;
83
	}
84
	
85
	private void initialize() {
86
		fConfigurationBlock.initialize();
87
	}
88
	
89
    /*
90
	 * @see PreferencePage#performOk()
91
	 */
92
	public boolean performOk() {
93
		
94
		fConfigurationBlock.performOk();
95
96
		fOverlayStore.propagate();
97
		
98
		CUIPlugin.getDefault().savePluginPreferences();
99
		
100
		return true;
101
	}
102
	
103
	/*
104
	 * @see PreferencePage#performDefaults()
105
	 */
106
	public void performDefaults() {
107
		
108
		fOverlayStore.loadDefaults();
109
		fConfigurationBlock.performDefaults();
110
111
		super.performDefaults();
112
	}
113
	
114
	/*
115
	 * @see DialogPage#dispose()
116
	 */
117
	public void dispose() {
118
		
119
		fConfigurationBlock.dispose();
120
		
121
		if (fOverlayStore != null) {
122
			fOverlayStore.stop();
123
			fOverlayStore= null;
124
		}
125
		
126
		super.dispose();
127
	}
128
}
(-)src/org/eclipse/cdt/internal/ui/preferences/PropertyAndPreferencePage.java (+287 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
package org.eclipse.cdt.internal.ui.preferences;
13
14
import java.util.Map;
15
16
import org.eclipse.core.resources.IProject;
17
import org.eclipse.core.resources.IResource;
18
import org.eclipse.core.runtime.IAdaptable;
19
import org.eclipse.core.runtime.IStatus;
20
import org.eclipse.jface.dialogs.ControlEnableState;
21
import org.eclipse.jface.dialogs.Dialog;
22
import org.eclipse.jface.preference.PreferencePage;
23
import org.eclipse.swt.SWT;
24
import org.eclipse.swt.layout.GridData;
25
import org.eclipse.swt.layout.GridLayout;
26
import org.eclipse.swt.widgets.Composite;
27
import org.eclipse.swt.widgets.Control;
28
import org.eclipse.swt.widgets.Link;
29
import org.eclipse.ui.IWorkbench;
30
import org.eclipse.ui.IWorkbenchPreferencePage;
31
import org.eclipse.ui.IWorkbenchPropertyPage;
32
import org.eclipse.ui.dialogs.PreferencesUtil;
33
34
import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
35
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
36
import org.eclipse.cdt.internal.ui.dialogs.StatusUtil;
37
38
/**
39
 * Base for project property and preference pages
40
 */
41
public abstract class PropertyAndPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, IWorkbenchPropertyPage {
42
	
43
	private Control fConfigurationBlockControl;
44
	private ControlEnableState fBlockEnableState;
45
	private Link fChangeWorkspaceSettings;
46
//	private SelectionButtonDialogField fUseProjectSettings;
47
	private IStatus fBlockStatus;
48
	private Composite fParentComposite;
49
	
50
	private IProject fProject; // project or null
51
	private Map fData; // page data
52
	
53
	public static final String DATA_NO_LINK= "PropertyAndPreferencePage.nolink"; //$NON-NLS-1$
54
	
55
	public PropertyAndPreferencePage() {
56
		fBlockStatus= new StatusInfo();
57
		fBlockEnableState= null;
58
		fProject= null;
59
		fData= null;
60
	}
61
62
	protected abstract Control createPreferenceContent(Composite composite);
63
	protected abstract boolean hasProjectSpecificOptions(IProject project);
64
	
65
	protected abstract String getPreferencePageID();
66
	protected abstract String getPropertyPageID();
67
	
68
	protected boolean supportsProjectSpecificOptions() {
69
		return getPropertyPageID() != null;
70
	}
71
	
72
	protected boolean offerLink() {
73
		return fData == null || !Boolean.TRUE.equals(fData.get(DATA_NO_LINK));
74
	}
75
	
76
// TODO: Project specific settings are not supported yet.
77
//protected Label createDescriptionLabel(Composite parent) {
78
//		fParentComposite= parent;
79
//		if (isProjectPreferencePage()) {
80
//			Composite composite= new Composite(parent, SWT.NONE);
81
//			composite.setFont(parent.getFont());
82
//			GridLayout layout= new GridLayout();
83
//			layout.marginHeight= 0;
84
//			layout.marginWidth= 0;
85
//			layout.numColumns= 2;
86
//			composite.setLayout(layout);
87
//			composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
88
//			
89
//			IDialogFieldListener listener= new IDialogFieldListener() {
90
//				public void dialogFieldChanged(DialogField field) {
91
//					enableProjectSpecificSettings(((SelectionButtonDialogField)field).isSelected());
92
//				}
93
//			};
94
//			
95
//			fUseProjectSettings= new SelectionButtonDialogField(SWT.CHECK);
96
//			fUseProjectSettings.setDialogFieldListener(listener);
97
//			fUseProjectSettings.setLabelText(PreferencesMessages.PropertyAndPreferencePage_useprojectsettings_label); 
98
//			fUseProjectSettings.doFillIntoGrid(composite, 1);
99
//			LayoutUtil.setHorizontalGrabbing(fUseProjectSettings.getSelectionButton(null));
100
//			
101
//			if (offerLink()) {
102
//				fChangeWorkspaceSettings= createLink(composite, PreferencesMessages.PropertyAndPreferencePage_useworkspacesettings_change);
103
//				fChangeWorkspaceSettings.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
104
//			} else {
105
//				LayoutUtil.setHorizontalSpan(fUseProjectSettings.getSelectionButton(null), 2);
106
//			}
107
//			
108
//			Label horizontalLine= new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
109
//			horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
110
//			horizontalLine.setFont(composite.getFont());
111
//		} else if (supportsProjectSpecificOptions() && offerLink()) {
112
//			fChangeWorkspaceSettings= createLink(parent, PreferencesMessages.PropertyAndPreferencePage_showprojectspecificsettings_label);
113
//			fChangeWorkspaceSettings.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false));
114
//		}
115
//
116
//		return super.createDescriptionLabel(parent);
117
//    }
118
	
119
	/*
120
	 * @see org.eclipse.jface.preference.IPreferencePage#createContents(Composite)
121
	 */
122
	protected Control createContents(Composite parent) {
123
		Composite composite= new Composite(parent, SWT.NONE);
124
		GridLayout layout= new GridLayout();
125
		layout.marginHeight= 0;
126
		layout.marginWidth= 0;
127
		composite.setLayout(layout);
128
		composite.setFont(parent.getFont());
129
			
130
		GridData data= new GridData(GridData.FILL, GridData.FILL, true, true);
131
		
132
		fConfigurationBlockControl= createPreferenceContent(composite);
133
		fConfigurationBlockControl.setLayoutData(data);
134
135
//      TODO: Project specific settings are not supported yet.
136
//		if (isProjectPreferencePage()) {
137
//			boolean useProjectSettings= hasProjectSpecificOptions(getProject());
138
//			enableProjectSpecificSettings(useProjectSettings);
139
//		}
140
141
		Dialog.applyDialogFont(composite);
142
		return composite;
143
	}
144
145
	protected boolean useProjectSettings() {
146
//      TODO: Project specific settings are not supported yet.
147
//		return isProjectPreferencePage() && fUseProjectSettings != null && fUseProjectSettings.isSelected();
148
		return false;
149
	}
150
	
151
	protected boolean isProjectPreferencePage() {
152
		return fProject != null;
153
	}
154
	
155
	protected IProject getProject() {
156
		return fProject;
157
	}
158
	
159
	protected final void openWorkspacePreferences(Object data) {
160
		String id= getPreferencePageID();
161
		PreferencesUtil.createPreferenceDialogOn(getShell(), id, new String[] { id }, data).open();
162
	}
163
	
164
	protected final void openProjectProperties(IProject project, Object data) {
165
		String id= getPropertyPageID();
166
		if (id != null) {
167
			PreferencesUtil.createPropertyDialogOn(getShell(), project, id, new String[] { id }, data).open();
168
		}
169
	}
170
	
171
//	TODO: Project specific settings are not supported yet.
172
//	protected void enableProjectSpecificSettings(boolean useProjectSpecificSettings) {
173
//		fUseProjectSettings.setSelection(useProjectSpecificSettings);
174
//		enablePreferenceContent(useProjectSpecificSettings);
175
//		updateLinkVisibility();
176
//		doStatusChanged();
177
//	}
178
//	
179
//	private void updateLinkVisibility() {
180
//		if (fChangeWorkspaceSettings == null || fChangeWorkspaceSettings.isDisposed()) {
181
//			return;
182
//		}
183
//		
184
//		if (isProjectPreferencePage()) {
185
//			fChangeWorkspaceSettings.setEnabled(!useProjectSettings());
186
//		}
187
//	}
188
	
189
	protected void setPreferenceContentStatus(IStatus status) {
190
		fBlockStatus= status;
191
		doStatusChanged();
192
	}
193
	
194
	/**
195
	 * Returns a new status change listener that calls {@link #setPreferenceContentStatus(IStatus)}
196
	 * when the status has changed
197
	 * @return The new listener
198
	 */
199
	protected IStatusChangeListener getNewStatusChangedListener() {
200
		return new IStatusChangeListener() {
201
			public void statusChanged(IStatus status) {
202
				setPreferenceContentStatus(status);
203
			}
204
		};		
205
	}
206
	
207
	protected IStatus getPreferenceContentStatus() {
208
		return fBlockStatus;
209
	}
210
211
	protected void doStatusChanged() {
212
		if (!isProjectPreferencePage() || useProjectSettings()) {
213
			updateStatus(fBlockStatus);
214
		} else {
215
			updateStatus(new StatusInfo());
216
		}
217
	}
218
		
219
	protected void enablePreferenceContent(boolean enable) {
220
		if (enable) {
221
			if (fBlockEnableState != null) {
222
				fBlockEnableState.restore();
223
				fBlockEnableState= null;
224
			}
225
		} else {
226
			if (fBlockEnableState == null) {
227
				fBlockEnableState= ControlEnableState.disable(fConfigurationBlockControl);
228
			}
229
		}	
230
	}
231
	
232
	/*
233
	 * @see org.eclipse.jface.preference.IPreferencePage#performDefaults()
234
	 */
235
	protected void performDefaults() {
236
//      TODO: Project specific settings are not supported yet.
237
//		if (useProjectSettings()) {
238
//			enableProjectSpecificSettings(false);
239
//		}
240
		super.performDefaults();
241
	}
242
243
	private void updateStatus(IStatus status) {
244
		setValid(!status.matches(IStatus.ERROR));
245
		StatusUtil.applyToStatusLine(this, status);
246
	}
247
248
	/* (non-Javadoc)
249
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
250
	 */
251
	public void init(IWorkbench workbench) {
252
	}
253
254
	/* (non-Javadoc)
255
	 * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
256
	 */
257
	public IAdaptable getElement() {
258
		return fProject;
259
	}
260
261
	/* (non-Javadoc)
262
	 * @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
263
	 */
264
	public void setElement(IAdaptable element) {
265
		fProject= (IProject) element.getAdapter(IResource.class);
266
	}
267
	
268
	
269
	/* (non-Javadoc)
270
	 * @see org.eclipse.jface.preference.PreferencePage#applyData(java.lang.Object)
271
	 */
272
	public void applyData(Object data) {
273
		if (data instanceof Map) {
274
			fData= (Map) data;
275
		}
276
		if (fChangeWorkspaceSettings != null) {
277
			if (!offerLink()) {
278
				fChangeWorkspaceSettings.dispose();
279
				fParentComposite.layout(true, true);
280
			}
281
		}
282
 	}
283
	
284
	protected Map getData() {
285
		return fData;
286
	}
287
}
(-)src/org/eclipse/cdt/internal/ui/preferences/formatter/AlreadyExistsDialog.java (+194 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
package org.eclipse.cdt.internal.ui.preferences.formatter;
13
14
import org.eclipse.core.runtime.IStatus;
15
16
import org.eclipse.swt.SWT;
17
import org.eclipse.swt.events.ModifyEvent;
18
import org.eclipse.swt.events.ModifyListener;
19
import org.eclipse.swt.events.SelectionEvent;
20
import org.eclipse.swt.events.SelectionListener;
21
import org.eclipse.swt.layout.GridData;
22
import org.eclipse.swt.layout.GridLayout;
23
import org.eclipse.swt.widgets.Button;
24
import org.eclipse.swt.widgets.Composite;
25
import org.eclipse.swt.widgets.Control;
26
import org.eclipse.swt.widgets.Label;
27
import org.eclipse.swt.widgets.Shell;
28
import org.eclipse.swt.widgets.Text;
29
30
import org.eclipse.jface.dialogs.IDialogConstants;
31
import org.eclipse.jface.dialogs.StatusDialog;
32
33
import org.eclipse.cdt.internal.ui.util.Messages;
34
35
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
36
import org.eclipse.cdt.internal.ui.preferences.formatter.ProfileManager.CustomProfile;
37
38
/**
39
 * The dialog to rename an imported profile. 
40
 */
41
public class AlreadyExistsDialog extends StatusDialog {
42
	
43
	private Composite fComposite;
44
	protected Text fNameText;
45
	private Button fRenameRadio, fOverwriteRadio;
46
	
47
	private final int NUM_COLUMNS= 2;
48
	
49
	private final StatusInfo fOk;
50
	private final StatusInfo fEmpty;
51
	private final StatusInfo fDuplicate;
52
	
53
	private final CustomProfile fProfile;
54
	private final ProfileManager fProfileManager;
55
	
56
	public AlreadyExistsDialog(Shell parentShell, CustomProfile profile, ProfileManager profileManager) {
57
		super(parentShell);
58
		fProfile= profile;
59
		fProfileManager= profileManager;
60
		fOk= new StatusInfo();
61
		fDuplicate= new StatusInfo(IStatus.ERROR, FormatterMessages.AlreadyExistsDialog_message_profile_already_exists); 
62
		fEmpty= new StatusInfo(IStatus.ERROR, FormatterMessages.AlreadyExistsDialog_message_profile_name_empty); 
63
	}
64
	
65
	
66
	public void create() {
67
		super.create();
68
		setTitle(FormatterMessages.AlreadyExistsDialog_dialog_title); 
69
	}
70
	
71
	public Control createDialogArea(Composite parent) {
72
				
73
		initializeComposite(parent);
74
		
75
		createLabel(Messages.format(FormatterMessages.AlreadyExistsDialog_dialog_label, fProfile.getName())); 
76
77
		fRenameRadio= createRadioButton(FormatterMessages.AlreadyExistsDialog_rename_radio_button_desc); 
78
		fNameText= createTextField();
79
80
		fOverwriteRadio= createRadioButton(FormatterMessages.AlreadyExistsDialog_overwrite_radio_button_desc); 
81
82
		fRenameRadio.setSelection(true);
83
		
84
		fNameText.setText(fProfile.getName());
85
		fNameText.setSelection(0, fProfile.getName().length());
86
		fNameText.setFocus();
87
		
88
		fNameText.addModifyListener( new ModifyListener() {
89
			public void modifyText(ModifyEvent e) {
90
				doValidation();
91
			}
92
		});
93
		
94
		fRenameRadio.addSelectionListener(new SelectionListener() {
95
			public void widgetSelected(SelectionEvent e) {
96
				fNameText.setEnabled(true);
97
				fNameText.setFocus();
98
				fNameText.setSelection(0, fNameText.getText().length());
99
				doValidation();
100
			}
101
			public void widgetDefaultSelected(SelectionEvent e) {
102
			}
103
		});
104
		
105
		fOverwriteRadio.addSelectionListener(new SelectionListener() {
106
			public void widgetSelected(SelectionEvent e) {
107
				fNameText.setEnabled(false);
108
				doValidation();
109
			}
110
			public void widgetDefaultSelected(SelectionEvent e) {
111
			}
112
		});
113
		
114
		updateStatus(fDuplicate);
115
		
116
		applyDialogFont(fComposite);
117
		
118
		return fComposite;
119
	}
120
	
121
	private void initializeComposite(Composite parent) {
122
		fComposite= new Composite(parent, SWT.NULL);
123
		
124
		final GridLayout layout= new GridLayout();
125
		layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
126
		layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
127
		layout.verticalSpacing= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
128
		layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
129
		layout.numColumns= NUM_COLUMNS;
130
		
131
		fComposite.setLayout(layout);
132
	}
133
	
134
	private Label createLabel(String text) {
135
		final GridData gd= new GridData(GridData.FILL_HORIZONTAL);
136
		gd.horizontalSpan= NUM_COLUMNS;
137
		gd.widthHint= convertWidthInCharsToPixels(60);
138
		final Label label= new Label(fComposite, SWT.WRAP);
139
		label.setText(text);
140
		label.setLayoutData(gd);
141
		return label;
142
	}
143
	
144
	private Button createRadioButton(String text) {
145
		final GridData gd = new GridData();
146
		gd.horizontalSpan = NUM_COLUMNS;
147
		gd.widthHint= convertWidthInCharsToPixels(60);
148
		final Button radio= new Button(fComposite, SWT.RADIO);
149
		radio.setLayoutData(gd);
150
		radio.setText(text);
151
		return radio;
152
	}
153
	
154
	private Text createTextField() {
155
		final GridData gd = new GridData( GridData.FILL_HORIZONTAL);
156
		gd.horizontalSpan= NUM_COLUMNS;
157
		final Text text= new Text(fComposite, SWT.SINGLE | SWT.BORDER);
158
		text.setLayoutData(gd);
159
		return text;
160
	}
161
162
	/**
163
	 * Validate the current settings
164
	 */
165
	protected void doValidation() {
166
167
		if (fOverwriteRadio.getSelection()) {
168
			updateStatus(fOk);
169
			return;
170
		}
171
172
		final String name= fNameText.getText().trim();
173
		
174
		if (name.length() == 0) {
175
			updateStatus(fEmpty);
176
			return;
177
		}
178
		
179
		if (fProfileManager.containsName(name)) {
180
			updateStatus(fDuplicate);
181
			return;
182
		}
183
		
184
		updateStatus(fOk);
185
	}
186
	
187
	protected void okPressed() {
188
		if (!getStatus().isOK()) 
189
			return;
190
		if (fRenameRadio.getSelection())
191
			fProfile.rename(fNameText.getText().trim(), fProfileManager);
192
		super.okPressed();
193
	}
194
}
(-)src/org/eclipse/cdt/internal/ui/preferences/formatter/CPreview.java (+198 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
package org.eclipse.cdt.internal.ui.preferences.formatter;
13
14
import java.util.Map;
15
16
import org.eclipse.swt.SWT;
17
import org.eclipse.swt.custom.StyledText;
18
import org.eclipse.swt.events.DisposeEvent;
19
import org.eclipse.swt.events.DisposeListener;
20
import org.eclipse.swt.graphics.Font;
21
import org.eclipse.swt.graphics.RGB;
22
import org.eclipse.swt.widgets.Composite;
23
import org.eclipse.swt.widgets.Control;
24
25
import org.eclipse.jface.preference.IPreferenceStore;
26
import org.eclipse.jface.preference.PreferenceConverter;
27
import org.eclipse.jface.preference.PreferenceStore;
28
import org.eclipse.jface.resource.JFaceResources;
29
import org.eclipse.jface.util.IPropertyChangeListener;
30
import org.eclipse.jface.util.PropertyChangeEvent;
31
32
import org.eclipse.jface.text.Document;
33
import org.eclipse.jface.text.MarginPainter;
34
import org.eclipse.jface.text.source.SourceViewer;
35
36
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
37
import org.eclipse.ui.texteditor.ChainedPreferenceStore;
38
39
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
40
41
import org.eclipse.cdt.ui.PreferenceConstants;
42
import org.eclipse.cdt.ui.text.ICPartitions;
43
44
import org.eclipse.cdt.ui.CUIPlugin;
45
46
import org.eclipse.cdt.internal.ui.editor.CSourceViewer;
47
import org.eclipse.cdt.internal.ui.text.CSourceViewerConfiguration;
48
import org.eclipse.cdt.internal.ui.text.CTextTools;
49
import org.eclipse.cdt.internal.ui.text.SimpleCSourceViewerConfiguration;
50
51
52
public abstract class CPreview {
53
    
54
	private final class CSourcePreviewerUpdater {
55
	    
56
	    final IPropertyChangeListener fontListener= new IPropertyChangeListener() {
57
	        public void propertyChange(PropertyChangeEvent event) {
58
	            if (event.getProperty().equals(PreferenceConstants.EDITOR_TEXT_FONT)) {
59
					final Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT);
60
					fSourceViewer.getTextWidget().setFont(font);
61
					if (fMarginPainter != null) {
62
						fMarginPainter.initialize();
63
					}
64
				}
65
			}
66
		};
67
		
68
	    final IPropertyChangeListener propertyListener= new IPropertyChangeListener() {
69
			public void propertyChange(PropertyChangeEvent event) {
70
				if (fViewerConfiguration.affectsTextPresentation(event)) {
71
					fViewerConfiguration.handlePropertyChangeEvent(event);
72
					fSourceViewer.invalidateTextPresentation();
73
				}
74
			}
75
		};
76
		
77
		public CSourcePreviewerUpdater() {
78
			
79
		    JFaceResources.getFontRegistry().addListener(fontListener);
80
		    fPreferenceStore.addPropertyChangeListener(propertyListener);
81
			
82
			fSourceViewer.getTextWidget().addDisposeListener(new DisposeListener() {
83
				public void widgetDisposed(DisposeEvent e) {
84
					JFaceResources.getFontRegistry().removeListener(fontListener);
85
					fPreferenceStore.removePropertyChangeListener(propertyListener);
86
				}
87
			});
88
		}
89
	}
90
	
91
	protected final CSourceViewerConfiguration fViewerConfiguration;
92
	protected final Document fPreviewDocument;
93
	protected final SourceViewer fSourceViewer;
94
	protected final IPreferenceStore fPreferenceStore;
95
	
96
	protected final MarginPainter fMarginPainter;
97
	
98
	protected Map fWorkingValues;
99
100
	private int fTabSize= 0;
101
	
102
	/**
103
	 * Create a new C preview
104
	 * @param workingValues
105
	 * @param parent
106
	 */
107
	public CPreview(Map workingValues, Composite parent) {
108
		CTextTools tools= CUIPlugin.getDefault().getTextTools();
109
		fPreviewDocument= new Document();
110
		fWorkingValues= workingValues;
111
		tools.setupCDocumentPartitioner( fPreviewDocument, ICPartitions.C_PARTITIONING);	
112
		
113
		PreferenceStore prioritizedSettings= new PreferenceStore();
114
		
115
		IPreferenceStore[] chain= { prioritizedSettings, CUIPlugin.getDefault().getCombinedPreferenceStore() };
116
		fPreferenceStore= new ChainedPreferenceStore(chain);
117
		fSourceViewer= new CSourceViewer(parent, null, null, false, SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
118
		fViewerConfiguration= new SimpleCSourceViewerConfiguration(tools.getColorManager(), fPreferenceStore, null, ICPartitions.C_PARTITIONING, true);
119
		fSourceViewer.configure(fViewerConfiguration);
120
		fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
121
		
122
		fMarginPainter= new MarginPainter(fSourceViewer);
123
		final RGB rgb= PreferenceConverter.getColor(fPreferenceStore, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR);
124
		fMarginPainter.setMarginRulerColor(tools.getColorManager().getColor(rgb));
125
		fSourceViewer.addPainter(fMarginPainter);
126
		
127
		new CSourcePreviewerUpdater();
128
		fSourceViewer.setDocument(fPreviewDocument);
129
	}
130
	
131
	public Control getControl() {
132
	    return fSourceViewer.getControl();
133
	}
134
	
135
	public void update() {
136
		if (fWorkingValues == null) {
137
		    fPreviewDocument.set(""); //$NON-NLS-1$
138
		    return;
139
		}
140
		
141
		// update the print margin
142
		final String value= (String)fWorkingValues.get(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT);
143
		final int lineWidth= getPositiveIntValue(value, 0);
144
		fMarginPainter.setMarginRulerColumn(lineWidth);
145
		
146
		// update the tab size
147
		final int tabSize= getPositiveIntValue((String) fWorkingValues.get(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE), 0);
148
		if (tabSize != fTabSize) fSourceViewer.getTextWidget().setTabs(tabSize);
149
		fTabSize= tabSize;
150
		
151
		final StyledText widget= (StyledText)fSourceViewer.getControl();
152
		final int height= widget.getClientArea().height;
153
		final int top0= widget.getTopPixel();
154
		
155
		final int totalPixels0= getHeightOfAllLines(widget);
156
		final int topPixelRange0= totalPixels0 > height ? totalPixels0 - height : 0;
157
		
158
		widget.setRedraw(false);
159
		doFormatPreview();
160
		fSourceViewer.setSelection(null);
161
		
162
		final int totalPixels1= getHeightOfAllLines(widget);
163
		final int topPixelRange1= totalPixels1 > height ? totalPixels1 - height : 0;
164
165
		final int top1= topPixelRange0 > 0 ? (int)(topPixelRange1 * top0 / (double)topPixelRange0) : 0;
166
		widget.setTopPixel(top1);
167
		widget.setRedraw(true);
168
	}
169
	
170
	private int getHeightOfAllLines(StyledText styledText) {
171
		int height= 0;
172
		int lineCount= styledText.getLineCount();
173
		for (int i= 0; i < lineCount; i++)
174
			height= height + styledText.getLineHeight(styledText.getOffsetAtLine(i));
175
		return height;
176
	}
177
	
178
	protected abstract void doFormatPreview();
179
180
	private static int getPositiveIntValue(String string, int defaultValue) {
181
	    try {
182
	        int i= Integer.parseInt(string);
183
	        if (i >= 0) {
184
	            return i;
185
	        }
186
	    } catch (NumberFormatException e) {
187
	    }
188
	    return defaultValue;
189
	}		
190
	
191
	public final Map getWorkingValues() {
192
		return fWorkingValues;
193
	}
194
	
195
	public final void setWorkingValues(Map workingValues) {
196
		fWorkingValues= workingValues;
197
	}
198
}
(-)src/org/eclipse/cdt/core/formatter/CodeFormatter.java (+9 lines)
Lines 46-51 Link Here
46
	 */
46
	 */
47
	public static final int K_COMPILATION_UNIT = 0x08;
47
	public static final int K_COMPILATION_UNIT = 0x08;
48
48
49
	/**
50
	 * Kind used to format a single-line comment
51
	 */
52
	public static final int K_SINGLE_LINE_COMMENT = 0x10;
53
	/**
54
	 * Kind used to format a multi-line comment
55
	 */
56
	public static final int K_MULTI_LINE_COMMENT = 0x20;
57
49
	/** 
58
	/** 
50
	 * Format <code>source</code>,
59
	 * Format <code>source</code>,
51
	 * and returns a text edit that correspond to the difference between the given string and the formatted string.
60
	 * and returns a text edit that correspond to the difference between the given string and the formatted string.
(-)src/org/eclipse/cdt/core/formatter/CodeFormatterConstants.java (-3095 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 QNX Software Systems and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     QNX Software Systems - Initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
package org.eclipse.cdt.core.formatter;
13
14
import java.util.Map;
15
16
import org.eclipse.cdt.core.CCorePlugin;
17
import org.eclipse.cdt.internal.formatter.DefaultCodeFormatterOptions;
18
import org.eclipse.cdt.internal.formatter.align.Alignment;
19
20
/**
21
 */
22
public class CodeFormatterConstants {
23
24
	/**
25
	 * <pre>
26
	 * FORMATTER / Option for alignment of arguments in allocation expression
27
	 *     - option id:         "org.eclipse.cdt.core.formatter.language"
28
	 *     - possible values:   values proposed in class <code>ParserLanguage</code> 
29
	 *     - default:           ParserLanguage.CPP
30
	 * </pre>
31
	 */
32
	public static final String FORMATTER_LANGUAGE = CCorePlugin.PLUGIN_ID + ".formatter.language";	 //$NON-NLS-1$
33
	
34
	/**
35
	 * <pre>
36
	 * FORMATTER / Option for alignment of arguments in allocation expression
37
	 *     - option id:         "org.eclipse.cdt.core.formatter.current_file"
38
	 *     - possible values:   object of class <code>IFile</code> or <code>null</code> 
39
	 *     - default:           null
40
	 * </pre>
41
	 */
42
	public static final String FORMATTER_CURRENT_FILE = CCorePlugin.PLUGIN_ID + ".formatter.current_file";	 //$NON-NLS-1$
43
	
44
	/**
45
	 * <pre>
46
	 * FORMATTER / Value to set a brace location at the end of a line.
47
	 * </pre>
48
	 * @see #FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION
49
	 * @see #FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER
50
	 * @see #FORMATTER_BRACE_POSITION_FOR_BLOCK
51
	 * @see #FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION
52
 	 * @see #FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION
53
 	 * @see #FORMATTER_BRACE_POSITION_FOR_SWITCH
54
	 * @see #FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION
55
	 */
56
	public static final String END_OF_LINE = "end_of_line";	//$NON-NLS-1$
57
58
	/**
59
	 * <pre>
60
	 * FORMATTER / Value to set an option to false.
61
	 * </pre>
62
	 */
63
	public static final String FALSE = "false"; //$NON-NLS-1$
64
	
65
	/**
66
	 * <pre>
67
	 * FORMATTER / Option to align type members of a type declaration on column
68
	 *     - option id:         "org.eclipse.cdt.core.formatter.formatter.align_type_members_on_columns"
69
	 *     - possible values:   { TRUE, FALSE }
70
	 *     - default:           FALSE
71
	 * </pre>
72
	 * @see #TRUE
73
	 * @see #FALSE
74
	 */
75
	public static final String FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS = CCorePlugin.PLUGIN_ID + ".formatter.align_type_members_on_columns";	 //$NON-NLS-1$
76
77
	/**
78
	 * <pre>
79
	 * FORMATTER / Option for alignment of arguments in allocation expression
80
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_allocation_expression"
81
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
82
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
83
	 * </pre>
84
	 * @see #createAlignmentValue(boolean, int, int)
85
	 */
86
	public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_arguments_in_allocation_expression";	 //$NON-NLS-1$
87
	/**
88
	 * <pre>
89
	 * FORMATTER / Option for alignment of arguments in enum constant
90
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_enum_constant"
91
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
92
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
93
	 * </pre>
94
	 * @see #createAlignmentValue(boolean, int, int)
95
	 */
96
	public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_arguments_in_enum_constant";	 //$NON-NLS-1$
97
	/**
98
	 * <pre>
99
	 * FORMATTER / Option for alignment of arguments in explicit constructor call
100
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call"
101
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
102
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
103
	 * </pre>
104
	 * @see #createAlignmentValue(boolean, int, int)
105
	 */
106
	public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_EXPLICIT_CONSTRUCTOR_CALL = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_arguments_in_explicit_constructor_call";	 //$NON-NLS-1$
107
	/**
108
	 * <pre>
109
	 * FORMATTER / Option for alignment of arguments in method invocation
110
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation"
111
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
112
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
113
	 * </pre>
114
	 * @see #createAlignmentValue(boolean, int, int)
115
	 */
116
	public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_arguments_in_method_invocation";	 //$NON-NLS-1$
117
	/**
118
	 * <pre>
119
	 * FORMATTER / Option for alignment of arguments in qualified allocation expression
120
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression"
121
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
122
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
123
	 * </pre>
124
	 * @see #createAlignmentValue(boolean, int, int)
125
	 */
126
	public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_QUALIFIED_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_arguments_in_qualified_allocation_expression";	 //$NON-NLS-1$
127
	/**
128
	 * <pre>
129
	 * FORMATTER / Option for alignment of assignment
130
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_assignment"
131
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
132
	 *     - default:           createAlignmentValue(false, M_NO_ALIGNMENT, INDENT_DEFAULT)
133
	 * </pre>
134
	 * @see #createAlignmentValue(boolean, int, int)
135
	 */
136
	public static final String FORMATTER_ALIGNMENT_FOR_ASSIGNMENT  = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_assignment";	 //$NON-NLS-1$
137
	/**
138
	 * <pre>
139
	 * FORMATTER / Option for alignment of binary expression
140
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_binary_expression"
141
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
142
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
143
	 * </pre>
144
	 * @see #createAlignmentValue(boolean, int, int)
145
	 */
146
	public static final String FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_binary_expression";	 //$NON-NLS-1$
147
	/**
148
	 * <pre>
149
	 * FORMATTER / Option for alignment of compact if
150
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_compact_if"
151
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
152
	 *     - default:           createAlignmentValue(false, WRAP_ONE_PER_LINE, INDENT_BY_ONE)
153
	 * </pre>
154
	 * @see #createAlignmentValue(boolean, int, int)
155
	 */
156
	public static final String FORMATTER_ALIGNMENT_FOR_COMPACT_IF = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_compact_if";	 //$NON-NLS-1$
157
	/**
158
	 * <pre>
159
	 * FORMATTER / Option for alignment of conditional expression
160
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_conditional_expression"
161
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
162
	 *     - default:           createAlignmentValue(false, WRAP_ONE_PER_LINE, INDENT_DEFAULT)
163
	 * </pre>
164
	 * @see #createAlignmentValue(boolean, int, int)
165
	 */
166
	public static final String FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_conditional_expression";	 //$NON-NLS-1$
167
	/**
168
	 * <pre>
169
	 * FORMATTER / Option for alignment of enum constants
170
	 *     - option id:        "org.eclipse.cdt.core.formatter.alignment_for_enum_constants"
171
	 *     - possible values:  values returned by <code>createAlignmentValue(boolean, int, int)</code> call
172
	 *     - default:          createAlignmentValue(false, WRAP_NO_SPLIT, INDENT_DEFAULT)
173
	 * </pre>
174
	 * @see #createAlignmentValue(boolean, int, int)
175
	 */
176
	public static final String FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_enum_constants";	 //$NON-NLS-1$
177
	/**
178
	 * <pre>
179
	 * FORMATTER / Option for alignment of expressions in array initializer
180
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer"
181
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
182
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
183
	 * </pre>
184
	 * @see #createAlignmentValue(boolean, int, int)
185
	 */
186
	public static final String FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_expressions_in_array_initializer";	 //$NON-NLS-1$
187
	/**
188
	 * <pre>
189
	 * FORMATTER / Option for alignment of multiple fields
190
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_multiple_fields"
191
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
192
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
193
	 * </pre>
194
	 * @see #createAlignmentValue(boolean, int, int)
195
	 */
196
	public static final String FORMATTER_ALIGNMENT_FOR_MULTIPLE_FIELDS = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_multiple_fields";//$NON-NLS-1$	
197
	/**
198
	 * <pre>
199
	 * FORMATTER / Option for alignment of parameters in constructor declaration
200
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_parameters_in_constructor_declaration"
201
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
202
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
203
	 * </pre>
204
	 * @see #createAlignmentValue(boolean, int, int)
205
	 */
206
	public static final String FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_parameters_in_constructor_declaration";	 //$NON-NLS-1$
207
	/**
208
	 * <pre>
209
	 * FORMATTER / Option for alignment of parameters in method declaration
210
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration"
211
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
212
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
213
	 * </pre>
214
	 * @see #createAlignmentValue(boolean, int, int)
215
	 */
216
	public static final String FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_parameters_in_method_declaration";	 //$NON-NLS-1$
217
	/**
218
	 * <pre>
219
	 * FORMATTER / Option for alignment of selector in method invocation
220
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_selector_in_method_invocation"
221
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
222
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
223
	 * </pre>
224
	 * @see #createAlignmentValue(boolean, int, int)
225
	 */
226
	public static final String FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_selector_in_method_invocation";	 //$NON-NLS-1$
227
	/**
228
	 * <pre>
229
	 * FORMATTER / Option for alignment of superclass in type declaration
230
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_superclass_in_type_declaration"
231
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
232
	 *     - default:           createAlignmentValue(false, WRAP_NEXT_SHIFTED, INDENT_DEFAULT)
233
	 * </pre>
234
	 * @see #createAlignmentValue(boolean, int, int)
235
	 */
236
	public static final String FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_superclass_in_type_declaration";	 //$NON-NLS-1$
237
	/**
238
	 * <pre>
239
	 * FORMATTER / Option for alignment of superinterfaces in enum declaration
240
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration"
241
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
242
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
243
	 * </pre>
244
	 * @see #createAlignmentValue(boolean, int, int)
245
	 */
246
	public static final String FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_ENUM_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_superinterfaces_in_enum_declaration";	 //$NON-NLS-1$
247
	/**
248
	 * <pre>
249
	 * FORMATTER / Option for alignment of superinterfaces in type declaration
250
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_superinterfaces_in_type_declaration"
251
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
252
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
253
	 * </pre>
254
	 * @see #createAlignmentValue(boolean, int, int)
255
	 */
256
	public static final String FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_superinterfaces_in_type_declaration";	 //$NON-NLS-1$
257
	/**
258
	 * <pre>
259
	 * FORMATTER / Option for alignment of throws clause in constructor declaration
260
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration"
261
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
262
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
263
	 * </pre>
264
	 * @see #createAlignmentValue(boolean, int, int)
265
	 */
266
	public static final String FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_throws_clause_in_constructor_declaration";	 //$NON-NLS-1$
267
	/**
268
	 * <pre>
269
	 * FORMATTER / Option for alignment of throws clause in method declaration
270
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration"
271
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
272
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
273
	 * </pre>
274
	 * @see #createAlignmentValue(boolean, int, int)
275
	 */
276
	public static final String FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_throws_clause_in_method_declaration";	 //$NON-NLS-1$
277
278
//	/**
279
//	 * <pre>
280
//	 * FORMATTER / Option to add blank lines after the imports declaration
281
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_after_imports"
282
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
283
//	 *     - default:           "0"
284
//	 * </pre>
285
//	 */
286
//	public static final String FORMATTER_BLANK_LINES_AFTER_IMPORTS = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_after_imports";	//$NON-NLS-1$
287
//	/**
288
//	 * <pre>
289
//	 * FORMATTER / Option to add blank lines after the package declaration
290
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_after_package"
291
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
292
//	 *     - default:           "0"
293
//	 * </pre>
294
//	 */
295
//	public static final String FORMATTER_BLANK_LINES_AFTER_PACKAGE = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_after_package";	//$NON-NLS-1$
296
//	/**
297
//	 * <pre>
298
//	 * FORMATTER / Option to add blank lines at the beginning of the method body
299
//	 *     - option id:         "org.eclipse.cdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body"
300
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
301
//	 *     - default:           "0"
302
//	 * </pre>
303
//	 */
304
//	public static final String FORMATTER_BLANK_LINES_AT_BEGINNING_OF_METHOD_BODY = CCorePlugin.PLUGIN_ID + ".formatter.number_of_blank_lines_at_beginning_of_method_body"; //$NON-NLS-1$
305
//	/**
306
//	 * <pre>
307
//	 * FORMATTER / Option to add blank lines before a field declaration
308
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_before_field"
309
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
310
//	 *     - default:           "0"
311
//	 * </pre>
312
//	 */
313
//	public static final String FORMATTER_BLANK_LINES_BEFORE_FIELD = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_field";	//$NON-NLS-1$
314
//	/**
315
//	 * <pre>
316
//	 * FORMATTER / Option to add blank lines before the first class body declaration
317
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_before_first_class_body_declaration"
318
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
319
//	 *     - default:           "0"
320
//	 * </pre>
321
//	 */
322
//	public static final String FORMATTER_BLANK_LINES_BEFORE_FIRST_CLASS_BODY_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_first_class_body_declaration";	//$NON-NLS-1$
323
//	/**
324
//	 * <pre>
325
//	 * FORMATTER / Option to add blank lines before the imports declaration
326
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_before_imports"
327
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
328
//	 *     - default:           "0"
329
//	 * </pre>
330
//	 */
331
//	public static final String FORMATTER_BLANK_LINES_BEFORE_IMPORTS = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_imports";	//$NON-NLS-1$
332
//	/**
333
//	 * <pre>
334
//	 * FORMATTER / Option to add blank lines before a member type declaration
335
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_before_member_type"
336
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
337
//	 *     - default:           "0"
338
//	 * </pre>
339
//	 */
340
//	public static final String FORMATTER_BLANK_LINES_BEFORE_MEMBER_TYPE = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_member_type";	//$NON-NLS-1$
341
//	/**
342
//	 * <pre>
343
//	 * FORMATTER / Option to add blank lines before a method declaration
344
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_before_method"
345
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
346
//	 *     - default:           "0"
347
//	 * </pre>
348
//	 */
349
//	public static final String FORMATTER_BLANK_LINES_BEFORE_METHOD = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_method";	//$NON-NLS-1$
350
//	/**
351
//	 * <pre>
352
//	 * FORMATTER / Option to add blank lines before a new chunk
353
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_before_new_chunk"
354
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
355
//	 *     - default:           "0"
356
//	 * </pre>
357
//	 */
358
//	public static final String FORMATTER_BLANK_LINES_BEFORE_NEW_CHUNK = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_new_chunk";	//$NON-NLS-1$
359
//	/**
360
//	 * <pre>
361
//	 * FORMATTER / Option to add blank lines before the package declaration
362
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_before_package"
363
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
364
//	 *     - default:           "0"
365
//	 * </pre>
366
//	 */
367
//	public static final String FORMATTER_BLANK_LINES_BEFORE_PACKAGE = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_package";	//$NON-NLS-1$
368
//	/**
369
//	 * <pre>
370
//	 * FORMATTER / Option to add blank lines between type declarations
371
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_between_type_declarations"
372
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
373
//	 *     - default:           "0"
374
//	 * </pre>
375
//	 */
376
//	public static final String FORMATTER_BLANK_LINES_BETWEEN_TYPE_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_between_type_declarations";	//$NON-NLS-1$
377
378
	/**
379
	 * <pre>
380
	 * FORMATTER / Option to position the braces of an annotation type declaration
381
	 *     - option id:         "org.eclipse.cdt.core.formatter.brace_position_for_annotation_type_declaration"
382
	 *     - possible values:   { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
383
	 *     - default:           END_OF_LINE
384
	 * </pre>
385
	 * @see #END_OF_LINE
386
	 * @see #NEXT_LINE
387
	 * @see #NEXT_LINE_SHIFTED
388
	 * @see #NEXT_LINE_ON_WRAP
389
	 */
390
	public static final String FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_array_initializer";	//$NON-NLS-1$
391
	/**
392
	 * <pre>
393
	 * FORMATTER / Option to position the braces of a block
394
	 *     - option id:         "org.eclipse.cdt.core.formatter.brace_position_for_block"
395
	 *     - possible values:   { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
396
	 *     - default:           END_OF_LINE
397
	 * </pre>
398
	 * @see #END_OF_LINE
399
	 * @see #NEXT_LINE
400
	 * @see #NEXT_LINE_SHIFTED
401
	 * @see #NEXT_LINE_ON_WRAP
402
	 */
403
	public static final String FORMATTER_BRACE_POSITION_FOR_BLOCK = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_block";	//$NON-NLS-1$
404
	/**
405
	 * <pre>
406
	 * FORMATTER / Option to position the braces of a block in a case statement when the block is the first statement following
407
	 *             the case
408
	 *     - option id:         "org.eclipse.cdt.core.formatter.brace_position_for_block_in_case"
409
	 *     - possible values:   { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
410
	 *     - default:           END_OF_LINE
411
	 * </pre>
412
	 * @see #END_OF_LINE
413
	 * @see #NEXT_LINE
414
	 * @see #NEXT_LINE_SHIFTED
415
	 * @see #NEXT_LINE_ON_WRAP
416
	 */
417
	public static final String FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_block_in_case";	//$NON-NLS-1$
418
	/**
419
	 * <pre>
420
	 * FORMATTER / Option to position the braces of a constructor declaration
421
	 *     - option id:         "org.eclipse.cdt.core.formatter.brace_position_for_constructor_declaration"
422
	 *     - possible values:   { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
423
	 *     - default:           END_OF_LINE
424
	 * </pre>
425
	 * @see #END_OF_LINE
426
	 * @see #NEXT_LINE
427
	 * @see #NEXT_LINE_SHIFTED
428
	 * @see #NEXT_LINE_ON_WRAP
429
	 */
430
	public static final String FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_constructor_declaration";	//$NON-NLS-1$
431
	/**
432
	 * <pre>
433
	 * FORMATTER / Option to position the braces of an enum constant
434
	 *     - option id:         "org.eclipse.cdt.core.formatter.brace_position_for_enum_constant"
435
	 *     - possible values:   { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
436
	 *     - default:           END_OF_LINE
437
	 * </pre>
438
	 * @see #END_OF_LINE
439
	 * @see #NEXT_LINE
440
	 * @see #NEXT_LINE_SHIFTED
441
	 * @see #NEXT_LINE_ON_WRAP
442
	 */
443
	public static final String FORMATTER_BRACE_POSITION_FOR_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_enum_constant";	//$NON-NLS-1$
444
	/**
445
	 * <pre>
446
	 * FORMATTER / Option to position the braces of an enum declaration
447
	 *     - option id:         "org.eclipse.cdt.core.formatter.brace_position_for_enum_declaration"
448
	 *     - possible values:   { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
449
	 *     - default:           END_OF_LINE
450
	 * </pre>
451
	 * @see #END_OF_LINE
452
	 * @see #NEXT_LINE
453
	 * @see #NEXT_LINE_SHIFTED
454
	 * @see #NEXT_LINE_ON_WRAP
455
	 */
456
	public static final String FORMATTER_BRACE_POSITION_FOR_ENUM_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_enum_declaration";	//$NON-NLS-1$
457
	/**
458
	 * <pre>
459
	 * FORMATTER / Option to position the braces of a method declaration
460
	 *     - option id:         "org.eclipse.cdt.core.formatter.brace_position_for_method_declaration"
461
	 *     - possible values:   { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
462
	 *     - default:           END_OF_LINE
463
	 * </pre>
464
	 * @see #END_OF_LINE
465
	 * @see #NEXT_LINE
466
	 * @see #NEXT_LINE_SHIFTED
467
	 * @see #NEXT_LINE_ON_WRAP
468
	 */
469
	public static final String FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_method_declaration";	//$NON-NLS-1$
470
	/**
471
	 * <pre>
472
	 * FORMATTER / Option to position the braces of a switch statement
473
	 *     - option id:         "org.eclipse.cdt.core.formatter.brace_position_for_switch"
474
	 *     - possible values:   { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
475
	 *     - default:           END_OF_LINE
476
	 * </pre>
477
	 * @see #END_OF_LINE
478
	 * @see #NEXT_LINE
479
	 * @see #NEXT_LINE_SHIFTED
480
	 * @see #NEXT_LINE_ON_WRAP
481
	 */
482
	public static final String FORMATTER_BRACE_POSITION_FOR_SWITCH = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_switch";	//$NON-NLS-1$
483
	/**
484
	 * <pre>
485
	 * FORMATTER / Option to position the braces of a type declaration
486
	 *     - option id:         "org.eclipse.cdt.core.formatter.brace_position_for_type_declaration"
487
	 *     - possible values:   { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
488
	 *     - default:           END_OF_LINE
489
	 * </pre>
490
	 * @see #END_OF_LINE
491
	 * @see #NEXT_LINE
492
	 * @see #NEXT_LINE_SHIFTED
493
	 * @see #NEXT_LINE_ON_WRAP
494
	 */
495
	public static final String FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_type_declaration";	//$NON-NLS-1$
496
497
//	/**
498
//	 * <pre>
499
//	 * FORMATTER / Option to control whether blank lines are cleared inside comments
500
//	 *     - option id:         "org.eclipse.cdt.core.formatter.comment.clear_blank_lines"
501
//	 *     - possible values:   { TRUE, FALSE }
502
//	 *     - default:           FALSE
503
//	 * </pre>
504
//	 * @see #TRUE
505
//	 * @see #FALSE
506
//	 */	
507
//	public final static String FORMATTER_COMMENT_CLEAR_BLANK_LINES = CCorePlugin.PLUGIN_ID + ".formatter.comment.clear_blank_lines"; //$NON-NLS-1$
508
	
509
//	/**
510
//	 * <pre>
511
//	 * FORMATTER / Option to control whether comments are formatted
512
//	 *     - option id:         "org.eclipse.cdt.core.formatter.comment.format_comments"
513
//	 *     - possible values:   { TRUE, FALSE }
514
//	 *     - default:           TRUE
515
//	 * </pre>
516
//	 * @see #TRUE
517
//	 * @see #FALSE
518
//	 */	
519
//	public final static String FORMATTER_COMMENT_FORMAT = CCorePlugin.PLUGIN_ID + ".formatter.comment.format_comments"; //$NON-NLS-1$
520
521
//	/**
522
//	 * <pre>
523
//	 * FORMATTER / Option to control whether the header comment of a C/C++ source file is formatted
524
//	 *     - option id:         "org.eclipse.cdt.core.formatter.comment.format_header"
525
//	 *     - possible values:   { TRUE, FALSE }
526
//	 *     - default:           FALSE
527
//	 * </pre>
528
//	 * @see #TRUE
529
//	 * @see #FALSE
530
//	 */	
531
//	public final static String FORMATTER_COMMENT_FORMAT_HEADER = CCorePlugin.PLUGIN_ID + ".formatter.comment.format_header"; //$NON-NLS-1$
532
533
//	/**
534
//	 * <pre>
535
//	 * FORMATTER / Option to control whether HTML tags are formatted.
536
//	 *     - option id:         "org.eclipse.cdt.core.formatter.comment.format_html"
537
//	 *     - possible values:   { TRUE, FALSE }
538
//	 *     - default:           TRUE
539
//	 * </pre>
540
//	 * @see #TRUE
541
//	 * @see #FALSE
542
//	 */	
543
//	public final static String FORMATTER_COMMENT_FORMAT_HTML = CCorePlugin.PLUGIN_ID + ".formatter.comment.format_html"; //$NON-NLS-1$
544
545
//	/**
546
//	 * <pre>
547
//	 * FORMATTER / Option to control whether code snippets are formatted in comments
548
//	 *     - option id:         "org.eclipse.cdt.core.formatter.comment.format_source_code"
549
//	 *     - possible values:   { TRUE, FALSE }
550
//	 *     - default:           TRUE
551
//	 * </pre>
552
//	 * @see #TRUE
553
//	 * @see #FALSE
554
//	 */	
555
//	public final static String FORMATTER_COMMENT_FORMAT_SOURCE = CCorePlugin.PLUGIN_ID + ".formatter.comment.format_source_code"; //$NON-NLS-1$
556
	
557
//	/**
558
//	 * <pre>
559
//	 * FORMATTER / Option to specify the line length for comments.
560
//	 *     - option id:         "org.eclipse.cdt.core.formatter.comment.line_length"
561
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
562
//	 *     - default:           "80"
563
//	 * </pre>
564
//	 */	
565
//	public final static String FORMATTER_COMMENT_LINE_LENGTH = CCorePlugin.PLUGIN_ID + ".formatter.comment.line_length"; //$NON-NLS-1$
566
567
//	/**
568
//	 * <pre>
569
//	 * FORMATTER / Option to compact else/if
570
//	 *     - option id:         "org.eclipse.cdt.core.formatter.compact_else_if"
571
//	 *     - possible values:   { TRUE, FALSE }
572
//	 *     - default:           TRUE
573
//	 * </pre>
574
//	 * @see #TRUE
575
//	 * @see #FALSE
576
//	 */
577
//	public static final String FORMATTER_COMPACT_ELSE_IF = CCorePlugin.PLUGIN_ID + ".formatter.compact_else_if";	//$NON-NLS-1$
578
579
	/**
580
	 * <pre>
581
	 * FORMATTER / Option to set the continuation indentation
582
	 *     - option id:         "org.eclipse.cdt.core.formatter.continuation_indentation"
583
	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
584
	 *     - default:           "2"
585
	 * </pre>
586
	 */
587
	public static final String FORMATTER_CONTINUATION_INDENTATION = CCorePlugin.PLUGIN_ID + ".formatter.continuation_indentation";	//$NON-NLS-1$
588
	/**
589
	 * <pre>
590
	 * FORMATTER / Option to set the continuation indentation inside array initializer
591
	 *     - option id:         "org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer"
592
	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
593
	 *     - default:           "2"
594
	 * </pre>
595
	 */
596
	public static final String FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.continuation_indentation_for_array_initializer";	//$NON-NLS-1$
597
	/**
598
	 * <pre>
599
	 * FORMATTER / Option to indent body declarations compare to its enclosing annotation declaration header
600
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header"
601
	 *     - possible values:   { TRUE, FALSE }
602
	 *     - default:           TRUE
603
	 * </pre>
604
	 * @see #TRUE
605
	 * @see #FALSE
606
	 */
607
	public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ANNOTATION_DECLARATION_HEADER = CCorePlugin.PLUGIN_ID + ".formatter.indent_body_declarations_compare_to_annotation_declaration_header";	//$NON-NLS-1$
608
	/**
609
	 * <pre>
610
	 * FORMATTER / Option to indent body declarations compare to its enclosing enum constant header
611
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header"
612
	 *     - possible values:   { TRUE, FALSE }
613
	 *     - default:           TRUE
614
	 * </pre>
615
	 * @see #TRUE
616
	 * @see #FALSE
617
	 */
618
	public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_CONSTANT_HEADER = CCorePlugin.PLUGIN_ID + ".formatter.indent_body_declarations_compare_to_enum_constant_header";	//$NON-NLS-1$
619
	/**
620
	 * <pre>
621
	 * FORMATTER / Option to indent body declarations compare to its enclosing enum declaration header
622
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header"
623
	 *     - possible values:   { TRUE, FALSE }
624
	 *     - default:           TRUE
625
	 * </pre>
626
	 * @see #TRUE
627
	 * @see #FALSE
628
	 */
629
	public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_DECLARATION_HEADER = CCorePlugin.PLUGIN_ID + ".formatter.indent_body_declarations_compare_to_enum_declaration_header";	//$NON-NLS-1$
630
	/**
631
	 * <pre>
632
	 * FORMATTER / Option to indent body declarations compare to its enclosing type header
633
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_type_header"
634
	 *     - possible values:   { TRUE, FALSE }
635
	 *     - default:           TRUE
636
	 * </pre>
637
	 * @see #TRUE
638
	 * @see #FALSE
639
	 */
640
	public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_TYPE_HEADER = CCorePlugin.PLUGIN_ID + ".formatter.indent_body_declarations_compare_to_type_header";	//$NON-NLS-1$
641
	/**
642
	 * <pre>
643
	 * FORMATTER / Option to indent breaks compare to cases
644
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases"
645
	 *     - possible values:   { TRUE, FALSE }
646
	 *     - default:           TRUE
647
	 * </pre>
648
	 * @see #TRUE
649
	 * @see #FALSE
650
	 */
651
	public static final String FORMATTER_INDENT_BREAKS_COMPARE_TO_CASES = CCorePlugin.PLUGIN_ID + ".formatter.indent_breaks_compare_to_cases";	//$NON-NLS-1$
652
	/**
653
	 * <pre>
654
	 * FORMATTER / Option to indent empty lines
655
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_empty_lines"
656
	 *     - possible values:   { TRUE, FALSE }
657
	 *     - default:           FALSE
658
	 * </pre>
659
	 * @see #TRUE
660
	 * @see #FALSE
661
	 */
662
	public static final String FORMATTER_INDENT_EMPTY_LINES = CCorePlugin.PLUGIN_ID + ".formatter.indent_empty_lines"; //$NON-NLS-1$	
663
	/**
664
	 * <pre>
665
	 * FORMATTER / Option to indent statements inside a block
666
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_statements_compare_to_block"
667
	 *     - possible values:   { TRUE, FALSE }
668
	 *     - default:           TRUE
669
	 * </pre>
670
	 * @see #TRUE
671
	 * @see #FALSE
672
	 */
673
	public static final String FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK = CCorePlugin.PLUGIN_ID + ".formatter.indent_statements_compare_to_block"; //$NON-NLS-1$
674
	/**
675
	 * <pre>
676
	 * FORMATTER / Option to indent statements inside the body of a method or a constructor
677
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_statements_compare_to_body"
678
	 *     - possible values:   { TRUE, FALSE }
679
	 *     - default:           TRUE
680
	 * </pre>
681
	 * @see #TRUE
682
	 * @see #FALSE
683
	 */
684
	public static final String FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY = CCorePlugin.PLUGIN_ID + ".formatter.indent_statements_compare_to_body"; //$NON-NLS-1$
685
	/**
686
	 * <pre>
687
	 * FORMATTER / Option to indent switch statements compare to cases
688
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases"
689
	 *     - possible values:   { TRUE, FALSE }
690
	 *     - default:           TRUE
691
	 * </pre>
692
	 * @see #TRUE
693
	 * @see #FALSE
694
	 */
695
	public static final String FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES = CCorePlugin.PLUGIN_ID + ".formatter.indent_switchstatements_compare_to_cases";	//$NON-NLS-1$
696
	/**
697
	 * <pre>
698
	 * FORMATTER / Option to indent switch statements compare to switch
699
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch"
700
	 *     - possible values:   { TRUE, FALSE }
701
	 *     - default:           TRUE
702
	 * </pre>
703
	 * @see #TRUE
704
	 * @see #FALSE
705
	 */
706
	public static final String FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH = CCorePlugin.PLUGIN_ID + ".formatter.indent_switchstatements_compare_to_switch";	//$NON-NLS-1$
707
708
	/**
709
	 * <pre>
710
	 * FORMATTER / Option to specify the equivalent number of spaces that represents one indentation 
711
	 *     - option id:         "org.eclipse.cdt.core.formatter.indentation.size"
712
	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
713
	 *     - default:           "4"
714
	 * </pre>
715
	 * <p>This option is used only if the tab char is set to MIXED.
716
	 * </p>
717
	 * @see #FORMATTER_TAB_CHAR
718
	 */
719
	public static final String FORMATTER_INDENTATION_SIZE = CCorePlugin.PLUGIN_ID + ".formatter.indentation.size"; //$NON-NLS-1$
720
721
//	/**
722
//	 * <pre>
723
//	 * FORMATTER / Option to insert a new line after an annotation
724
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_after_annotation"
725
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
726
//	 *     - default:           INSERT
727
//	 * </pre>
728
//	 * @see CCorePlugin#INSERT
729
//	 * @see CCorePlugin#DO_NOT_INSERT
730
//	 */
731
//	public static final String FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_after_annotation";//$NON-NLS-1$
732
//
733
//	/**
734
//	 * <pre>
735
//	 * FORMATTER / Option to insert a new line after the opening brace in an array initializer
736
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer"
737
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
738
//	 *     - default:           DO_NOT_INSERT
739
//	 * </pre>
740
//	 * @see CCorePlugin#INSERT
741
//	 * @see CCorePlugin#DO_NOT_INSERT
742
//	 */
743
//	public static final String FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_after_opening_brace_in_array_initializer";//$NON-NLS-1$
744
//
745
//	/**
746
//	 * <pre>
747
//	 * FORMATTER / Option to insert a new line at the end of the current file if missing
748
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing"
749
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
750
//	 *     - default:           DO_NOT_INSERT
751
//	 * </pre>
752
//	 * @see CCorePlugin#INSERT
753
//	 * @see CCorePlugin#DO_NOT_INSERT
754
//	 */
755
//	public static final String FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_at_end_of_file_if_missing";//$NON-NLS-1$
756
//	/**
757
//	 * <pre>
758
//	 * FORMATTER / Option to insert a new line before the catch keyword in try statement
759
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement"
760
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
761
//	 *     - default:           DO_NOT_INSERT
762
//	 * </pre>
763
//	 * @see CCorePlugin#INSERT
764
//	 * @see CCorePlugin#DO_NOT_INSERT
765
//	 */
766
//	public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_before_catch_in_try_statement";	//$NON-NLS-1$
767
//	/**
768
//	 * <pre>
769
//	 * FORMATTER / Option to insert a new line before the closing brace in an array initializer
770
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer"
771
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
772
//	 *     - default:           DO_NOT_INSERT
773
//	 * </pre>
774
//	 * @see CCorePlugin#INSERT
775
//	 * @see CCorePlugin#DO_NOT_INSERT
776
//	 */
777
//	public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_before_closing_brace_in_array_initializer";//$NON-NLS-1$
778
//	/**
779
//	 * <pre>
780
//	 * FORMATTER / Option to insert a new line before the else keyword in if statement
781
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement"
782
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
783
//	 *     - default:           DO_NOT_INSERT
784
//	 * </pre>
785
//	 * @see CCorePlugin#INSERT
786
//	 * @see CCorePlugin#DO_NOT_INSERT
787
//	 */
788
//	public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_before_else_in_if_statement";	//$NON-NLS-1$
789
//	/**
790
//	 * <pre>
791
//	 * FORMATTER / Option to insert a new line before the finally keyword in try statement
792
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_before_finally_in_try_statement"
793
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
794
//	 *     - default:           DO_NOT_INSERT
795
//	 * </pre>
796
//	 * @see CCorePlugin#INSERT
797
//	 * @see CCorePlugin#DO_NOT_INSERT
798
//	 */
799
//	public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_before_finally_in_try_statement";	//$NON-NLS-1$
800
//	/**
801
//	 * <pre>
802
//	 * FORMATTER / Option to insert a new line before while in do statement
803
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement"
804
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
805
//	 *     - default:           DO_NOT_INSERT
806
//	 * </pre>
807
//	 * @see CCorePlugin#INSERT
808
//	 * @see CCorePlugin#DO_NOT_INSERT
809
//	 */
810
//	public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_before_while_in_do_statement";	//$NON-NLS-1$
811
//	/**
812
//	 * <pre>
813
//	 * FORMATTER / Option to insert a new line in an empty annotation declaration
814
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_annotation_declaration"
815
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
816
//	 *     - default:           INSERT
817
//	 * </pre>
818
//	 * @see CCorePlugin#INSERT
819
//	 * @see CCorePlugin#DO_NOT_INSERT
820
//	 */
821
//	public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ANNOTATION_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_annotation_declaration";	//$NON-NLS-1$
822
//	/**
823
//	 * <pre>
824
//	 * FORMATTER / Option to insert a new line in an empty anonymous type declaration
825
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration"
826
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
827
//	 *     - default:           INSERT
828
//	 * </pre>
829
//	 * @see CCorePlugin#INSERT
830
//	 * @see CCorePlugin#DO_NOT_INSERT
831
//	 */
832
//	public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ANONYMOUS_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_anonymous_type_declaration";	//$NON-NLS-1$
833
//	/**
834
//	 * <pre>
835
//	 * FORMATTER / Option to insert a new line in an empty block
836
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block"
837
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
838
//	 *     - default:           INSERT
839
//	 * </pre>
840
//	 * @see CCorePlugin#INSERT
841
//	 * @see CCorePlugin#DO_NOT_INSERT
842
//	 */
843
//	public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_BLOCK = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_block";	//$NON-NLS-1$
844
//	/**
845
//	 * <pre>
846
//	 * FORMATTER / Option to insert a new line in an empty enum constant
847
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_enum_constant"
848
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
849
//	 *     - default:           INSERT
850
//	 * </pre>
851
//	 * @see CCorePlugin#INSERT
852
//	 * @see CCorePlugin#DO_NOT_INSERT
853
//	 */
854
//	public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_enum_constant";	//$NON-NLS-1$
855
//	/**
856
//	 * <pre>
857
//	 * FORMATTER / Option to insert a new line in an empty enum declaration
858
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_enum_declaration"
859
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
860
//	 *     - default:           INSERT
861
//	 * </pre>
862
//	 * @see CCorePlugin#INSERT
863
//	 * @see CCorePlugin#DO_NOT_INSERT
864
//	 */
865
//	public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_enum_declaration";	//$NON-NLS-1$
866
//	/**
867
//	 * <pre>
868
//	 * FORMATTER / Option to insert a new line in an empty method body
869
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_method_body"
870
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
871
//	 *     - default:           INSERT
872
//	 * </pre>
873
//	 * @see CCorePlugin#INSERT
874
//	 * @see CCorePlugin#DO_NOT_INSERT
875
//	 */
876
//	public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_METHOD_BODY = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_method_body";	//$NON-NLS-1$
877
//	/**
878
//	 * <pre>
879
//	 * FORMATTER / Option to insert a new line in an empty type declaration
880
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_type_declaration"
881
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
882
//	 *     - default:           INSERT
883
//	 * </pre>
884
//	 * @see CCorePlugin#INSERT
885
//	 * @see CCorePlugin#DO_NOT_INSERT
886
//	 */
887
//	public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_type_declaration";	//$NON-NLS-1$
888
//	/**
889
//	 * <pre>
890
//	 * FORMATTER / Option to insert a space after and in wilcard
891
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_and_in_type_parameter"
892
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
893
//	 *     - default:           INSERT
894
//	 * </pre>
895
//	 * @see CCorePlugin#INSERT
896
//	 * @see CCorePlugin#DO_NOT_INSERT
897
//	 */
898
//	public static final String FORMATTER_INSERT_SPACE_AFTER_AND_IN_TYPE_PARAMETER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_and_in_type_parameter"; //$NON-NLS-1$
899
//	/**
900
//	 * <pre>
901
//	 * FORMATTER / Option to insert a space after an assignment operator
902
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator"
903
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
904
//	 *     - default:           INSERT
905
//	 * </pre>
906
//	 * @see CCorePlugin#INSERT
907
//	 * @see CCorePlugin#DO_NOT_INSERT
908
//	 */
909
//	public static final String FORMATTER_INSERT_SPACE_AFTER_ASSIGNMENT_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_assignment_operator"; //$NON-NLS-1$
910
//	/**
911
//	 * <pre>
912
//	 * FORMATTER / Option to insert a space after at in annotation
913
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_at_in_annotation"
914
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
915
//	 *     - default:           INSERT
916
//	 * </pre>
917
//	 * @see CCorePlugin#INSERT
918
//	 * @see CCorePlugin#DO_NOT_INSERT
919
//	 */
920
//	public static final String FORMATTER_INSERT_SPACE_AFTER_AT_IN_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_at_in_annotation"; //$NON-NLS-1$
921
//	/**
922
//	 * <pre>
923
//	 * FORMATTER / Option to insert a space after at in annotation type declaration
924
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_at_in_annotation_type_declaration"
925
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
926
//	 *     - default:           DO_NOT_INSERT
927
//	 * </pre>
928
//	 * @see CCorePlugin#INSERT
929
//	 * @see CCorePlugin#DO_NOT_INSERT
930
//	 */
931
//	public static final String FORMATTER_INSERT_SPACE_AFTER_AT_IN_ANNOTATION_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_at_in_annotation_type_declaration"; //$NON-NLS-1$
932
//	/**
933
//	 * <pre>
934
//	 * FORMATTER / Option to insert a space after a binary operator
935
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_binary_operator"
936
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
937
//	 *     - default:           INSERT
938
//	 * </pre>
939
//	 * @see CCorePlugin#INSERT
940
//	 * @see CCorePlugin#DO_NOT_INSERT
941
//	 */
942
//	public static final String FORMATTER_INSERT_SPACE_AFTER_BINARY_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_binary_operator"; //$NON-NLS-1$
943
//	/**
944
//	 * <pre>
945
//	 * FORMATTER / Option to insert a space after the closing angle bracket in type arguments
946
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments"
947
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
948
//	 *     - default:           INSERT
949
//	 * </pre>
950
//	 * @see CCorePlugin#INSERT
951
//	 * @see CCorePlugin#DO_NOT_INSERT
952
//	 */
953
//	public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_closing_angle_bracket_in_type_arguments"; //$NON-NLS-1$
954
//	/**
955
//	 * <pre>
956
//	 * FORMATTER / Option to insert a space after the closing angle bracket in type parameters
957
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters"
958
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
959
//	 *     - default:           INSERT
960
//	 * </pre>
961
//	 * @see CCorePlugin#INSERT
962
//	 * @see CCorePlugin#DO_NOT_INSERT
963
//	 */
964
//	public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_closing_angle_bracket_in_type_parameters"; //$NON-NLS-1$
965
//	/**
966
//	 * <pre>
967
//	 * FORMATTER / Option to insert a space after the closing brace of a block
968
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block"
969
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
970
//	 *     - default:           INSERT
971
//	 * </pre>
972
//	 * @see CCorePlugin#INSERT
973
//	 * @see CCorePlugin#DO_NOT_INSERT
974
//	 */
975
//	public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_BRACE_IN_BLOCK = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_closing_brace_in_block"; //$NON-NLS-1$
976
//	/**
977
//	 * <pre>
978
//	 * FORMATTER / Option to insert a space after the closing parenthesis of a cast expression
979
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast"
980
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
981
//	 *     - default:           INSERT
982
//	 * </pre>
983
//	 * @see CCorePlugin#INSERT
984
//	 * @see CCorePlugin#DO_NOT_INSERT
985
//	 */
986
//	public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_PAREN_IN_CAST = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_closing_paren_in_cast"; //$NON-NLS-1$
987
//	/**
988
//	 * <pre>
989
//	 * FORMATTER / Option to insert a space after the colon in an assert statement
990
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_colon_in_assert"
991
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
992
//	 *     - default:           INSERT
993
//	 * </pre>
994
//	 * @see CCorePlugin#INSERT
995
//	 * @see CCorePlugin#DO_NOT_INSERT
996
//	 */
997
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_ASSERT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_colon_in_assert"; //$NON-NLS-1$
998
//	/**
999
//	 * <pre>
1000
//	 * FORMATTER / Option to insert a space after colon in a case statement when a opening brace follows the colon
1001
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case"
1002
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1003
//	 *     - default:           INSERT
1004
//	 * </pre>
1005
//	 * @see CCorePlugin#INSERT
1006
//	 * @see CCorePlugin#DO_NOT_INSERT
1007
//	 */
1008
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CASE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_colon_in_case";	//$NON-NLS-1$
1009
//	/**
1010
//	 * <pre>
1011
//	 * FORMATTER / Option to insert a space after the colon in a conditional expression
1012
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional"
1013
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1014
//	 *     - default:           INSERT
1015
//	 * </pre>
1016
//	 * @see CCorePlugin#INSERT
1017
//	 * @see CCorePlugin#DO_NOT_INSERT
1018
//	 */
1019
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CONDITIONAL = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_colon_in_conditional"; //$NON-NLS-1$
1020
//	/**
1021
//	 * <pre>
1022
//	 * FORMATTER / Option to insert a space after colon in a for statement
1023
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_colon_in_for"
1024
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1025
//	 *     - default:           INSERT
1026
//	 * </pre>
1027
//	 * @see CCorePlugin#INSERT
1028
//	 * @see CCorePlugin#DO_NOT_INSERT
1029
//	 */
1030
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_colon_in_for";	//$NON-NLS-1$
1031
//	/**
1032
//	 * <pre>
1033
//	 * FORMATTER / Option to insert a space after the colon in a labeled statement
1034
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement"
1035
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1036
//	 *     - default:           INSERT
1037
//	 * </pre>
1038
//	 * @see CCorePlugin#INSERT
1039
//	 * @see CCorePlugin#DO_NOT_INSERT
1040
//	 */
1041
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_LABELED_STATEMENT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_colon_in_labeled_statement"; //$NON-NLS-1$
1042
//	/**
1043
//	 * <pre>
1044
//	 * FORMATTER / Option to insert a space after the comma in an allocation expression
1045
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_allocation_expression"
1046
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1047
//	 *     - default:           INSERT
1048
//	 * </pre>
1049
//	 * @see CCorePlugin#INSERT
1050
//	 * @see CCorePlugin#DO_NOT_INSERT
1051
//	 */
1052
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_allocation_expression"; //$NON-NLS-1$
1053
//	/**
1054
//	 * <pre>
1055
//	 * FORMATTER / Option to insert a space after the comma in annotation
1056
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_annotation"
1057
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1058
//	 *     - default:           INSERT
1059
//	 * </pre>
1060
//	 * @see CCorePlugin#INSERT
1061
//	 * @see CCorePlugin#DO_NOT_INSERT
1062
//	 */
1063
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_annotation"; //$NON-NLS-1$
1064
//	/**
1065
//	 * <pre>
1066
//	 * FORMATTER / Option to insert a space after the comma in an array initializer
1067
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer"
1068
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1069
//	 *     - default:           INSERT
1070
//	 * </pre>
1071
//	 * @see CCorePlugin#INSERT
1072
//	 * @see CCorePlugin#DO_NOT_INSERT
1073
//	 */
1074
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_array_initializer"; //$NON-NLS-1$
1075
//	/**
1076
//	 * <pre>
1077
//	 * FORMATTER / Option to insert a space after the comma in the parameters of a constructor declaration
1078
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters"
1079
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1080
//	 *     - default:           INSERT
1081
//	 * </pre>
1082
//	 * @see CCorePlugin#INSERT
1083
//	 * @see CCorePlugin#DO_NOT_INSERT
1084
//	 */
1085
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_constructor_declaration_parameters"; //$NON-NLS-1$
1086
//	/**
1087
//	 * <pre>
1088
//	 * FORMATTER / Option to insert a space after the comma in the exception names in a throws clause of a constructor declaration
1089
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws"
1090
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1091
//	 *     - default:           INSERT
1092
//	 * </pre>
1093
//	 * @see CCorePlugin#INSERT
1094
//	 * @see CCorePlugin#DO_NOT_INSERT
1095
//	 */
1096
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_constructor_declaration_throws"; //$NON-NLS-1$
1097
//	/**
1098
//	 * <pre>
1099
//	 * FORMATTER / Option to insert a space after the comma in the arguments of an enum constant
1100
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments"
1101
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1102
//	 *     - default:           INSERT
1103
//	 * </pre>
1104
//	 * @see CCorePlugin#INSERT
1105
//	 * @see CCorePlugin#DO_NOT_INSERT
1106
//	 */
1107
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ENUM_CONSTANT_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_enum_constant_arguments"; //$NON-NLS-1$
1108
//	/**
1109
//	 * <pre>
1110
//	 * FORMATTER / Option to insert a space after the comma in enum declarations
1111
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations"
1112
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1113
//	 *     - default:           INSERT
1114
//	 * </pre>
1115
//	 * @see CCorePlugin#INSERT
1116
//	 * @see CCorePlugin#DO_NOT_INSERT
1117
//	 */
1118
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ENUM_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_enum_declarations"; //$NON-NLS-1$
1119
//	/**
1120
//	 * <pre>
1121
//	 * FORMATTER / Option to insert a space after the comma in the arguments of an explicit constructor call
1122
//	 *     - option id:         "org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments"
1123
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1124
//	 *     - default:           INSERT
1125
//	 * </pre>
1126
//	 * @see CCorePlugin#INSERT
1127
//	 * @see CCorePlugin#DO_NOT_INSERT
1128
//	 */
1129
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_explicitconstructorcall_arguments"; //$NON-NLS-1$
1130
//	/**
1131
//	 * <pre>
1132
//	 * FORMATTER / Option to insert a space after the comma in the increments of a for statement
1133
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_for_increments"
1134
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1135
//	 *     - default:           INSERT
1136
//	 * </pre>
1137
//	 * @see CCorePlugin#INSERT
1138
//	 * @see CCorePlugin#DO_NOT_INSERT
1139
//	 */
1140
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INCREMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_for_increments"; //$NON-NLS-1$
1141
//	/**
1142
//	 * <pre>
1143
//	 * FORMATTER / Option to insert a space after the comma in the initializations of a for statement
1144
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_for_inits"
1145
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1146
//	 *     - default:           INSERT
1147
//	 * </pre>
1148
//	 * @see CCorePlugin#INSERT
1149
//	 * @see CCorePlugin#DO_NOT_INSERT
1150
//	 */
1151
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INITS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_for_inits"; //$NON-NLS-1$
1152
//	/**
1153
//	 * <pre>
1154
//	 * FORMATTER / Option to insert a space after the comma in the parameters of a method declaration
1155
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters"
1156
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1157
//	 *     - default:           INSERT
1158
//	 * </pre>
1159
//	 * @see CCorePlugin#INSERT
1160
//	 * @see CCorePlugin#DO_NOT_INSERT
1161
//	 */
1162
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_method_declaration_parameters"; //$NON-NLS-1$
1163
//	/**
1164
//	 * <pre>
1165
//	 * FORMATTER / Option to insert a space after the comma in the exception names in a throws clause of a method declaration
1166
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws"
1167
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1168
//	 *     - default:           INSERT
1169
//	 * </pre>
1170
//	 * @see CCorePlugin#INSERT
1171
//	 * @see CCorePlugin#DO_NOT_INSERT
1172
//	 */
1173
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_method_declaration_throws"; //$NON-NLS-1$
1174
//	/**
1175
//	 * <pre>
1176
//	 * FORMATTER / Option to insert a space after the comma in the arguments of a method invocation
1177
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments"
1178
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1179
//	 *     - default:           INSERT
1180
//	 * </pre>
1181
//	 * @see CCorePlugin#INSERT
1182
//	 * @see CCorePlugin#DO_NOT_INSERT
1183
//	 */
1184
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_INVOCATION_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_method_invocation_arguments"; //$NON-NLS-1$
1185
//	/**
1186
//	 * <pre>
1187
//	 * FORMATTER / Option to insert a space after the comma in multiple field declaration
1188
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations"
1189
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1190
//	 *     - default:           INSERT
1191
//	 * </pre>
1192
//	 * @see CCorePlugin#INSERT
1193
//	 * @see CCorePlugin#DO_NOT_INSERT
1194
//	 */
1195
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_multiple_field_declarations"; //$NON-NLS-1$
1196
//	/**
1197
//	 * <pre>
1198
//	 * FORMATTER / Option to insert a space after the comma in multiple local declaration
1199
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations"
1200
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1201
//	 *     - default:           INSERT
1202
//	 * </pre>
1203
//	 * @see CCorePlugin#INSERT
1204
//	 * @see CCorePlugin#DO_NOT_INSERT
1205
//	 */
1206
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_multiple_local_declarations"; //$NON-NLS-1$
1207
//	/**
1208
//	 * <pre>
1209
//	 * FORMATTER / Option to insert a space after the comma in parameterized type reference
1210
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference"
1211
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1212
//	 *     - default:           INSERT
1213
//	 * </pre>
1214
//	 * @see CCorePlugin#INSERT
1215
//	 * @see CCorePlugin#DO_NOT_INSERT
1216
//	 */
1217
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_parameterized_type_reference"; //$NON-NLS-1$
1218
//	/**
1219
//	 * <pre>
1220
//	 * FORMATTER / Option to insert a space after the comma in superinterfaces names of a type header
1221
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_superinterfaces"
1222
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1223
//	 *     - default:           INSERT
1224
//	 * </pre>
1225
//	 * @see CCorePlugin#INSERT
1226
//	 * @see CCorePlugin#DO_NOT_INSERT
1227
//	 */
1228
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_SUPERINTERFACES = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_superinterfaces"; //$NON-NLS-1$
1229
//	/**
1230
//	 * <pre>
1231
//	 * FORMATTER / Option to insert a space after the comma in type arguments
1232
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_type_arguments"
1233
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1234
//	 *     - default:           INSERT
1235
//	 * </pre>
1236
//	 * @see CCorePlugin#INSERT
1237
//	 * @see CCorePlugin#DO_NOT_INSERT
1238
//	 */
1239
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_type_arguments"; //$NON-NLS-1$
1240
//	/**
1241
//	 * <pre>
1242
//	 * FORMATTER / Option to insert a space after the comma in type parameters
1243
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_type_parameters"
1244
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1245
//	 *     - default:           INSERT
1246
//	 * </pre>
1247
//	 * @see CCorePlugin#INSERT
1248
//	 * @see CCorePlugin#DO_NOT_INSERT
1249
//	 */
1250
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_type_parameters"; //$NON-NLS-1$
1251
//	/**
1252
//	 * <pre>
1253
//	 * FORMATTER / Option to insert a space after ellipsis
1254
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_ellipsis"
1255
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1256
//	 *     - default:           INSERT
1257
//	 * </pre>
1258
//	 * @see CCorePlugin#INSERT
1259
//	 * @see CCorePlugin#DO_NOT_INSERT
1260
//	 */
1261
//	public static final String FORMATTER_INSERT_SPACE_AFTER_ELLIPSIS  = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_ellipsis";	//$NON-NLS-1$
1262
//	/**
1263
//	 * <pre>
1264
//	 * FORMATTER / Option to insert a space after the opening angle bracket in parameterized type reference
1265
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference"
1266
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1267
//	 *     - default:           DO_NOT_INSERT
1268
//	 * </pre>
1269
//	 * @see CCorePlugin#INSERT
1270
//	 * @see CCorePlugin#DO_NOT_INSERT
1271
//	 */
1272
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference";//$NON-NLS-1$
1273
//	/**
1274
//	 * <pre>
1275
//	 * FORMATTER / Option to insert a space after the opening angle bracket in type arguments
1276
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments"
1277
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1278
//	 *     - default:           DO_NOT_INSERT
1279
//	 * </pre>
1280
//	 * @see CCorePlugin#INSERT
1281
//	 * @see CCorePlugin#DO_NOT_INSERT
1282
//	 */
1283
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_angle_bracket_in_type_arguments";//$NON-NLS-1$
1284
//	/**
1285
//	 * <pre>
1286
//	 * FORMATTER / Option to insert a space after the opening angle bracket in type parameters
1287
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters"
1288
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1289
//	 *     - default:           DO_NOT_INSERT
1290
//	 * </pre>
1291
//	 * @see CCorePlugin#INSERT
1292
//	 * @see CCorePlugin#DO_NOT_INSERT
1293
//	 */
1294
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_angle_bracket_in_type_parameters";//$NON-NLS-1$
1295
//	/**
1296
//	 * <pre>
1297
//	 * FORMATTER / Option to insert a space after the opening brace in an array initializer
1298
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer"
1299
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1300
//	 *     - default:           DO_NOT_INSERT
1301
//	 * </pre>
1302
//	 * @see CCorePlugin#INSERT
1303
//	 * @see CCorePlugin#DO_NOT_INSERT
1304
//	 */
1305
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_brace_in_array_initializer";	//$NON-NLS-1$
1306
//	/**
1307
//	 * <pre>
1308
//	 * FORMATTER / Option to insert a space after the opening bracket inside an array allocation expression
1309
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression"
1310
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1311
//	 *     - default:           DO_NOT_INSERT
1312
//	 * </pre>
1313
//	 * @see CCorePlugin#INSERT
1314
//	 * @see CCorePlugin#DO_NOT_INSERT
1315
//	 */
1316
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_bracket_in_array_allocation_expression";//$NON-NLS-1$
1317
//	/**
1318
//	 * <pre>
1319
//	 * FORMATTER / Option to insert a space after the opening bracket inside an array reference
1320
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket_in_array_reference"
1321
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1322
//	 *     - default:           DO_NOT_INSERT
1323
//	 * </pre>
1324
//	 * @see CCorePlugin#INSERT
1325
//	 * @see CCorePlugin#DO_NOT_INSERT
1326
//	 */
1327
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_bracket_in_array_reference";//$NON-NLS-1$
1328
//	/**
1329
//	 * <pre>
1330
//	 * FORMATTER / Option to insert a space after the opening parenthesis in annotation
1331
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_annotation"
1332
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1333
//	 *     - default:           DO_NOT_INSERT
1334
//	 * </pre>
1335
//	 * @see CCorePlugin#INSERT
1336
//	 * @see CCorePlugin#DO_NOT_INSERT
1337
//	 */
1338
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_annotation"; //$NON-NLS-1$
1339
//	/**
1340
//	 * <pre>
1341
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a cast expression
1342
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast"
1343
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1344
//	 *     - default:           DO_NOT_INSERT
1345
//	 * </pre>
1346
//	 * @see CCorePlugin#INSERT
1347
//	 * @see CCorePlugin#DO_NOT_INSERT
1348
//	 */
1349
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CAST = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_cast"; //$NON-NLS-1$
1350
//	/**
1351
//	 * <pre>
1352
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a catch
1353
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch"
1354
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1355
//	 *     - default:           DO_NOT_INSERT
1356
//	 * </pre>
1357
//	 * @see CCorePlugin#INSERT
1358
//	 * @see CCorePlugin#DO_NOT_INSERT
1359
//	 */
1360
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CATCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_catch"; //$NON-NLS-1$
1361
//	/**
1362
//	 * <pre>
1363
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a constructor declaration
1364
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration"
1365
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1366
//	 *     - default:           DO_NOT_INSERT
1367
//	 * </pre>
1368
//	 * @see CCorePlugin#INSERT
1369
//	 * @see CCorePlugin#DO_NOT_INSERT
1370
//	 */
1371
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_constructor_declaration";	//$NON-NLS-1$
1372
//	/**
1373
//	 * <pre>
1374
//	 * FORMATTER / Option to insert a space after the opening parenthesis in enum constant
1375
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_enum_constant"
1376
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1377
//	 *     - default:           DO_NOT_INSERT
1378
//	 * </pre>
1379
//	 * @see CCorePlugin#INSERT
1380
//	 * @see CCorePlugin#DO_NOT_INSERT
1381
//	 */
1382
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_enum_constant"; //$NON-NLS-1$
1383
//	/**
1384
//	 * <pre>
1385
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a for statement
1386
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for"
1387
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1388
//	 *     - default:           DO_NOT_INSERT
1389
//	 * </pre>
1390
//	 * @see CCorePlugin#INSERT
1391
//	 * @see CCorePlugin#DO_NOT_INSERT
1392
//	 */
1393
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_for"; //$NON-NLS-1$
1394
//	/**
1395
//	 * <pre>
1396
//	 * FORMATTER / Option to insert a space after the opening parenthesis in an if statement
1397
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if"
1398
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1399
//	 *     - default:           DO_NOT_INSERT
1400
//	 * </pre>
1401
//	 * @see CCorePlugin#INSERT
1402
//	 * @see CCorePlugin#DO_NOT_INSERT
1403
//	 */
1404
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_IF = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_if"; //$NON-NLS-1$
1405
//	/**
1406
//	 * <pre>
1407
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a method declaration
1408
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration"
1409
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1410
//	 *     - default:           DO_NOT_INSERT
1411
//	 * </pre>
1412
//	 * @see CCorePlugin#INSERT
1413
//	 * @see CCorePlugin#DO_NOT_INSERT
1414
//	 */
1415
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_method_declaration";	//$NON-NLS-1$
1416
//	/**
1417
//	 * <pre>
1418
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a method invocation
1419
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation"
1420
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1421
//	 *     - default:           DO_NOT_INSERT
1422
//	 * </pre>
1423
//	 * @see CCorePlugin#INSERT
1424
//	 * @see CCorePlugin#DO_NOT_INSERT
1425
//	 */
1426
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_method_invocation"; //$NON-NLS-1$
1427
//	/**
1428
//	 * <pre>
1429
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a parenthesized expression
1430
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression"
1431
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1432
//	 *     - default:           DO_NOT_INSERT
1433
//	 * </pre>
1434
//	 * @see CCorePlugin#INSERT
1435
//	 * @see CCorePlugin#DO_NOT_INSERT
1436
//	 */
1437
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_parenthesized_expression"; //$NON-NLS-1$
1438
//	/**
1439
//	 * <pre>
1440
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a switch statement
1441
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch"
1442
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1443
//	 *     - default:           DO_NOT_INSERT
1444
//	 * </pre>
1445
//	 * @see CCorePlugin#INSERT
1446
//	 * @see CCorePlugin#DO_NOT_INSERT
1447
//	 */
1448
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SWITCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_switch"; //$NON-NLS-1$
1449
//	/**
1450
//	 * <pre>
1451
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a synchronized statement
1452
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_synchronized"
1453
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1454
//	 *     - default:           DO_NOT_INSERT
1455
//	 * </pre>
1456
//	 * @see CCorePlugin#INSERT
1457
//	 * @see CCorePlugin#DO_NOT_INSERT
1458
//	 */
1459
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SYNCHRONIZED = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_synchronized"; //$NON-NLS-1$
1460
//	/**
1461
//	 * <pre>
1462
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a while statement
1463
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while"
1464
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1465
//	 *     - default:           DO_NOT_INSERT
1466
//	 * </pre>
1467
//	 * @see CCorePlugin#INSERT
1468
//	 * @see CCorePlugin#DO_NOT_INSERT
1469
//	 */
1470
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_WHILE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_while"; //$NON-NLS-1$
1471
//	/**
1472
//	 * <pre>
1473
//	 * FORMATTER / Option to insert a space after a postfix operator
1474
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator"
1475
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1476
//	 *     - default:           DO_NOT_INSERT
1477
//	 * </pre>
1478
//	 * @see CCorePlugin#INSERT
1479
//	 * @see CCorePlugin#DO_NOT_INSERT
1480
//	 */
1481
//	public static final String FORMATTER_INSERT_SPACE_AFTER_POSTFIX_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_postfix_operator"; //$NON-NLS-1$
1482
//	/**
1483
//	 * <pre>
1484
//	 * FORMATTER / Option to insert a space after a prefix operator
1485
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator"
1486
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1487
//	 *     - default:           DO_NOT_INSERT
1488
//	 * </pre>
1489
//	 * @see CCorePlugin#INSERT
1490
//	 * @see CCorePlugin#DO_NOT_INSERT
1491
//	 */
1492
//	public static final String FORMATTER_INSERT_SPACE_AFTER_PREFIX_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_prefix_operator"; //$NON-NLS-1$
1493
//	/**
1494
//	 * <pre>
1495
//	 * FORMATTER / Option to insert a space after question mark in a conditional expression
1496
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional"
1497
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1498
//	 *     - default:           DO_NOT_INSERT
1499
//	 * </pre>
1500
//	 * @see CCorePlugin#INSERT
1501
//	 * @see CCorePlugin#DO_NOT_INSERT
1502
//	 */
1503
//	public static final String FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_CONDITIONAL = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_question_in_conditional"; //$NON-NLS-1$
1504
//	/**
1505
//	 * <pre>
1506
//	 * FORMATTER / Option to insert a space after question mark in a wildcard
1507
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_question_in_wildcard"
1508
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1509
//	 *     - default:           DO_NOT_INSERT
1510
//	 * </pre>
1511
//	 * @see CCorePlugin#INSERT
1512
//	 * @see CCorePlugin#DO_NOT_INSERT
1513
//	 */
1514
//	public static final String FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_WILDCARD = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_question_in_wildcard"; //$NON-NLS-1$
1515
//	/**
1516
//	 * <pre>
1517
//	 * FORMATTER / Option to insert a space after semicolon in a for statement
1518
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for"
1519
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1520
//	 *     - default:           INSERT
1521
//	 * </pre>
1522
//	 * @see CCorePlugin#INSERT
1523
//	 * @see CCorePlugin#DO_NOT_INSERT
1524
//	 */
1525
//	public static final String FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_semicolon_in_for"; //$NON-NLS-1$
1526
//	/**
1527
//	 * <pre>
1528
//	 * FORMATTER / Option to insert a space after an unary operator
1529
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_unary_operator"
1530
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1531
//	 *     - default:           DO_NOT_INSERT
1532
//	 * </pre>
1533
//	 * @see CCorePlugin#INSERT
1534
//	 * @see CCorePlugin#DO_NOT_INSERT
1535
//	 */
1536
//	public static final String FORMATTER_INSERT_SPACE_AFTER_UNARY_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_unary_operator"; //$NON-NLS-1$
1537
//	/**
1538
//	 * <pre>
1539
//	 * FORMATTER / Option to insert a space before and in wildcard
1540
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_and_in_type_parameter"
1541
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1542
//	 *     - default:           INSERT
1543
//	 * </pre>
1544
//	 * @see CCorePlugin#INSERT
1545
//	 * @see CCorePlugin#DO_NOT_INSERT
1546
//	 */
1547
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_AND_IN_TYPE_PARAMETER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_and_in_type_parameter";	//$NON-NLS-1$
1548
//	/**
1549
//	 * <pre>
1550
//	 * FORMATTER / Option to insert a space before an assignment operator
1551
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator"
1552
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1553
//	 *     - default:           INSERT
1554
//	 * </pre>
1555
//	 * @see CCorePlugin#INSERT
1556
//	 * @see CCorePlugin#DO_NOT_INSERT
1557
//	 */
1558
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_assignment_operator";	//$NON-NLS-1$
1559
//	/**
1560
//	 * <pre>
1561
//	 * FORMATTER / Option to insert a space before at in annotation type declaration
1562
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_at_in_annotation_type_declaration"
1563
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1564
//	 *     - default:           INSERT
1565
//	 * </pre>
1566
//	 * @see CCorePlugin#INSERT
1567
//	 * @see CCorePlugin#DO_NOT_INSERT
1568
//	 */
1569
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_AT_IN_ANNOTATION_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_at_in_annotation_type_declaration";	//$NON-NLS-1$
1570
//	/**
1571
//	 * <pre>
1572
//	 * FORMATTER / Option to insert a space before an binary operator
1573
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_binary_operator"
1574
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1575
//	 *     - default:           DO_NOT_INSERT
1576
//	 * </pre>
1577
//	 * @see CCorePlugin#INSERT
1578
//	 * @see CCorePlugin#DO_NOT_INSERT
1579
//	 */
1580
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_BINARY_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_binary_operator";	//$NON-NLS-1$
1581
//	/**
1582
//	 * <pre>
1583
//	 * FORMATTER / Option to insert a space before the closing angle bracket in parameterized type reference
1584
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference"
1585
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1586
//	 *     - default:           DO_NOT_INSERT
1587
//	 * </pre>
1588
//	 * @see CCorePlugin#INSERT
1589
//	 * @see CCorePlugin#DO_NOT_INSERT
1590
//	 */
1591
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference";		//$NON-NLS-1$
1592
//	/**
1593
//	 * <pre>
1594
//	 * FORMATTER / Option to insert a space before the closing angle bracket in type arguments
1595
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments"
1596
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1597
//	 *     - default:           DO_NOT_INSERT
1598
//	 * </pre>
1599
//	 * @see CCorePlugin#INSERT
1600
//	 * @see CCorePlugin#DO_NOT_INSERT
1601
//	 */
1602
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_angle_bracket_in_type_arguments";		//$NON-NLS-1$
1603
//	/**
1604
//	 * <pre>
1605
//	 * FORMATTER / Option to insert a space before the closing angle bracket in type parameters
1606
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters"
1607
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1608
//	 *     - default:           DO_NOT_INSERT
1609
//	 * </pre>
1610
//	 * @see CCorePlugin#INSERT
1611
//	 * @see CCorePlugin#DO_NOT_INSERT
1612
//	 */
1613
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_angle_bracket_in_type_parameters";		//$NON-NLS-1$
1614
//	/**
1615
//	 * <pre>
1616
//	 * FORMATTER / Option to insert a space before the closing brace in an array initializer
1617
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer"
1618
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1619
//	 *     - default:           DO_NOT_INSERT
1620
//	 * </pre>
1621
//	 * @see CCorePlugin#INSERT
1622
//	 * @see CCorePlugin#DO_NOT_INSERT
1623
//	 */
1624
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_brace_in_array_initializer";		//$NON-NLS-1$
1625
//	/**
1626
//	 * <pre>
1627
//	 * FORMATTER / Option to insert a space before the closing bracket in an array allocation expression
1628
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression"
1629
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1630
//	 *     - default:           DO_NOT_INSERT
1631
//	 * </pre>
1632
//	 * @see CCorePlugin#INSERT
1633
//	 * @see CCorePlugin#DO_NOT_INSERT
1634
//	 */
1635
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_bracket_in_array_allocation_expression";//$NON-NLS-1$
1636
//	/**
1637
//	 * <pre>
1638
//	 * FORMATTER / Option to insert a space before the closing bracket in an array reference
1639
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket_in_array_reference"
1640
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1641
//	 *     - default:           DO_NOT_INSERT
1642
//	 * </pre>
1643
//	 * @see CCorePlugin#INSERT
1644
//	 * @see CCorePlugin#DO_NOT_INSERT
1645
//	 */
1646
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_bracket_in_array_reference";//$NON-NLS-1$
1647
//	/**
1648
//	 * <pre>
1649
//	 * FORMATTER / Option to insert a space before the closing parenthesis in annotation
1650
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_annotation"
1651
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1652
//	 *     - default:           DO_NOT_INSERT
1653
//	 * </pre>
1654
//	 * @see CCorePlugin#INSERT
1655
//	 * @see CCorePlugin#DO_NOT_INSERT
1656
//	 */
1657
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_annotation";	//$NON-NLS-1$
1658
//	/**
1659
//	 * <pre>
1660
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a cast expression
1661
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast"
1662
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1663
//	 *     - default:           DO_NOT_INSERT
1664
//	 * </pre>
1665
//	 * @see CCorePlugin#INSERT
1666
//	 * @see CCorePlugin#DO_NOT_INSERT
1667
//	 */
1668
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CAST = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_cast";	//$NON-NLS-1$
1669
//	/**
1670
//	 * <pre>
1671
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a catch
1672
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch"
1673
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1674
//	 *     - default:           DO_NOT_INSERT
1675
//	 * </pre>
1676
//	 * @see CCorePlugin#INSERT
1677
//	 * @see CCorePlugin#DO_NOT_INSERT
1678
//	 */
1679
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CATCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_catch";	//$NON-NLS-1$
1680
//	/**
1681
//	 * <pre>
1682
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a constructor declaration
1683
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration"
1684
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1685
//	 *     - default:           DO_NOT_INSERT
1686
//	 * </pre>
1687
//	 * @see CCorePlugin#INSERT
1688
//	 * @see CCorePlugin#DO_NOT_INSERT
1689
//	 */
1690
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_constructor_declaration";	//$NON-NLS-1$
1691
//	/**
1692
//	 * <pre>
1693
//	 * FORMATTER / Option to insert a space before the closing parenthesis in enum constant
1694
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_enum_constant"
1695
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1696
//	 *     - default:           DO_NOT_INSERT
1697
//	 * </pre>
1698
//	 * @see CCorePlugin#INSERT
1699
//	 * @see CCorePlugin#DO_NOT_INSERT
1700
//	 */
1701
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_enum_constant";	//$NON-NLS-1$
1702
//	/**
1703
//	 * <pre>
1704
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a for statement
1705
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for"
1706
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1707
//	 *     - default:           DO_NOT_INSERT
1708
//	 * </pre>
1709
//	 * @see CCorePlugin#INSERT
1710
//	 * @see CCorePlugin#DO_NOT_INSERT
1711
//	 */
1712
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_for";	//$NON-NLS-1$
1713
//	/**
1714
//	 * <pre>
1715
//	 * FORMATTER / Option to insert a space before the closing parenthesis in an if statement
1716
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if"
1717
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1718
//	 *     - default:           DO_NOT_INSERT
1719
//	 * </pre>
1720
//	 * @see CCorePlugin#INSERT
1721
//	 * @see CCorePlugin#DO_NOT_INSERT
1722
//	 */
1723
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_IF = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_if";	//$NON-NLS-1$
1724
//	/**
1725
//	 * <pre>
1726
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a method declaration
1727
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration"
1728
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1729
//	 *     - default:           DO_NOT_INSERT
1730
//	 * </pre>
1731
//	 * @see CCorePlugin#INSERT
1732
//	 * @see CCorePlugin#DO_NOT_INSERT
1733
//	 */
1734
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_method_declaration";	//$NON-NLS-1$
1735
//	/**
1736
//	 * <pre>
1737
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a method invocation
1738
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation"
1739
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1740
//	 *     - default:           DO_NOT_INSERT
1741
//	 * </pre>
1742
//	 * @see CCorePlugin#INSERT
1743
//	 * @see CCorePlugin#DO_NOT_INSERT
1744
//	 */
1745
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_method_invocation"; //$NON-NLS-1$
1746
//	/**
1747
//	 * <pre>
1748
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a parenthesized expression
1749
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression"
1750
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1751
//	 *     - default:           DO_NOT_INSERT
1752
//	 * </pre>
1753
//	 * @see CCorePlugin#INSERT
1754
//	 * @see CCorePlugin#DO_NOT_INSERT
1755
//	 */
1756
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_parenthesized_expression"; //$NON-NLS-1$
1757
//	/**
1758
//	 * <pre>
1759
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a switch statement
1760
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch"
1761
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1762
//	 *     - default:           DO_NOT_INSERT
1763
//	 * </pre>
1764
//	 * @see CCorePlugin#INSERT
1765
//	 * @see CCorePlugin#DO_NOT_INSERT
1766
//	 */
1767
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SWITCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_switch";	//$NON-NLS-1$
1768
//	/**
1769
//	 * <pre>
1770
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a synchronized statement
1771
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_synchronized"
1772
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1773
//	 *     - default:           DO_NOT_INSERT
1774
//	 * </pre>
1775
//	 * @see CCorePlugin#INSERT
1776
//	 * @see CCorePlugin#DO_NOT_INSERT
1777
//	 */
1778
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SYNCHRONIZED = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_synchronized";	//$NON-NLS-1$
1779
//	/**
1780
//	 * <pre>
1781
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a while statement
1782
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while"
1783
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1784
//	 *     - default:           DO_NOT_INSERT
1785
//	 * </pre>
1786
//	 * @see CCorePlugin#INSERT
1787
//	 * @see CCorePlugin#DO_NOT_INSERT
1788
//	 */
1789
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_WHILE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_while";	//$NON-NLS-1$
1790
//	/**
1791
//	 * <pre>
1792
//	 * FORMATTER / Option to insert a space before colon in an assert statement
1793
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_colon_in_assert"
1794
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1795
//	 *     - default:           INSERT
1796
//	 * </pre>
1797
//	 * @see CCorePlugin#INSERT
1798
//	 * @see CCorePlugin#DO_NOT_INSERT
1799
//	 */
1800
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_ASSERT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_colon_in_assert";	//$NON-NLS-1$
1801
//	/**
1802
//	 * <pre>
1803
//	 * FORMATTER / Option to insert a space before colon in a case statement
1804
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case"
1805
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1806
//	 *     - default:           INSERT
1807
//	 * </pre>
1808
//	 * @see CCorePlugin#INSERT
1809
//	 * @see CCorePlugin#DO_NOT_INSERT
1810
//	 */
1811
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CASE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_colon_in_case";	//$NON-NLS-1$
1812
//	/**
1813
//	 * <pre>
1814
//	 * FORMATTER / Option to insert a space before colon in a conditional expression
1815
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional"
1816
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1817
//	 *     - default:           INSERT
1818
//	 * </pre>
1819
//	 * @see CCorePlugin#INSERT
1820
//	 * @see CCorePlugin#DO_NOT_INSERT
1821
//	 */
1822
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CONDITIONAL = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_colon_in_conditional";	//$NON-NLS-1$
1823
//	/**
1824
//	 * <pre>
1825
//	 * FORMATTER / Option to insert a space before colon in a default statement
1826
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default"
1827
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1828
//	 *     - default:           INSERT
1829
//	 * </pre>
1830
//	 * @see CCorePlugin#INSERT
1831
//	 * @see CCorePlugin#DO_NOT_INSERT
1832
//	 */
1833
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_DEFAULT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_colon_in_default";	//$NON-NLS-1$
1834
//	/**
1835
//	 * <pre>
1836
//	 * FORMATTER / Option to insert a space before colon in a for statement
1837
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_colon_in_for"
1838
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1839
//	 *     - default:           INSERT
1840
//	 * </pre>
1841
//	 * @see CCorePlugin#INSERT
1842
//	 * @see CCorePlugin#DO_NOT_INSERT
1843
//	 */
1844
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_colon_in_for";	//$NON-NLS-1$
1845
//	/**
1846
//	 * <pre>
1847
//	 * FORMATTER / Option to insert a space before colon in a labeled statement
1848
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement"
1849
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1850
//	 *     - default:           INSERT
1851
//	 * </pre>
1852
//	 * @see CCorePlugin#INSERT
1853
//	 * @see CCorePlugin#DO_NOT_INSERT
1854
//	 */
1855
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_LABELED_STATEMENT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_colon_in_labeled_statement";	//$NON-NLS-1$
1856
//	/**
1857
//	 * <pre>
1858
//	 * FORMATTER / Option to insert a space before comma in an allocation expression
1859
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_allocation_expression"
1860
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1861
//	 *     - default:           DO_NOT_INSERT
1862
//	 * </pre>
1863
//	 * @see CCorePlugin#INSERT
1864
//	 * @see CCorePlugin#DO_NOT_INSERT
1865
//	 */
1866
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_allocation_expression";	//$NON-NLS-1$
1867
//	/**
1868
//	 * <pre>
1869
//	 * FORMATTER / Option to insert a space before comma in annotation
1870
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_annotation"
1871
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1872
//	 *     - default:           DO_NOT_INSERT
1873
//	 * </pre>
1874
//	 * @see CCorePlugin#INSERT
1875
//	 * @see CCorePlugin#DO_NOT_INSERT
1876
//	 */
1877
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_annotation";	//$NON-NLS-1$
1878
//	/**
1879
//	 * <pre>
1880
//	 * FORMATTER / Option to insert a space before comma in an array initializer
1881
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer"
1882
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1883
//	 *     - default:           DO_NOT_INSERT
1884
//	 * </pre>
1885
//	 * @see CCorePlugin#INSERT
1886
//	 * @see CCorePlugin#DO_NOT_INSERT
1887
//	 */
1888
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_array_initializer";	//$NON-NLS-1$
1889
//	/**
1890
//	 * <pre>
1891
//	 * FORMATTER / Option to insert a space before comma in the parameters of a constructor declaration
1892
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters"
1893
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1894
//	 *     - default:           DO_NOT_INSERT
1895
//	 * </pre>
1896
//	 * @see CCorePlugin#INSERT
1897
//	 * @see CCorePlugin#DO_NOT_INSERT
1898
//	 */
1899
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_constructor_declaration_parameters";	//$NON-NLS-1$
1900
//	/**
1901
//	 * <pre>
1902
//	 * FORMATTER / Option to insert a space before comma in the exception names of the throws clause of a constructor declaration
1903
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws"
1904
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1905
//	 *     - default:           DO_NOT_INSERT
1906
//	 * </pre>
1907
//	 * @see CCorePlugin#INSERT
1908
//	 * @see CCorePlugin#DO_NOT_INSERT
1909
//	 */
1910
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_constructor_declaration_throws";	//$NON-NLS-1$
1911
//	/**
1912
//	 * <pre>
1913
//	 * FORMATTER / Option to insert a space before comma in the arguments of enum constant
1914
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments"
1915
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1916
//	 *     - default:           DO_NOT_INSERT
1917
//	 * </pre>
1918
//	 * @see CCorePlugin#INSERT
1919
//	 * @see CCorePlugin#DO_NOT_INSERT
1920
//	 */
1921
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_CONSTANT_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_enum_constant_arguments";	//$NON-NLS-1$
1922
//	/**
1923
//	 * <pre>
1924
//	 * FORMATTER / Option to insert a space before comma in enum declarations
1925
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations"
1926
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1927
//	 *     - default:           DO_NOT_INSERT
1928
//	 * </pre>
1929
//	 * @see CCorePlugin#INSERT
1930
//	 * @see CCorePlugin#DO_NOT_INSERT
1931
//	 */
1932
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_enum_declarations";	//$NON-NLS-1$
1933
//	/**
1934
//	 * <pre>
1935
//	 * FORMATTER / Option to insert a space before comma in the arguments of an explicit constructor call
1936
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments"
1937
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1938
//	 *     - default:           DO_NOT_INSERT
1939
//	 * </pre>
1940
//	 * @see CCorePlugin#INSERT
1941
//	 * @see CCorePlugin#DO_NOT_INSERT
1942
//	 */
1943
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_explicitconstructorcall_arguments";	//$NON-NLS-1$
1944
//	/**
1945
//	 * <pre>
1946
//	 * FORMATTER / Option to insert a space before comma in the increments of a for statement
1947
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_for_increments"
1948
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1949
//	 *     - default:           DO_NOT_INSERT
1950
//	 * </pre>
1951
//	 * @see CCorePlugin#INSERT
1952
//	 * @see CCorePlugin#DO_NOT_INSERT
1953
//	 */
1954
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INCREMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_for_increments";	//$NON-NLS-1$
1955
//	/**
1956
//	 * <pre>
1957
//	 * FORMATTER / Option to insert a space before comma in the initializations of a for statement
1958
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_for_inits"
1959
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1960
//	 *     - default:           DO_NOT_INSERT
1961
//	 * </pre>
1962
//	 * @see CCorePlugin#INSERT
1963
//	 * @see CCorePlugin#DO_NOT_INSERT
1964
//	 */
1965
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INITS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_for_inits";	//$NON-NLS-1$
1966
//	/**
1967
//	 * <pre>
1968
//	 * FORMATTER / Option to insert a space before comma in the parameters of a method declaration
1969
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters"
1970
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1971
//	 *     - default:           DO_NOT_INSERT
1972
//	 * </pre>
1973
//	 * @see CCorePlugin#INSERT
1974
//	 * @see CCorePlugin#DO_NOT_INSERT
1975
//	 */
1976
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_method_declaration_parameters";	//$NON-NLS-1$
1977
//	/**
1978
//	 * <pre>
1979
//	 * FORMATTER / Option to insert a space before comma in the exception names of the throws clause of a method declaration
1980
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws"
1981
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1982
//	 *     - default:           DO_NOT_INSERT
1983
//	 * </pre>
1984
//	 * @see CCorePlugin#INSERT
1985
//	 * @see CCorePlugin#DO_NOT_INSERT
1986
//	 */
1987
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_method_declaration_throws";	//$NON-NLS-1$
1988
//	/**
1989
//	 * <pre>
1990
//	 * FORMATTER / Option to insert a space before comma in the arguments of a method invocation
1991
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments"
1992
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1993
//	 *     - default:           DO_NOT_INSERT
1994
//	 * </pre>
1995
//	 * @see CCorePlugin#INSERT
1996
//	 * @see CCorePlugin#DO_NOT_INSERT
1997
//	 */
1998
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_method_invocation_arguments";	//$NON-NLS-1$
1999
//	/**
2000
//	 * <pre>
2001
//	 * FORMATTER / Option to insert a space before comma in a multiple field declaration
2002
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations"
2003
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2004
//	 *     - default:           DO_NOT_INSERT
2005
//	 * </pre>
2006
//	 * @see CCorePlugin#INSERT
2007
//	 * @see CCorePlugin#DO_NOT_INSERT
2008
//	 */
2009
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_multiple_field_declarations";	//$NON-NLS-1$
2010
//	/**
2011
//	 * <pre>
2012
//	 * FORMATTER / Option to insert a space before comma in a multiple local declaration
2013
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations"
2014
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2015
//	 *     - default:           DO_NOT_INSERT
2016
//	 * </pre>
2017
//	 * @see CCorePlugin#INSERT
2018
//	 * @see CCorePlugin#DO_NOT_INSERT
2019
//	 */
2020
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_multiple_local_declarations";	//$NON-NLS-1$
2021
//	/**
2022
//	 * <pre>
2023
//	 * FORMATTER / Option to insert a space before comma in parameterized type reference
2024
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference"
2025
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2026
//	 *     - default:           DO_NOT_INSERT
2027
//	 * </pre>
2028
//	 * @see CCorePlugin#INSERT
2029
//	 * @see CCorePlugin#DO_NOT_INSERT
2030
//	 */
2031
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_parameterized_type_reference";	//$NON-NLS-1$
2032
//	/**
2033
//	 * <pre>
2034
//	 * FORMATTER / Option to insert a space before comma in the superinterfaces names in a type header
2035
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_superinterfaces"
2036
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2037
//	 *     - default:           DO_NOT_INSERT
2038
//	 * </pre>
2039
//	 * @see CCorePlugin#INSERT
2040
//	 * @see CCorePlugin#DO_NOT_INSERT
2041
//	 */
2042
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_SUPERINTERFACES = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_superinterfaces";	//$NON-NLS-1$
2043
//	/**
2044
//	 * <pre>
2045
//	 * FORMATTER / Option to insert a space before comma in type arguments
2046
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_type_arguments"
2047
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2048
//	 *     - default:           DO_NOT_INSERT
2049
//	 * </pre>
2050
//	 * @see CCorePlugin#INSERT
2051
//	 * @see CCorePlugin#DO_NOT_INSERT
2052
//	 */
2053
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_type_arguments";	//$NON-NLS-1$
2054
//	/**
2055
//	 * <pre>
2056
//	 * FORMATTER / Option to insert a space before comma in type parameters
2057
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_type_parameters"
2058
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2059
//	 *     - default:           DO_NOT_INSERT
2060
//	 * </pre>
2061
//	 * @see CCorePlugin#INSERT
2062
//	 * @see CCorePlugin#DO_NOT_INSERT
2063
//	 */
2064
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_type_parameters";	//$NON-NLS-1$
2065
//	/**
2066
//	 * <pre>
2067
//	 * FORMATTER / Option to insert a space before ellipsis
2068
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_ellipsis"
2069
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2070
//	 *     - default:           DO_NOT_INSERT
2071
//	 * </pre>
2072
//	 * @see CCorePlugin#INSERT
2073
//	 * @see CCorePlugin#DO_NOT_INSERT
2074
//	 */
2075
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_ELLIPSIS  = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_ellipsis";	//$NON-NLS-1$
2076
//	/**
2077
//	 * <pre>
2078
//	 * FORMATTER / Option to insert a space before the opening angle bracket in parameterized type reference
2079
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference"
2080
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2081
//	 *     - default:           DO_NOT_INSERT
2082
//	 * </pre>
2083
//	 * @see CCorePlugin#INSERT
2084
//	 * @see CCorePlugin#DO_NOT_INSERT
2085
//	 */
2086
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE  = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference";	//$NON-NLS-1$
2087
//	/**
2088
//	 * <pre>
2089
//	 * FORMATTER / Option to insert a space before the opening angle bracket in type arguments
2090
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments"
2091
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2092
//	 *     - default:           DO_NOT_INSERT
2093
//	 * </pre>
2094
//	 * @see CCorePlugin#INSERT
2095
//	 * @see CCorePlugin#DO_NOT_INSERT
2096
//	 */
2097
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_angle_bracket_in_type_arguments";	//$NON-NLS-1$
2098
//	/**
2099
//	 * <pre>
2100
//	 * FORMATTER / Option to insert a space before the opening angle bracket in type parameters
2101
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters"
2102
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2103
//	 *     - default:           DO_NOT_INSERT
2104
//	 * </pre>
2105
//	 * @see CCorePlugin#INSERT
2106
//	 * @see CCorePlugin#DO_NOT_INSERT
2107
//	 */
2108
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_angle_bracket_in_type_parameters";	//$NON-NLS-1$
2109
//	/**
2110
//	 * <pre>
2111
//	 * FORMATTER / Option to insert a space before the opening brace in an annotation type declaration
2112
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration"
2113
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2114
//	 *     - default:           INSERT
2115
//	 * </pre>
2116
//	 * @see CCorePlugin#INSERT
2117
//	 * @see CCorePlugin#DO_NOT_INSERT
2118
//	 */
2119
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ANNOTATION_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_annotation_type_declaration"; 	//$NON-NLS-1$
2120
//	/**
2121
//	 * <pre>
2122
//	 * FORMATTER / Option to insert a space before the opening brace in an anonymous type declaration
2123
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration"
2124
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2125
//	 *     - default:           INSERT
2126
//	 * </pre>
2127
//	 * @see CCorePlugin#INSERT
2128
//	 * @see CCorePlugin#DO_NOT_INSERT
2129
//	 */
2130
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ANONYMOUS_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_anonymous_type_declaration"; 	//$NON-NLS-1$
2131
//	/**
2132
//	 * <pre>
2133
//	 * FORMATTER / Option to insert a space before the opening brace in an array initializer
2134
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer"
2135
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2136
//	 *     - default:           DO_NOT_INSERT
2137
//	 * </pre>
2138
//	 * @see CCorePlugin#INSERT
2139
//	 * @see CCorePlugin#DO_NOT_INSERT
2140
//	 */
2141
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_array_initializer"; //$NON-NLS-1$
2142
//	/**
2143
//	 * <pre>
2144
//	 * FORMATTER / Option to insert a space before the opening brace in a block
2145
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block"
2146
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2147
//	 *     - default:           INSERT
2148
//	 * </pre>
2149
//	 * @see CCorePlugin#INSERT
2150
//	 * @see CCorePlugin#DO_NOT_INSERT
2151
//	 */
2152
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_BLOCK = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_block";	//$NON-NLS-1$
2153
//	/**
2154
//	 * <pre>
2155
//	 * FORMATTER / Option to insert a space before the opening brace in a constructor declaration
2156
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration"
2157
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2158
//	 *     - default:           INSERT
2159
//	 * </pre>
2160
//	 * @see CCorePlugin#INSERT
2161
//	 * @see CCorePlugin#DO_NOT_INSERT
2162
//	 */
2163
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_constructor_declaration";	//$NON-NLS-1$
2164
//	/**
2165
//	 * <pre>
2166
//	 * FORMATTER / Option to insert a space before the opening brace in an enum constant
2167
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_enum_constant"
2168
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2169
//	 *     - default:           INSERT
2170
//	 * </pre>
2171
//	 * @see CCorePlugin#INSERT
2172
//	 * @see CCorePlugin#DO_NOT_INSERT
2173
//	 */
2174
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_enum_constant";	//$NON-NLS-1$
2175
//	/**
2176
//	 * <pre>
2177
//	 * FORMATTER / Option to insert a space before the opening brace in an enum declaration
2178
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration"
2179
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2180
//	 *     - default:           INSERT
2181
//	 * </pre>
2182
//	 * @see CCorePlugin#INSERT
2183
//	 * @see CCorePlugin#DO_NOT_INSERT
2184
//	 */
2185
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_enum_declaration";	//$NON-NLS-1$
2186
//	/**
2187
//	 * <pre>
2188
//	 * FORMATTER / Option to insert a space before the opening brace in a method declaration
2189
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration"
2190
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2191
//	 *     - default:           INSERT
2192
//	 * </pre>
2193
//	 * @see CCorePlugin#INSERT
2194
//	 * @see CCorePlugin#DO_NOT_INSERT
2195
//	 */
2196
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_method_declaration";	//$NON-NLS-1$
2197
//	/**
2198
//	 * <pre>
2199
//	 * FORMATTER / Option to insert a space before the opening brace in a switch statement
2200
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch"
2201
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2202
//	 *     - default:           INSERT
2203
//	 * </pre>
2204
//	 * @see CCorePlugin#INSERT
2205
//	 * @see CCorePlugin#DO_NOT_INSERT
2206
//	 */
2207
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_SWITCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_switch";	//$NON-NLS-1$
2208
//	/**
2209
//	 * <pre>
2210
//	 * FORMATTER / Option to insert a space before the opening brace in a type declaration
2211
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration"
2212
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2213
//	 *     - default:           INSERT
2214
//	 * </pre>
2215
//	 * @see CCorePlugin#INSERT
2216
//	 * @see CCorePlugin#DO_NOT_INSERT
2217
//	 */
2218
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_type_declaration";	//$NON-NLS-1$
2219
//	/**
2220
//	 * <pre>
2221
//	 * FORMATTER / Option to insert a space before the opening bracket in an array allocation expression
2222
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression"
2223
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2224
//	 *     - default:           DO_NOT_INSERT
2225
//	 * </pre>
2226
//	 * @see CCorePlugin#INSERT
2227
//	 * @see CCorePlugin#DO_NOT_INSERT
2228
//	 */
2229
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_bracket_in_array_allocation_expression";//$NON-NLS-1$
2230
//	/**
2231
//	 * <pre>
2232
//	 * FORMATTER / Option to insert a space before the opening bracket in an array reference
2233
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket_in_array_reference"
2234
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2235
//	 *     - default:           DO_NOT_INSERT
2236
//	 * </pre>
2237
//	 * @see CCorePlugin#INSERT
2238
//	 * @see CCorePlugin#DO_NOT_INSERT
2239
//	 */
2240
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_bracket_in_array_reference";//$NON-NLS-1$
2241
//	/**
2242
//	 * <pre>
2243
//	 * FORMATTER / Option to insert a space before the opening bracket in an array type reference
2244
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference"
2245
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2246
//	 *     - default:           DO_NOT_INSERT
2247
//	 * </pre>
2248
//	 * @see CCorePlugin#INSERT
2249
//	 * @see CCorePlugin#DO_NOT_INSERT
2250
//	 */
2251
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_bracket_in_array_type_reference";	//$NON-NLS-1$
2252
//	/**
2253
//	 * <pre>
2254
//	 * FORMATTER / Option to insert a space before the opening parenthesis in annotation
2255
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_annotation"
2256
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2257
//	 *     - default:           DO_NOT_INSERT
2258
//	 * </pre>
2259
//	 * @see CCorePlugin#INSERT
2260
//	 * @see CCorePlugin#DO_NOT_INSERT
2261
//	 */
2262
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_annotation";	//$NON-NLS-1$
2263
//	/**
2264
//	 * <pre>
2265
//	 * FORMATTER / Option to insert a space before the opening parenthesis in annotation type member declaration
2266
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration"
2267
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2268
//	 *     - default:           DO_NOT_INSERT
2269
//	 * </pre>
2270
//	 * @see CCorePlugin#INSERT
2271
//	 * @see CCorePlugin#DO_NOT_INSERT
2272
//	 */
2273
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ANNOTATION_TYPE_MEMBER_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration";	//$NON-NLS-1$
2274
//	/**
2275
//	 * <pre>
2276
//	 * FORMATTER / Option to insert a space before the opening parenthesis in a catch
2277
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch"
2278
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2279
//	 *     - default:           INSERT
2280
//	 * </pre>
2281
//	 * @see CCorePlugin#INSERT
2282
//	 * @see CCorePlugin#DO_NOT_INSERT
2283
//	 */
2284
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CATCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_catch";	//$NON-NLS-1$
2285
//	/**
2286
//	 * <pre>
2287
//	 * FORMATTER / Option to insert a space before the opening parenthesis in a constructor declaration
2288
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration"
2289
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2290
//	 *     - default:           DO_NOT_INSERT
2291
//	 * </pre>
2292
//	 * @see CCorePlugin#INSERT
2293
//	 * @see CCorePlugin#DO_NOT_INSERT
2294
//	 */
2295
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_constructor_declaration";	//$NON-NLS-1$
2296
//	/**
2297
//	 * <pre>
2298
//	 * FORMATTER / Option to insert a space before the opening parenthesis in enum constant
2299
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_enum_constant"
2300
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2301
//	 *     - default:           DO_NOT_INSERT
2302
//	 * </pre>
2303
//	 * @see CCorePlugin#INSERT
2304
//	 * @see CCorePlugin#DO_NOT_INSERT
2305
//	 */
2306
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_enum_constant";	//$NON-NLS-1$
2307
//	/**
2308
//	 * <pre>
2309
//	 * FORMATTER / Option to insert a space before the opening parenthesis in a for statement
2310
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for"
2311
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2312
//	 *     - default:           INSERT
2313
//	 * </pre>
2314
//	 * @see CCorePlugin#INSERT
2315
//	 * @see CCorePlugin#DO_NOT_INSERT
2316
//	 */
2317
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_for";	//$NON-NLS-1$
2318
//	/**
2319
//	 * <pre>
2320
//	 * FORMATTER / Option to insert a space before the opening parenthesis in an if statement
2321
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if"
2322
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2323
//	 *     - default:           INSERT
2324
//	 * </pre>
2325
//	 * @see CCorePlugin#INSERT
2326
//	 * @see CCorePlugin#DO_NOT_INSERT
2327
//	 */
2328
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_IF = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_if";	//$NON-NLS-1$
2329
//	/**
2330
//	 * <pre>
2331
//	 * FORMATTER / Option to insert a space before the opening parenthesis in a method declaration
2332
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration"
2333
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2334
//	 *     - default:           DO_NOT_INSERT
2335
//	 * </pre>
2336
//	 * @see CCorePlugin#INSERT
2337
//	 * @see CCorePlugin#DO_NOT_INSERT
2338
//	 */
2339
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_method_declaration";	//$NON-NLS-1$
2340
//	/**
2341
//	 * <pre>
2342
//	 * FORMATTER / Option to insert a space before the opening parenthesis in a method invocation
2343
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation"
2344
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2345
//	 *     - default:           DO_NOT_INSERT
2346
//	 * </pre>
2347
//	 * @see CCorePlugin#INSERT
2348
//	 * @see CCorePlugin#DO_NOT_INSERT
2349
//	 */
2350
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_method_invocation";	//$NON-NLS-1$
2351
//	/**
2352
//	 * <pre>
2353
//	 * FORMATTER / Option to insert a space before the opening parenthesis in a parenthesized expression
2354
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression"
2355
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2356
//	 *     - default:           DO_NOT_INSERT
2357
//	 * </pre>
2358
//	 * @see CCorePlugin#INSERT
2359
//	 * @see CCorePlugin#DO_NOT_INSERT
2360
//	 */
2361
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_parenthesized_expression"; //$NON-NLS-1$
2362
//	/**
2363
//	 * <pre>
2364
//	 * FORMATTER / Option to insert a space before the opening parenthesis in a switch statement
2365
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch"
2366
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2367
//	 *     - default:           INSERT
2368
//	 * </pre>
2369
//	 * @see CCorePlugin#INSERT
2370
//	 * @see CCorePlugin#DO_NOT_INSERT
2371
//	 */
2372
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SWITCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_switch";	//$NON-NLS-1$
2373
//	/**
2374
//	 * <pre>
2375
//	 * FORMATTER / Option to insert a space before the opening parenthesis in a synchronized statement
2376
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_synchronized"
2377
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2378
//	 *     - default:           INSERT
2379
//	 * </pre>
2380
//	 * @see CCorePlugin#INSERT
2381
//	 * @see CCorePlugin#DO_NOT_INSERT
2382
//	 */
2383
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SYNCHRONIZED = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_synchronized";	//$NON-NLS-1$
2384
//	/**
2385
//	 * <pre>
2386
//	 * FORMATTER / Option to insert a space before the opening parenthesis in a while statement
2387
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while"
2388
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2389
//	 *     - default:           INSERT
2390
//	 * </pre>
2391
//	 * @see CCorePlugin#INSERT
2392
//	 * @see CCorePlugin#DO_NOT_INSERT
2393
//	 */
2394
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_WHILE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_while";	//$NON-NLS-1$
2395
//	/**
2396
//	 * <pre>
2397
//	 * FORMATTER / Option to insert a space before parenthesized expression in return statement
2398
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_parenthesized_expression_in_return"
2399
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2400
//	 *     - default:           INSERT
2401
//	 * </pre>
2402
//	 * 
2403
//	 * @see CCorePlugin#INSERT
2404
//	 * @see CCorePlugin#DO_NOT_INSERT
2405
//	 */
2406
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_RETURN  = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_parenthesized_expression_in_return";	//$NON-NLS-1$
2407
//	/**
2408
//	 * <pre>
2409
//	 * FORMATTER / Option to insert a space before a postfix operator
2410
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator"
2411
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2412
//	 *     - default:           DO_NOT_INSERT
2413
//	 * </pre>
2414
//	 * @see CCorePlugin#INSERT
2415
//	 * @see CCorePlugin#DO_NOT_INSERT
2416
//	 */
2417
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_POSTFIX_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_postfix_operator";	//$NON-NLS-1$
2418
//	/**
2419
//	 * <pre>
2420
//	 * FORMATTER / Option to insert a space before a prefix operator
2421
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator"
2422
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2423
//	 *     - default:           DO_NOT_INSERT
2424
//	 * </pre>
2425
//	 * @see CCorePlugin#INSERT
2426
//	 * @see CCorePlugin#DO_NOT_INSERT
2427
//	 */
2428
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_PREFIX_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_prefix_operator";	//$NON-NLS-1$
2429
//	/**
2430
//	 * <pre>
2431
//	 * FORMATTER / Option to insert a space before question mark in a conditional expression
2432
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional"
2433
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2434
//	 *     - default:           INSERT
2435
//	 * </pre>
2436
//	 * @see CCorePlugin#INSERT
2437
//	 * @see CCorePlugin#DO_NOT_INSERT
2438
//	 */
2439
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_CONDITIONAL = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_question_in_conditional";	//$NON-NLS-1$
2440
//	/**
2441
//	 * <pre>
2442
//	 * FORMATTER / Option to insert a space before question mark in a wildcard
2443
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_question_in_wildcard"
2444
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2445
//	 *     - default:           DO_NOT_INSERT
2446
//	 * </pre>
2447
//	 * @see CCorePlugin#INSERT
2448
//	 * @see CCorePlugin#DO_NOT_INSERT
2449
//	 */
2450
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_WILDCARD = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_question_in_wildcard"; //$NON-NLS-1$
2451
//	/**
2452
//	 * <pre>
2453
//	 * FORMATTER / Option to insert a space before semicolon
2454
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_semicolon"
2455
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2456
//	 *     - default:           DO_NOT_INSERT
2457
//	 * </pre>
2458
//	 * @see CCorePlugin#INSERT
2459
//	 * @see CCorePlugin#DO_NOT_INSERT
2460
//	 */
2461
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_semicolon";	//$NON-NLS-1$
2462
//	/**
2463
//	 * <pre>
2464
//	 * FORMATTER / Option to insert a space before semicolon in for statement
2465
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for"
2466
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2467
//	 *     - default:           DO_NOT_INSERT
2468
//	 * </pre>
2469
//	 * @see CCorePlugin#INSERT
2470
//	 * @see CCorePlugin#DO_NOT_INSERT
2471
//	 */
2472
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_semicolon_in_for";	//$NON-NLS-1$
2473
//	/**
2474
//	 * <pre>
2475
//	 * FORMATTER / Option to insert a space before unary operator
2476
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_unary_operator"
2477
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2478
//	 *     - default:           DO_NOT_INSERT
2479
//	 * </pre>
2480
//	 * @see CCorePlugin#INSERT
2481
//	 * @see CCorePlugin#DO_NOT_INSERT
2482
//	 */
2483
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_UNARY_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_unary_operator";	//$NON-NLS-1$
2484
//
2485
//	/**
2486
//	 * <pre>
2487
//	 * FORMATTER / Option to insert a space between brackets in an array type reference
2488
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_between_brackets_in_array_type_reference"
2489
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2490
//	 *     - default:           DO_NOT_INSERT
2491
//	 * </pre>
2492
//	 * @see CCorePlugin#INSERT
2493
//	 * @see CCorePlugin#DO_NOT_INSERT
2494
//	 */
2495
//	public static final String FORMATTER_INSERT_SPACE_BETWEEN_BRACKETS_IN_ARRAY_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_brackets_in_array_type_reference";	//$NON-NLS-1$
2496
//	/**
2497
//	 * <pre>
2498
//	 * FORMATTER / Option to insert a space between empty braces in an array initializer
2499
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer"
2500
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2501
//	 *     - default:           DO_NOT_INSERT
2502
//	 * </pre>
2503
//	 * @see CCorePlugin#INSERT
2504
//	 * @see CCorePlugin#DO_NOT_INSERT
2505
//	 */
2506
//	public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_braces_in_array_initializer";	//$NON-NLS-1$
2507
//	/**
2508
//	 * <pre>
2509
//	 * FORMATTER / Option to insert a space between empty brackets in an array allocation expression
2510
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression"
2511
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2512
//	 *     - default:           DO_NOT_INSERT
2513
//	 * </pre>
2514
//	 * @see CCorePlugin#INSERT
2515
//	 * @see CCorePlugin#DO_NOT_INSERT
2516
//	 */
2517
//	public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACKETS_IN_ARRAY_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_brackets_in_array_allocation_expression";	//$NON-NLS-1$
2518
//	/**
2519
//	 * <pre>
2520
//	 * FORMATTER / Option to insert a space between empty parenthesis in an annotation type member declaration
2521
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration"
2522
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2523
//	 *     - default:           DO_NOT_INSERT
2524
//	 * </pre>
2525
//	 * @see CCorePlugin#INSERT
2526
//	 * @see CCorePlugin#DO_NOT_INSERT
2527
//	 */
2528
//	public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_ANNOTATION_TYPE_MEMBER_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration";	//$NON-NLS-1$
2529
//	/**
2530
//	 * <pre>
2531
//	 * FORMATTER / Option to insert a space between empty parenthesis in a constructor declaration
2532
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration"
2533
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2534
//	 *     - default:           DO_NOT_INSERT
2535
//	 * </pre>
2536
//	 * @see CCorePlugin#INSERT
2537
//	 * @see CCorePlugin#DO_NOT_INSERT
2538
//	 */
2539
//	public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_constructor_declaration";	//$NON-NLS-1$
2540
//	/**
2541
//	 * <pre>
2542
//	 * FORMATTER / Option to insert a space between empty parenthesis in enum constant
2543
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_enum_constant"
2544
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2545
//	 *     - default:           DO_NOT_INSERT
2546
//	 * </pre>
2547
//	 * @see CCorePlugin#INSERT
2548
//	 * @see CCorePlugin#DO_NOT_INSERT
2549
//	 */
2550
//	public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_enum_constant";	//$NON-NLS-1$
2551
//	/**
2552
//	 * <pre>
2553
//	 * FORMATTER / Option to insert a space between empty parenthesis in a method declaration
2554
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration"
2555
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2556
//	 *     - default:           DO_NOT_INSERT
2557
//	 * </pre>
2558
//	 * @see CCorePlugin#INSERT
2559
//	 * @see CCorePlugin#DO_NOT_INSERT
2560
//	 */
2561
//	public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_method_declaration";	//$NON-NLS-1$
2562
//	/**
2563
//	 * <pre>
2564
//	 * FORMATTER / Option to insert a space between empty parenthesis in a method invocation
2565
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation"
2566
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2567
//	 *     - default:           DO_NOT_INSERT
2568
//	 * </pre>
2569
//	 * @see CCorePlugin#INSERT
2570
//	 * @see CCorePlugin#DO_NOT_INSERT
2571
//	 */
2572
//	public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_method_invocation";	//$NON-NLS-1$
2573
//	/**
2574
//	 * <pre>
2575
//	 * FORMATTER / Option to keep else statement on the same line
2576
//	 *     - option id:         "org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line"
2577
//	 *     - possible values:   { TRUE, FALSE }
2578
//	 *     - default:           FALSE
2579
//	 * </pre>
2580
//	 * @see #TRUE
2581
//	 * @see #FALSE
2582
//	 */
2583
//	public static final String FORMATTER_KEEP_ELSE_STATEMENT_ON_SAME_LINE = CCorePlugin.PLUGIN_ID + ".formatter.keep_else_statement_on_same_line"; //$NON-NLS-1$
2584
//	/**
2585
//	 * <pre>
2586
//	 * FORMATTER / Option to keep empty array initializer one one line
2587
//	 *     - option id:         "org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line"
2588
//	 *     - possible values:   { TRUE, FALSE }
2589
//	 *     - default:           FALSE
2590
//	 * </pre>
2591
//	 * @see #TRUE
2592
//	 * @see #FALSE
2593
//	 */
2594
//	public static final String FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE = CCorePlugin.PLUGIN_ID + ".formatter.keep_empty_array_initializer_on_one_line"; //$NON-NLS-1$
2595
//	/**
2596
//	 * <pre>
2597
//	 * FORMATTER / Option to keep guardian clause on one line
2598
//	 *     - option id:         "org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line"
2599
//	 *     - possible values:   { TRUE, FALSE }
2600
//	 *     - default:           FALSE
2601
//	 * </pre>
2602
//	 * @see #TRUE
2603
//	 * @see #FALSE
2604
//	 */
2605
//	public static final String FORMATTER_KEEP_GUARDIAN_CLAUSE_ON_ONE_LINE = CCorePlugin.PLUGIN_ID + ".formatter.format_guardian_clause_on_one_line";	//$NON-NLS-1$
2606
//	/**
2607
//	 * <pre>
2608
//	 * FORMATTER / Option to keep simple if statement on the one line
2609
//	 *     - option id:         "org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line"
2610
//	 *     - possible values:   { TRUE, FALSE }
2611
//	 *     - default:           FALSE
2612
//	 * </pre>
2613
//	 * @see #TRUE
2614
//	 * @see #FALSE
2615
//	 */
2616
//	public static final String FORMATTER_KEEP_SIMPLE_IF_ON_ONE_LINE = CCorePlugin.PLUGIN_ID + ".formatter.keep_imple_if_on_one_line"; //$NON-NLS-1$
2617
//	/**
2618
//	 * <pre>
2619
//	 * FORMATTER / Option to keep then statement on the same line
2620
//	 *     - option id:         "org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line"
2621
//	 *     - possible values:   { TRUE, FALSE }
2622
//	 *     - default:           FALSE
2623
//	 * </pre>
2624
//	 * @see #TRUE
2625
//	 * @see #FALSE
2626
//	 */
2627
//	public static final String FORMATTER_KEEP_THEN_STATEMENT_ON_SAME_LINE = CCorePlugin.PLUGIN_ID + ".formatter.keep_then_statement_on_same_line";//$NON-NLS-1$
2628
2629
	/**
2630
	 * <pre>
2631
	 * FORMATTER / Option to specify the length of the page. Beyond this length, the formatter will try to split the code
2632
	 *     - option id:         "org.eclipse.cdt.core.formatter.lineSplit"
2633
	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
2634
	 *     - default:           "80"
2635
	 * </pre>
2636
	 */
2637
	public static final String FORMATTER_LINE_SPLIT = CCorePlugin.PLUGIN_ID + ".formatter.lineSplit"; //$NON-NLS-1$
2638
//
2639
//	/**
2640
//	 * <pre>
2641
//	 * FORMATTER / Option to specify the number of empty lines to preserve
2642
//	 *     - option id:         "org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve"
2643
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
2644
//	 *     - default:           "0"
2645
//	 * </pre>
2646
//	 */
2647
//	public static final String FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE = CCorePlugin.PLUGIN_ID + ".formatter.number_of_empty_lines_to_preserve";	//$NON-NLS-1$
2648
//	/**
2649
//	 * <pre>
2650
//	 * FORMATTER / Option to specify whether or not empty statement should be on a new line
2651
//	 *     - option id:         "org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line"
2652
//	 *     - possible values:   { TRUE, FALSE }
2653
//	 *     - default:           FALSE
2654
//	 * </pre>
2655
//	 * @see #TRUE
2656
//	 * @see #FALSE
2657
//	 */
2658
//	public static final String FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE = CCorePlugin.PLUGIN_ID + ".formatter.put_empty_statement_on_new_line";	//$NON-NLS-1$
2659
	/**
2660
	 * <pre>
2661
	 * FORMATTER / Option to specify the tabulation size
2662
	 *     - option id:         "org.eclipse.cdt.core.formatter.tabulation.char"
2663
	 *     - possible values:   { TAB, SPACE, MIXED }
2664
	 *     - default:           TAB
2665
	 * </pre>
2666
	 * More values may be added in the future.
2667
	 * 
2668
	 * @see CCorePlugin#TAB
2669
	 * @see CCorePlugin#SPACE
2670
	 * @see #MIXED
2671
	 */
2672
	public static final String FORMATTER_TAB_CHAR = CCorePlugin.PLUGIN_ID + ".formatter.tabulation.char"; //$NON-NLS-1$
2673
	/**
2674
	 * <pre>
2675
	 * FORMATTER / Option to specify the equivalent number of spaces that represents one tabulation 
2676
	 *     - option id:         "org.eclipse.cdt.core.formatter.tabulation.size"
2677
	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
2678
	 *     - default:           "4"
2679
	 * </pre>
2680
	 */
2681
	public static final String FORMATTER_TAB_SIZE = CCorePlugin.PLUGIN_ID + ".formatter.tabulation.size"; //$NON-NLS-1$
2682
2683
	/**
2684
	 * <pre>
2685
	 * FORMATTER / Option to use tabulations only for leading indentations 
2686
	 *     - option id:         "org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations"
2687
	 *     - possible values:   { TRUE, FALSE }
2688
	 *     - default:           FALSE
2689
	 * </pre>
2690
	 * @see #TRUE
2691
	 * @see #FALSE
2692
	 */
2693
	public static final String FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS = CCorePlugin.PLUGIN_ID + ".formatter.use_tabs_only_for_leading_indentations"; //$NON-NLS-1$
2694
2695
	/**
2696
	 * <pre>
2697
	 * FORMATTER / The wrapping is done by indenting by one compare to the current indentation.
2698
	 * </pre>
2699
	 */
2700
	public static final int INDENT_BY_ONE= 2;
2701
	
2702
	/**
2703
	 * <pre>
2704
	 * FORMATTER / The wrapping is done by using the current indentation.
2705
	 * </pre>
2706
	 */
2707
	public static final int INDENT_DEFAULT= 0;
2708
	/**
2709
	 * <pre>
2710
	 * FORMATTER / The wrapping is done by indenting on column under the splitting location.
2711
	 * </pre>
2712
	 */
2713
	public static final int INDENT_ON_COLUMN = 1;
2714
	
2715
	/**
2716
	 * <pre>
2717
	 * FORMATTER / Possible value for the option FORMATTER_TAB_CHAR
2718
	 * </pre>
2719
	 * @see CCorePlugin#TAB
2720
	 * @see CCorePlugin#SPACE
2721
	 * @see #FORMATTER_TAB_CHAR
2722
	 */
2723
	public static final String MIXED = "mixed"; //$NON-NLS-1$
2724
//	/**
2725
//	 * <pre>
2726
//	 * FORMATTER / Value to set a brace location at the start of the next line with
2727
//	 *             the right indentation.
2728
//	 * </pre>
2729
//	 * @see #FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION
2730
//	 * @see #FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER
2731
//	 * @see #FORMATTER_BRACE_POSITION_FOR_BLOCK
2732
//	 * @see #FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION
2733
// 	 * @see #FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION
2734
// 	 * @see #FORMATTER_BRACE_POSITION_FOR_SWITCH
2735
//	 * @see #FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION
2736
//	 */
2737
//	public static final String NEXT_LINE = "next_line"; //$NON-NLS-1$
2738
//	/**
2739
//	 * <pre>
2740
//	 * FORMATTER / Value to set a brace location at the start of the next line if a wrapping
2741
//	 *             occured.
2742
//	 * </pre>
2743
//	 * @see #FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION
2744
//	 * @see #FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER
2745
//	 * @see #FORMATTER_BRACE_POSITION_FOR_BLOCK
2746
//	 * @see #FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION
2747
// 	 * @see #FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION
2748
// 	 * @see #FORMATTER_BRACE_POSITION_FOR_SWITCH
2749
//	 * @see #FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION
2750
//	 */
2751
//    public static final String NEXT_LINE_ON_WRAP = "next_line_on_wrap"; //$NON-NLS-1$
2752
	/**
2753
	 * <pre>
2754
	 * FORMATTER / Value to set a brace location at the start of the next line with
2755
	 *             an extra indentation.
2756
	 * </pre>
2757
	 * @see #FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION
2758
	 * @see #FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER
2759
	 * @see #FORMATTER_BRACE_POSITION_FOR_BLOCK
2760
	 * @see #FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION
2761
 	 * @see #FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION
2762
 	 * @see #FORMATTER_BRACE_POSITION_FOR_SWITCH
2763
	 * @see #FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION
2764
	 */
2765
	public static final String NEXT_LINE_SHIFTED = "next_line_shifted";	//$NON-NLS-1$
2766
	/**
2767
	 * <pre>
2768
	 * FORMATTER / Value to set an option to true.
2769
	 * </pre>
2770
	 */
2771
	public static final String TRUE = "true"; //$NON-NLS-1$
2772
	/**
2773
	 * <pre>
2774
	 * FORMATTER / The wrapping is done using as few lines as possible.
2775
	 * </pre>
2776
	 */
2777
	public static final int WRAP_COMPACT= 1;
2778
	/**
2779
	 * <pre>
2780
	 * FORMATTER / The wrapping is done putting the first element on a new
2781
	 *             line and then wrapping next elements using as few lines as possible.
2782
	 * </pre>
2783
	 */
2784
	public static final int WRAP_COMPACT_FIRST_BREAK= 2;
2785
	/**
2786
	 * <pre>
2787
	 * FORMATTER / The wrapping is done by putting each element on its own line
2788
	 *             except the first element.
2789
	 * </pre>
2790
	 */
2791
	public static final int WRAP_NEXT_PER_LINE= 5;
2792
	/**
2793
	 * <pre>
2794
	 * FORMATTER / The wrapping is done by putting each element on its own line.
2795
	 *             All elements are indented by one except the first element.
2796
	 * </pre>
2797
	 */
2798
	public static final int WRAP_NEXT_SHIFTED= 4;
2799
2800
	/**
2801
	 * <pre>
2802
	 * FORMATTER / Value to disable alignment.
2803
	 * </pre>
2804
	 */
2805
	public static final int WRAP_NO_SPLIT= 0;
2806
	/**
2807
	 * <pre>
2808
	 * FORMATTER / The wrapping is done by putting each element on its own line.
2809
	 * </pre>
2810
	 */
2811
	public static final int WRAP_ONE_PER_LINE= 3;
2812
2813
	/*
2814
	 * Private constants.
2815
	 */
2816
	private static final IllegalArgumentException WRONG_ARGUMENT = new IllegalArgumentException();
2817
	
2818
	/**
2819
	 * Create a new alignment value according to the given values. This must be used to set up
2820
	 * the alignment options.
2821
	 * 
2822
	 * @param forceSplit the given force value
2823
	 * @param wrapStyle the given wrapping style
2824
	 * @param indentStyle the given indent style
2825
	 * 
2826
	 * @return the new alignement value
2827
	 */
2828
	public static String createAlignmentValue(boolean forceSplit, int wrapStyle, int indentStyle) {
2829
		int alignmentValue = 0; 
2830
		switch(wrapStyle) {
2831
			case WRAP_COMPACT :
2832
				alignmentValue |= Alignment.M_COMPACT_SPLIT;
2833
				break;
2834
			case WRAP_COMPACT_FIRST_BREAK :
2835
				alignmentValue |= Alignment.M_COMPACT_FIRST_BREAK_SPLIT;
2836
				break;
2837
			case WRAP_NEXT_PER_LINE :
2838
				alignmentValue |= Alignment.M_NEXT_PER_LINE_SPLIT;
2839
				break;
2840
			case WRAP_NEXT_SHIFTED :
2841
				alignmentValue |= Alignment.M_NEXT_SHIFTED_SPLIT;
2842
				break;
2843
			case WRAP_ONE_PER_LINE :
2844
				alignmentValue |= Alignment.M_ONE_PER_LINE_SPLIT;
2845
				break;
2846
		}		
2847
		if (forceSplit) {
2848
			alignmentValue |= Alignment.M_FORCE;
2849
		}
2850
		switch(indentStyle) {
2851
			case INDENT_BY_ONE :
2852
				alignmentValue |= Alignment.M_INDENT_BY_ONE;
2853
				break;
2854
			case INDENT_ON_COLUMN :
2855
				alignmentValue |= Alignment.M_INDENT_ON_COLUMN;
2856
		}
2857
		return String.valueOf(alignmentValue);
2858
	}
2859
2860
	/**
2861
	 * Returns the default Eclipse formatter settings
2862
	 * 
2863
	 * @return the Eclipse default settings
2864
	 */
2865
	public static Map getEclipseDefaultSettings() {
2866
		return DefaultCodeFormatterOptions.getEclipseDefaultSettings().getMap();
2867
	}
2868
2869
	/**
2870
	 * <p>Return the force value of the given alignment value.
2871
	 * The given alignment value should be created using the <code>createAlignmentValue(boolean, int, int)</code>
2872
	 * API.
2873
	 * </p>
2874
	 *
2875
	 * @param value the given alignment value
2876
	 * @return the force value of the given alignment value
2877
	 * @see #createAlignmentValue(boolean, int, int)
2878
	 * @exception IllegalArgumentException if the given alignment value is null, or if it 
2879
	 * doesn't have a valid format.
2880
	 */
2881
	public static boolean getForceWrapping(String value) {
2882
		if (value == null) {
2883
			throw WRONG_ARGUMENT;
2884
		}
2885
		try {
2886
			int existingValue = Integer.parseInt(value);
2887
			return (existingValue & Alignment.M_FORCE) != 0;
2888
		} catch (NumberFormatException e) {
2889
			throw WRONG_ARGUMENT;
2890
		}
2891
	}
2892
	
2893
	/**
2894
	 * <p>Return the indentation style of the given alignment value.
2895
	 * The given alignment value should be created using the <code>createAlignmentValue(boolean, int, int)</code>
2896
	 * API.
2897
	 * </p>
2898
	 *
2899
	 * @param value the given alignment value
2900
	 * @return the indentation style of the given alignment value
2901
	 * @see #createAlignmentValue(boolean, int, int)
2902
	 * @exception IllegalArgumentException if the given alignment value is null, or if it 
2903
	 * doesn't have a valid format.
2904
	 */
2905
	public static int getIndentStyle(String value) {
2906
		if (value == null) {
2907
			throw WRONG_ARGUMENT;
2908
		}
2909
		try {
2910
			int existingValue = Integer.parseInt(value);
2911
			if ((existingValue & Alignment.M_INDENT_BY_ONE) != 0) {
2912
				return INDENT_BY_ONE;
2913
			} else if ((existingValue & Alignment.M_INDENT_ON_COLUMN) != 0) {
2914
				return INDENT_ON_COLUMN;
2915
			} else {
2916
				return INDENT_DEFAULT;
2917
			}
2918
		} catch (NumberFormatException e) {
2919
			throw WRONG_ARGUMENT;
2920
		}
2921
	}
2922
2923
	/**
2924
	 * <p>Return the wrapping style of the given alignment value.
2925
	 * The given alignment value should be created using the <code>createAlignmentValue(boolean, int, int)</code>
2926
	 * API.
2927
	 * </p>
2928
	 *
2929
	 * @param value the given alignment value
2930
	 * @return the wrapping style of the given alignment value
2931
	 * @see #createAlignmentValue(boolean, int, int)
2932
	 * @exception IllegalArgumentException if the given alignment value is null, or if it 
2933
	 * doesn't have a valid format.
2934
	 */
2935
	public static int getWrappingStyle(String value) {
2936
		if (value == null) {
2937
			throw WRONG_ARGUMENT;
2938
		}
2939
		try {
2940
			int existingValue = Integer.parseInt(value) & Alignment.SPLIT_MASK;
2941
			switch(existingValue) {
2942
				case Alignment.M_COMPACT_SPLIT :
2943
					return WRAP_COMPACT;
2944
				case Alignment.M_COMPACT_FIRST_BREAK_SPLIT :
2945
					return WRAP_COMPACT_FIRST_BREAK;
2946
				case Alignment.M_NEXT_PER_LINE_SPLIT :
2947
					return WRAP_NEXT_PER_LINE;
2948
				case Alignment.M_NEXT_SHIFTED_SPLIT :
2949
					return WRAP_NEXT_SHIFTED;
2950
				case Alignment.M_ONE_PER_LINE_SPLIT :
2951
					return WRAP_ONE_PER_LINE;
2952
				default:
2953
					return WRAP_NO_SPLIT;
2954
			}
2955
		} catch (NumberFormatException e) {
2956
			throw WRONG_ARGUMENT;
2957
		}
2958
	}
2959
	/**
2960
	 * <p>Set the force value of the given alignment value and return the new value.
2961
	 * The given alignment value should be created using the <code>createAlignmentValue(boolean, int, int)</code>
2962
	 * API.
2963
	 * </p>
2964
	 *
2965
	 * @param value the given alignment value
2966
	 * @param force the given force value
2967
	 * @return the new alignment value
2968
	 * @see #createAlignmentValue(boolean, int, int)
2969
	 * @exception IllegalArgumentException if the given alignment value is null, or if it 
2970
	 * doesn't have a valid format.
2971
	 */
2972
	public static String setForceWrapping(String value, boolean force) {
2973
		if (value == null) {
2974
			throw WRONG_ARGUMENT;
2975
		}
2976
		try {
2977
			int existingValue = Integer.parseInt(value);
2978
			// clear existing force bit
2979
			existingValue &= ~Alignment.M_FORCE;
2980
			if (force) {
2981
				existingValue |= Alignment.M_FORCE;
2982
			}
2983
			return String.valueOf(existingValue);
2984
		} catch (NumberFormatException e) {
2985
			throw WRONG_ARGUMENT;
2986
		}		
2987
	}
2988
	
2989
	/**
2990
	 * <p>Set the indentation style of the given alignment value and return the new value.
2991
	 * The given value should be created using the <code>createAlignmentValue(boolean, int, int)</code>
2992
	 * API.
2993
	 * </p>
2994
	 *
2995
	 * @param value the given alignment value
2996
	 * @param indentStyle the given indentation style
2997
	 * @return the new alignment value
2998
	 * @see #INDENT_BY_ONE
2999
	 * @see #INDENT_DEFAULT
3000
	 * @see #INDENT_ON_COLUMN
3001
	 * @see #createAlignmentValue(boolean, int, int)
3002
	 * @exception IllegalArgumentException if the given alignment value is null, if the given
3003
	 * indentation style is not one of the possible indentation styles, or if the given
3004
	 * alignment value doesn't have a valid format.
3005
	 */
3006
	public static String setIndentStyle(String value, int indentStyle) {
3007
		if (value == null) {
3008
			throw WRONG_ARGUMENT;
3009
		}
3010
		switch(indentStyle) {
3011
			case INDENT_BY_ONE :
3012
			case INDENT_DEFAULT :
3013
			case INDENT_ON_COLUMN :
3014
				break;
3015
			default :
3016
				throw WRONG_ARGUMENT;
3017
		}
3018
		try {
3019
			int existingValue = Integer.parseInt(value);
3020
			// clear existing indent bits
3021
			existingValue &= ~(Alignment.M_INDENT_BY_ONE | Alignment.M_INDENT_ON_COLUMN);
3022
			switch(indentStyle) {
3023
				case INDENT_BY_ONE :
3024
					existingValue |= Alignment.M_INDENT_BY_ONE;
3025
					break;
3026
				case INDENT_ON_COLUMN :
3027
					existingValue |= Alignment.M_INDENT_ON_COLUMN;
3028
			}
3029
			return String.valueOf(existingValue);
3030
		} catch (NumberFormatException e) {
3031
			throw WRONG_ARGUMENT;
3032
		}
3033
	}
3034
	/**
3035
	 * <p>Set the wrapping style of the given alignment value and return the new value.
3036
	 * The given value should be created using the <code>createAlignmentValue(boolean, int, int)</code>
3037
	 * API.
3038
	 * </p>
3039
	 *
3040
	 * @param value the given alignment value
3041
	 * @param wrappingStyle the given wrapping style
3042
	 * @return the new alignment value
3043
	 * @see #WRAP_COMPACT
3044
	 * @see #WRAP_COMPACT_FIRST_BREAK
3045
	 * @see #WRAP_NEXT_PER_LINE
3046
	 * @see #WRAP_NEXT_SHIFTED
3047
	 * @see #WRAP_NO_SPLIT
3048
	 * @see #WRAP_ONE_PER_LINE
3049
	 * @see #createAlignmentValue(boolean, int, int)
3050
	 * @exception IllegalArgumentException if the given alignment value is null, if the given
3051
	 * wrapping style is not one of the possible wrapping styles, or if the given
3052
	 * alignment value doesn't have a valid format.
3053
	 */
3054
	public static String setWrappingStyle(String value, int wrappingStyle) {
3055
		if (value == null) {
3056
			throw WRONG_ARGUMENT;
3057
		}
3058
		switch(wrappingStyle) {
3059
			case WRAP_COMPACT :
3060
			case WRAP_COMPACT_FIRST_BREAK :
3061
			case WRAP_NEXT_PER_LINE :
3062
			case WRAP_NEXT_SHIFTED :
3063
			case WRAP_NO_SPLIT :
3064
			case WRAP_ONE_PER_LINE :
3065
				break;
3066
			default:
3067
				throw WRONG_ARGUMENT;
3068
		}
3069
		try {
3070
			int existingValue = Integer.parseInt(value);
3071
			// clear existing split bits
3072
			existingValue &= ~(Alignment.SPLIT_MASK);
3073
			switch(wrappingStyle) {
3074
				case WRAP_COMPACT :
3075
					existingValue |= Alignment.M_COMPACT_SPLIT;
3076
					break;
3077
				case WRAP_COMPACT_FIRST_BREAK :
3078
					existingValue |= Alignment.M_COMPACT_FIRST_BREAK_SPLIT;
3079
					break;
3080
				case WRAP_NEXT_PER_LINE :
3081
					existingValue |= Alignment.M_NEXT_PER_LINE_SPLIT;
3082
					break;
3083
				case WRAP_NEXT_SHIFTED :
3084
					existingValue |= Alignment.M_NEXT_SHIFTED_SPLIT;
3085
					break;
3086
				case WRAP_ONE_PER_LINE :
3087
					existingValue |= Alignment.M_ONE_PER_LINE_SPLIT;
3088
					break;
3089
			}
3090
			return String.valueOf(existingValue);
3091
		} catch (NumberFormatException e) {
3092
			throw WRONG_ARGUMENT;
3093
		}
3094
	}
3095
}
(-)src/org/eclipse/cdt/internal/formatter/DefaultCodeFormatterOptions.java (-132 / +132 lines)
Lines 14-20 Link Here
14
import java.util.HashMap;
14
import java.util.HashMap;
15
import java.util.Map;
15
import java.util.Map;
16
16
17
import org.eclipse.cdt.core.formatter.CodeFormatterConstants;
17
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
18
import org.eclipse.cdt.core.CCorePlugin;
18
import org.eclipse.cdt.core.CCorePlugin;
19
import org.eclipse.cdt.internal.formatter.align.Alignment;
19
import org.eclipse.cdt.internal.formatter.align.Alignment;
20
20
Lines 288-331 Link Here
288
288
289
	public Map getMap() {
289
	public Map getMap() {
290
		Map options = new HashMap();
290
		Map options = new HashMap();
291
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION, getAlignment(this.alignment_for_arguments_in_allocation_expression));
291
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION, getAlignment(this.alignment_for_arguments_in_allocation_expression));
292
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ENUM_CONSTANT, getAlignment(this.alignment_for_arguments_in_enum_constant));
292
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ENUM_CONSTANT, getAlignment(this.alignment_for_arguments_in_enum_constant));
293
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_EXPLICIT_CONSTRUCTOR_CALL, getAlignment(this.alignment_for_arguments_in_explicit_constructor_call));
293
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_EXPLICIT_CONSTRUCTOR_CALL, getAlignment(this.alignment_for_arguments_in_explicit_constructor_call));
294
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION, getAlignment(this.alignment_for_arguments_in_method_invocation));
294
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION, getAlignment(this.alignment_for_arguments_in_method_invocation));
295
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_QUALIFIED_ALLOCATION_EXPRESSION, getAlignment(this.alignment_for_arguments_in_qualified_allocation_expression));
295
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_QUALIFIED_ALLOCATION_EXPRESSION, getAlignment(this.alignment_for_arguments_in_qualified_allocation_expression));
296
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ASSIGNMENT, getAlignment(this.alignment_for_assignment));
296
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ASSIGNMENT, getAlignment(this.alignment_for_assignment));
297
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION, getAlignment(this.alignment_for_binary_expression));
297
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION, getAlignment(this.alignment_for_binary_expression));
298
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_COMPACT_IF, getAlignment(this.alignment_for_compact_if));
298
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_COMPACT_IF, getAlignment(this.alignment_for_compact_if));
299
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION, getAlignment(this.alignment_for_conditional_expression));
299
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION, getAlignment(this.alignment_for_conditional_expression));
300
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS, getAlignment(this.alignment_for_enum_constants));
300
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS, getAlignment(this.alignment_for_enum_constants));
301
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER, getAlignment(this.alignment_for_expressions_in_array_initializer));
301
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER, getAlignment(this.alignment_for_expressions_in_array_initializer));
302
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_MULTIPLE_FIELDS, getAlignment(this.alignment_for_multiple_fields));
302
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_MULTIPLE_FIELDS, getAlignment(this.alignment_for_multiple_fields));
303
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION, getAlignment(this.alignment_for_parameters_in_constructor_declaration));
303
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION, getAlignment(this.alignment_for_parameters_in_constructor_declaration));
304
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION, getAlignment(this.alignment_for_parameters_in_method_declaration));
304
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION, getAlignment(this.alignment_for_parameters_in_method_declaration));
305
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION, getAlignment(this.alignment_for_selector_in_method_invocation));
305
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION, getAlignment(this.alignment_for_selector_in_method_invocation));
306
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION, getAlignment(this.alignment_for_superclass_in_type_declaration));
306
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION, getAlignment(this.alignment_for_superclass_in_type_declaration));
307
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_ENUM_DECLARATION, getAlignment(this.alignment_for_superinterfaces_in_enum_declaration));
307
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_ENUM_DECLARATION, getAlignment(this.alignment_for_superinterfaces_in_enum_declaration));
308
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_TYPE_DECLARATION, getAlignment(this.alignment_for_superinterfaces_in_type_declaration));
308
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_TYPE_DECLARATION, getAlignment(this.alignment_for_superinterfaces_in_type_declaration));
309
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_CONSTRUCTOR_DECLARATION, getAlignment(this.alignment_for_throws_clause_in_constructor_declaration));
309
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_CONSTRUCTOR_DECLARATION, getAlignment(this.alignment_for_throws_clause_in_constructor_declaration));
310
		options.put(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION, getAlignment(this.alignment_for_throws_clause_in_method_declaration));
310
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION, getAlignment(this.alignment_for_throws_clause_in_method_declaration));
311
		options.put(CodeFormatterConstants.FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS, this.align_type_members_on_columns ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
311
		options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS, this.align_type_members_on_columns ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
312
		options.put(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER, this.brace_position_for_array_initializer);
312
		options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER, this.brace_position_for_array_initializer);
313
		options.put(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, this.brace_position_for_block);
313
		options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, this.brace_position_for_block);
314
		options.put(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE, this.brace_position_for_block_in_case);
314
		options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE, this.brace_position_for_block_in_case);
315
		options.put(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, this.brace_position_for_constructor_declaration);
315
		options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, this.brace_position_for_constructor_declaration);
316
		options.put(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ENUM_CONSTANT, this.brace_position_for_enum_constant);
316
		options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ENUM_CONSTANT, this.brace_position_for_enum_constant);
317
		options.put(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ENUM_DECLARATION, this.brace_position_for_enum_declaration);
317
		options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ENUM_DECLARATION, this.brace_position_for_enum_declaration);
318
		options.put(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, this.brace_position_for_method_declaration);
318
		options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, this.brace_position_for_method_declaration);
319
		options.put(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, this.brace_position_for_type_declaration);
319
		options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, this.brace_position_for_type_declaration);
320
		options.put(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, this.brace_position_for_switch);
320
		options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, this.brace_position_for_switch);
321
//		options.put(CodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES, this.comment_clear_blank_lines ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
321
//		options.put(CodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES, this.comment_clear_blank_lines ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
322
//		options.put(CodeFormatterConstants.FORMATTER_COMMENT_FORMAT, this.comment_format ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
322
//		options.put(CodeFormatterConstants.FORMATTER_COMMENT_FORMAT, this.comment_format ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
323
//		options.put(CodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HEADER, this.comment_format_header ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
323
//		options.put(CodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HEADER, this.comment_format_header ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
324
//		options.put(CodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HTML, this.comment_format_html ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
324
//		options.put(CodeFormatterConstants.FORMATTER_COMMENT_FORMAT_HTML, this.comment_format_html ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
325
//		options.put(CodeFormatterConstants.FORMATTER_COMMENT_FORMAT_SOURCE, this.comment_format_source ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
325
//		options.put(CodeFormatterConstants.FORMATTER_COMMENT_FORMAT_SOURCE, this.comment_format_source ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
326
//		options.put(CodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, Integer.toString(this.comment_line_length));
326
//		options.put(CodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, Integer.toString(this.comment_line_length));
327
		options.put(CodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION, Integer.toString(this.continuation_indentation));
327
		options.put(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION, Integer.toString(this.continuation_indentation));
328
		options.put(CodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER, Integer.toString(this.continuation_indentation_for_array_initializer));
328
		options.put(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER, Integer.toString(this.continuation_indentation_for_array_initializer));
329
//		options.put(CodeFormatterConstants.FORMATTER_BLANK_LINES_AFTER_IMPORTS, Integer.toString(this.blank_lines_after_imports));
329
//		options.put(CodeFormatterConstants.FORMATTER_BLANK_LINES_AFTER_IMPORTS, Integer.toString(this.blank_lines_after_imports));
330
//		options.put(CodeFormatterConstants.FORMATTER_BLANK_LINES_AFTER_PACKAGE, Integer.toString(this.blank_lines_after_package));
330
//		options.put(CodeFormatterConstants.FORMATTER_BLANK_LINES_AFTER_PACKAGE, Integer.toString(this.blank_lines_after_package));
331
//		options.put(CodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_FIELD, Integer.toString(this.blank_lines_before_field));
331
//		options.put(CodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_FIELD, Integer.toString(this.blank_lines_before_field));
Lines 337-352 Link Here
337
//		options.put(CodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_PACKAGE, Integer.toString(this.blank_lines_before_package));
337
//		options.put(CodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_PACKAGE, Integer.toString(this.blank_lines_before_package));
338
//		options.put(CodeFormatterConstants.FORMATTER_BLANK_LINES_BETWEEN_TYPE_DECLARATIONS, Integer.toString(this.blank_lines_between_type_declarations));
338
//		options.put(CodeFormatterConstants.FORMATTER_BLANK_LINES_BETWEEN_TYPE_DECLARATIONS, Integer.toString(this.blank_lines_between_type_declarations));
339
//		options.put(CodeFormatterConstants.FORMATTER_BLANK_LINES_AT_BEGINNING_OF_METHOD_BODY, Integer.toString(this.blank_lines_at_beginning_of_method_body));
339
//		options.put(CodeFormatterConstants.FORMATTER_BLANK_LINES_AT_BEGINNING_OF_METHOD_BODY, Integer.toString(this.blank_lines_at_beginning_of_method_body));
340
		options.put(CodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK, this.indent_statements_compare_to_block ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
340
		options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK, this.indent_statements_compare_to_block ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
341
		options.put(CodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY, this.indent_statements_compare_to_body ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
341
		options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY, this.indent_statements_compare_to_body ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
342
		options.put(CodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_CONSTANT_HEADER, this.indent_body_declarations_compare_to_enum_constant_header ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
342
		options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_CONSTANT_HEADER, this.indent_body_declarations_compare_to_enum_constant_header ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
343
		options.put(CodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_DECLARATION_HEADER, this.indent_body_declarations_compare_to_enum_declaration_header ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
343
		options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_DECLARATION_HEADER, this.indent_body_declarations_compare_to_enum_declaration_header ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
344
		options.put(CodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_TYPE_HEADER, this.indent_body_declarations_compare_to_type_header ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
344
		options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_TYPE_HEADER, this.indent_body_declarations_compare_to_type_header ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
345
		options.put(CodeFormatterConstants.FORMATTER_INDENT_BREAKS_COMPARE_TO_CASES, this.indent_breaks_compare_to_cases ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
345
		options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BREAKS_COMPARE_TO_CASES, this.indent_breaks_compare_to_cases ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
346
		options.put(CodeFormatterConstants.FORMATTER_INDENT_EMPTY_LINES, this.indent_empty_lines ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
346
		options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_EMPTY_LINES, this.indent_empty_lines ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
347
		options.put(CodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES, this.indent_switchstatements_compare_to_cases ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
347
		options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES, this.indent_switchstatements_compare_to_cases ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
348
		options.put(CodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH, this.indent_switchstatements_compare_to_switch ? CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
348
		options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH, this.indent_switchstatements_compare_to_switch ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
349
		options.put(CodeFormatterConstants.FORMATTER_INDENTATION_SIZE, Integer.toString(this.indentation_size));
349
		options.put(DefaultCodeFormatterConstants.FORMATTER_INDENTATION_SIZE, Integer.toString(this.indentation_size));
350
//		options.put(CodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, this.insert_new_line_after_opening_brace_in_array_initializer? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
350
//		options.put(CodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, this.insert_new_line_after_opening_brace_in_array_initializer? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
351
//		options.put(CodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING, this.insert_new_line_at_end_of_file_if_missing ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
351
//		options.put(CodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING, this.insert_new_line_at_end_of_file_if_missing ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
352
//		options.put(CodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, this.insert_new_line_before_catch_in_try_statement? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
352
//		options.put(CodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, this.insert_new_line_before_catch_in_try_statement? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
Lines 511-532 Link Here
511
//		options.put(CodeFormatterConstants.FORMATTER_LINE_SPLIT, Integer.toString(this.page_width));
511
//		options.put(CodeFormatterConstants.FORMATTER_LINE_SPLIT, Integer.toString(this.page_width));
512
		switch(this.tab_char) {
512
		switch(this.tab_char) {
513
			case SPACE :
513
			case SPACE :
514
				options.put(CodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE);
514
				options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE);
515
				break;
515
				break;
516
			case TAB :
516
			case TAB :
517
				options.put(CodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.TAB);
517
				options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.TAB);
518
				break;
518
				break;
519
			case MIXED :
519
			case MIXED :
520
				options.put(CodeFormatterConstants.FORMATTER_TAB_CHAR, CodeFormatterConstants.MIXED);
520
				options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, DefaultCodeFormatterConstants.MIXED);
521
				break;
521
				break;
522
		}
522
		}
523
		options.put(CodeFormatterConstants.FORMATTER_TAB_SIZE, Integer.toString(this.tab_size));
523
		options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, Integer.toString(this.tab_size));
524
		options.put(CodeFormatterConstants.FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS, this.use_tabs_only_for_leading_indentations ?  CodeFormatterConstants.TRUE : CodeFormatterConstants.FALSE);
524
		options.put(DefaultCodeFormatterConstants.FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS, this.use_tabs_only_for_leading_indentations ?  DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
525
		return options;
525
		return options;
526
	}
526
	}
527
527
528
	public void set(Map settings) {
528
	public void set(Map settings) {
529
		final Object alignmentForArgumentsInAllocationExpressionOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION);
529
		final Object alignmentForArgumentsInAllocationExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION);
530
		if (alignmentForArgumentsInAllocationExpressionOption != null) {
530
		if (alignmentForArgumentsInAllocationExpressionOption != null) {
531
			try {
531
			try {
532
				this.alignment_for_arguments_in_allocation_expression = Integer.parseInt((String) alignmentForArgumentsInAllocationExpressionOption);
532
				this.alignment_for_arguments_in_allocation_expression = Integer.parseInt((String) alignmentForArgumentsInAllocationExpressionOption);
Lines 536-542 Link Here
536
				this.alignment_for_arguments_in_allocation_expression = Alignment.M_COMPACT_SPLIT;
536
				this.alignment_for_arguments_in_allocation_expression = Alignment.M_COMPACT_SPLIT;
537
			}
537
			}
538
		}
538
		}
539
		final Object alignmentForArgumentsInEnumConstantOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ENUM_CONSTANT);
539
		final Object alignmentForArgumentsInEnumConstantOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ENUM_CONSTANT);
540
		if (alignmentForArgumentsInEnumConstantOption != null) {
540
		if (alignmentForArgumentsInEnumConstantOption != null) {
541
			try {
541
			try {
542
				this.alignment_for_arguments_in_enum_constant = Integer.parseInt((String) alignmentForArgumentsInEnumConstantOption);
542
				this.alignment_for_arguments_in_enum_constant = Integer.parseInt((String) alignmentForArgumentsInEnumConstantOption);
Lines 546-552 Link Here
546
				this.alignment_for_arguments_in_enum_constant = Alignment.M_COMPACT_SPLIT;
546
				this.alignment_for_arguments_in_enum_constant = Alignment.M_COMPACT_SPLIT;
547
			}
547
			}
548
		}
548
		}
549
		final Object alignmentForArgumentsInExplicitConstructorCallOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_EXPLICIT_CONSTRUCTOR_CALL);
549
		final Object alignmentForArgumentsInExplicitConstructorCallOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_EXPLICIT_CONSTRUCTOR_CALL);
550
		if (alignmentForArgumentsInExplicitConstructorCallOption != null) {
550
		if (alignmentForArgumentsInExplicitConstructorCallOption != null) {
551
			try {
551
			try {
552
				this.alignment_for_arguments_in_explicit_constructor_call = Integer.parseInt((String) alignmentForArgumentsInExplicitConstructorCallOption);
552
				this.alignment_for_arguments_in_explicit_constructor_call = Integer.parseInt((String) alignmentForArgumentsInExplicitConstructorCallOption);
Lines 556-562 Link Here
556
				this.alignment_for_arguments_in_explicit_constructor_call = Alignment.M_COMPACT_SPLIT;
556
				this.alignment_for_arguments_in_explicit_constructor_call = Alignment.M_COMPACT_SPLIT;
557
			}
557
			}
558
		}
558
		}
559
		final Object alignmentForArgumentsInMethodInvocationOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION);
559
		final Object alignmentForArgumentsInMethodInvocationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION);
560
		if (alignmentForArgumentsInMethodInvocationOption != null) {
560
		if (alignmentForArgumentsInMethodInvocationOption != null) {
561
			try {
561
			try {
562
				this.alignment_for_arguments_in_method_invocation = Integer.parseInt((String) alignmentForArgumentsInMethodInvocationOption);
562
				this.alignment_for_arguments_in_method_invocation = Integer.parseInt((String) alignmentForArgumentsInMethodInvocationOption);
Lines 566-572 Link Here
566
				this.alignment_for_arguments_in_method_invocation = Alignment.M_COMPACT_SPLIT;
566
				this.alignment_for_arguments_in_method_invocation = Alignment.M_COMPACT_SPLIT;
567
			}
567
			}
568
		}
568
		}
569
		final Object alignmentForArgumentsInQualifiedAllocationExpressionOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_QUALIFIED_ALLOCATION_EXPRESSION);
569
		final Object alignmentForArgumentsInQualifiedAllocationExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_QUALIFIED_ALLOCATION_EXPRESSION);
570
		if (alignmentForArgumentsInQualifiedAllocationExpressionOption != null) {
570
		if (alignmentForArgumentsInQualifiedAllocationExpressionOption != null) {
571
			try {
571
			try {
572
				this.alignment_for_arguments_in_qualified_allocation_expression = Integer.parseInt((String) alignmentForArgumentsInQualifiedAllocationExpressionOption);
572
				this.alignment_for_arguments_in_qualified_allocation_expression = Integer.parseInt((String) alignmentForArgumentsInQualifiedAllocationExpressionOption);
Lines 576-582 Link Here
576
				this.alignment_for_arguments_in_qualified_allocation_expression = Alignment.M_COMPACT_SPLIT;
576
				this.alignment_for_arguments_in_qualified_allocation_expression = Alignment.M_COMPACT_SPLIT;
577
			}
577
			}
578
		}
578
		}
579
		final Object alignmentForAssignmentOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ASSIGNMENT);
579
		final Object alignmentForAssignmentOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ASSIGNMENT);
580
		if (alignmentForAssignmentOption != null) {
580
		if (alignmentForAssignmentOption != null) {
581
			try {
581
			try {
582
				this.alignment_for_assignment = Integer.parseInt((String) alignmentForAssignmentOption);
582
				this.alignment_for_assignment = Integer.parseInt((String) alignmentForAssignmentOption);
Lines 586-592 Link Here
586
				this.alignment_for_assignment =  Alignment.M_ONE_PER_LINE_SPLIT;
586
				this.alignment_for_assignment =  Alignment.M_ONE_PER_LINE_SPLIT;
587
			}
587
			}
588
		}
588
		}
589
		final Object alignmentForBinaryExpressionOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION);
589
		final Object alignmentForBinaryExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION);
590
		if (alignmentForBinaryExpressionOption != null) {
590
		if (alignmentForBinaryExpressionOption != null) {
591
			try {
591
			try {
592
				this.alignment_for_binary_expression = Integer.parseInt((String) alignmentForBinaryExpressionOption);
592
				this.alignment_for_binary_expression = Integer.parseInt((String) alignmentForBinaryExpressionOption);
Lines 596-602 Link Here
596
				this.alignment_for_binary_expression =  Alignment.M_COMPACT_SPLIT;
596
				this.alignment_for_binary_expression =  Alignment.M_COMPACT_SPLIT;
597
			}
597
			}
598
		}
598
		}
599
		final Object alignmentForCompactIfOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_COMPACT_IF);
599
		final Object alignmentForCompactIfOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_COMPACT_IF);
600
		if (alignmentForCompactIfOption != null) {
600
		if (alignmentForCompactIfOption != null) {
601
			try {
601
			try {
602
				this.alignment_for_compact_if = Integer.parseInt((String) alignmentForCompactIfOption);
602
				this.alignment_for_compact_if = Integer.parseInt((String) alignmentForCompactIfOption);
Lines 606-612 Link Here
606
				this.alignment_for_compact_if = Alignment.M_ONE_PER_LINE_SPLIT | Alignment.M_INDENT_BY_ONE;
606
				this.alignment_for_compact_if = Alignment.M_ONE_PER_LINE_SPLIT | Alignment.M_INDENT_BY_ONE;
607
			}
607
			}
608
		}
608
		}
609
		final Object alignmentForConditionalExpressionOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION);
609
		final Object alignmentForConditionalExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION);
610
		if (alignmentForConditionalExpressionOption != null) {
610
		if (alignmentForConditionalExpressionOption != null) {
611
			try {
611
			try {
612
				this.alignment_for_conditional_expression = Integer.parseInt((String) alignmentForConditionalExpressionOption);
612
				this.alignment_for_conditional_expression = Integer.parseInt((String) alignmentForConditionalExpressionOption);
Lines 616-622 Link Here
616
				this.alignment_for_conditional_expression = Alignment.M_ONE_PER_LINE_SPLIT;
616
				this.alignment_for_conditional_expression = Alignment.M_ONE_PER_LINE_SPLIT;
617
			}
617
			}
618
		}
618
		}
619
		final Object alignmentForEnumConstantsOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS);
619
		final Object alignmentForEnumConstantsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS);
620
		if (alignmentForEnumConstantsOption != null) {
620
		if (alignmentForEnumConstantsOption != null) {
621
			try {
621
			try {
622
				this.alignment_for_enum_constants = Integer.parseInt((String) alignmentForEnumConstantsOption);
622
				this.alignment_for_enum_constants = Integer.parseInt((String) alignmentForEnumConstantsOption);
Lines 626-632 Link Here
626
				this.alignment_for_enum_constants = Alignment.NONE;
626
				this.alignment_for_enum_constants = Alignment.NONE;
627
			}
627
			}
628
		}
628
		}
629
		final Object alignmentForExpressionsInArrayInitializerOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER);
629
		final Object alignmentForExpressionsInArrayInitializerOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER);
630
		if (alignmentForExpressionsInArrayInitializerOption != null) {
630
		if (alignmentForExpressionsInArrayInitializerOption != null) {
631
			try {
631
			try {
632
				this.alignment_for_expressions_in_array_initializer = Integer.parseInt((String) alignmentForExpressionsInArrayInitializerOption);
632
				this.alignment_for_expressions_in_array_initializer = Integer.parseInt((String) alignmentForExpressionsInArrayInitializerOption);
Lines 636-642 Link Here
636
				this.alignment_for_expressions_in_array_initializer = Alignment.M_COMPACT_SPLIT;
636
				this.alignment_for_expressions_in_array_initializer = Alignment.M_COMPACT_SPLIT;
637
			}
637
			}
638
		}
638
		}
639
		final Object alignmentForMultipleFieldsOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_MULTIPLE_FIELDS);
639
		final Object alignmentForMultipleFieldsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_MULTIPLE_FIELDS);
640
		if (alignmentForMultipleFieldsOption != null) {
640
		if (alignmentForMultipleFieldsOption != null) {
641
			try {
641
			try {
642
				this.alignment_for_multiple_fields = Integer.parseInt((String) alignmentForMultipleFieldsOption);
642
				this.alignment_for_multiple_fields = Integer.parseInt((String) alignmentForMultipleFieldsOption);
Lines 646-652 Link Here
646
				this.alignment_for_multiple_fields = Alignment.M_COMPACT_SPLIT;
646
				this.alignment_for_multiple_fields = Alignment.M_COMPACT_SPLIT;
647
			}
647
			}
648
		}
648
		}
649
		final Object alignmentForParametersInConstructorDeclarationOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION);
649
		final Object alignmentForParametersInConstructorDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION);
650
		if (alignmentForParametersInConstructorDeclarationOption != null) {
650
		if (alignmentForParametersInConstructorDeclarationOption != null) {
651
			try {
651
			try {
652
				this.alignment_for_parameters_in_constructor_declaration = Integer.parseInt((String) alignmentForParametersInConstructorDeclarationOption);
652
				this.alignment_for_parameters_in_constructor_declaration = Integer.parseInt((String) alignmentForParametersInConstructorDeclarationOption);
Lines 656-662 Link Here
656
				this.alignment_for_parameters_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
656
				this.alignment_for_parameters_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
657
			}
657
			}
658
		}
658
		}
659
		final Object alignmentForParametersInMethodDeclarationOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION);
659
		final Object alignmentForParametersInMethodDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION);
660
		if (alignmentForParametersInMethodDeclarationOption != null) {
660
		if (alignmentForParametersInMethodDeclarationOption != null) {
661
			try {
661
			try {
662
				this.alignment_for_parameters_in_method_declaration = Integer.parseInt((String) alignmentForParametersInMethodDeclarationOption);
662
				this.alignment_for_parameters_in_method_declaration = Integer.parseInt((String) alignmentForParametersInMethodDeclarationOption);
Lines 666-672 Link Here
666
				this.alignment_for_parameters_in_method_declaration = Alignment.M_COMPACT_SPLIT;
666
				this.alignment_for_parameters_in_method_declaration = Alignment.M_COMPACT_SPLIT;
667
			}
667
			}
668
		}
668
		}
669
		final Object alignmentForSelectorInMethodInvocationOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION);
669
		final Object alignmentForSelectorInMethodInvocationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION);
670
		if (alignmentForSelectorInMethodInvocationOption != null) {
670
		if (alignmentForSelectorInMethodInvocationOption != null) {
671
			try {
671
			try {
672
				this.alignment_for_selector_in_method_invocation = Integer.parseInt((String) alignmentForSelectorInMethodInvocationOption);
672
				this.alignment_for_selector_in_method_invocation = Integer.parseInt((String) alignmentForSelectorInMethodInvocationOption);
Lines 676-682 Link Here
676
				this.alignment_for_selector_in_method_invocation = Alignment.M_COMPACT_SPLIT;
676
				this.alignment_for_selector_in_method_invocation = Alignment.M_COMPACT_SPLIT;
677
			}
677
			}
678
		}
678
		}
679
		final Object alignmentForSuperclassInTypeDeclarationOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION);
679
		final Object alignmentForSuperclassInTypeDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION);
680
		if (alignmentForSuperclassInTypeDeclarationOption != null) {
680
		if (alignmentForSuperclassInTypeDeclarationOption != null) {
681
			try {
681
			try {
682
				this.alignment_for_superclass_in_type_declaration = Integer.parseInt((String) alignmentForSuperclassInTypeDeclarationOption);
682
				this.alignment_for_superclass_in_type_declaration = Integer.parseInt((String) alignmentForSuperclassInTypeDeclarationOption);
Lines 686-692 Link Here
686
				this.alignment_for_superclass_in_type_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
686
				this.alignment_for_superclass_in_type_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
687
			}
687
			}
688
		}
688
		}
689
		final Object alignmentForSuperinterfacesInEnumDeclarationOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_ENUM_DECLARATION);
689
		final Object alignmentForSuperinterfacesInEnumDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_ENUM_DECLARATION);
690
		if (alignmentForSuperinterfacesInEnumDeclarationOption != null) {
690
		if (alignmentForSuperinterfacesInEnumDeclarationOption != null) {
691
			try {
691
			try {
692
				this.alignment_for_superinterfaces_in_enum_declaration = Integer.parseInt((String) alignmentForSuperinterfacesInEnumDeclarationOption);
692
				this.alignment_for_superinterfaces_in_enum_declaration = Integer.parseInt((String) alignmentForSuperinterfacesInEnumDeclarationOption);
Lines 696-702 Link Here
696
				this.alignment_for_superinterfaces_in_enum_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
696
				this.alignment_for_superinterfaces_in_enum_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
697
			}
697
			}
698
		}
698
		}
699
		final Object alignmentForSuperinterfacesInTypeDeclarationOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_TYPE_DECLARATION);
699
		final Object alignmentForSuperinterfacesInTypeDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_TYPE_DECLARATION);
700
		if (alignmentForSuperinterfacesInTypeDeclarationOption != null) {
700
		if (alignmentForSuperinterfacesInTypeDeclarationOption != null) {
701
			try {
701
			try {
702
				this.alignment_for_superinterfaces_in_type_declaration = Integer.parseInt((String) alignmentForSuperinterfacesInTypeDeclarationOption);
702
				this.alignment_for_superinterfaces_in_type_declaration = Integer.parseInt((String) alignmentForSuperinterfacesInTypeDeclarationOption);
Lines 706-712 Link Here
706
				this.alignment_for_superinterfaces_in_type_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
706
				this.alignment_for_superinterfaces_in_type_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
707
			}
707
			}
708
		}
708
		}
709
		final Object alignmentForThrowsClauseInConstructorDeclarationOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_CONSTRUCTOR_DECLARATION);
709
		final Object alignmentForThrowsClauseInConstructorDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_CONSTRUCTOR_DECLARATION);
710
		if (alignmentForThrowsClauseInConstructorDeclarationOption != null) {
710
		if (alignmentForThrowsClauseInConstructorDeclarationOption != null) {
711
			try {
711
			try {
712
				this.alignment_for_throws_clause_in_constructor_declaration = Integer.parseInt((String) alignmentForThrowsClauseInConstructorDeclarationOption);
712
				this.alignment_for_throws_clause_in_constructor_declaration = Integer.parseInt((String) alignmentForThrowsClauseInConstructorDeclarationOption);
Lines 716-722 Link Here
716
				this.alignment_for_throws_clause_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
716
				this.alignment_for_throws_clause_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
717
			}
717
			}
718
		}
718
		}
719
		final Object alignmentForThrowsClauseInMethodDeclarationOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION);
719
		final Object alignmentForThrowsClauseInMethodDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION);
720
		if (alignmentForThrowsClauseInMethodDeclarationOption != null) {
720
		if (alignmentForThrowsClauseInMethodDeclarationOption != null) {
721
			try {
721
			try {
722
				this.alignment_for_throws_clause_in_method_declaration = Integer.parseInt((String) alignmentForThrowsClauseInMethodDeclarationOption);
722
				this.alignment_for_throws_clause_in_method_declaration = Integer.parseInt((String) alignmentForThrowsClauseInMethodDeclarationOption);
Lines 726-808 Link Here
726
				this.alignment_for_throws_clause_in_method_declaration = Alignment.M_COMPACT_SPLIT;
726
				this.alignment_for_throws_clause_in_method_declaration = Alignment.M_COMPACT_SPLIT;
727
			}
727
			}
728
		}
728
		}
729
		final Object alignTypeMembersOnColumnsOption = settings.get(CodeFormatterConstants.FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS);
729
		final Object alignTypeMembersOnColumnsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS);
730
		if (alignTypeMembersOnColumnsOption != null) {
730
		if (alignTypeMembersOnColumnsOption != null) {
731
			this.align_type_members_on_columns = CodeFormatterConstants.TRUE.equals(alignTypeMembersOnColumnsOption);
731
			this.align_type_members_on_columns = DefaultCodeFormatterConstants.TRUE.equals(alignTypeMembersOnColumnsOption);
732
		}
732
		}
733
		final Object bracePositionForArrayInitializerOption = settings.get(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER);
733
		final Object bracePositionForArrayInitializerOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER);
734
		if (bracePositionForArrayInitializerOption != null) {
734
		if (bracePositionForArrayInitializerOption != null) {
735
			try {
735
			try {
736
				this.brace_position_for_array_initializer = (String) bracePositionForArrayInitializerOption;
736
				this.brace_position_for_array_initializer = (String) bracePositionForArrayInitializerOption;
737
			} catch(ClassCastException e) {
737
			} catch(ClassCastException e) {
738
				this.brace_position_for_array_initializer = CodeFormatterConstants.END_OF_LINE;
738
				this.brace_position_for_array_initializer = DefaultCodeFormatterConstants.END_OF_LINE;
739
			}
739
			}
740
		}
740
		}
741
		final Object bracePositionForBlockOption = settings.get(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK);
741
		final Object bracePositionForBlockOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK);
742
		if (bracePositionForBlockOption != null) {
742
		if (bracePositionForBlockOption != null) {
743
			try {
743
			try {
744
				this.brace_position_for_block = (String) bracePositionForBlockOption;
744
				this.brace_position_for_block = (String) bracePositionForBlockOption;
745
			} catch(ClassCastException e) {
745
			} catch(ClassCastException e) {
746
				this.brace_position_for_block = CodeFormatterConstants.END_OF_LINE;
746
				this.brace_position_for_block = DefaultCodeFormatterConstants.END_OF_LINE;
747
			}
747
			}
748
		}
748
		}
749
		final Object bracePositionForBlockInCaseOption = settings.get(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE);
749
		final Object bracePositionForBlockInCaseOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE);
750
		if (bracePositionForBlockInCaseOption != null) {
750
		if (bracePositionForBlockInCaseOption != null) {
751
			try {
751
			try {
752
				this.brace_position_for_block_in_case = (String) bracePositionForBlockInCaseOption;
752
				this.brace_position_for_block_in_case = (String) bracePositionForBlockInCaseOption;
753
			} catch(ClassCastException e) {
753
			} catch(ClassCastException e) {
754
				this.brace_position_for_block_in_case = CodeFormatterConstants.END_OF_LINE;
754
				this.brace_position_for_block_in_case = DefaultCodeFormatterConstants.END_OF_LINE;
755
			}
755
			}
756
		}
756
		}
757
		final Object bracePositionForConstructorDeclarationOption = settings.get(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION);
757
		final Object bracePositionForConstructorDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION);
758
		if (bracePositionForConstructorDeclarationOption != null) {
758
		if (bracePositionForConstructorDeclarationOption != null) {
759
			try {
759
			try {
760
				this.brace_position_for_constructor_declaration = (String) bracePositionForConstructorDeclarationOption;
760
				this.brace_position_for_constructor_declaration = (String) bracePositionForConstructorDeclarationOption;
761
			} catch(ClassCastException e) {
761
			} catch(ClassCastException e) {
762
				this.brace_position_for_constructor_declaration = CodeFormatterConstants.END_OF_LINE;
762
				this.brace_position_for_constructor_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
763
			}
763
			}
764
		}
764
		}
765
		final Object bracePositionForEnumConstantOption = settings.get(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ENUM_CONSTANT);
765
		final Object bracePositionForEnumConstantOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ENUM_CONSTANT);
766
		if (bracePositionForEnumConstantOption != null) {
766
		if (bracePositionForEnumConstantOption != null) {
767
			try {
767
			try {
768
				this.brace_position_for_enum_constant = (String) bracePositionForEnumConstantOption;
768
				this.brace_position_for_enum_constant = (String) bracePositionForEnumConstantOption;
769
			} catch(ClassCastException e) {
769
			} catch(ClassCastException e) {
770
				this.brace_position_for_enum_constant = CodeFormatterConstants.END_OF_LINE;
770
				this.brace_position_for_enum_constant = DefaultCodeFormatterConstants.END_OF_LINE;
771
			}
771
			}
772
		}
772
		}
773
		final Object bracePositionForEnumDeclarationOption = settings.get(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ENUM_DECLARATION);
773
		final Object bracePositionForEnumDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ENUM_DECLARATION);
774
		if (bracePositionForEnumDeclarationOption != null) {
774
		if (bracePositionForEnumDeclarationOption != null) {
775
			try {
775
			try {
776
				this.brace_position_for_enum_declaration = (String) bracePositionForEnumDeclarationOption;
776
				this.brace_position_for_enum_declaration = (String) bracePositionForEnumDeclarationOption;
777
			} catch(ClassCastException e) {
777
			} catch(ClassCastException e) {
778
				this.brace_position_for_enum_declaration = CodeFormatterConstants.END_OF_LINE;
778
				this.brace_position_for_enum_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
779
			}
779
			}
780
		}
780
		}
781
		final Object bracePositionForMethodDeclarationOption = settings.get(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION);
781
		final Object bracePositionForMethodDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION);
782
		if (bracePositionForMethodDeclarationOption != null) {
782
		if (bracePositionForMethodDeclarationOption != null) {
783
			try {
783
			try {
784
				this.brace_position_for_method_declaration = (String) bracePositionForMethodDeclarationOption;
784
				this.brace_position_for_method_declaration = (String) bracePositionForMethodDeclarationOption;
785
			} catch(ClassCastException e) {
785
			} catch(ClassCastException e) {
786
				this.brace_position_for_method_declaration = CodeFormatterConstants.END_OF_LINE;
786
				this.brace_position_for_method_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
787
			}
787
			}
788
		}
788
		}
789
		final Object bracePositionForSwitchOption = settings.get(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH);
789
		final Object bracePositionForSwitchOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH);
790
		if (bracePositionForSwitchOption != null) {
790
		if (bracePositionForSwitchOption != null) {
791
			try {
791
			try {
792
				this.brace_position_for_switch = (String) bracePositionForSwitchOption;
792
				this.brace_position_for_switch = (String) bracePositionForSwitchOption;
793
			} catch(ClassCastException e) {
793
			} catch(ClassCastException e) {
794
				this.brace_position_for_switch = CodeFormatterConstants.END_OF_LINE;
794
				this.brace_position_for_switch = DefaultCodeFormatterConstants.END_OF_LINE;
795
			}
795
			}
796
		}
796
		}
797
		final Object bracePositionForTypeDeclarationOption = settings.get(CodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION);
797
		final Object bracePositionForTypeDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION);
798
		if (bracePositionForTypeDeclarationOption != null) {
798
		if (bracePositionForTypeDeclarationOption != null) {
799
			try {
799
			try {
800
				this.brace_position_for_type_declaration = (String) bracePositionForTypeDeclarationOption;
800
				this.brace_position_for_type_declaration = (String) bracePositionForTypeDeclarationOption;
801
			} catch(ClassCastException e) {
801
			} catch(ClassCastException e) {
802
				this.brace_position_for_type_declaration = CodeFormatterConstants.END_OF_LINE;
802
				this.brace_position_for_type_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
803
			}
803
			}
804
		}
804
		}
805
		final Object continuationIndentationOption = settings.get(CodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION);
805
		final Object continuationIndentationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION);
806
		if (continuationIndentationOption != null) {
806
		if (continuationIndentationOption != null) {
807
			try {
807
			try {
808
				this.continuation_indentation = Integer.parseInt((String) continuationIndentationOption);
808
				this.continuation_indentation = Integer.parseInt((String) continuationIndentationOption);
Lines 812-818 Link Here
812
				this.continuation_indentation = 2;
812
				this.continuation_indentation = 2;
813
			}
813
			}
814
		}
814
		}
815
		final Object continuationIndentationForArrayInitializerOption = settings.get(CodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER);
815
		final Object continuationIndentationForArrayInitializerOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER);
816
		if (continuationIndentationForArrayInitializerOption != null) {
816
		if (continuationIndentationForArrayInitializerOption != null) {
817
			try {
817
			try {
818
				this.continuation_indentation_for_array_initializer = Integer.parseInt((String) continuationIndentationForArrayInitializerOption);
818
				this.continuation_indentation_for_array_initializer = Integer.parseInt((String) continuationIndentationForArrayInitializerOption);
Lines 962-1004 Link Here
962
//				this.comment_line_length = 80;
962
//				this.comment_line_length = 80;
963
//			}
963
//			}
964
//		}
964
//		}
965
		final Object indentStatementsCompareToBlockOption = settings.get(CodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK);
965
		final Object indentStatementsCompareToBlockOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK);
966
		if (indentStatementsCompareToBlockOption != null) {
966
		if (indentStatementsCompareToBlockOption != null) {
967
			this.indent_statements_compare_to_block = CodeFormatterConstants.TRUE.equals(indentStatementsCompareToBlockOption);
967
			this.indent_statements_compare_to_block = DefaultCodeFormatterConstants.TRUE.equals(indentStatementsCompareToBlockOption);
968
		}
968
		}
969
		final Object indentStatementsCompareToBodyOption = settings.get(CodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY);
969
		final Object indentStatementsCompareToBodyOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY);
970
		if (indentStatementsCompareToBodyOption != null) {
970
		if (indentStatementsCompareToBodyOption != null) {
971
			this.indent_statements_compare_to_body = CodeFormatterConstants.TRUE.equals(indentStatementsCompareToBodyOption);
971
			this.indent_statements_compare_to_body = DefaultCodeFormatterConstants.TRUE.equals(indentStatementsCompareToBodyOption);
972
		}
972
		}
973
		final Object indentBodyDeclarationsCompareToEnumConstantHeaderOption = settings.get(CodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_CONSTANT_HEADER);
973
		final Object indentBodyDeclarationsCompareToEnumConstantHeaderOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_CONSTANT_HEADER);
974
		if (indentBodyDeclarationsCompareToEnumConstantHeaderOption != null) {
974
		if (indentBodyDeclarationsCompareToEnumConstantHeaderOption != null) {
975
			this.indent_body_declarations_compare_to_enum_constant_header = CodeFormatterConstants.TRUE.equals(indentBodyDeclarationsCompareToEnumConstantHeaderOption);
975
			this.indent_body_declarations_compare_to_enum_constant_header = DefaultCodeFormatterConstants.TRUE.equals(indentBodyDeclarationsCompareToEnumConstantHeaderOption);
976
		}
976
		}
977
		final Object indentBodyDeclarationsCompareToEnumDeclarationHeaderOption = settings.get(CodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_DECLARATION_HEADER);
977
		final Object indentBodyDeclarationsCompareToEnumDeclarationHeaderOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_DECLARATION_HEADER);
978
		if (indentBodyDeclarationsCompareToEnumDeclarationHeaderOption != null) {
978
		if (indentBodyDeclarationsCompareToEnumDeclarationHeaderOption != null) {
979
			this.indent_body_declarations_compare_to_enum_declaration_header = CodeFormatterConstants.TRUE.equals(indentBodyDeclarationsCompareToEnumDeclarationHeaderOption);
979
			this.indent_body_declarations_compare_to_enum_declaration_header = DefaultCodeFormatterConstants.TRUE.equals(indentBodyDeclarationsCompareToEnumDeclarationHeaderOption);
980
		}
980
		}
981
		final Object indentBodyDeclarationsCompareToTypeHeaderOption = settings.get(CodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_TYPE_HEADER);
981
		final Object indentBodyDeclarationsCompareToTypeHeaderOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_TYPE_HEADER);
982
		if (indentBodyDeclarationsCompareToTypeHeaderOption != null) {
982
		if (indentBodyDeclarationsCompareToTypeHeaderOption != null) {
983
			this.indent_body_declarations_compare_to_type_header = CodeFormatterConstants.TRUE.equals(indentBodyDeclarationsCompareToTypeHeaderOption);
983
			this.indent_body_declarations_compare_to_type_header = DefaultCodeFormatterConstants.TRUE.equals(indentBodyDeclarationsCompareToTypeHeaderOption);
984
		}
984
		}
985
		final Object indentBreaksCompareToCasesOption = settings.get(CodeFormatterConstants.FORMATTER_INDENT_BREAKS_COMPARE_TO_CASES);
985
		final Object indentBreaksCompareToCasesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_BREAKS_COMPARE_TO_CASES);
986
		if (indentBreaksCompareToCasesOption != null) {
986
		if (indentBreaksCompareToCasesOption != null) {
987
			this.indent_breaks_compare_to_cases = CodeFormatterConstants.TRUE.equals(indentBreaksCompareToCasesOption);
987
			this.indent_breaks_compare_to_cases = DefaultCodeFormatterConstants.TRUE.equals(indentBreaksCompareToCasesOption);
988
		}
988
		}
989
		final Object indentEmptyLinesOption = settings.get(CodeFormatterConstants.FORMATTER_INDENT_EMPTY_LINES);
989
		final Object indentEmptyLinesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_EMPTY_LINES);
990
		if (indentEmptyLinesOption != null) {
990
		if (indentEmptyLinesOption != null) {
991
			this.indent_empty_lines = CodeFormatterConstants.TRUE.equals(indentEmptyLinesOption);
991
			this.indent_empty_lines = DefaultCodeFormatterConstants.TRUE.equals(indentEmptyLinesOption);
992
		}
992
		}
993
		final Object indentSwitchstatementsCompareToCasesOption = settings.get(CodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES);
993
		final Object indentSwitchstatementsCompareToCasesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES);
994
		if (indentSwitchstatementsCompareToCasesOption != null) {
994
		if (indentSwitchstatementsCompareToCasesOption != null) {
995
			this.indent_switchstatements_compare_to_cases = CodeFormatterConstants.TRUE.equals(indentSwitchstatementsCompareToCasesOption);
995
			this.indent_switchstatements_compare_to_cases = DefaultCodeFormatterConstants.TRUE.equals(indentSwitchstatementsCompareToCasesOption);
996
		}
996
		}
997
		final Object indentSwitchstatementsCompareToSwitchOption = settings.get(CodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH);
997
		final Object indentSwitchstatementsCompareToSwitchOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH);
998
		if (indentSwitchstatementsCompareToSwitchOption != null) {
998
		if (indentSwitchstatementsCompareToSwitchOption != null) {
999
			this.indent_switchstatements_compare_to_switch = CodeFormatterConstants.TRUE.equals(indentSwitchstatementsCompareToSwitchOption);
999
			this.indent_switchstatements_compare_to_switch = DefaultCodeFormatterConstants.TRUE.equals(indentSwitchstatementsCompareToSwitchOption);
1000
		}
1000
		}
1001
		final Object indentationSizeOption = settings.get(CodeFormatterConstants.FORMATTER_INDENTATION_SIZE);
1001
		final Object indentationSizeOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENTATION_SIZE);
1002
		if (indentationSizeOption != null) {
1002
		if (indentationSizeOption != null) {
1003
			try {
1003
			try {
1004
				this.indentation_size = Integer.parseInt((String) indentationSizeOption);
1004
				this.indentation_size = Integer.parseInt((String) indentationSizeOption);
Lines 1658-1664 Link Here
1658
//		if (putEmptyStatementOnNewLineOption != null) {
1658
//		if (putEmptyStatementOnNewLineOption != null) {
1659
//			this.put_empty_statement_on_new_line = CodeFormatterConstants.TRUE.equals(putEmptyStatementOnNewLineOption);
1659
//			this.put_empty_statement_on_new_line = CodeFormatterConstants.TRUE.equals(putEmptyStatementOnNewLineOption);
1660
//		}
1660
//		}
1661
		final Object tabSizeOption = settings.get(CodeFormatterConstants.FORMATTER_TAB_SIZE);
1661
		final Object tabSizeOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE);
1662
		if (tabSizeOption != null) {
1662
		if (tabSizeOption != null) {
1663
			try {
1663
			try {
1664
				this.tab_size = Integer.parseInt((String) tabSizeOption);
1664
				this.tab_size = Integer.parseInt((String) tabSizeOption);
Lines 1668-1678 Link Here
1668
				this.tab_size = 4;
1668
				this.tab_size = 4;
1669
			}
1669
			}
1670
		}
1670
		}
1671
		final Object useTabsOnlyForLeadingIndentationsOption = settings.get(CodeFormatterConstants.FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS);
1671
		final Object useTabsOnlyForLeadingIndentationsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS);
1672
		if (useTabsOnlyForLeadingIndentationsOption != null) {
1672
		if (useTabsOnlyForLeadingIndentationsOption != null) {
1673
			this.use_tabs_only_for_leading_indentations = CodeFormatterConstants.TRUE.equals(useTabsOnlyForLeadingIndentationsOption);
1673
			this.use_tabs_only_for_leading_indentations = DefaultCodeFormatterConstants.TRUE.equals(useTabsOnlyForLeadingIndentationsOption);
1674
		}
1674
		}
1675
		final Object pageWidthOption = settings.get(CodeFormatterConstants.FORMATTER_LINE_SPLIT);
1675
		final Object pageWidthOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT);
1676
		if (pageWidthOption != null) {
1676
		if (pageWidthOption != null) {
1677
			try {
1677
			try {
1678
				this.page_width = Integer.parseInt((String) pageWidthOption);
1678
				this.page_width = Integer.parseInt((String) pageWidthOption);
Lines 1682-1688 Link Here
1682
				this.page_width = 80;
1682
				this.page_width = 80;
1683
			}
1683
			}
1684
		}
1684
		}
1685
		final Object useTabOption = settings.get(CodeFormatterConstants.FORMATTER_TAB_CHAR);
1685
		final Object useTabOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR);
1686
		if (useTabOption != null) {
1686
		if (useTabOption != null) {
1687
			if (CCorePlugin.TAB.equals(useTabOption)) {
1687
			if (CCorePlugin.TAB.equals(useTabOption)) {
1688
				this.tab_char = TAB;
1688
				this.tab_char = TAB;
Lines 1716-1730 Link Here
1716
		this.alignment_for_throws_clause_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
1716
		this.alignment_for_throws_clause_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
1717
		this.alignment_for_throws_clause_in_method_declaration = Alignment.M_COMPACT_SPLIT;
1717
		this.alignment_for_throws_clause_in_method_declaration = Alignment.M_COMPACT_SPLIT;
1718
		this.align_type_members_on_columns = false;
1718
		this.align_type_members_on_columns = false;
1719
		this.brace_position_for_array_initializer = CodeFormatterConstants.END_OF_LINE;
1719
		this.brace_position_for_array_initializer = DefaultCodeFormatterConstants.END_OF_LINE;
1720
		this.brace_position_for_block = CodeFormatterConstants.END_OF_LINE;
1720
		this.brace_position_for_block = DefaultCodeFormatterConstants.END_OF_LINE;
1721
		this.brace_position_for_block_in_case = CodeFormatterConstants.END_OF_LINE;
1721
		this.brace_position_for_block_in_case = DefaultCodeFormatterConstants.END_OF_LINE;
1722
		this.brace_position_for_constructor_declaration = CodeFormatterConstants.END_OF_LINE;
1722
		this.brace_position_for_constructor_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
1723
		this.brace_position_for_enum_constant = CodeFormatterConstants.END_OF_LINE;
1723
		this.brace_position_for_enum_constant = DefaultCodeFormatterConstants.END_OF_LINE;
1724
		this.brace_position_for_enum_declaration = CodeFormatterConstants.END_OF_LINE;
1724
		this.brace_position_for_enum_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
1725
		this.brace_position_for_method_declaration = CodeFormatterConstants.END_OF_LINE;
1725
		this.brace_position_for_method_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
1726
		this.brace_position_for_type_declaration = CodeFormatterConstants.END_OF_LINE;
1726
		this.brace_position_for_type_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
1727
		this.brace_position_for_switch = CodeFormatterConstants.END_OF_LINE;
1727
		this.brace_position_for_switch = DefaultCodeFormatterConstants.END_OF_LINE;
1728
//		this.comment_clear_blank_lines = false;
1728
//		this.comment_clear_blank_lines = false;
1729
//		this.comment_format = true;
1729
//		this.comment_format = true;
1730
//		this.comment_format_header = false;
1730
//		this.comment_format_header = false;
Lines 1947-1961 Link Here
1947
		this.alignment_for_throws_clause_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
1947
		this.alignment_for_throws_clause_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
1948
		this.alignment_for_throws_clause_in_method_declaration = Alignment.M_COMPACT_SPLIT;
1948
		this.alignment_for_throws_clause_in_method_declaration = Alignment.M_COMPACT_SPLIT;
1949
		this.align_type_members_on_columns = false;
1949
		this.align_type_members_on_columns = false;
1950
		this.brace_position_for_array_initializer = CodeFormatterConstants.END_OF_LINE;
1950
		this.brace_position_for_array_initializer = DefaultCodeFormatterConstants.END_OF_LINE;
1951
		this.brace_position_for_block = CodeFormatterConstants.END_OF_LINE;
1951
		this.brace_position_for_block = DefaultCodeFormatterConstants.END_OF_LINE;
1952
		this.brace_position_for_block_in_case = CodeFormatterConstants.END_OF_LINE;
1952
		this.brace_position_for_block_in_case = DefaultCodeFormatterConstants.END_OF_LINE;
1953
		this.brace_position_for_constructor_declaration = CodeFormatterConstants.END_OF_LINE;
1953
		this.brace_position_for_constructor_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
1954
		this.brace_position_for_enum_constant = CodeFormatterConstants.END_OF_LINE;
1954
		this.brace_position_for_enum_constant = DefaultCodeFormatterConstants.END_OF_LINE;
1955
		this.brace_position_for_enum_declaration = CodeFormatterConstants.END_OF_LINE;
1955
		this.brace_position_for_enum_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
1956
		this.brace_position_for_method_declaration = CodeFormatterConstants.END_OF_LINE;
1956
		this.brace_position_for_method_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
1957
		this.brace_position_for_type_declaration = CodeFormatterConstants.END_OF_LINE;
1957
		this.brace_position_for_type_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
1958
		this.brace_position_for_switch = CodeFormatterConstants.END_OF_LINE;
1958
		this.brace_position_for_switch = DefaultCodeFormatterConstants.END_OF_LINE;
1959
//		this.comment_clear_blank_lines = false;
1959
//		this.comment_clear_blank_lines = false;
1960
//		this.comment_format = true;
1960
//		this.comment_format = true;
1961
//		this.comment_format_header = false;
1961
//		this.comment_format_header = false;
(-)src/org/eclipse/cdt/internal/core/CCorePreferenceInitializer.java (-2 / +2 lines)
Lines 17-23 Link Here
17
17
18
import org.eclipse.cdt.core.CCorePlugin;
18
import org.eclipse.cdt.core.CCorePlugin;
19
import org.eclipse.cdt.core.CCorePreferenceConstants;
19
import org.eclipse.cdt.core.CCorePreferenceConstants;
20
import org.eclipse.cdt.core.formatter.CodeFormatterConstants;
20
import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
21
import org.eclipse.cdt.internal.core.model.CModelManager;
21
import org.eclipse.cdt.internal.core.model.CModelManager;
22
//import org.eclipse.core.runtime.Preferences;
22
//import org.eclipse.core.runtime.Preferences;
23
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
23
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
Lines 35-41 Link Here
35
        HashSet optionNames = CModelManager.OptionNames;
35
        HashSet optionNames = CModelManager.OptionNames;
36
    
36
    
37
		// Formatter settings
37
		// Formatter settings
38
		Map defaultOptionsMap = CodeFormatterConstants.getEclipseDefaultSettings(); // code formatter defaults
38
		Map defaultOptionsMap = DefaultCodeFormatterConstants.getEclipseDefaultSettings(); // code formatter defaults
39
39
40
		// Compiler settings
40
		// Compiler settings
41
		defaultOptionsMap.put(CCorePreferenceConstants.TRANSLATION_TASK_TAGS, CCorePreferenceConstants.DEFAULT_TASK_TAG); 
41
		defaultOptionsMap.put(CCorePreferenceConstants.TRANSLATION_TASK_TAGS, CCorePreferenceConstants.DEFAULT_TASK_TAG); 
(-)src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterConstants.java (+3083 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 QNX Software Systems and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     QNX Software Systems - Initial API and implementation
10
 *     Sergey Prigogin, Google
11
 *******************************************************************************/
12
package org.eclipse.cdt.core.formatter;
13
14
import java.util.Map;
15
16
import org.eclipse.cdt.core.CCorePlugin;
17
import org.eclipse.cdt.internal.formatter.DefaultCodeFormatterOptions;
18
import org.eclipse.cdt.internal.formatter.align.Alignment;
19
20
/**
21
 */
22
public class DefaultCodeFormatterConstants {
23
24
	/**
25
	 * <pre>
26
	 * FORMATTER / Option for alignment of arguments in allocation expression
27
	 *     - option id:         "org.eclipse.cdt.core.formatter.language"
28
	 *     - possible values:   values proposed in class <code>ParserLanguage</code> 
29
	 *     - default:           ParserLanguage.CPP
30
	 * </pre>
31
	 */
32
	public static final String FORMATTER_LANGUAGE = CCorePlugin.PLUGIN_ID + ".formatter.language";	 //$NON-NLS-1$
33
	
34
	/**
35
	 * <pre>
36
	 * FORMATTER / Option for alignment of arguments in allocation expression
37
	 *     - option id:         "org.eclipse.cdt.core.formatter.current_file"
38
	 *     - possible values:   object of class <code>IFile</code> or <code>null</code> 
39
	 *     - default:           null
40
	 * </pre>
41
	 */
42
	public static final String FORMATTER_CURRENT_FILE = CCorePlugin.PLUGIN_ID + ".formatter.current_file";	 //$NON-NLS-1$
43
	
44
	/**
45
	 * <pre>
46
	 * FORMATTER / Value to set a brace location at the end of a line.
47
	 * </pre>
48
	 * @see #FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION
49
	 * @see #FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER
50
	 * @see #FORMATTER_BRACE_POSITION_FOR_BLOCK
51
	 * @see #FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION
52
 	 * @see #FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION
53
 	 * @see #FORMATTER_BRACE_POSITION_FOR_SWITCH
54
	 * @see #FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION
55
	 */
56
	public static final String END_OF_LINE = "end_of_line";	//$NON-NLS-1$
57
58
	/**
59
	 * <pre>
60
	 * FORMATTER / Value to set an option to false.
61
	 * </pre>
62
	 */
63
	public static final String FALSE = "false"; //$NON-NLS-1$
64
	
65
	/**
66
	 * <pre>
67
	 * FORMATTER / Option to align type members of a type declaration on column
68
	 *     - option id:         "org.eclipse.cdt.core.formatter.formatter.align_type_members_on_columns"
69
	 *     - possible values:   { TRUE, FALSE }
70
	 *     - default:           FALSE
71
	 * </pre>
72
	 * @see #TRUE
73
	 * @see #FALSE
74
	 */
75
	public static final String FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS = CCorePlugin.PLUGIN_ID + ".formatter.align_type_members_on_columns";	 //$NON-NLS-1$
76
77
	/**
78
	 * <pre>
79
	 * FORMATTER / Option for alignment of arguments in allocation expression
80
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_allocation_expression"
81
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
82
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
83
	 * </pre>
84
	 * @see #createAlignmentValue(boolean, int, int)
85
	 */
86
	public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_arguments_in_allocation_expression";	 //$NON-NLS-1$
87
	/**
88
	 * <pre>
89
	 * FORMATTER / Option for alignment of arguments in enum constant
90
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_enum_constant"
91
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
92
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
93
	 * </pre>
94
	 * @see #createAlignmentValue(boolean, int, int)
95
	 */
96
	public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_arguments_in_enum_constant";	 //$NON-NLS-1$
97
	/**
98
	 * <pre>
99
	 * FORMATTER / Option for alignment of arguments in explicit constructor call
100
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call"
101
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
102
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
103
	 * </pre>
104
	 * @see #createAlignmentValue(boolean, int, int)
105
	 */
106
	public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_EXPLICIT_CONSTRUCTOR_CALL = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_arguments_in_explicit_constructor_call";	 //$NON-NLS-1$
107
	/**
108
	 * <pre>
109
	 * FORMATTER / Option for alignment of arguments in method invocation
110
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation"
111
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
112
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
113
	 * </pre>
114
	 * @see #createAlignmentValue(boolean, int, int)
115
	 */
116
	public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_arguments_in_method_invocation";	 //$NON-NLS-1$
117
	/**
118
	 * <pre>
119
	 * FORMATTER / Option for alignment of arguments in qualified allocation expression
120
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression"
121
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
122
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
123
	 * </pre>
124
	 * @see #createAlignmentValue(boolean, int, int)
125
	 */
126
	public static final String FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_QUALIFIED_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_arguments_in_qualified_allocation_expression";	 //$NON-NLS-1$
127
	/**
128
	 * <pre>
129
	 * FORMATTER / Option for alignment of assignment
130
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_assignment"
131
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
132
	 *     - default:           createAlignmentValue(false, M_NO_ALIGNMENT, INDENT_DEFAULT)
133
	 * </pre>
134
	 * @see #createAlignmentValue(boolean, int, int)
135
	 */
136
	public static final String FORMATTER_ALIGNMENT_FOR_ASSIGNMENT  = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_assignment";	 //$NON-NLS-1$
137
	/**
138
	 * <pre>
139
	 * FORMATTER / Option for alignment of binary expression
140
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_binary_expression"
141
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
142
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
143
	 * </pre>
144
	 * @see #createAlignmentValue(boolean, int, int)
145
	 */
146
	public static final String FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_binary_expression";	 //$NON-NLS-1$
147
	/**
148
	 * <pre>
149
	 * FORMATTER / Option for alignment of compact if
150
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_compact_if"
151
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
152
	 *     - default:           createAlignmentValue(false, WRAP_ONE_PER_LINE, INDENT_BY_ONE)
153
	 * </pre>
154
	 * @see #createAlignmentValue(boolean, int, int)
155
	 */
156
	public static final String FORMATTER_ALIGNMENT_FOR_COMPACT_IF = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_compact_if";	 //$NON-NLS-1$
157
	/**
158
	 * <pre>
159
	 * FORMATTER / Option for alignment of conditional expression
160
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_conditional_expression"
161
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
162
	 *     - default:           createAlignmentValue(false, WRAP_ONE_PER_LINE, INDENT_DEFAULT)
163
	 * </pre>
164
	 * @see #createAlignmentValue(boolean, int, int)
165
	 */
166
	public static final String FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_conditional_expression";	 //$NON-NLS-1$
167
	/**
168
	 * <pre>
169
	 * FORMATTER / Option for alignment of enum constants
170
	 *     - option id:        "org.eclipse.cdt.core.formatter.alignment_for_enum_constants"
171
	 *     - possible values:  values returned by <code>createAlignmentValue(boolean, int, int)</code> call
172
	 *     - default:          createAlignmentValue(false, WRAP_NO_SPLIT, INDENT_DEFAULT)
173
	 * </pre>
174
	 * @see #createAlignmentValue(boolean, int, int)
175
	 */
176
	public static final String FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_enum_constants";	 //$NON-NLS-1$
177
	/**
178
	 * <pre>
179
	 * FORMATTER / Option for alignment of expressions in array initializer
180
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer"
181
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
182
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
183
	 * </pre>
184
	 * @see #createAlignmentValue(boolean, int, int)
185
	 */
186
	public static final String FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_expressions_in_array_initializer";	 //$NON-NLS-1$
187
	/**
188
	 * <pre>
189
	 * FORMATTER / Option for alignment of multiple fields
190
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_multiple_fields"
191
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
192
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
193
	 * </pre>
194
	 * @see #createAlignmentValue(boolean, int, int)
195
	 */
196
	public static final String FORMATTER_ALIGNMENT_FOR_MULTIPLE_FIELDS = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_multiple_fields";//$NON-NLS-1$	
197
	/**
198
	 * <pre>
199
	 * FORMATTER / Option for alignment of parameters in constructor declaration
200
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_parameters_in_constructor_declaration"
201
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
202
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
203
	 * </pre>
204
	 * @see #createAlignmentValue(boolean, int, int)
205
	 */
206
	public static final String FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_parameters_in_constructor_declaration";	 //$NON-NLS-1$
207
	/**
208
	 * <pre>
209
	 * FORMATTER / Option for alignment of parameters in method declaration
210
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration"
211
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
212
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
213
	 * </pre>
214
	 * @see #createAlignmentValue(boolean, int, int)
215
	 */
216
	public static final String FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_parameters_in_method_declaration";	 //$NON-NLS-1$
217
	/**
218
	 * <pre>
219
	 * FORMATTER / Option for alignment of selector in method invocation
220
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_selector_in_method_invocation"
221
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
222
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
223
	 * </pre>
224
	 * @see #createAlignmentValue(boolean, int, int)
225
	 */
226
	public static final String FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_selector_in_method_invocation";	 //$NON-NLS-1$
227
	/**
228
	 * <pre>
229
	 * FORMATTER / Option for alignment of superclass in type declaration
230
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_superclass_in_type_declaration"
231
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
232
	 *     - default:           createAlignmentValue(false, WRAP_NEXT_SHIFTED, INDENT_DEFAULT)
233
	 * </pre>
234
	 * @see #createAlignmentValue(boolean, int, int)
235
	 */
236
	public static final String FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_superclass_in_type_declaration";	 //$NON-NLS-1$
237
	/**
238
	 * <pre>
239
	 * FORMATTER / Option for alignment of superinterfaces in enum declaration
240
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration"
241
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
242
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
243
	 * </pre>
244
	 * @see #createAlignmentValue(boolean, int, int)
245
	 */
246
	public static final String FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_ENUM_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_superinterfaces_in_enum_declaration";	 //$NON-NLS-1$
247
	/**
248
	 * <pre>
249
	 * FORMATTER / Option for alignment of superinterfaces in type declaration
250
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_superinterfaces_in_type_declaration"
251
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
252
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
253
	 * </pre>
254
	 * @see #createAlignmentValue(boolean, int, int)
255
	 */
256
	public static final String FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_superinterfaces_in_type_declaration";	 //$NON-NLS-1$
257
	/**
258
	 * <pre>
259
	 * FORMATTER / Option for alignment of throws clause in constructor declaration
260
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration"
261
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
262
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
263
	 * </pre>
264
	 * @see #createAlignmentValue(boolean, int, int)
265
	 */
266
	public static final String FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_throws_clause_in_constructor_declaration";	 //$NON-NLS-1$
267
	/**
268
	 * <pre>
269
	 * FORMATTER / Option for alignment of throws clause in method declaration
270
	 *     - option id:         "org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration"
271
	 *     - possible values:   values returned by <code>createAlignmentValue(boolean, int, int)</code> call
272
	 *     - default:           createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
273
	 * </pre>
274
	 * @see #createAlignmentValue(boolean, int, int)
275
	 */
276
	public static final String FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_throws_clause_in_method_declaration";	 //$NON-NLS-1$
277
278
//	/**
279
//	 * <pre>
280
//	 * FORMATTER / Option to add blank lines after the imports declaration
281
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_after_imports"
282
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
283
//	 *     - default:           "0"
284
//	 * </pre>
285
//	 */
286
//	public static final String FORMATTER_BLANK_LINES_AFTER_IMPORTS = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_after_imports";	//$NON-NLS-1$
287
//	/**
288
//	 * <pre>
289
//	 * FORMATTER / Option to add blank lines after the package declaration
290
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_after_package"
291
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
292
//	 *     - default:           "0"
293
//	 * </pre>
294
//	 */
295
//	public static final String FORMATTER_BLANK_LINES_AFTER_PACKAGE = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_after_package";	//$NON-NLS-1$
296
//	/**
297
//	 * <pre>
298
//	 * FORMATTER / Option to add blank lines at the beginning of the method body
299
//	 *     - option id:         "org.eclipse.cdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body"
300
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
301
//	 *     - default:           "0"
302
//	 * </pre>
303
//	 */
304
//	public static final String FORMATTER_BLANK_LINES_AT_BEGINNING_OF_METHOD_BODY = CCorePlugin.PLUGIN_ID + ".formatter.number_of_blank_lines_at_beginning_of_method_body"; //$NON-NLS-1$
305
//	/**
306
//	 * <pre>
307
//	 * FORMATTER / Option to add blank lines before a field declaration
308
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_before_field"
309
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
310
//	 *     - default:           "0"
311
//	 * </pre>
312
//	 */
313
//	public static final String FORMATTER_BLANK_LINES_BEFORE_FIELD = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_field";	//$NON-NLS-1$
314
//	/**
315
//	 * <pre>
316
//	 * FORMATTER / Option to add blank lines before the first class body declaration
317
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_before_first_class_body_declaration"
318
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
319
//	 *     - default:           "0"
320
//	 * </pre>
321
//	 */
322
//	public static final String FORMATTER_BLANK_LINES_BEFORE_FIRST_CLASS_BODY_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_first_class_body_declaration";	//$NON-NLS-1$
323
//	/**
324
//	 * <pre>
325
//	 * FORMATTER / Option to add blank lines before the imports declaration
326
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_before_imports"
327
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
328
//	 *     - default:           "0"
329
//	 * </pre>
330
//	 */
331
//	public static final String FORMATTER_BLANK_LINES_BEFORE_IMPORTS = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_imports";	//$NON-NLS-1$
332
//	/**
333
//	 * <pre>
334
//	 * FORMATTER / Option to add blank lines before a member type declaration
335
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_before_member_type"
336
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
337
//	 *     - default:           "0"
338
//	 * </pre>
339
//	 */
340
//	public static final String FORMATTER_BLANK_LINES_BEFORE_MEMBER_TYPE = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_member_type";	//$NON-NLS-1$
341
//	/**
342
//	 * <pre>
343
//	 * FORMATTER / Option to add blank lines before a method declaration
344
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_before_method"
345
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
346
//	 *     - default:           "0"
347
//	 * </pre>
348
//	 */
349
//	public static final String FORMATTER_BLANK_LINES_BEFORE_METHOD = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_method";	//$NON-NLS-1$
350
//	/**
351
//	 * <pre>
352
//	 * FORMATTER / Option to add blank lines before a new chunk
353
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_before_new_chunk"
354
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
355
//	 *     - default:           "0"
356
//	 * </pre>
357
//	 */
358
//	public static final String FORMATTER_BLANK_LINES_BEFORE_NEW_CHUNK = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_new_chunk";	//$NON-NLS-1$
359
//	/**
360
//	 * <pre>
361
//	 * FORMATTER / Option to add blank lines before the package declaration
362
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_before_package"
363
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
364
//	 *     - default:           "0"
365
//	 * </pre>
366
//	 */
367
//	public static final String FORMATTER_BLANK_LINES_BEFORE_PACKAGE = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_before_package";	//$NON-NLS-1$
368
//	/**
369
//	 * <pre>
370
//	 * FORMATTER / Option to add blank lines between type declarations
371
//	 *     - option id:         "org.eclipse.cdt.core.formatter.blank_lines_between_type_declarations"
372
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
373
//	 *     - default:           "0"
374
//	 * </pre>
375
//	 */
376
//	public static final String FORMATTER_BLANK_LINES_BETWEEN_TYPE_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.blank_lines_between_type_declarations";	//$NON-NLS-1$
377
378
	/**
379
	 * <pre>
380
	 * FORMATTER / Option to position the braces of an annotation type declaration
381
	 *     - option id:         "org.eclipse.cdt.core.formatter.brace_position_for_annotation_type_declaration"
382
	 *     - possible values:   { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
383
	 *     - default:           END_OF_LINE
384
	 * </pre>
385
	 * @see #END_OF_LINE
386
	 * @see #NEXT_LINE
387
	 * @see #NEXT_LINE_SHIFTED
388
	 * @see #NEXT_LINE_ON_WRAP
389
	 */
390
	public static final String FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_array_initializer";	//$NON-NLS-1$
391
	/**
392
	 * <pre>
393
	 * FORMATTER / Option to position the braces of a block
394
	 *     - option id:         "org.eclipse.cdt.core.formatter.brace_position_for_block"
395
	 *     - possible values:   { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
396
	 *     - default:           END_OF_LINE
397
	 * </pre>
398
	 * @see #END_OF_LINE
399
	 * @see #NEXT_LINE
400
	 * @see #NEXT_LINE_SHIFTED
401
	 * @see #NEXT_LINE_ON_WRAP
402
	 */
403
	public static final String FORMATTER_BRACE_POSITION_FOR_BLOCK = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_block";	//$NON-NLS-1$
404
	/**
405
	 * <pre>
406
	 * FORMATTER / Option to position the braces of a block in a case statement when the block is the first statement following
407
	 *             the case
408
	 *     - option id:         "org.eclipse.cdt.core.formatter.brace_position_for_block_in_case"
409
	 *     - possible values:   { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
410
	 *     - default:           END_OF_LINE
411
	 * </pre>
412
	 * @see #END_OF_LINE
413
	 * @see #NEXT_LINE
414
	 * @see #NEXT_LINE_SHIFTED
415
	 * @see #NEXT_LINE_ON_WRAP
416
	 */
417
	public static final String FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_block_in_case";	//$NON-NLS-1$
418
	/**
419
	 * <pre>
420
	 * FORMATTER / Option to position the braces of a constructor declaration
421
	 *     - option id:         "org.eclipse.cdt.core.formatter.brace_position_for_constructor_declaration"
422
	 *     - possible values:   { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
423
	 *     - default:           END_OF_LINE
424
	 * </pre>
425
	 * @see #END_OF_LINE
426
	 * @see #NEXT_LINE
427
	 * @see #NEXT_LINE_SHIFTED
428
	 * @see #NEXT_LINE_ON_WRAP
429
	 */
430
	public static final String FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_constructor_declaration";	//$NON-NLS-1$
431
	/**
432
	 * <pre>
433
	 * FORMATTER / Option to position the braces of an enum constant
434
	 *     - option id:         "org.eclipse.cdt.core.formatter.brace_position_for_enum_constant"
435
	 *     - possible values:   { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
436
	 *     - default:           END_OF_LINE
437
	 * </pre>
438
	 * @see #END_OF_LINE
439
	 * @see #NEXT_LINE
440
	 * @see #NEXT_LINE_SHIFTED
441
	 * @see #NEXT_LINE_ON_WRAP
442
	 */
443
	public static final String FORMATTER_BRACE_POSITION_FOR_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_enum_constant";	//$NON-NLS-1$
444
	/**
445
	 * <pre>
446
	 * FORMATTER / Option to position the braces of an enum declaration
447
	 *     - option id:         "org.eclipse.cdt.core.formatter.brace_position_for_enum_declaration"
448
	 *     - possible values:   { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
449
	 *     - default:           END_OF_LINE
450
	 * </pre>
451
	 * @see #END_OF_LINE
452
	 * @see #NEXT_LINE
453
	 * @see #NEXT_LINE_SHIFTED
454
	 * @see #NEXT_LINE_ON_WRAP
455
	 */
456
	public static final String FORMATTER_BRACE_POSITION_FOR_ENUM_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_enum_declaration";	//$NON-NLS-1$
457
	/**
458
	 * <pre>
459
	 * FORMATTER / Option to position the braces of a method declaration
460
	 *     - option id:         "org.eclipse.cdt.core.formatter.brace_position_for_method_declaration"
461
	 *     - possible values:   { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
462
	 *     - default:           END_OF_LINE
463
	 * </pre>
464
	 * @see #END_OF_LINE
465
	 * @see #NEXT_LINE
466
	 * @see #NEXT_LINE_SHIFTED
467
	 * @see #NEXT_LINE_ON_WRAP
468
	 */
469
	public static final String FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_method_declaration";	//$NON-NLS-1$
470
	/**
471
	 * <pre>
472
	 * FORMATTER / Option to position the braces of a switch statement
473
	 *     - option id:         "org.eclipse.cdt.core.formatter.brace_position_for_switch"
474
	 *     - possible values:   { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
475
	 *     - default:           END_OF_LINE
476
	 * </pre>
477
	 * @see #END_OF_LINE
478
	 * @see #NEXT_LINE
479
	 * @see #NEXT_LINE_SHIFTED
480
	 * @see #NEXT_LINE_ON_WRAP
481
	 */
482
	public static final String FORMATTER_BRACE_POSITION_FOR_SWITCH = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_switch";	//$NON-NLS-1$
483
	/**
484
	 * <pre>
485
	 * FORMATTER / Option to position the braces of a type declaration
486
	 *     - option id:         "org.eclipse.cdt.core.formatter.brace_position_for_type_declaration"
487
	 *     - possible values:   { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP }
488
	 *     - default:           END_OF_LINE
489
	 * </pre>
490
	 * @see #END_OF_LINE
491
	 * @see #NEXT_LINE
492
	 * @see #NEXT_LINE_SHIFTED
493
	 * @see #NEXT_LINE_ON_WRAP
494
	 */
495
	public static final String FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.brace_position_for_type_declaration";	//$NON-NLS-1$
496
497
	/**
498
	 * <pre>
499
	 * FORMATTER / Option to control whether blank lines are cleared inside comments
500
	 *     - option id:         "org.eclipse.cdt.core.formatter.comment.clear_blank_lines"
501
	 *     - possible values:   { TRUE, FALSE }
502
	 *     - default:           FALSE
503
	 * </pre>
504
	 * @see #TRUE
505
	 * @see #FALSE
506
	 */	
507
	public final static String FORMATTER_COMMENT_CLEAR_BLANK_LINES = CCorePlugin.PLUGIN_ID + ".formatter.comment.clear_blank_lines"; //$NON-NLS-1$
508
	
509
	/**
510
	 * <pre>
511
	 * FORMATTER / Option to control whether comments are formatted
512
	 *     - option id:         "org.eclipse.cdt.core.formatter.comment.format_comments"
513
	 *     - possible values:   { TRUE, FALSE }
514
	 *     - default:           TRUE
515
	 * </pre>
516
	 * @see #TRUE
517
	 * @see #FALSE
518
	 */	
519
	public final static String FORMATTER_COMMENT_FORMAT = CCorePlugin.PLUGIN_ID + ".formatter.comment.format_comments"; //$NON-NLS-1$
520
521
	/**
522
	 * <pre>
523
	 * FORMATTER / Option to control whether the header comment of a C/C++ source file is formatted
524
	 *     - option id:         "org.eclipse.cdt.core.formatter.comment.format_header"
525
	 *     - possible values:   { TRUE, FALSE }
526
	 *     - default:           FALSE
527
	 * </pre>
528
	 * @see #TRUE
529
	 * @see #FALSE
530
	 */	
531
	public final static String FORMATTER_COMMENT_FORMAT_HEADER = CCorePlugin.PLUGIN_ID + ".formatter.comment.format_header"; //$NON-NLS-1$
532
533
	/**
534
	 * <pre>
535
	 * FORMATTER / Option to control whether code snippets are formatted in comments
536
	 *     - option id:         "org.eclipse.cdt.core.formatter.comment.format_source_code"
537
	 *     - possible values:   { TRUE, FALSE }
538
	 *     - default:           TRUE
539
	 * </pre>
540
	 * @see #TRUE
541
	 * @see #FALSE
542
	 */	
543
	public final static String FORMATTER_COMMENT_FORMAT_SOURCE = CCorePlugin.PLUGIN_ID + ".formatter.comment.format_source_code"; //$NON-NLS-1$
544
	
545
	/**
546
	 * <pre>
547
	 * FORMATTER / Option to specify the line length for comments.
548
	 *     - option id:         "org.eclipse.cdt.core.formatter.comment.line_length"
549
	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
550
	 *     - default:           "80"
551
	 * </pre>
552
	 */	
553
	public final static String FORMATTER_COMMENT_LINE_LENGTH = CCorePlugin.PLUGIN_ID + ".formatter.comment.line_length"; //$NON-NLS-1$
554
555
//	/**
556
//	 * <pre>
557
//	 * FORMATTER / Option to compact else/if
558
//	 *     - option id:         "org.eclipse.cdt.core.formatter.compact_else_if"
559
//	 *     - possible values:   { TRUE, FALSE }
560
//	 *     - default:           TRUE
561
//	 * </pre>
562
//	 * @see #TRUE
563
//	 * @see #FALSE
564
//	 */
565
//	public static final String FORMATTER_COMPACT_ELSE_IF = CCorePlugin.PLUGIN_ID + ".formatter.compact_else_if";	//$NON-NLS-1$
566
567
	/**
568
	 * <pre>
569
	 * FORMATTER / Option to set the continuation indentation
570
	 *     - option id:         "org.eclipse.cdt.core.formatter.continuation_indentation"
571
	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
572
	 *     - default:           "2"
573
	 * </pre>
574
	 */
575
	public static final String FORMATTER_CONTINUATION_INDENTATION = CCorePlugin.PLUGIN_ID + ".formatter.continuation_indentation";	//$NON-NLS-1$
576
	/**
577
	 * <pre>
578
	 * FORMATTER / Option to set the continuation indentation inside array initializer
579
	 *     - option id:         "org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer"
580
	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
581
	 *     - default:           "2"
582
	 * </pre>
583
	 */
584
	public static final String FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.continuation_indentation_for_array_initializer";	//$NON-NLS-1$
585
	/**
586
	 * <pre>
587
	 * FORMATTER / Option to indent body declarations compare to its enclosing annotation declaration header
588
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header"
589
	 *     - possible values:   { TRUE, FALSE }
590
	 *     - default:           TRUE
591
	 * </pre>
592
	 * @see #TRUE
593
	 * @see #FALSE
594
	 */
595
	public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ANNOTATION_DECLARATION_HEADER = CCorePlugin.PLUGIN_ID + ".formatter.indent_body_declarations_compare_to_annotation_declaration_header";	//$NON-NLS-1$
596
	/**
597
	 * <pre>
598
	 * FORMATTER / Option to indent body declarations compare to its enclosing enum constant header
599
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header"
600
	 *     - possible values:   { TRUE, FALSE }
601
	 *     - default:           TRUE
602
	 * </pre>
603
	 * @see #TRUE
604
	 * @see #FALSE
605
	 */
606
	public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_CONSTANT_HEADER = CCorePlugin.PLUGIN_ID + ".formatter.indent_body_declarations_compare_to_enum_constant_header";	//$NON-NLS-1$
607
	/**
608
	 * <pre>
609
	 * FORMATTER / Option to indent body declarations compare to its enclosing enum declaration header
610
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header"
611
	 *     - possible values:   { TRUE, FALSE }
612
	 *     - default:           TRUE
613
	 * </pre>
614
	 * @see #TRUE
615
	 * @see #FALSE
616
	 */
617
	public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_DECLARATION_HEADER = CCorePlugin.PLUGIN_ID + ".formatter.indent_body_declarations_compare_to_enum_declaration_header";	//$NON-NLS-1$
618
	/**
619
	 * <pre>
620
	 * FORMATTER / Option to indent body declarations compare to its enclosing type header
621
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_type_header"
622
	 *     - possible values:   { TRUE, FALSE }
623
	 *     - default:           TRUE
624
	 * </pre>
625
	 * @see #TRUE
626
	 * @see #FALSE
627
	 */
628
	public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_TYPE_HEADER = CCorePlugin.PLUGIN_ID + ".formatter.indent_body_declarations_compare_to_type_header";	//$NON-NLS-1$
629
	/**
630
	 * <pre>
631
	 * FORMATTER / Option to indent breaks compare to cases
632
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases"
633
	 *     - possible values:   { TRUE, FALSE }
634
	 *     - default:           TRUE
635
	 * </pre>
636
	 * @see #TRUE
637
	 * @see #FALSE
638
	 */
639
	public static final String FORMATTER_INDENT_BREAKS_COMPARE_TO_CASES = CCorePlugin.PLUGIN_ID + ".formatter.indent_breaks_compare_to_cases";	//$NON-NLS-1$
640
	/**
641
	 * <pre>
642
	 * FORMATTER / Option to indent empty lines
643
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_empty_lines"
644
	 *     - possible values:   { TRUE, FALSE }
645
	 *     - default:           FALSE
646
	 * </pre>
647
	 * @see #TRUE
648
	 * @see #FALSE
649
	 */
650
	public static final String FORMATTER_INDENT_EMPTY_LINES = CCorePlugin.PLUGIN_ID + ".formatter.indent_empty_lines"; //$NON-NLS-1$	
651
	/**
652
	 * <pre>
653
	 * FORMATTER / Option to indent statements inside a block
654
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_statements_compare_to_block"
655
	 *     - possible values:   { TRUE, FALSE }
656
	 *     - default:           TRUE
657
	 * </pre>
658
	 * @see #TRUE
659
	 * @see #FALSE
660
	 */
661
	public static final String FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK = CCorePlugin.PLUGIN_ID + ".formatter.indent_statements_compare_to_block"; //$NON-NLS-1$
662
	/**
663
	 * <pre>
664
	 * FORMATTER / Option to indent statements inside the body of a method or a constructor
665
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_statements_compare_to_body"
666
	 *     - possible values:   { TRUE, FALSE }
667
	 *     - default:           TRUE
668
	 * </pre>
669
	 * @see #TRUE
670
	 * @see #FALSE
671
	 */
672
	public static final String FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY = CCorePlugin.PLUGIN_ID + ".formatter.indent_statements_compare_to_body"; //$NON-NLS-1$
673
	/**
674
	 * <pre>
675
	 * FORMATTER / Option to indent switch statements compare to cases
676
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases"
677
	 *     - possible values:   { TRUE, FALSE }
678
	 *     - default:           TRUE
679
	 * </pre>
680
	 * @see #TRUE
681
	 * @see #FALSE
682
	 */
683
	public static final String FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES = CCorePlugin.PLUGIN_ID + ".formatter.indent_switchstatements_compare_to_cases";	//$NON-NLS-1$
684
	/**
685
	 * <pre>
686
	 * FORMATTER / Option to indent switch statements compare to switch
687
	 *     - option id:         "org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch"
688
	 *     - possible values:   { TRUE, FALSE }
689
	 *     - default:           TRUE
690
	 * </pre>
691
	 * @see #TRUE
692
	 * @see #FALSE
693
	 */
694
	public static final String FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH = CCorePlugin.PLUGIN_ID + ".formatter.indent_switchstatements_compare_to_switch";	//$NON-NLS-1$
695
696
	/**
697
	 * <pre>
698
	 * FORMATTER / Option to specify the equivalent number of spaces that represents one indentation 
699
	 *     - option id:         "org.eclipse.cdt.core.formatter.indentation.size"
700
	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
701
	 *     - default:           "4"
702
	 * </pre>
703
	 * <p>This option is used only if the tab char is set to MIXED.
704
	 * </p>
705
	 * @see #FORMATTER_TAB_CHAR
706
	 */
707
	public static final String FORMATTER_INDENTATION_SIZE = CCorePlugin.PLUGIN_ID + ".formatter.indentation.size"; //$NON-NLS-1$
708
709
//	/**
710
//	 * <pre>
711
//	 * FORMATTER / Option to insert a new line after an annotation
712
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_after_annotation"
713
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
714
//	 *     - default:           INSERT
715
//	 * </pre>
716
//	 * @see CCorePlugin#INSERT
717
//	 * @see CCorePlugin#DO_NOT_INSERT
718
//	 */
719
//	public static final String FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_after_annotation";//$NON-NLS-1$
720
//
721
//	/**
722
//	 * <pre>
723
//	 * FORMATTER / Option to insert a new line after the opening brace in an array initializer
724
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer"
725
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
726
//	 *     - default:           DO_NOT_INSERT
727
//	 * </pre>
728
//	 * @see CCorePlugin#INSERT
729
//	 * @see CCorePlugin#DO_NOT_INSERT
730
//	 */
731
//	public static final String FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_after_opening_brace_in_array_initializer";//$NON-NLS-1$
732
//
733
//	/**
734
//	 * <pre>
735
//	 * FORMATTER / Option to insert a new line at the end of the current file if missing
736
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing"
737
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
738
//	 *     - default:           DO_NOT_INSERT
739
//	 * </pre>
740
//	 * @see CCorePlugin#INSERT
741
//	 * @see CCorePlugin#DO_NOT_INSERT
742
//	 */
743
//	public static final String FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_at_end_of_file_if_missing";//$NON-NLS-1$
744
//	/**
745
//	 * <pre>
746
//	 * FORMATTER / Option to insert a new line before the catch keyword in try statement
747
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement"
748
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
749
//	 *     - default:           DO_NOT_INSERT
750
//	 * </pre>
751
//	 * @see CCorePlugin#INSERT
752
//	 * @see CCorePlugin#DO_NOT_INSERT
753
//	 */
754
//	public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_before_catch_in_try_statement";	//$NON-NLS-1$
755
//	/**
756
//	 * <pre>
757
//	 * FORMATTER / Option to insert a new line before the closing brace in an array initializer
758
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer"
759
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
760
//	 *     - default:           DO_NOT_INSERT
761
//	 * </pre>
762
//	 * @see CCorePlugin#INSERT
763
//	 * @see CCorePlugin#DO_NOT_INSERT
764
//	 */
765
//	public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_before_closing_brace_in_array_initializer";//$NON-NLS-1$
766
//	/**
767
//	 * <pre>
768
//	 * FORMATTER / Option to insert a new line before the else keyword in if statement
769
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement"
770
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
771
//	 *     - default:           DO_NOT_INSERT
772
//	 * </pre>
773
//	 * @see CCorePlugin#INSERT
774
//	 * @see CCorePlugin#DO_NOT_INSERT
775
//	 */
776
//	public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_before_else_in_if_statement";	//$NON-NLS-1$
777
//	/**
778
//	 * <pre>
779
//	 * FORMATTER / Option to insert a new line before the finally keyword in try statement
780
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_before_finally_in_try_statement"
781
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
782
//	 *     - default:           DO_NOT_INSERT
783
//	 * </pre>
784
//	 * @see CCorePlugin#INSERT
785
//	 * @see CCorePlugin#DO_NOT_INSERT
786
//	 */
787
//	public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_before_finally_in_try_statement";	//$NON-NLS-1$
788
//	/**
789
//	 * <pre>
790
//	 * FORMATTER / Option to insert a new line before while in do statement
791
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement"
792
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
793
//	 *     - default:           DO_NOT_INSERT
794
//	 * </pre>
795
//	 * @see CCorePlugin#INSERT
796
//	 * @see CCorePlugin#DO_NOT_INSERT
797
//	 */
798
//	public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_before_while_in_do_statement";	//$NON-NLS-1$
799
//	/**
800
//	 * <pre>
801
//	 * FORMATTER / Option to insert a new line in an empty annotation declaration
802
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_annotation_declaration"
803
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
804
//	 *     - default:           INSERT
805
//	 * </pre>
806
//	 * @see CCorePlugin#INSERT
807
//	 * @see CCorePlugin#DO_NOT_INSERT
808
//	 */
809
//	public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ANNOTATION_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_annotation_declaration";	//$NON-NLS-1$
810
//	/**
811
//	 * <pre>
812
//	 * FORMATTER / Option to insert a new line in an empty anonymous type declaration
813
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration"
814
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
815
//	 *     - default:           INSERT
816
//	 * </pre>
817
//	 * @see CCorePlugin#INSERT
818
//	 * @see CCorePlugin#DO_NOT_INSERT
819
//	 */
820
//	public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ANONYMOUS_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_anonymous_type_declaration";	//$NON-NLS-1$
821
//	/**
822
//	 * <pre>
823
//	 * FORMATTER / Option to insert a new line in an empty block
824
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block"
825
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
826
//	 *     - default:           INSERT
827
//	 * </pre>
828
//	 * @see CCorePlugin#INSERT
829
//	 * @see CCorePlugin#DO_NOT_INSERT
830
//	 */
831
//	public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_BLOCK = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_block";	//$NON-NLS-1$
832
//	/**
833
//	 * <pre>
834
//	 * FORMATTER / Option to insert a new line in an empty enum constant
835
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_enum_constant"
836
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
837
//	 *     - default:           INSERT
838
//	 * </pre>
839
//	 * @see CCorePlugin#INSERT
840
//	 * @see CCorePlugin#DO_NOT_INSERT
841
//	 */
842
//	public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_enum_constant";	//$NON-NLS-1$
843
//	/**
844
//	 * <pre>
845
//	 * FORMATTER / Option to insert a new line in an empty enum declaration
846
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_enum_declaration"
847
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
848
//	 *     - default:           INSERT
849
//	 * </pre>
850
//	 * @see CCorePlugin#INSERT
851
//	 * @see CCorePlugin#DO_NOT_INSERT
852
//	 */
853
//	public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_enum_declaration";	//$NON-NLS-1$
854
//	/**
855
//	 * <pre>
856
//	 * FORMATTER / Option to insert a new line in an empty method body
857
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_method_body"
858
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
859
//	 *     - default:           INSERT
860
//	 * </pre>
861
//	 * @see CCorePlugin#INSERT
862
//	 * @see CCorePlugin#DO_NOT_INSERT
863
//	 */
864
//	public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_METHOD_BODY = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_method_body";	//$NON-NLS-1$
865
//	/**
866
//	 * <pre>
867
//	 * FORMATTER / Option to insert a new line in an empty type declaration
868
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_new_line_in_empty_type_declaration"
869
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
870
//	 *     - default:           INSERT
871
//	 * </pre>
872
//	 * @see CCorePlugin#INSERT
873
//	 * @see CCorePlugin#DO_NOT_INSERT
874
//	 */
875
//	public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_in_empty_type_declaration";	//$NON-NLS-1$
876
//	/**
877
//	 * <pre>
878
//	 * FORMATTER / Option to insert a space after and in wilcard
879
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_and_in_type_parameter"
880
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
881
//	 *     - default:           INSERT
882
//	 * </pre>
883
//	 * @see CCorePlugin#INSERT
884
//	 * @see CCorePlugin#DO_NOT_INSERT
885
//	 */
886
//	public static final String FORMATTER_INSERT_SPACE_AFTER_AND_IN_TYPE_PARAMETER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_and_in_type_parameter"; //$NON-NLS-1$
887
//	/**
888
//	 * <pre>
889
//	 * FORMATTER / Option to insert a space after an assignment operator
890
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator"
891
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
892
//	 *     - default:           INSERT
893
//	 * </pre>
894
//	 * @see CCorePlugin#INSERT
895
//	 * @see CCorePlugin#DO_NOT_INSERT
896
//	 */
897
//	public static final String FORMATTER_INSERT_SPACE_AFTER_ASSIGNMENT_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_assignment_operator"; //$NON-NLS-1$
898
//	/**
899
//	 * <pre>
900
//	 * FORMATTER / Option to insert a space after at in annotation
901
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_at_in_annotation"
902
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
903
//	 *     - default:           INSERT
904
//	 * </pre>
905
//	 * @see CCorePlugin#INSERT
906
//	 * @see CCorePlugin#DO_NOT_INSERT
907
//	 */
908
//	public static final String FORMATTER_INSERT_SPACE_AFTER_AT_IN_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_at_in_annotation"; //$NON-NLS-1$
909
//	/**
910
//	 * <pre>
911
//	 * FORMATTER / Option to insert a space after at in annotation type declaration
912
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_at_in_annotation_type_declaration"
913
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
914
//	 *     - default:           DO_NOT_INSERT
915
//	 * </pre>
916
//	 * @see CCorePlugin#INSERT
917
//	 * @see CCorePlugin#DO_NOT_INSERT
918
//	 */
919
//	public static final String FORMATTER_INSERT_SPACE_AFTER_AT_IN_ANNOTATION_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_at_in_annotation_type_declaration"; //$NON-NLS-1$
920
//	/**
921
//	 * <pre>
922
//	 * FORMATTER / Option to insert a space after a binary operator
923
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_binary_operator"
924
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
925
//	 *     - default:           INSERT
926
//	 * </pre>
927
//	 * @see CCorePlugin#INSERT
928
//	 * @see CCorePlugin#DO_NOT_INSERT
929
//	 */
930
//	public static final String FORMATTER_INSERT_SPACE_AFTER_BINARY_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_binary_operator"; //$NON-NLS-1$
931
//	/**
932
//	 * <pre>
933
//	 * FORMATTER / Option to insert a space after the closing angle bracket in type arguments
934
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments"
935
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
936
//	 *     - default:           INSERT
937
//	 * </pre>
938
//	 * @see CCorePlugin#INSERT
939
//	 * @see CCorePlugin#DO_NOT_INSERT
940
//	 */
941
//	public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_closing_angle_bracket_in_type_arguments"; //$NON-NLS-1$
942
//	/**
943
//	 * <pre>
944
//	 * FORMATTER / Option to insert a space after the closing angle bracket in type parameters
945
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters"
946
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
947
//	 *     - default:           INSERT
948
//	 * </pre>
949
//	 * @see CCorePlugin#INSERT
950
//	 * @see CCorePlugin#DO_NOT_INSERT
951
//	 */
952
//	public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_closing_angle_bracket_in_type_parameters"; //$NON-NLS-1$
953
//	/**
954
//	 * <pre>
955
//	 * FORMATTER / Option to insert a space after the closing brace of a block
956
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block"
957
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
958
//	 *     - default:           INSERT
959
//	 * </pre>
960
//	 * @see CCorePlugin#INSERT
961
//	 * @see CCorePlugin#DO_NOT_INSERT
962
//	 */
963
//	public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_BRACE_IN_BLOCK = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_closing_brace_in_block"; //$NON-NLS-1$
964
//	/**
965
//	 * <pre>
966
//	 * FORMATTER / Option to insert a space after the closing parenthesis of a cast expression
967
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast"
968
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
969
//	 *     - default:           INSERT
970
//	 * </pre>
971
//	 * @see CCorePlugin#INSERT
972
//	 * @see CCorePlugin#DO_NOT_INSERT
973
//	 */
974
//	public static final String FORMATTER_INSERT_SPACE_AFTER_CLOSING_PAREN_IN_CAST = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_closing_paren_in_cast"; //$NON-NLS-1$
975
//	/**
976
//	 * <pre>
977
//	 * FORMATTER / Option to insert a space after the colon in an assert statement
978
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_colon_in_assert"
979
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
980
//	 *     - default:           INSERT
981
//	 * </pre>
982
//	 * @see CCorePlugin#INSERT
983
//	 * @see CCorePlugin#DO_NOT_INSERT
984
//	 */
985
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_ASSERT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_colon_in_assert"; //$NON-NLS-1$
986
//	/**
987
//	 * <pre>
988
//	 * FORMATTER / Option to insert a space after colon in a case statement when a opening brace follows the colon
989
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case"
990
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
991
//	 *     - default:           INSERT
992
//	 * </pre>
993
//	 * @see CCorePlugin#INSERT
994
//	 * @see CCorePlugin#DO_NOT_INSERT
995
//	 */
996
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CASE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_colon_in_case";	//$NON-NLS-1$
997
//	/**
998
//	 * <pre>
999
//	 * FORMATTER / Option to insert a space after the colon in a conditional expression
1000
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional"
1001
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1002
//	 *     - default:           INSERT
1003
//	 * </pre>
1004
//	 * @see CCorePlugin#INSERT
1005
//	 * @see CCorePlugin#DO_NOT_INSERT
1006
//	 */
1007
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CONDITIONAL = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_colon_in_conditional"; //$NON-NLS-1$
1008
//	/**
1009
//	 * <pre>
1010
//	 * FORMATTER / Option to insert a space after colon in a for statement
1011
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_colon_in_for"
1012
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1013
//	 *     - default:           INSERT
1014
//	 * </pre>
1015
//	 * @see CCorePlugin#INSERT
1016
//	 * @see CCorePlugin#DO_NOT_INSERT
1017
//	 */
1018
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_colon_in_for";	//$NON-NLS-1$
1019
//	/**
1020
//	 * <pre>
1021
//	 * FORMATTER / Option to insert a space after the colon in a labeled statement
1022
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement"
1023
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1024
//	 *     - default:           INSERT
1025
//	 * </pre>
1026
//	 * @see CCorePlugin#INSERT
1027
//	 * @see CCorePlugin#DO_NOT_INSERT
1028
//	 */
1029
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COLON_IN_LABELED_STATEMENT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_colon_in_labeled_statement"; //$NON-NLS-1$
1030
//	/**
1031
//	 * <pre>
1032
//	 * FORMATTER / Option to insert a space after the comma in an allocation expression
1033
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_allocation_expression"
1034
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1035
//	 *     - default:           INSERT
1036
//	 * </pre>
1037
//	 * @see CCorePlugin#INSERT
1038
//	 * @see CCorePlugin#DO_NOT_INSERT
1039
//	 */
1040
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_allocation_expression"; //$NON-NLS-1$
1041
//	/**
1042
//	 * <pre>
1043
//	 * FORMATTER / Option to insert a space after the comma in annotation
1044
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_annotation"
1045
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1046
//	 *     - default:           INSERT
1047
//	 * </pre>
1048
//	 * @see CCorePlugin#INSERT
1049
//	 * @see CCorePlugin#DO_NOT_INSERT
1050
//	 */
1051
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_annotation"; //$NON-NLS-1$
1052
//	/**
1053
//	 * <pre>
1054
//	 * FORMATTER / Option to insert a space after the comma in an array initializer
1055
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer"
1056
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1057
//	 *     - default:           INSERT
1058
//	 * </pre>
1059
//	 * @see CCorePlugin#INSERT
1060
//	 * @see CCorePlugin#DO_NOT_INSERT
1061
//	 */
1062
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_array_initializer"; //$NON-NLS-1$
1063
//	/**
1064
//	 * <pre>
1065
//	 * FORMATTER / Option to insert a space after the comma in the parameters of a constructor declaration
1066
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters"
1067
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1068
//	 *     - default:           INSERT
1069
//	 * </pre>
1070
//	 * @see CCorePlugin#INSERT
1071
//	 * @see CCorePlugin#DO_NOT_INSERT
1072
//	 */
1073
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_constructor_declaration_parameters"; //$NON-NLS-1$
1074
//	/**
1075
//	 * <pre>
1076
//	 * FORMATTER / Option to insert a space after the comma in the exception names in a throws clause of a constructor declaration
1077
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws"
1078
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1079
//	 *     - default:           INSERT
1080
//	 * </pre>
1081
//	 * @see CCorePlugin#INSERT
1082
//	 * @see CCorePlugin#DO_NOT_INSERT
1083
//	 */
1084
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_constructor_declaration_throws"; //$NON-NLS-1$
1085
//	/**
1086
//	 * <pre>
1087
//	 * FORMATTER / Option to insert a space after the comma in the arguments of an enum constant
1088
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments"
1089
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1090
//	 *     - default:           INSERT
1091
//	 * </pre>
1092
//	 * @see CCorePlugin#INSERT
1093
//	 * @see CCorePlugin#DO_NOT_INSERT
1094
//	 */
1095
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ENUM_CONSTANT_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_enum_constant_arguments"; //$NON-NLS-1$
1096
//	/**
1097
//	 * <pre>
1098
//	 * FORMATTER / Option to insert a space after the comma in enum declarations
1099
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations"
1100
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1101
//	 *     - default:           INSERT
1102
//	 * </pre>
1103
//	 * @see CCorePlugin#INSERT
1104
//	 * @see CCorePlugin#DO_NOT_INSERT
1105
//	 */
1106
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ENUM_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_enum_declarations"; //$NON-NLS-1$
1107
//	/**
1108
//	 * <pre>
1109
//	 * FORMATTER / Option to insert a space after the comma in the arguments of an explicit constructor call
1110
//	 *     - option id:         "org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments"
1111
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1112
//	 *     - default:           INSERT
1113
//	 * </pre>
1114
//	 * @see CCorePlugin#INSERT
1115
//	 * @see CCorePlugin#DO_NOT_INSERT
1116
//	 */
1117
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_explicitconstructorcall_arguments"; //$NON-NLS-1$
1118
//	/**
1119
//	 * <pre>
1120
//	 * FORMATTER / Option to insert a space after the comma in the increments of a for statement
1121
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_for_increments"
1122
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1123
//	 *     - default:           INSERT
1124
//	 * </pre>
1125
//	 * @see CCorePlugin#INSERT
1126
//	 * @see CCorePlugin#DO_NOT_INSERT
1127
//	 */
1128
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INCREMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_for_increments"; //$NON-NLS-1$
1129
//	/**
1130
//	 * <pre>
1131
//	 * FORMATTER / Option to insert a space after the comma in the initializations of a for statement
1132
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_for_inits"
1133
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1134
//	 *     - default:           INSERT
1135
//	 * </pre>
1136
//	 * @see CCorePlugin#INSERT
1137
//	 * @see CCorePlugin#DO_NOT_INSERT
1138
//	 */
1139
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INITS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_for_inits"; //$NON-NLS-1$
1140
//	/**
1141
//	 * <pre>
1142
//	 * FORMATTER / Option to insert a space after the comma in the parameters of a method declaration
1143
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters"
1144
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1145
//	 *     - default:           INSERT
1146
//	 * </pre>
1147
//	 * @see CCorePlugin#INSERT
1148
//	 * @see CCorePlugin#DO_NOT_INSERT
1149
//	 */
1150
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_method_declaration_parameters"; //$NON-NLS-1$
1151
//	/**
1152
//	 * <pre>
1153
//	 * FORMATTER / Option to insert a space after the comma in the exception names in a throws clause of a method declaration
1154
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws"
1155
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1156
//	 *     - default:           INSERT
1157
//	 * </pre>
1158
//	 * @see CCorePlugin#INSERT
1159
//	 * @see CCorePlugin#DO_NOT_INSERT
1160
//	 */
1161
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_method_declaration_throws"; //$NON-NLS-1$
1162
//	/**
1163
//	 * <pre>
1164
//	 * FORMATTER / Option to insert a space after the comma in the arguments of a method invocation
1165
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments"
1166
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1167
//	 *     - default:           INSERT
1168
//	 * </pre>
1169
//	 * @see CCorePlugin#INSERT
1170
//	 * @see CCorePlugin#DO_NOT_INSERT
1171
//	 */
1172
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_INVOCATION_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_method_invocation_arguments"; //$NON-NLS-1$
1173
//	/**
1174
//	 * <pre>
1175
//	 * FORMATTER / Option to insert a space after the comma in multiple field declaration
1176
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations"
1177
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1178
//	 *     - default:           INSERT
1179
//	 * </pre>
1180
//	 * @see CCorePlugin#INSERT
1181
//	 * @see CCorePlugin#DO_NOT_INSERT
1182
//	 */
1183
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_multiple_field_declarations"; //$NON-NLS-1$
1184
//	/**
1185
//	 * <pre>
1186
//	 * FORMATTER / Option to insert a space after the comma in multiple local declaration
1187
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations"
1188
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1189
//	 *     - default:           INSERT
1190
//	 * </pre>
1191
//	 * @see CCorePlugin#INSERT
1192
//	 * @see CCorePlugin#DO_NOT_INSERT
1193
//	 */
1194
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_multiple_local_declarations"; //$NON-NLS-1$
1195
//	/**
1196
//	 * <pre>
1197
//	 * FORMATTER / Option to insert a space after the comma in parameterized type reference
1198
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference"
1199
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1200
//	 *     - default:           INSERT
1201
//	 * </pre>
1202
//	 * @see CCorePlugin#INSERT
1203
//	 * @see CCorePlugin#DO_NOT_INSERT
1204
//	 */
1205
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_parameterized_type_reference"; //$NON-NLS-1$
1206
//	/**
1207
//	 * <pre>
1208
//	 * FORMATTER / Option to insert a space after the comma in superinterfaces names of a type header
1209
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_superinterfaces"
1210
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1211
//	 *     - default:           INSERT
1212
//	 * </pre>
1213
//	 * @see CCorePlugin#INSERT
1214
//	 * @see CCorePlugin#DO_NOT_INSERT
1215
//	 */
1216
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_SUPERINTERFACES = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_superinterfaces"; //$NON-NLS-1$
1217
//	/**
1218
//	 * <pre>
1219
//	 * FORMATTER / Option to insert a space after the comma in type arguments
1220
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_type_arguments"
1221
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1222
//	 *     - default:           INSERT
1223
//	 * </pre>
1224
//	 * @see CCorePlugin#INSERT
1225
//	 * @see CCorePlugin#DO_NOT_INSERT
1226
//	 */
1227
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_type_arguments"; //$NON-NLS-1$
1228
//	/**
1229
//	 * <pre>
1230
//	 * FORMATTER / Option to insert a space after the comma in type parameters
1231
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_type_parameters"
1232
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1233
//	 *     - default:           INSERT
1234
//	 * </pre>
1235
//	 * @see CCorePlugin#INSERT
1236
//	 * @see CCorePlugin#DO_NOT_INSERT
1237
//	 */
1238
//	public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_type_parameters"; //$NON-NLS-1$
1239
//	/**
1240
//	 * <pre>
1241
//	 * FORMATTER / Option to insert a space after ellipsis
1242
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_ellipsis"
1243
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1244
//	 *     - default:           INSERT
1245
//	 * </pre>
1246
//	 * @see CCorePlugin#INSERT
1247
//	 * @see CCorePlugin#DO_NOT_INSERT
1248
//	 */
1249
//	public static final String FORMATTER_INSERT_SPACE_AFTER_ELLIPSIS  = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_ellipsis";	//$NON-NLS-1$
1250
//	/**
1251
//	 * <pre>
1252
//	 * FORMATTER / Option to insert a space after the opening angle bracket in parameterized type reference
1253
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference"
1254
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1255
//	 *     - default:           DO_NOT_INSERT
1256
//	 * </pre>
1257
//	 * @see CCorePlugin#INSERT
1258
//	 * @see CCorePlugin#DO_NOT_INSERT
1259
//	 */
1260
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference";//$NON-NLS-1$
1261
//	/**
1262
//	 * <pre>
1263
//	 * FORMATTER / Option to insert a space after the opening angle bracket in type arguments
1264
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments"
1265
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1266
//	 *     - default:           DO_NOT_INSERT
1267
//	 * </pre>
1268
//	 * @see CCorePlugin#INSERT
1269
//	 * @see CCorePlugin#DO_NOT_INSERT
1270
//	 */
1271
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_angle_bracket_in_type_arguments";//$NON-NLS-1$
1272
//	/**
1273
//	 * <pre>
1274
//	 * FORMATTER / Option to insert a space after the opening angle bracket in type parameters
1275
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters"
1276
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1277
//	 *     - default:           DO_NOT_INSERT
1278
//	 * </pre>
1279
//	 * @see CCorePlugin#INSERT
1280
//	 * @see CCorePlugin#DO_NOT_INSERT
1281
//	 */
1282
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_angle_bracket_in_type_parameters";//$NON-NLS-1$
1283
//	/**
1284
//	 * <pre>
1285
//	 * FORMATTER / Option to insert a space after the opening brace in an array initializer
1286
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer"
1287
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1288
//	 *     - default:           DO_NOT_INSERT
1289
//	 * </pre>
1290
//	 * @see CCorePlugin#INSERT
1291
//	 * @see CCorePlugin#DO_NOT_INSERT
1292
//	 */
1293
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_brace_in_array_initializer";	//$NON-NLS-1$
1294
//	/**
1295
//	 * <pre>
1296
//	 * FORMATTER / Option to insert a space after the opening bracket inside an array allocation expression
1297
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression"
1298
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1299
//	 *     - default:           DO_NOT_INSERT
1300
//	 * </pre>
1301
//	 * @see CCorePlugin#INSERT
1302
//	 * @see CCorePlugin#DO_NOT_INSERT
1303
//	 */
1304
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_bracket_in_array_allocation_expression";//$NON-NLS-1$
1305
//	/**
1306
//	 * <pre>
1307
//	 * FORMATTER / Option to insert a space after the opening bracket inside an array reference
1308
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket_in_array_reference"
1309
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1310
//	 *     - default:           DO_NOT_INSERT
1311
//	 * </pre>
1312
//	 * @see CCorePlugin#INSERT
1313
//	 * @see CCorePlugin#DO_NOT_INSERT
1314
//	 */
1315
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_bracket_in_array_reference";//$NON-NLS-1$
1316
//	/**
1317
//	 * <pre>
1318
//	 * FORMATTER / Option to insert a space after the opening parenthesis in annotation
1319
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_annotation"
1320
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1321
//	 *     - default:           DO_NOT_INSERT
1322
//	 * </pre>
1323
//	 * @see CCorePlugin#INSERT
1324
//	 * @see CCorePlugin#DO_NOT_INSERT
1325
//	 */
1326
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_annotation"; //$NON-NLS-1$
1327
//	/**
1328
//	 * <pre>
1329
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a cast expression
1330
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast"
1331
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1332
//	 *     - default:           DO_NOT_INSERT
1333
//	 * </pre>
1334
//	 * @see CCorePlugin#INSERT
1335
//	 * @see CCorePlugin#DO_NOT_INSERT
1336
//	 */
1337
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CAST = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_cast"; //$NON-NLS-1$
1338
//	/**
1339
//	 * <pre>
1340
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a catch
1341
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch"
1342
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1343
//	 *     - default:           DO_NOT_INSERT
1344
//	 * </pre>
1345
//	 * @see CCorePlugin#INSERT
1346
//	 * @see CCorePlugin#DO_NOT_INSERT
1347
//	 */
1348
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CATCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_catch"; //$NON-NLS-1$
1349
//	/**
1350
//	 * <pre>
1351
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a constructor declaration
1352
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration"
1353
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1354
//	 *     - default:           DO_NOT_INSERT
1355
//	 * </pre>
1356
//	 * @see CCorePlugin#INSERT
1357
//	 * @see CCorePlugin#DO_NOT_INSERT
1358
//	 */
1359
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_constructor_declaration";	//$NON-NLS-1$
1360
//	/**
1361
//	 * <pre>
1362
//	 * FORMATTER / Option to insert a space after the opening parenthesis in enum constant
1363
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_enum_constant"
1364
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1365
//	 *     - default:           DO_NOT_INSERT
1366
//	 * </pre>
1367
//	 * @see CCorePlugin#INSERT
1368
//	 * @see CCorePlugin#DO_NOT_INSERT
1369
//	 */
1370
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_enum_constant"; //$NON-NLS-1$
1371
//	/**
1372
//	 * <pre>
1373
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a for statement
1374
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for"
1375
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1376
//	 *     - default:           DO_NOT_INSERT
1377
//	 * </pre>
1378
//	 * @see CCorePlugin#INSERT
1379
//	 * @see CCorePlugin#DO_NOT_INSERT
1380
//	 */
1381
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_for"; //$NON-NLS-1$
1382
//	/**
1383
//	 * <pre>
1384
//	 * FORMATTER / Option to insert a space after the opening parenthesis in an if statement
1385
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if"
1386
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1387
//	 *     - default:           DO_NOT_INSERT
1388
//	 * </pre>
1389
//	 * @see CCorePlugin#INSERT
1390
//	 * @see CCorePlugin#DO_NOT_INSERT
1391
//	 */
1392
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_IF = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_if"; //$NON-NLS-1$
1393
//	/**
1394
//	 * <pre>
1395
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a method declaration
1396
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration"
1397
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1398
//	 *     - default:           DO_NOT_INSERT
1399
//	 * </pre>
1400
//	 * @see CCorePlugin#INSERT
1401
//	 * @see CCorePlugin#DO_NOT_INSERT
1402
//	 */
1403
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_method_declaration";	//$NON-NLS-1$
1404
//	/**
1405
//	 * <pre>
1406
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a method invocation
1407
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation"
1408
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1409
//	 *     - default:           DO_NOT_INSERT
1410
//	 * </pre>
1411
//	 * @see CCorePlugin#INSERT
1412
//	 * @see CCorePlugin#DO_NOT_INSERT
1413
//	 */
1414
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_method_invocation"; //$NON-NLS-1$
1415
//	/**
1416
//	 * <pre>
1417
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a parenthesized expression
1418
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression"
1419
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1420
//	 *     - default:           DO_NOT_INSERT
1421
//	 * </pre>
1422
//	 * @see CCorePlugin#INSERT
1423
//	 * @see CCorePlugin#DO_NOT_INSERT
1424
//	 */
1425
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_parenthesized_expression"; //$NON-NLS-1$
1426
//	/**
1427
//	 * <pre>
1428
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a switch statement
1429
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch"
1430
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1431
//	 *     - default:           DO_NOT_INSERT
1432
//	 * </pre>
1433
//	 * @see CCorePlugin#INSERT
1434
//	 * @see CCorePlugin#DO_NOT_INSERT
1435
//	 */
1436
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SWITCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_switch"; //$NON-NLS-1$
1437
//	/**
1438
//	 * <pre>
1439
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a synchronized statement
1440
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_synchronized"
1441
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1442
//	 *     - default:           DO_NOT_INSERT
1443
//	 * </pre>
1444
//	 * @see CCorePlugin#INSERT
1445
//	 * @see CCorePlugin#DO_NOT_INSERT
1446
//	 */
1447
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SYNCHRONIZED = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_synchronized"; //$NON-NLS-1$
1448
//	/**
1449
//	 * <pre>
1450
//	 * FORMATTER / Option to insert a space after the opening parenthesis in a while statement
1451
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while"
1452
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1453
//	 *     - default:           DO_NOT_INSERT
1454
//	 * </pre>
1455
//	 * @see CCorePlugin#INSERT
1456
//	 * @see CCorePlugin#DO_NOT_INSERT
1457
//	 */
1458
//	public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_WHILE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_while"; //$NON-NLS-1$
1459
//	/**
1460
//	 * <pre>
1461
//	 * FORMATTER / Option to insert a space after a postfix operator
1462
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator"
1463
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1464
//	 *     - default:           DO_NOT_INSERT
1465
//	 * </pre>
1466
//	 * @see CCorePlugin#INSERT
1467
//	 * @see CCorePlugin#DO_NOT_INSERT
1468
//	 */
1469
//	public static final String FORMATTER_INSERT_SPACE_AFTER_POSTFIX_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_postfix_operator"; //$NON-NLS-1$
1470
//	/**
1471
//	 * <pre>
1472
//	 * FORMATTER / Option to insert a space after a prefix operator
1473
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator"
1474
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1475
//	 *     - default:           DO_NOT_INSERT
1476
//	 * </pre>
1477
//	 * @see CCorePlugin#INSERT
1478
//	 * @see CCorePlugin#DO_NOT_INSERT
1479
//	 */
1480
//	public static final String FORMATTER_INSERT_SPACE_AFTER_PREFIX_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_prefix_operator"; //$NON-NLS-1$
1481
//	/**
1482
//	 * <pre>
1483
//	 * FORMATTER / Option to insert a space after question mark in a conditional expression
1484
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional"
1485
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1486
//	 *     - default:           DO_NOT_INSERT
1487
//	 * </pre>
1488
//	 * @see CCorePlugin#INSERT
1489
//	 * @see CCorePlugin#DO_NOT_INSERT
1490
//	 */
1491
//	public static final String FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_CONDITIONAL = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_question_in_conditional"; //$NON-NLS-1$
1492
//	/**
1493
//	 * <pre>
1494
//	 * FORMATTER / Option to insert a space after question mark in a wildcard
1495
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_question_in_wildcard"
1496
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1497
//	 *     - default:           DO_NOT_INSERT
1498
//	 * </pre>
1499
//	 * @see CCorePlugin#INSERT
1500
//	 * @see CCorePlugin#DO_NOT_INSERT
1501
//	 */
1502
//	public static final String FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_WILDCARD = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_question_in_wildcard"; //$NON-NLS-1$
1503
//	/**
1504
//	 * <pre>
1505
//	 * FORMATTER / Option to insert a space after semicolon in a for statement
1506
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for"
1507
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1508
//	 *     - default:           INSERT
1509
//	 * </pre>
1510
//	 * @see CCorePlugin#INSERT
1511
//	 * @see CCorePlugin#DO_NOT_INSERT
1512
//	 */
1513
//	public static final String FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_semicolon_in_for"; //$NON-NLS-1$
1514
//	/**
1515
//	 * <pre>
1516
//	 * FORMATTER / Option to insert a space after an unary operator
1517
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_after_unary_operator"
1518
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1519
//	 *     - default:           DO_NOT_INSERT
1520
//	 * </pre>
1521
//	 * @see CCorePlugin#INSERT
1522
//	 * @see CCorePlugin#DO_NOT_INSERT
1523
//	 */
1524
//	public static final String FORMATTER_INSERT_SPACE_AFTER_UNARY_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_unary_operator"; //$NON-NLS-1$
1525
//	/**
1526
//	 * <pre>
1527
//	 * FORMATTER / Option to insert a space before and in wildcard
1528
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_and_in_type_parameter"
1529
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1530
//	 *     - default:           INSERT
1531
//	 * </pre>
1532
//	 * @see CCorePlugin#INSERT
1533
//	 * @see CCorePlugin#DO_NOT_INSERT
1534
//	 */
1535
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_AND_IN_TYPE_PARAMETER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_and_in_type_parameter";	//$NON-NLS-1$
1536
//	/**
1537
//	 * <pre>
1538
//	 * FORMATTER / Option to insert a space before an assignment operator
1539
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator"
1540
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1541
//	 *     - default:           INSERT
1542
//	 * </pre>
1543
//	 * @see CCorePlugin#INSERT
1544
//	 * @see CCorePlugin#DO_NOT_INSERT
1545
//	 */
1546
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_assignment_operator";	//$NON-NLS-1$
1547
//	/**
1548
//	 * <pre>
1549
//	 * FORMATTER / Option to insert a space before at in annotation type declaration
1550
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_at_in_annotation_type_declaration"
1551
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1552
//	 *     - default:           INSERT
1553
//	 * </pre>
1554
//	 * @see CCorePlugin#INSERT
1555
//	 * @see CCorePlugin#DO_NOT_INSERT
1556
//	 */
1557
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_AT_IN_ANNOTATION_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_at_in_annotation_type_declaration";	//$NON-NLS-1$
1558
//	/**
1559
//	 * <pre>
1560
//	 * FORMATTER / Option to insert a space before an binary operator
1561
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_binary_operator"
1562
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1563
//	 *     - default:           DO_NOT_INSERT
1564
//	 * </pre>
1565
//	 * @see CCorePlugin#INSERT
1566
//	 * @see CCorePlugin#DO_NOT_INSERT
1567
//	 */
1568
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_BINARY_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_binary_operator";	//$NON-NLS-1$
1569
//	/**
1570
//	 * <pre>
1571
//	 * FORMATTER / Option to insert a space before the closing angle bracket in parameterized type reference
1572
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference"
1573
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1574
//	 *     - default:           DO_NOT_INSERT
1575
//	 * </pre>
1576
//	 * @see CCorePlugin#INSERT
1577
//	 * @see CCorePlugin#DO_NOT_INSERT
1578
//	 */
1579
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference";		//$NON-NLS-1$
1580
//	/**
1581
//	 * <pre>
1582
//	 * FORMATTER / Option to insert a space before the closing angle bracket in type arguments
1583
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments"
1584
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1585
//	 *     - default:           DO_NOT_INSERT
1586
//	 * </pre>
1587
//	 * @see CCorePlugin#INSERT
1588
//	 * @see CCorePlugin#DO_NOT_INSERT
1589
//	 */
1590
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_angle_bracket_in_type_arguments";		//$NON-NLS-1$
1591
//	/**
1592
//	 * <pre>
1593
//	 * FORMATTER / Option to insert a space before the closing angle bracket in type parameters
1594
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters"
1595
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1596
//	 *     - default:           DO_NOT_INSERT
1597
//	 * </pre>
1598
//	 * @see CCorePlugin#INSERT
1599
//	 * @see CCorePlugin#DO_NOT_INSERT
1600
//	 */
1601
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_angle_bracket_in_type_parameters";		//$NON-NLS-1$
1602
//	/**
1603
//	 * <pre>
1604
//	 * FORMATTER / Option to insert a space before the closing brace in an array initializer
1605
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer"
1606
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1607
//	 *     - default:           DO_NOT_INSERT
1608
//	 * </pre>
1609
//	 * @see CCorePlugin#INSERT
1610
//	 * @see CCorePlugin#DO_NOT_INSERT
1611
//	 */
1612
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_brace_in_array_initializer";		//$NON-NLS-1$
1613
//	/**
1614
//	 * <pre>
1615
//	 * FORMATTER / Option to insert a space before the closing bracket in an array allocation expression
1616
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression"
1617
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1618
//	 *     - default:           DO_NOT_INSERT
1619
//	 * </pre>
1620
//	 * @see CCorePlugin#INSERT
1621
//	 * @see CCorePlugin#DO_NOT_INSERT
1622
//	 */
1623
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_bracket_in_array_allocation_expression";//$NON-NLS-1$
1624
//	/**
1625
//	 * <pre>
1626
//	 * FORMATTER / Option to insert a space before the closing bracket in an array reference
1627
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket_in_array_reference"
1628
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1629
//	 *     - default:           DO_NOT_INSERT
1630
//	 * </pre>
1631
//	 * @see CCorePlugin#INSERT
1632
//	 * @see CCorePlugin#DO_NOT_INSERT
1633
//	 */
1634
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_bracket_in_array_reference";//$NON-NLS-1$
1635
//	/**
1636
//	 * <pre>
1637
//	 * FORMATTER / Option to insert a space before the closing parenthesis in annotation
1638
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_annotation"
1639
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1640
//	 *     - default:           DO_NOT_INSERT
1641
//	 * </pre>
1642
//	 * @see CCorePlugin#INSERT
1643
//	 * @see CCorePlugin#DO_NOT_INSERT
1644
//	 */
1645
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_annotation";	//$NON-NLS-1$
1646
//	/**
1647
//	 * <pre>
1648
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a cast expression
1649
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast"
1650
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1651
//	 *     - default:           DO_NOT_INSERT
1652
//	 * </pre>
1653
//	 * @see CCorePlugin#INSERT
1654
//	 * @see CCorePlugin#DO_NOT_INSERT
1655
//	 */
1656
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CAST = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_cast";	//$NON-NLS-1$
1657
//	/**
1658
//	 * <pre>
1659
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a catch
1660
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch"
1661
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1662
//	 *     - default:           DO_NOT_INSERT
1663
//	 * </pre>
1664
//	 * @see CCorePlugin#INSERT
1665
//	 * @see CCorePlugin#DO_NOT_INSERT
1666
//	 */
1667
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CATCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_catch";	//$NON-NLS-1$
1668
//	/**
1669
//	 * <pre>
1670
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a constructor declaration
1671
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration"
1672
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1673
//	 *     - default:           DO_NOT_INSERT
1674
//	 * </pre>
1675
//	 * @see CCorePlugin#INSERT
1676
//	 * @see CCorePlugin#DO_NOT_INSERT
1677
//	 */
1678
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_constructor_declaration";	//$NON-NLS-1$
1679
//	/**
1680
//	 * <pre>
1681
//	 * FORMATTER / Option to insert a space before the closing parenthesis in enum constant
1682
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_enum_constant"
1683
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1684
//	 *     - default:           DO_NOT_INSERT
1685
//	 * </pre>
1686
//	 * @see CCorePlugin#INSERT
1687
//	 * @see CCorePlugin#DO_NOT_INSERT
1688
//	 */
1689
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_enum_constant";	//$NON-NLS-1$
1690
//	/**
1691
//	 * <pre>
1692
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a for statement
1693
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for"
1694
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1695
//	 *     - default:           DO_NOT_INSERT
1696
//	 * </pre>
1697
//	 * @see CCorePlugin#INSERT
1698
//	 * @see CCorePlugin#DO_NOT_INSERT
1699
//	 */
1700
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_for";	//$NON-NLS-1$
1701
//	/**
1702
//	 * <pre>
1703
//	 * FORMATTER / Option to insert a space before the closing parenthesis in an if statement
1704
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if"
1705
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1706
//	 *     - default:           DO_NOT_INSERT
1707
//	 * </pre>
1708
//	 * @see CCorePlugin#INSERT
1709
//	 * @see CCorePlugin#DO_NOT_INSERT
1710
//	 */
1711
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_IF = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_if";	//$NON-NLS-1$
1712
//	/**
1713
//	 * <pre>
1714
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a method declaration
1715
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration"
1716
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1717
//	 *     - default:           DO_NOT_INSERT
1718
//	 * </pre>
1719
//	 * @see CCorePlugin#INSERT
1720
//	 * @see CCorePlugin#DO_NOT_INSERT
1721
//	 */
1722
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_method_declaration";	//$NON-NLS-1$
1723
//	/**
1724
//	 * <pre>
1725
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a method invocation
1726
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation"
1727
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1728
//	 *     - default:           DO_NOT_INSERT
1729
//	 * </pre>
1730
//	 * @see CCorePlugin#INSERT
1731
//	 * @see CCorePlugin#DO_NOT_INSERT
1732
//	 */
1733
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_method_invocation"; //$NON-NLS-1$
1734
//	/**
1735
//	 * <pre>
1736
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a parenthesized expression
1737
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression"
1738
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1739
//	 *     - default:           DO_NOT_INSERT
1740
//	 * </pre>
1741
//	 * @see CCorePlugin#INSERT
1742
//	 * @see CCorePlugin#DO_NOT_INSERT
1743
//	 */
1744
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_parenthesized_expression"; //$NON-NLS-1$
1745
//	/**
1746
//	 * <pre>
1747
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a switch statement
1748
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch"
1749
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1750
//	 *     - default:           DO_NOT_INSERT
1751
//	 * </pre>
1752
//	 * @see CCorePlugin#INSERT
1753
//	 * @see CCorePlugin#DO_NOT_INSERT
1754
//	 */
1755
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SWITCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_switch";	//$NON-NLS-1$
1756
//	/**
1757
//	 * <pre>
1758
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a synchronized statement
1759
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_synchronized"
1760
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1761
//	 *     - default:           DO_NOT_INSERT
1762
//	 * </pre>
1763
//	 * @see CCorePlugin#INSERT
1764
//	 * @see CCorePlugin#DO_NOT_INSERT
1765
//	 */
1766
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SYNCHRONIZED = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_synchronized";	//$NON-NLS-1$
1767
//	/**
1768
//	 * <pre>
1769
//	 * FORMATTER / Option to insert a space before the closing parenthesis in a while statement
1770
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while"
1771
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1772
//	 *     - default:           DO_NOT_INSERT
1773
//	 * </pre>
1774
//	 * @see CCorePlugin#INSERT
1775
//	 * @see CCorePlugin#DO_NOT_INSERT
1776
//	 */
1777
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_WHILE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_while";	//$NON-NLS-1$
1778
//	/**
1779
//	 * <pre>
1780
//	 * FORMATTER / Option to insert a space before colon in an assert statement
1781
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_colon_in_assert"
1782
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1783
//	 *     - default:           INSERT
1784
//	 * </pre>
1785
//	 * @see CCorePlugin#INSERT
1786
//	 * @see CCorePlugin#DO_NOT_INSERT
1787
//	 */
1788
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_ASSERT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_colon_in_assert";	//$NON-NLS-1$
1789
//	/**
1790
//	 * <pre>
1791
//	 * FORMATTER / Option to insert a space before colon in a case statement
1792
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case"
1793
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1794
//	 *     - default:           INSERT
1795
//	 * </pre>
1796
//	 * @see CCorePlugin#INSERT
1797
//	 * @see CCorePlugin#DO_NOT_INSERT
1798
//	 */
1799
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CASE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_colon_in_case";	//$NON-NLS-1$
1800
//	/**
1801
//	 * <pre>
1802
//	 * FORMATTER / Option to insert a space before colon in a conditional expression
1803
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional"
1804
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1805
//	 *     - default:           INSERT
1806
//	 * </pre>
1807
//	 * @see CCorePlugin#INSERT
1808
//	 * @see CCorePlugin#DO_NOT_INSERT
1809
//	 */
1810
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CONDITIONAL = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_colon_in_conditional";	//$NON-NLS-1$
1811
//	/**
1812
//	 * <pre>
1813
//	 * FORMATTER / Option to insert a space before colon in a default statement
1814
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default"
1815
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1816
//	 *     - default:           INSERT
1817
//	 * </pre>
1818
//	 * @see CCorePlugin#INSERT
1819
//	 * @see CCorePlugin#DO_NOT_INSERT
1820
//	 */
1821
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_DEFAULT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_colon_in_default";	//$NON-NLS-1$
1822
//	/**
1823
//	 * <pre>
1824
//	 * FORMATTER / Option to insert a space before colon in a for statement
1825
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_colon_in_for"
1826
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1827
//	 *     - default:           INSERT
1828
//	 * </pre>
1829
//	 * @see CCorePlugin#INSERT
1830
//	 * @see CCorePlugin#DO_NOT_INSERT
1831
//	 */
1832
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_colon_in_for";	//$NON-NLS-1$
1833
//	/**
1834
//	 * <pre>
1835
//	 * FORMATTER / Option to insert a space before colon in a labeled statement
1836
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement"
1837
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1838
//	 *     - default:           INSERT
1839
//	 * </pre>
1840
//	 * @see CCorePlugin#INSERT
1841
//	 * @see CCorePlugin#DO_NOT_INSERT
1842
//	 */
1843
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_LABELED_STATEMENT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_colon_in_labeled_statement";	//$NON-NLS-1$
1844
//	/**
1845
//	 * <pre>
1846
//	 * FORMATTER / Option to insert a space before comma in an allocation expression
1847
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_allocation_expression"
1848
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1849
//	 *     - default:           DO_NOT_INSERT
1850
//	 * </pre>
1851
//	 * @see CCorePlugin#INSERT
1852
//	 * @see CCorePlugin#DO_NOT_INSERT
1853
//	 */
1854
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_allocation_expression";	//$NON-NLS-1$
1855
//	/**
1856
//	 * <pre>
1857
//	 * FORMATTER / Option to insert a space before comma in annotation
1858
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_annotation"
1859
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1860
//	 *     - default:           DO_NOT_INSERT
1861
//	 * </pre>
1862
//	 * @see CCorePlugin#INSERT
1863
//	 * @see CCorePlugin#DO_NOT_INSERT
1864
//	 */
1865
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_annotation";	//$NON-NLS-1$
1866
//	/**
1867
//	 * <pre>
1868
//	 * FORMATTER / Option to insert a space before comma in an array initializer
1869
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer"
1870
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1871
//	 *     - default:           DO_NOT_INSERT
1872
//	 * </pre>
1873
//	 * @see CCorePlugin#INSERT
1874
//	 * @see CCorePlugin#DO_NOT_INSERT
1875
//	 */
1876
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_array_initializer";	//$NON-NLS-1$
1877
//	/**
1878
//	 * <pre>
1879
//	 * FORMATTER / Option to insert a space before comma in the parameters of a constructor declaration
1880
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters"
1881
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1882
//	 *     - default:           DO_NOT_INSERT
1883
//	 * </pre>
1884
//	 * @see CCorePlugin#INSERT
1885
//	 * @see CCorePlugin#DO_NOT_INSERT
1886
//	 */
1887
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_constructor_declaration_parameters";	//$NON-NLS-1$
1888
//	/**
1889
//	 * <pre>
1890
//	 * FORMATTER / Option to insert a space before comma in the exception names of the throws clause of a constructor declaration
1891
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws"
1892
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1893
//	 *     - default:           DO_NOT_INSERT
1894
//	 * </pre>
1895
//	 * @see CCorePlugin#INSERT
1896
//	 * @see CCorePlugin#DO_NOT_INSERT
1897
//	 */
1898
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_constructor_declaration_throws";	//$NON-NLS-1$
1899
//	/**
1900
//	 * <pre>
1901
//	 * FORMATTER / Option to insert a space before comma in the arguments of enum constant
1902
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments"
1903
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1904
//	 *     - default:           DO_NOT_INSERT
1905
//	 * </pre>
1906
//	 * @see CCorePlugin#INSERT
1907
//	 * @see CCorePlugin#DO_NOT_INSERT
1908
//	 */
1909
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_CONSTANT_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_enum_constant_arguments";	//$NON-NLS-1$
1910
//	/**
1911
//	 * <pre>
1912
//	 * FORMATTER / Option to insert a space before comma in enum declarations
1913
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations"
1914
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1915
//	 *     - default:           DO_NOT_INSERT
1916
//	 * </pre>
1917
//	 * @see CCorePlugin#INSERT
1918
//	 * @see CCorePlugin#DO_NOT_INSERT
1919
//	 */
1920
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_enum_declarations";	//$NON-NLS-1$
1921
//	/**
1922
//	 * <pre>
1923
//	 * FORMATTER / Option to insert a space before comma in the arguments of an explicit constructor call
1924
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments"
1925
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1926
//	 *     - default:           DO_NOT_INSERT
1927
//	 * </pre>
1928
//	 * @see CCorePlugin#INSERT
1929
//	 * @see CCorePlugin#DO_NOT_INSERT
1930
//	 */
1931
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_explicitconstructorcall_arguments";	//$NON-NLS-1$
1932
//	/**
1933
//	 * <pre>
1934
//	 * FORMATTER / Option to insert a space before comma in the increments of a for statement
1935
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_for_increments"
1936
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1937
//	 *     - default:           DO_NOT_INSERT
1938
//	 * </pre>
1939
//	 * @see CCorePlugin#INSERT
1940
//	 * @see CCorePlugin#DO_NOT_INSERT
1941
//	 */
1942
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INCREMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_for_increments";	//$NON-NLS-1$
1943
//	/**
1944
//	 * <pre>
1945
//	 * FORMATTER / Option to insert a space before comma in the initializations of a for statement
1946
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_for_inits"
1947
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1948
//	 *     - default:           DO_NOT_INSERT
1949
//	 * </pre>
1950
//	 * @see CCorePlugin#INSERT
1951
//	 * @see CCorePlugin#DO_NOT_INSERT
1952
//	 */
1953
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INITS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_for_inits";	//$NON-NLS-1$
1954
//	/**
1955
//	 * <pre>
1956
//	 * FORMATTER / Option to insert a space before comma in the parameters of a method declaration
1957
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters"
1958
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1959
//	 *     - default:           DO_NOT_INSERT
1960
//	 * </pre>
1961
//	 * @see CCorePlugin#INSERT
1962
//	 * @see CCorePlugin#DO_NOT_INSERT
1963
//	 */
1964
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_method_declaration_parameters";	//$NON-NLS-1$
1965
//	/**
1966
//	 * <pre>
1967
//	 * FORMATTER / Option to insert a space before comma in the exception names of the throws clause of a method declaration
1968
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws"
1969
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1970
//	 *     - default:           DO_NOT_INSERT
1971
//	 * </pre>
1972
//	 * @see CCorePlugin#INSERT
1973
//	 * @see CCorePlugin#DO_NOT_INSERT
1974
//	 */
1975
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_method_declaration_throws";	//$NON-NLS-1$
1976
//	/**
1977
//	 * <pre>
1978
//	 * FORMATTER / Option to insert a space before comma in the arguments of a method invocation
1979
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments"
1980
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1981
//	 *     - default:           DO_NOT_INSERT
1982
//	 * </pre>
1983
//	 * @see CCorePlugin#INSERT
1984
//	 * @see CCorePlugin#DO_NOT_INSERT
1985
//	 */
1986
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_method_invocation_arguments";	//$NON-NLS-1$
1987
//	/**
1988
//	 * <pre>
1989
//	 * FORMATTER / Option to insert a space before comma in a multiple field declaration
1990
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations"
1991
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1992
//	 *     - default:           DO_NOT_INSERT
1993
//	 * </pre>
1994
//	 * @see CCorePlugin#INSERT
1995
//	 * @see CCorePlugin#DO_NOT_INSERT
1996
//	 */
1997
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_multiple_field_declarations";	//$NON-NLS-1$
1998
//	/**
1999
//	 * <pre>
2000
//	 * FORMATTER / Option to insert a space before comma in a multiple local declaration
2001
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations"
2002
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2003
//	 *     - default:           DO_NOT_INSERT
2004
//	 * </pre>
2005
//	 * @see CCorePlugin#INSERT
2006
//	 * @see CCorePlugin#DO_NOT_INSERT
2007
//	 */
2008
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_multiple_local_declarations";	//$NON-NLS-1$
2009
//	/**
2010
//	 * <pre>
2011
//	 * FORMATTER / Option to insert a space before comma in parameterized type reference
2012
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference"
2013
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2014
//	 *     - default:           DO_NOT_INSERT
2015
//	 * </pre>
2016
//	 * @see CCorePlugin#INSERT
2017
//	 * @see CCorePlugin#DO_NOT_INSERT
2018
//	 */
2019
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_parameterized_type_reference";	//$NON-NLS-1$
2020
//	/**
2021
//	 * <pre>
2022
//	 * FORMATTER / Option to insert a space before comma in the superinterfaces names in a type header
2023
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_superinterfaces"
2024
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2025
//	 *     - default:           DO_NOT_INSERT
2026
//	 * </pre>
2027
//	 * @see CCorePlugin#INSERT
2028
//	 * @see CCorePlugin#DO_NOT_INSERT
2029
//	 */
2030
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_SUPERINTERFACES = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_superinterfaces";	//$NON-NLS-1$
2031
//	/**
2032
//	 * <pre>
2033
//	 * FORMATTER / Option to insert a space before comma in type arguments
2034
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_type_arguments"
2035
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2036
//	 *     - default:           DO_NOT_INSERT
2037
//	 * </pre>
2038
//	 * @see CCorePlugin#INSERT
2039
//	 * @see CCorePlugin#DO_NOT_INSERT
2040
//	 */
2041
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_type_arguments";	//$NON-NLS-1$
2042
//	/**
2043
//	 * <pre>
2044
//	 * FORMATTER / Option to insert a space before comma in type parameters
2045
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_type_parameters"
2046
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2047
//	 *     - default:           DO_NOT_INSERT
2048
//	 * </pre>
2049
//	 * @see CCorePlugin#INSERT
2050
//	 * @see CCorePlugin#DO_NOT_INSERT
2051
//	 */
2052
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_type_parameters";	//$NON-NLS-1$
2053
//	/**
2054
//	 * <pre>
2055
//	 * FORMATTER / Option to insert a space before ellipsis
2056
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_ellipsis"
2057
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2058
//	 *     - default:           DO_NOT_INSERT
2059
//	 * </pre>
2060
//	 * @see CCorePlugin#INSERT
2061
//	 * @see CCorePlugin#DO_NOT_INSERT
2062
//	 */
2063
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_ELLIPSIS  = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_ellipsis";	//$NON-NLS-1$
2064
//	/**
2065
//	 * <pre>
2066
//	 * FORMATTER / Option to insert a space before the opening angle bracket in parameterized type reference
2067
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference"
2068
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2069
//	 *     - default:           DO_NOT_INSERT
2070
//	 * </pre>
2071
//	 * @see CCorePlugin#INSERT
2072
//	 * @see CCorePlugin#DO_NOT_INSERT
2073
//	 */
2074
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE  = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference";	//$NON-NLS-1$
2075
//	/**
2076
//	 * <pre>
2077
//	 * FORMATTER / Option to insert a space before the opening angle bracket in type arguments
2078
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments"
2079
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2080
//	 *     - default:           DO_NOT_INSERT
2081
//	 * </pre>
2082
//	 * @see CCorePlugin#INSERT
2083
//	 * @see CCorePlugin#DO_NOT_INSERT
2084
//	 */
2085
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_angle_bracket_in_type_arguments";	//$NON-NLS-1$
2086
//	/**
2087
//	 * <pre>
2088
//	 * FORMATTER / Option to insert a space before the opening angle bracket in type parameters
2089
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters"
2090
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2091
//	 *     - default:           DO_NOT_INSERT
2092
//	 * </pre>
2093
//	 * @see CCorePlugin#INSERT
2094
//	 * @see CCorePlugin#DO_NOT_INSERT
2095
//	 */
2096
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_angle_bracket_in_type_parameters";	//$NON-NLS-1$
2097
//	/**
2098
//	 * <pre>
2099
//	 * FORMATTER / Option to insert a space before the opening brace in an annotation type declaration
2100
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration"
2101
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2102
//	 *     - default:           INSERT
2103
//	 * </pre>
2104
//	 * @see CCorePlugin#INSERT
2105
//	 * @see CCorePlugin#DO_NOT_INSERT
2106
//	 */
2107
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ANNOTATION_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_annotation_type_declaration"; 	//$NON-NLS-1$
2108
//	/**
2109
//	 * <pre>
2110
//	 * FORMATTER / Option to insert a space before the opening brace in an anonymous type declaration
2111
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration"
2112
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2113
//	 *     - default:           INSERT
2114
//	 * </pre>
2115
//	 * @see CCorePlugin#INSERT
2116
//	 * @see CCorePlugin#DO_NOT_INSERT
2117
//	 */
2118
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ANONYMOUS_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_anonymous_type_declaration"; 	//$NON-NLS-1$
2119
//	/**
2120
//	 * <pre>
2121
//	 * FORMATTER / Option to insert a space before the opening brace in an array initializer
2122
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer"
2123
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2124
//	 *     - default:           DO_NOT_INSERT
2125
//	 * </pre>
2126
//	 * @see CCorePlugin#INSERT
2127
//	 * @see CCorePlugin#DO_NOT_INSERT
2128
//	 */
2129
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_array_initializer"; //$NON-NLS-1$
2130
//	/**
2131
//	 * <pre>
2132
//	 * FORMATTER / Option to insert a space before the opening brace in a block
2133
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block"
2134
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2135
//	 *     - default:           INSERT
2136
//	 * </pre>
2137
//	 * @see CCorePlugin#INSERT
2138
//	 * @see CCorePlugin#DO_NOT_INSERT
2139
//	 */
2140
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_BLOCK = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_block";	//$NON-NLS-1$
2141
//	/**
2142
//	 * <pre>
2143
//	 * FORMATTER / Option to insert a space before the opening brace in a constructor declaration
2144
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration"
2145
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2146
//	 *     - default:           INSERT
2147
//	 * </pre>
2148
//	 * @see CCorePlugin#INSERT
2149
//	 * @see CCorePlugin#DO_NOT_INSERT
2150
//	 */
2151
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_constructor_declaration";	//$NON-NLS-1$
2152
//	/**
2153
//	 * <pre>
2154
//	 * FORMATTER / Option to insert a space before the opening brace in an enum constant
2155
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_enum_constant"
2156
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2157
//	 *     - default:           INSERT
2158
//	 * </pre>
2159
//	 * @see CCorePlugin#INSERT
2160
//	 * @see CCorePlugin#DO_NOT_INSERT
2161
//	 */
2162
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_enum_constant";	//$NON-NLS-1$
2163
//	/**
2164
//	 * <pre>
2165
//	 * FORMATTER / Option to insert a space before the opening brace in an enum declaration
2166
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration"
2167
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2168
//	 *     - default:           INSERT
2169
//	 * </pre>
2170
//	 * @see CCorePlugin#INSERT
2171
//	 * @see CCorePlugin#DO_NOT_INSERT
2172
//	 */
2173
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_enum_declaration";	//$NON-NLS-1$
2174
//	/**
2175
//	 * <pre>
2176
//	 * FORMATTER / Option to insert a space before the opening brace in a method declaration
2177
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration"
2178
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2179
//	 *     - default:           INSERT
2180
//	 * </pre>
2181
//	 * @see CCorePlugin#INSERT
2182
//	 * @see CCorePlugin#DO_NOT_INSERT
2183
//	 */
2184
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_method_declaration";	//$NON-NLS-1$
2185
//	/**
2186
//	 * <pre>
2187
//	 * FORMATTER / Option to insert a space before the opening brace in a switch statement
2188
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch"
2189
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2190
//	 *     - default:           INSERT
2191
//	 * </pre>
2192
//	 * @see CCorePlugin#INSERT
2193
//	 * @see CCorePlugin#DO_NOT_INSERT
2194
//	 */
2195
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_SWITCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_switch";	//$NON-NLS-1$
2196
//	/**
2197
//	 * <pre>
2198
//	 * FORMATTER / Option to insert a space before the opening brace in a type declaration
2199
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration"
2200
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2201
//	 *     - default:           INSERT
2202
//	 * </pre>
2203
//	 * @see CCorePlugin#INSERT
2204
//	 * @see CCorePlugin#DO_NOT_INSERT
2205
//	 */
2206
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_brace_in_type_declaration";	//$NON-NLS-1$
2207
//	/**
2208
//	 * <pre>
2209
//	 * FORMATTER / Option to insert a space before the opening bracket in an array allocation expression
2210
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression"
2211
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2212
//	 *     - default:           DO_NOT_INSERT
2213
//	 * </pre>
2214
//	 * @see CCorePlugin#INSERT
2215
//	 * @see CCorePlugin#DO_NOT_INSERT
2216
//	 */
2217
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_bracket_in_array_allocation_expression";//$NON-NLS-1$
2218
//	/**
2219
//	 * <pre>
2220
//	 * FORMATTER / Option to insert a space before the opening bracket in an array reference
2221
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket_in_array_reference"
2222
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2223
//	 *     - default:           DO_NOT_INSERT
2224
//	 * </pre>
2225
//	 * @see CCorePlugin#INSERT
2226
//	 * @see CCorePlugin#DO_NOT_INSERT
2227
//	 */
2228
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_bracket_in_array_reference";//$NON-NLS-1$
2229
//	/**
2230
//	 * <pre>
2231
//	 * FORMATTER / Option to insert a space before the opening bracket in an array type reference
2232
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference"
2233
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2234
//	 *     - default:           DO_NOT_INSERT
2235
//	 * </pre>
2236
//	 * @see CCorePlugin#INSERT
2237
//	 * @see CCorePlugin#DO_NOT_INSERT
2238
//	 */
2239
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_bracket_in_array_type_reference";	//$NON-NLS-1$
2240
//	/**
2241
//	 * <pre>
2242
//	 * FORMATTER / Option to insert a space before the opening parenthesis in annotation
2243
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_annotation"
2244
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2245
//	 *     - default:           DO_NOT_INSERT
2246
//	 * </pre>
2247
//	 * @see CCorePlugin#INSERT
2248
//	 * @see CCorePlugin#DO_NOT_INSERT
2249
//	 */
2250
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ANNOTATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_annotation";	//$NON-NLS-1$
2251
//	/**
2252
//	 * <pre>
2253
//	 * FORMATTER / Option to insert a space before the opening parenthesis in annotation type member declaration
2254
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration"
2255
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2256
//	 *     - default:           DO_NOT_INSERT
2257
//	 * </pre>
2258
//	 * @see CCorePlugin#INSERT
2259
//	 * @see CCorePlugin#DO_NOT_INSERT
2260
//	 */
2261
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ANNOTATION_TYPE_MEMBER_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration";	//$NON-NLS-1$
2262
//	/**
2263
//	 * <pre>
2264
//	 * FORMATTER / Option to insert a space before the opening parenthesis in a catch
2265
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch"
2266
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2267
//	 *     - default:           INSERT
2268
//	 * </pre>
2269
//	 * @see CCorePlugin#INSERT
2270
//	 * @see CCorePlugin#DO_NOT_INSERT
2271
//	 */
2272
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CATCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_catch";	//$NON-NLS-1$
2273
//	/**
2274
//	 * <pre>
2275
//	 * FORMATTER / Option to insert a space before the opening parenthesis in a constructor declaration
2276
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration"
2277
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2278
//	 *     - default:           DO_NOT_INSERT
2279
//	 * </pre>
2280
//	 * @see CCorePlugin#INSERT
2281
//	 * @see CCorePlugin#DO_NOT_INSERT
2282
//	 */
2283
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_constructor_declaration";	//$NON-NLS-1$
2284
//	/**
2285
//	 * <pre>
2286
//	 * FORMATTER / Option to insert a space before the opening parenthesis in enum constant
2287
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_enum_constant"
2288
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2289
//	 *     - default:           DO_NOT_INSERT
2290
//	 * </pre>
2291
//	 * @see CCorePlugin#INSERT
2292
//	 * @see CCorePlugin#DO_NOT_INSERT
2293
//	 */
2294
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_enum_constant";	//$NON-NLS-1$
2295
//	/**
2296
//	 * <pre>
2297
//	 * FORMATTER / Option to insert a space before the opening parenthesis in a for statement
2298
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for"
2299
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2300
//	 *     - default:           INSERT
2301
//	 * </pre>
2302
//	 * @see CCorePlugin#INSERT
2303
//	 * @see CCorePlugin#DO_NOT_INSERT
2304
//	 */
2305
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_for";	//$NON-NLS-1$
2306
//	/**
2307
//	 * <pre>
2308
//	 * FORMATTER / Option to insert a space before the opening parenthesis in an if statement
2309
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if"
2310
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2311
//	 *     - default:           INSERT
2312
//	 * </pre>
2313
//	 * @see CCorePlugin#INSERT
2314
//	 * @see CCorePlugin#DO_NOT_INSERT
2315
//	 */
2316
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_IF = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_if";	//$NON-NLS-1$
2317
//	/**
2318
//	 * <pre>
2319
//	 * FORMATTER / Option to insert a space before the opening parenthesis in a method declaration
2320
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration"
2321
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2322
//	 *     - default:           DO_NOT_INSERT
2323
//	 * </pre>
2324
//	 * @see CCorePlugin#INSERT
2325
//	 * @see CCorePlugin#DO_NOT_INSERT
2326
//	 */
2327
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_method_declaration";	//$NON-NLS-1$
2328
//	/**
2329
//	 * <pre>
2330
//	 * FORMATTER / Option to insert a space before the opening parenthesis in a method invocation
2331
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation"
2332
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2333
//	 *     - default:           DO_NOT_INSERT
2334
//	 * </pre>
2335
//	 * @see CCorePlugin#INSERT
2336
//	 * @see CCorePlugin#DO_NOT_INSERT
2337
//	 */
2338
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_method_invocation";	//$NON-NLS-1$
2339
//	/**
2340
//	 * <pre>
2341
//	 * FORMATTER / Option to insert a space before the opening parenthesis in a parenthesized expression
2342
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression"
2343
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2344
//	 *     - default:           DO_NOT_INSERT
2345
//	 * </pre>
2346
//	 * @see CCorePlugin#INSERT
2347
//	 * @see CCorePlugin#DO_NOT_INSERT
2348
//	 */
2349
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_parenthesized_expression"; //$NON-NLS-1$
2350
//	/**
2351
//	 * <pre>
2352
//	 * FORMATTER / Option to insert a space before the opening parenthesis in a switch statement
2353
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch"
2354
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2355
//	 *     - default:           INSERT
2356
//	 * </pre>
2357
//	 * @see CCorePlugin#INSERT
2358
//	 * @see CCorePlugin#DO_NOT_INSERT
2359
//	 */
2360
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SWITCH = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_switch";	//$NON-NLS-1$
2361
//	/**
2362
//	 * <pre>
2363
//	 * FORMATTER / Option to insert a space before the opening parenthesis in a synchronized statement
2364
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_synchronized"
2365
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2366
//	 *     - default:           INSERT
2367
//	 * </pre>
2368
//	 * @see CCorePlugin#INSERT
2369
//	 * @see CCorePlugin#DO_NOT_INSERT
2370
//	 */
2371
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SYNCHRONIZED = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_synchronized";	//$NON-NLS-1$
2372
//	/**
2373
//	 * <pre>
2374
//	 * FORMATTER / Option to insert a space before the opening parenthesis in a while statement
2375
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while"
2376
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2377
//	 *     - default:           INSERT
2378
//	 * </pre>
2379
//	 * @see CCorePlugin#INSERT
2380
//	 * @see CCorePlugin#DO_NOT_INSERT
2381
//	 */
2382
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_WHILE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_while";	//$NON-NLS-1$
2383
//	/**
2384
//	 * <pre>
2385
//	 * FORMATTER / Option to insert a space before parenthesized expression in return statement
2386
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_parenthesized_expression_in_return"
2387
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2388
//	 *     - default:           INSERT
2389
//	 * </pre>
2390
//	 * 
2391
//	 * @see CCorePlugin#INSERT
2392
//	 * @see CCorePlugin#DO_NOT_INSERT
2393
//	 */
2394
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_RETURN  = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_parenthesized_expression_in_return";	//$NON-NLS-1$
2395
//	/**
2396
//	 * <pre>
2397
//	 * FORMATTER / Option to insert a space before a postfix operator
2398
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator"
2399
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2400
//	 *     - default:           DO_NOT_INSERT
2401
//	 * </pre>
2402
//	 * @see CCorePlugin#INSERT
2403
//	 * @see CCorePlugin#DO_NOT_INSERT
2404
//	 */
2405
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_POSTFIX_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_postfix_operator";	//$NON-NLS-1$
2406
//	/**
2407
//	 * <pre>
2408
//	 * FORMATTER / Option to insert a space before a prefix operator
2409
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator"
2410
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2411
//	 *     - default:           DO_NOT_INSERT
2412
//	 * </pre>
2413
//	 * @see CCorePlugin#INSERT
2414
//	 * @see CCorePlugin#DO_NOT_INSERT
2415
//	 */
2416
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_PREFIX_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_prefix_operator";	//$NON-NLS-1$
2417
//	/**
2418
//	 * <pre>
2419
//	 * FORMATTER / Option to insert a space before question mark in a conditional expression
2420
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional"
2421
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2422
//	 *     - default:           INSERT
2423
//	 * </pre>
2424
//	 * @see CCorePlugin#INSERT
2425
//	 * @see CCorePlugin#DO_NOT_INSERT
2426
//	 */
2427
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_CONDITIONAL = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_question_in_conditional";	//$NON-NLS-1$
2428
//	/**
2429
//	 * <pre>
2430
//	 * FORMATTER / Option to insert a space before question mark in a wildcard
2431
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_question_in_wildcard"
2432
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2433
//	 *     - default:           DO_NOT_INSERT
2434
//	 * </pre>
2435
//	 * @see CCorePlugin#INSERT
2436
//	 * @see CCorePlugin#DO_NOT_INSERT
2437
//	 */
2438
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_WILDCARD = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_question_in_wildcard"; //$NON-NLS-1$
2439
//	/**
2440
//	 * <pre>
2441
//	 * FORMATTER / Option to insert a space before semicolon
2442
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_semicolon"
2443
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2444
//	 *     - default:           DO_NOT_INSERT
2445
//	 * </pre>
2446
//	 * @see CCorePlugin#INSERT
2447
//	 * @see CCorePlugin#DO_NOT_INSERT
2448
//	 */
2449
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_semicolon";	//$NON-NLS-1$
2450
//	/**
2451
//	 * <pre>
2452
//	 * FORMATTER / Option to insert a space before semicolon in for statement
2453
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for"
2454
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2455
//	 *     - default:           DO_NOT_INSERT
2456
//	 * </pre>
2457
//	 * @see CCorePlugin#INSERT
2458
//	 * @see CCorePlugin#DO_NOT_INSERT
2459
//	 */
2460
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON_IN_FOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_semicolon_in_for";	//$NON-NLS-1$
2461
//	/**
2462
//	 * <pre>
2463
//	 * FORMATTER / Option to insert a space before unary operator
2464
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_before_unary_operator"
2465
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2466
//	 *     - default:           DO_NOT_INSERT
2467
//	 * </pre>
2468
//	 * @see CCorePlugin#INSERT
2469
//	 * @see CCorePlugin#DO_NOT_INSERT
2470
//	 */
2471
//	public static final String FORMATTER_INSERT_SPACE_BEFORE_UNARY_OPERATOR = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_unary_operator";	//$NON-NLS-1$
2472
//
2473
//	/**
2474
//	 * <pre>
2475
//	 * FORMATTER / Option to insert a space between brackets in an array type reference
2476
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_between_brackets_in_array_type_reference"
2477
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2478
//	 *     - default:           DO_NOT_INSERT
2479
//	 * </pre>
2480
//	 * @see CCorePlugin#INSERT
2481
//	 * @see CCorePlugin#DO_NOT_INSERT
2482
//	 */
2483
//	public static final String FORMATTER_INSERT_SPACE_BETWEEN_BRACKETS_IN_ARRAY_TYPE_REFERENCE = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_brackets_in_array_type_reference";	//$NON-NLS-1$
2484
//	/**
2485
//	 * <pre>
2486
//	 * FORMATTER / Option to insert a space between empty braces in an array initializer
2487
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer"
2488
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2489
//	 *     - default:           DO_NOT_INSERT
2490
//	 * </pre>
2491
//	 * @see CCorePlugin#INSERT
2492
//	 * @see CCorePlugin#DO_NOT_INSERT
2493
//	 */
2494
//	public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_ARRAY_INITIALIZER = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_braces_in_array_initializer";	//$NON-NLS-1$
2495
//	/**
2496
//	 * <pre>
2497
//	 * FORMATTER / Option to insert a space between empty brackets in an array allocation expression
2498
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression"
2499
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2500
//	 *     - default:           DO_NOT_INSERT
2501
//	 * </pre>
2502
//	 * @see CCorePlugin#INSERT
2503
//	 * @see CCorePlugin#DO_NOT_INSERT
2504
//	 */
2505
//	public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACKETS_IN_ARRAY_ALLOCATION_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_brackets_in_array_allocation_expression";	//$NON-NLS-1$
2506
//	/**
2507
//	 * <pre>
2508
//	 * FORMATTER / Option to insert a space between empty parenthesis in an annotation type member declaration
2509
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration"
2510
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2511
//	 *     - default:           DO_NOT_INSERT
2512
//	 * </pre>
2513
//	 * @see CCorePlugin#INSERT
2514
//	 * @see CCorePlugin#DO_NOT_INSERT
2515
//	 */
2516
//	public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_ANNOTATION_TYPE_MEMBER_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration";	//$NON-NLS-1$
2517
//	/**
2518
//	 * <pre>
2519
//	 * FORMATTER / Option to insert a space between empty parenthesis in a constructor declaration
2520
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration"
2521
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2522
//	 *     - default:           DO_NOT_INSERT
2523
//	 * </pre>
2524
//	 * @see CCorePlugin#INSERT
2525
//	 * @see CCorePlugin#DO_NOT_INSERT
2526
//	 */
2527
//	public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_CONSTRUCTOR_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_constructor_declaration";	//$NON-NLS-1$
2528
//	/**
2529
//	 * <pre>
2530
//	 * FORMATTER / Option to insert a space between empty parenthesis in enum constant
2531
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_enum_constant"
2532
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2533
//	 *     - default:           DO_NOT_INSERT
2534
//	 * </pre>
2535
//	 * @see CCorePlugin#INSERT
2536
//	 * @see CCorePlugin#DO_NOT_INSERT
2537
//	 */
2538
//	public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_ENUM_CONSTANT = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_enum_constant";	//$NON-NLS-1$
2539
//	/**
2540
//	 * <pre>
2541
//	 * FORMATTER / Option to insert a space between empty parenthesis in a method declaration
2542
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration"
2543
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2544
//	 *     - default:           DO_NOT_INSERT
2545
//	 * </pre>
2546
//	 * @see CCorePlugin#INSERT
2547
//	 * @see CCorePlugin#DO_NOT_INSERT
2548
//	 */
2549
//	public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_method_declaration";	//$NON-NLS-1$
2550
//	/**
2551
//	 * <pre>
2552
//	 * FORMATTER / Option to insert a space between empty parenthesis in a method invocation
2553
//	 *     - option id:         "org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation"
2554
//	 *     - possible values:   { INSERT, DO_NOT_INSERT }
2555
//	 *     - default:           DO_NOT_INSERT
2556
//	 * </pre>
2557
//	 * @see CCorePlugin#INSERT
2558
//	 * @see CCorePlugin#DO_NOT_INSERT
2559
//	 */
2560
//	public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_method_invocation";	//$NON-NLS-1$
2561
//	/**
2562
//	 * <pre>
2563
//	 * FORMATTER / Option to keep else statement on the same line
2564
//	 *     - option id:         "org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line"
2565
//	 *     - possible values:   { TRUE, FALSE }
2566
//	 *     - default:           FALSE
2567
//	 * </pre>
2568
//	 * @see #TRUE
2569
//	 * @see #FALSE
2570
//	 */
2571
//	public static final String FORMATTER_KEEP_ELSE_STATEMENT_ON_SAME_LINE = CCorePlugin.PLUGIN_ID + ".formatter.keep_else_statement_on_same_line"; //$NON-NLS-1$
2572
//	/**
2573
//	 * <pre>
2574
//	 * FORMATTER / Option to keep empty array initializer one one line
2575
//	 *     - option id:         "org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line"
2576
//	 *     - possible values:   { TRUE, FALSE }
2577
//	 *     - default:           FALSE
2578
//	 * </pre>
2579
//	 * @see #TRUE
2580
//	 * @see #FALSE
2581
//	 */
2582
//	public static final String FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE = CCorePlugin.PLUGIN_ID + ".formatter.keep_empty_array_initializer_on_one_line"; //$NON-NLS-1$
2583
//	/**
2584
//	 * <pre>
2585
//	 * FORMATTER / Option to keep guardian clause on one line
2586
//	 *     - option id:         "org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line"
2587
//	 *     - possible values:   { TRUE, FALSE }
2588
//	 *     - default:           FALSE
2589
//	 * </pre>
2590
//	 * @see #TRUE
2591
//	 * @see #FALSE
2592
//	 */
2593
//	public static final String FORMATTER_KEEP_GUARDIAN_CLAUSE_ON_ONE_LINE = CCorePlugin.PLUGIN_ID + ".formatter.format_guardian_clause_on_one_line";	//$NON-NLS-1$
2594
//	/**
2595
//	 * <pre>
2596
//	 * FORMATTER / Option to keep simple if statement on the one line
2597
//	 *     - option id:         "org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line"
2598
//	 *     - possible values:   { TRUE, FALSE }
2599
//	 *     - default:           FALSE
2600
//	 * </pre>
2601
//	 * @see #TRUE
2602
//	 * @see #FALSE
2603
//	 */
2604
//	public static final String FORMATTER_KEEP_SIMPLE_IF_ON_ONE_LINE = CCorePlugin.PLUGIN_ID + ".formatter.keep_imple_if_on_one_line"; //$NON-NLS-1$
2605
//	/**
2606
//	 * <pre>
2607
//	 * FORMATTER / Option to keep then statement on the same line
2608
//	 *     - option id:         "org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line"
2609
//	 *     - possible values:   { TRUE, FALSE }
2610
//	 *     - default:           FALSE
2611
//	 * </pre>
2612
//	 * @see #TRUE
2613
//	 * @see #FALSE
2614
//	 */
2615
//	public static final String FORMATTER_KEEP_THEN_STATEMENT_ON_SAME_LINE = CCorePlugin.PLUGIN_ID + ".formatter.keep_then_statement_on_same_line";//$NON-NLS-1$
2616
2617
	/**
2618
	 * <pre>
2619
	 * FORMATTER / Option to specify the length of the page. Beyond this length, the formatter will try to split the code
2620
	 *     - option id:         "org.eclipse.cdt.core.formatter.lineSplit"
2621
	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
2622
	 *     - default:           "80"
2623
	 * </pre>
2624
	 */
2625
	public static final String FORMATTER_LINE_SPLIT = CCorePlugin.PLUGIN_ID + ".formatter.lineSplit"; //$NON-NLS-1$
2626
//
2627
//	/**
2628
//	 * <pre>
2629
//	 * FORMATTER / Option to specify the number of empty lines to preserve
2630
//	 *     - option id:         "org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve"
2631
//	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
2632
//	 *     - default:           "0"
2633
//	 * </pre>
2634
//	 */
2635
//	public static final String FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE = CCorePlugin.PLUGIN_ID + ".formatter.number_of_empty_lines_to_preserve";	//$NON-NLS-1$
2636
//	/**
2637
//	 * <pre>
2638
//	 * FORMATTER / Option to specify whether or not empty statement should be on a new line
2639
//	 *     - option id:         "org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line"
2640
//	 *     - possible values:   { TRUE, FALSE }
2641
//	 *     - default:           FALSE
2642
//	 * </pre>
2643
//	 * @see #TRUE
2644
//	 * @see #FALSE
2645
//	 */
2646
//	public static final String FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE = CCorePlugin.PLUGIN_ID + ".formatter.put_empty_statement_on_new_line";	//$NON-NLS-1$
2647
	/**
2648
	 * <pre>
2649
	 * FORMATTER / Option to specify the tabulation size
2650
	 *     - option id:         "org.eclipse.cdt.core.formatter.tabulation.char"
2651
	 *     - possible values:   { TAB, SPACE, MIXED }
2652
	 *     - default:           TAB
2653
	 * </pre>
2654
	 * More values may be added in the future.
2655
	 * 
2656
	 * @see CCorePlugin#TAB
2657
	 * @see CCorePlugin#SPACE
2658
	 * @see #MIXED
2659
	 */
2660
	public static final String FORMATTER_TAB_CHAR = CCorePlugin.PLUGIN_ID + ".formatter.tabulation.char"; //$NON-NLS-1$
2661
	/**
2662
	 * <pre>
2663
	 * FORMATTER / Option to specify the equivalent number of spaces that represents one tabulation 
2664
	 *     - option id:         "org.eclipse.cdt.core.formatter.tabulation.size"
2665
	 *     - possible values:   "&lt;n&gt;", where n is zero or a positive integer
2666
	 *     - default:           "4"
2667
	 * </pre>
2668
	 */
2669
	public static final String FORMATTER_TAB_SIZE = CCorePlugin.PLUGIN_ID + ".formatter.tabulation.size"; //$NON-NLS-1$
2670
2671
	/**
2672
	 * <pre>
2673
	 * FORMATTER / Option to use tabulations only for leading indentations 
2674
	 *     - option id:         "org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations"
2675
	 *     - possible values:   { TRUE, FALSE }
2676
	 *     - default:           FALSE
2677
	 * </pre>
2678
	 * @see #TRUE
2679
	 * @see #FALSE
2680
	 */
2681
	public static final String FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS = CCorePlugin.PLUGIN_ID + ".formatter.use_tabs_only_for_leading_indentations"; //$NON-NLS-1$
2682
2683
	/**
2684
	 * <pre>
2685
	 * FORMATTER / The wrapping is done by indenting by one compare to the current indentation.
2686
	 * </pre>
2687
	 */
2688
	public static final int INDENT_BY_ONE= 2;
2689
	
2690
	/**
2691
	 * <pre>
2692
	 * FORMATTER / The wrapping is done by using the current indentation.
2693
	 * </pre>
2694
	 */
2695
	public static final int INDENT_DEFAULT= 0;
2696
	/**
2697
	 * <pre>
2698
	 * FORMATTER / The wrapping is done by indenting on column under the splitting location.
2699
	 * </pre>
2700
	 */
2701
	public static final int INDENT_ON_COLUMN = 1;
2702
	
2703
	/**
2704
	 * <pre>
2705
	 * FORMATTER / Possible value for the option FORMATTER_TAB_CHAR
2706
	 * </pre>
2707
	 * @see CCorePlugin#TAB
2708
	 * @see CCorePlugin#SPACE
2709
	 * @see #FORMATTER_TAB_CHAR
2710
	 */
2711
	public static final String MIXED = "mixed"; //$NON-NLS-1$
2712
//	/**
2713
//	 * <pre>
2714
//	 * FORMATTER / Value to set a brace location at the start of the next line with
2715
//	 *             the right indentation.
2716
//	 * </pre>
2717
//	 * @see #FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION
2718
//	 * @see #FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER
2719
//	 * @see #FORMATTER_BRACE_POSITION_FOR_BLOCK
2720
//	 * @see #FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION
2721
// 	 * @see #FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION
2722
// 	 * @see #FORMATTER_BRACE_POSITION_FOR_SWITCH
2723
//	 * @see #FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION
2724
//	 */
2725
//	public static final String NEXT_LINE = "next_line"; //$NON-NLS-1$
2726
//	/**
2727
//	 * <pre>
2728
//	 * FORMATTER / Value to set a brace location at the start of the next line if a wrapping
2729
//	 *             occured.
2730
//	 * </pre>
2731
//	 * @see #FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION
2732
//	 * @see #FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER
2733
//	 * @see #FORMATTER_BRACE_POSITION_FOR_BLOCK
2734
//	 * @see #FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION
2735
// 	 * @see #FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION
2736
// 	 * @see #FORMATTER_BRACE_POSITION_FOR_SWITCH
2737
//	 * @see #FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION
2738
//	 */
2739
//    public static final String NEXT_LINE_ON_WRAP = "next_line_on_wrap"; //$NON-NLS-1$
2740
	/**
2741
	 * <pre>
2742
	 * FORMATTER / Value to set a brace location at the start of the next line with
2743
	 *             an extra indentation.
2744
	 * </pre>
2745
	 * @see #FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION
2746
	 * @see #FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER
2747
	 * @see #FORMATTER_BRACE_POSITION_FOR_BLOCK
2748
	 * @see #FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION
2749
 	 * @see #FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION
2750
 	 * @see #FORMATTER_BRACE_POSITION_FOR_SWITCH
2751
	 * @see #FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION
2752
	 */
2753
	public static final String NEXT_LINE_SHIFTED = "next_line_shifted";	//$NON-NLS-1$
2754
	/**
2755
	 * <pre>
2756
	 * FORMATTER / Value to set an option to true.
2757
	 * </pre>
2758
	 */
2759
	public static final String TRUE = "true"; //$NON-NLS-1$
2760
	/**
2761
	 * <pre>
2762
	 * FORMATTER / The wrapping is done using as few lines as possible.
2763
	 * </pre>
2764
	 */
2765
	public static final int WRAP_COMPACT= 1;
2766
	/**
2767
	 * <pre>
2768
	 * FORMATTER / The wrapping is done putting the first element on a new
2769
	 *             line and then wrapping next elements using as few lines as possible.
2770
	 * </pre>
2771
	 */
2772
	public static final int WRAP_COMPACT_FIRST_BREAK= 2;
2773
	/**
2774
	 * <pre>
2775
	 * FORMATTER / The wrapping is done by putting each element on its own line
2776
	 *             except the first element.
2777
	 * </pre>
2778
	 */
2779
	public static final int WRAP_NEXT_PER_LINE= 5;
2780
	/**
2781
	 * <pre>
2782
	 * FORMATTER / The wrapping is done by putting each element on its own line.
2783
	 *             All elements are indented by one except the first element.
2784
	 * </pre>
2785
	 */
2786
	public static final int WRAP_NEXT_SHIFTED= 4;
2787
2788
	/**
2789
	 * <pre>
2790
	 * FORMATTER / Value to disable alignment.
2791
	 * </pre>
2792
	 */
2793
	public static final int WRAP_NO_SPLIT= 0;
2794
	/**
2795
	 * <pre>
2796
	 * FORMATTER / The wrapping is done by putting each element on its own line.
2797
	 * </pre>
2798
	 */
2799
	public static final int WRAP_ONE_PER_LINE= 3;
2800
2801
	/*
2802
	 * Private constants.
2803
	 */
2804
	private static final IllegalArgumentException WRONG_ARGUMENT = new IllegalArgumentException();
2805
	
2806
	/**
2807
	 * Create a new alignment value according to the given values. This must be used to set up
2808
	 * the alignment options.
2809
	 * 
2810
	 * @param forceSplit the given force value
2811
	 * @param wrapStyle the given wrapping style
2812
	 * @param indentStyle the given indent style
2813
	 * 
2814
	 * @return the new alignement value
2815
	 */
2816
	public static String createAlignmentValue(boolean forceSplit, int wrapStyle, int indentStyle) {
2817
		int alignmentValue = 0; 
2818
		switch(wrapStyle) {
2819
			case WRAP_COMPACT :
2820
				alignmentValue |= Alignment.M_COMPACT_SPLIT;
2821
				break;
2822
			case WRAP_COMPACT_FIRST_BREAK :
2823
				alignmentValue |= Alignment.M_COMPACT_FIRST_BREAK_SPLIT;
2824
				break;
2825
			case WRAP_NEXT_PER_LINE :
2826
				alignmentValue |= Alignment.M_NEXT_PER_LINE_SPLIT;
2827
				break;
2828
			case WRAP_NEXT_SHIFTED :
2829
				alignmentValue |= Alignment.M_NEXT_SHIFTED_SPLIT;
2830
				break;
2831
			case WRAP_ONE_PER_LINE :
2832
				alignmentValue |= Alignment.M_ONE_PER_LINE_SPLIT;
2833
				break;
2834
		}		
2835
		if (forceSplit) {
2836
			alignmentValue |= Alignment.M_FORCE;
2837
		}
2838
		switch(indentStyle) {
2839
			case INDENT_BY_ONE :
2840
				alignmentValue |= Alignment.M_INDENT_BY_ONE;
2841
				break;
2842
			case INDENT_ON_COLUMN :
2843
				alignmentValue |= Alignment.M_INDENT_ON_COLUMN;
2844
		}
2845
		return String.valueOf(alignmentValue);
2846
	}
2847
2848
	/**
2849
	 * Returns the default Eclipse formatter settings
2850
	 * 
2851
	 * @return the Eclipse default settings
2852
	 */
2853
	public static Map getEclipseDefaultSettings() {
2854
		return DefaultCodeFormatterOptions.getEclipseDefaultSettings().getMap();
2855
	}
2856
2857
	/**
2858
	 * <p>Return the force value of the given alignment value.
2859
	 * The given alignment value should be created using the <code>createAlignmentValue(boolean, int, int)</code>
2860
	 * API.
2861
	 * </p>
2862
	 *
2863
	 * @param value the given alignment value
2864
	 * @return the force value of the given alignment value
2865
	 * @see #createAlignmentValue(boolean, int, int)
2866
	 * @exception IllegalArgumentException if the given alignment value is null, or if it 
2867
	 * doesn't have a valid format.
2868
	 */
2869
	public static boolean getForceWrapping(String value) {
2870
		if (value == null) {
2871
			throw WRONG_ARGUMENT;
2872
		}
2873
		try {
2874
			int existingValue = Integer.parseInt(value);
2875
			return (existingValue & Alignment.M_FORCE) != 0;
2876
		} catch (NumberFormatException e) {
2877
			throw WRONG_ARGUMENT;
2878
		}
2879
	}
2880
	
2881
	/**
2882
	 * <p>Return the indentation style of the given alignment value.
2883
	 * The given alignment value should be created using the <code>createAlignmentValue(boolean, int, int)</code>
2884
	 * API.
2885
	 * </p>
2886
	 *
2887
	 * @param value the given alignment value
2888
	 * @return the indentation style of the given alignment value
2889
	 * @see #createAlignmentValue(boolean, int, int)
2890
	 * @exception IllegalArgumentException if the given alignment value is null, or if it 
2891
	 * doesn't have a valid format.
2892
	 */
2893
	public static int getIndentStyle(String value) {
2894
		if (value == null) {
2895
			throw WRONG_ARGUMENT;
2896
		}
2897
		try {
2898
			int existingValue = Integer.parseInt(value);
2899
			if ((existingValue & Alignment.M_INDENT_BY_ONE) != 0) {
2900
				return INDENT_BY_ONE;
2901
			} else if ((existingValue & Alignment.M_INDENT_ON_COLUMN) != 0) {
2902
				return INDENT_ON_COLUMN;
2903
			} else {
2904
				return INDENT_DEFAULT;
2905
			}
2906
		} catch (NumberFormatException e) {
2907
			throw WRONG_ARGUMENT;
2908
		}
2909
	}
2910
2911
	/**
2912
	 * <p>Return the wrapping style of the given alignment value.
2913
	 * The given alignment value should be created using the <code>createAlignmentValue(boolean, int, int)</code>
2914
	 * API.
2915
	 * </p>
2916
	 *
2917
	 * @param value the given alignment value
2918
	 * @return the wrapping style of the given alignment value
2919
	 * @see #createAlignmentValue(boolean, int, int)
2920
	 * @exception IllegalArgumentException if the given alignment value is null, or if it 
2921
	 * doesn't have a valid format.
2922
	 */
2923
	public static int getWrappingStyle(String value) {
2924
		if (value == null) {
2925
			throw WRONG_ARGUMENT;
2926
		}
2927
		try {
2928
			int existingValue = Integer.parseInt(value) & Alignment.SPLIT_MASK;
2929
			switch(existingValue) {
2930
				case Alignment.M_COMPACT_SPLIT :
2931
					return WRAP_COMPACT;
2932
				case Alignment.M_COMPACT_FIRST_BREAK_SPLIT :
2933
					return WRAP_COMPACT_FIRST_BREAK;
2934
				case Alignment.M_NEXT_PER_LINE_SPLIT :
2935
					return WRAP_NEXT_PER_LINE;
2936
				case Alignment.M_NEXT_SHIFTED_SPLIT :
2937
					return WRAP_NEXT_SHIFTED;
2938
				case Alignment.M_ONE_PER_LINE_SPLIT :
2939
					return WRAP_ONE_PER_LINE;
2940
				default:
2941
					return WRAP_NO_SPLIT;
2942
			}
2943
		} catch (NumberFormatException e) {
2944
			throw WRONG_ARGUMENT;
2945
		}
2946
	}
2947
	/**
2948
	 * <p>Set the force value of the given alignment value and return the new value.
2949
	 * The given alignment value should be created using the <code>createAlignmentValue(boolean, int, int)</code>
2950
	 * API.
2951
	 * </p>
2952
	 *
2953
	 * @param value the given alignment value
2954
	 * @param force the given force value
2955
	 * @return the new alignment value
2956
	 * @see #createAlignmentValue(boolean, int, int)
2957
	 * @exception IllegalArgumentException if the given alignment value is null, or if it 
2958
	 * doesn't have a valid format.
2959
	 */
2960
	public static String setForceWrapping(String value, boolean force) {
2961
		if (value == null) {
2962
			throw WRONG_ARGUMENT;
2963
		}
2964
		try {
2965
			int existingValue = Integer.parseInt(value);
2966
			// clear existing force bit
2967
			existingValue &= ~Alignment.M_FORCE;
2968
			if (force) {
2969
				existingValue |= Alignment.M_FORCE;
2970
			}
2971
			return String.valueOf(existingValue);
2972
		} catch (NumberFormatException e) {
2973
			throw WRONG_ARGUMENT;
2974
		}		
2975
	}
2976
	
2977
	/**
2978
	 * <p>Set the indentation style of the given alignment value and return the new value.
2979
	 * The given value should be created using the <code>createAlignmentValue(boolean, int, int)</code>
2980
	 * API.
2981
	 * </p>
2982
	 *
2983
	 * @param value the given alignment value
2984
	 * @param indentStyle the given indentation style
2985
	 * @return the new alignment value
2986
	 * @see #INDENT_BY_ONE
2987
	 * @see #INDENT_DEFAULT
2988
	 * @see #INDENT_ON_COLUMN
2989
	 * @see #createAlignmentValue(boolean, int, int)
2990
	 * @exception IllegalArgumentException if the given alignment value is null, if the given
2991
	 * indentation style is not one of the possible indentation styles, or if the given
2992
	 * alignment value doesn't have a valid format.
2993
	 */
2994
	public static String setIndentStyle(String value, int indentStyle) {
2995
		if (value == null) {
2996
			throw WRONG_ARGUMENT;
2997
		}
2998
		switch(indentStyle) {
2999
			case INDENT_BY_ONE :
3000
			case INDENT_DEFAULT :
3001
			case INDENT_ON_COLUMN :
3002
				break;
3003
			default :
3004
				throw WRONG_ARGUMENT;
3005
		}
3006
		try {
3007
			int existingValue = Integer.parseInt(value);
3008
			// clear existing indent bits
3009
			existingValue &= ~(Alignment.M_INDENT_BY_ONE | Alignment.M_INDENT_ON_COLUMN);
3010
			switch(indentStyle) {
3011
				case INDENT_BY_ONE :
3012
					existingValue |= Alignment.M_INDENT_BY_ONE;
3013
					break;
3014
				case INDENT_ON_COLUMN :
3015
					existingValue |= Alignment.M_INDENT_ON_COLUMN;
3016
			}
3017
			return String.valueOf(existingValue);
3018
		} catch (NumberFormatException e) {
3019
			throw WRONG_ARGUMENT;
3020
		}
3021
	}
3022
	/**
3023
	 * <p>Set the wrapping style of the given alignment value and return the new value.
3024
	 * The given value should be created using the <code>createAlignmentValue(boolean, int, int)</code>
3025
	 * API.
3026
	 * </p>
3027
	 *
3028
	 * @param value the given alignment value
3029
	 * @param wrappingStyle the given wrapping style
3030
	 * @return the new alignment value
3031
	 * @see #WRAP_COMPACT
3032
	 * @see #WRAP_COMPACT_FIRST_BREAK
3033
	 * @see #WRAP_NEXT_PER_LINE
3034
	 * @see #WRAP_NEXT_SHIFTED
3035
	 * @see #WRAP_NO_SPLIT
3036
	 * @see #WRAP_ONE_PER_LINE
3037
	 * @see #createAlignmentValue(boolean, int, int)
3038
	 * @exception IllegalArgumentException if the given alignment value is null, if the given
3039
	 * wrapping style is not one of the possible wrapping styles, or if the given
3040
	 * alignment value doesn't have a valid format.
3041
	 */
3042
	public static String setWrappingStyle(String value, int wrappingStyle) {
3043
		if (value == null) {
3044
			throw WRONG_ARGUMENT;
3045
		}
3046
		switch(wrappingStyle) {
3047
			case WRAP_COMPACT :
3048
			case WRAP_COMPACT_FIRST_BREAK :
3049
			case WRAP_NEXT_PER_LINE :
3050
			case WRAP_NEXT_SHIFTED :
3051
			case WRAP_NO_SPLIT :
3052
			case WRAP_ONE_PER_LINE :
3053
				break;
3054
			default:
3055
				throw WRONG_ARGUMENT;
3056
		}
3057
		try {
3058
			int existingValue = Integer.parseInt(value);
3059
			// clear existing split bits
3060
			existingValue &= ~(Alignment.SPLIT_MASK);
3061
			switch(wrappingStyle) {
3062
				case WRAP_COMPACT :
3063
					existingValue |= Alignment.M_COMPACT_SPLIT;
3064
					break;
3065
				case WRAP_COMPACT_FIRST_BREAK :
3066
					existingValue |= Alignment.M_COMPACT_FIRST_BREAK_SPLIT;
3067
					break;
3068
				case WRAP_NEXT_PER_LINE :
3069
					existingValue |= Alignment.M_NEXT_PER_LINE_SPLIT;
3070
					break;
3071
				case WRAP_NEXT_SHIFTED :
3072
					existingValue |= Alignment.M_NEXT_SHIFTED_SPLIT;
3073
					break;
3074
				case WRAP_ONE_PER_LINE :
3075
					existingValue |= Alignment.M_ONE_PER_LINE_SPLIT;
3076
					break;
3077
			}
3078
			return String.valueOf(existingValue);
3079
		} catch (NumberFormatException e) {
3080
			throw WRONG_ARGUMENT;
3081
		}
3082
	}
3083
}

Return to bug 148582