1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-08 16:55:38 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2014-08-08 15:17:07 -07:00
parent f0a593fbb7
commit 2009946e05
8 changed files with 382 additions and 526 deletions

View file

@ -17,7 +17,6 @@ import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.internal.formatter.align.Alignment; import org.eclipse.cdt.internal.formatter.align.Alignment;
/** /**
* Constants used to set up the options of the code formatter. * Constants used to set up the options of the code formatter.
* *
@ -26,12 +25,11 @@ import org.eclipse.cdt.internal.formatter.align.Alignment;
* @noinstantiate This class is not intended to be instantiated by clients. * @noinstantiate This class is not intended to be instantiated by clients.
*/ */
public class DefaultCodeFormatterConstants { public class DefaultCodeFormatterConstants {
/** /**
* <pre> * <pre>
* FORMATTER / Option for the language * FORMATTER / Option for the language
* - option id: "org.eclipse.cdt.core.formatter.language" * - option id: "org.eclipse.cdt.core.formatter.language"
* - possible values: object of class <code>ILanguage</code> or <code>null</code> * - possible values: object of class {@code ILanguage} or {@code null}
* - default: null * - default: null
* </pre> * </pre>
*/ */
@ -41,7 +39,7 @@ public class DefaultCodeFormatterConstants {
* <pre> * <pre>
* FORMATTER / Option for the current file * FORMATTER / Option for the current file
* - option id: "org.eclipse.cdt.core.formatter.current_file" * - option id: "org.eclipse.cdt.core.formatter.current_file"
* - possible values: object of class <code>IFile</code> or <code>null</code> * - possible values: object of class {@code IFile} or {@code null}
* - default: null * - default: null
* </pre> * </pre>
*/ */
@ -51,7 +49,7 @@ public class DefaultCodeFormatterConstants {
* <pre> * <pre>
* FORMATTER / Option for the translation unit * FORMATTER / Option for the translation unit
* - option id: "org.eclipse.cdt.core.formatter.current_translation_unit" * - option id: "org.eclipse.cdt.core.formatter.current_translation_unit"
* - possible values: object of class <code>ITranslationUnit</code> or <code>null</code> * - possible values: object of class {@code ITranslationUnit} or {@code null}
* - default: null * - default: null
* </pre> * </pre>
*/ */
@ -92,7 +90,7 @@ public class DefaultCodeFormatterConstants {
// * <pre> // * <pre>
// * FORMATTER / Option for alignment of arguments in allocation expression // * FORMATTER / Option for alignment of arguments in allocation expression
// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_allocation_expression" // * - option id: "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_allocation_expression"
// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call // * - possible values: values returned by {@code createAlignmentValue(boolean, int, int)} call
// * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT) // * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
// * </pre> // * </pre>
// * @see #createAlignmentValue(boolean, int, int) // * @see #createAlignmentValue(boolean, int, int)
@ -102,7 +100,7 @@ public class DefaultCodeFormatterConstants {
* <pre> * <pre>
* FORMATTER / Option for alignment of arguments in method invocation * FORMATTER / Option for alignment of arguments in method invocation
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation" * - option id: "org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call * - possible values: values returned by {@code createAlignmentValue(boolean, int, int)} call
* - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT) * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
* </pre> * </pre>
* @see #createAlignmentValue(boolean, int, int) * @see #createAlignmentValue(boolean, int, int)
@ -112,7 +110,7 @@ public class DefaultCodeFormatterConstants {
* <pre> * <pre>
* FORMATTER / Option for alignment of assignment * FORMATTER / Option for alignment of assignment
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_assignment" * - option id: "org.eclipse.cdt.core.formatter.alignment_for_assignment"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call * - possible values: values returned by {@code createAlignmentValue(boolean, int, int)} call
* - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT) * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
* </pre> * </pre>
* @see #createAlignmentValue(boolean, int, int) * @see #createAlignmentValue(boolean, int, int)
@ -123,7 +121,7 @@ public class DefaultCodeFormatterConstants {
* <pre> * <pre>
* FORMATTER / Option for alignment of binary expression * FORMATTER / Option for alignment of binary expression
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_binary_expression" * - option id: "org.eclipse.cdt.core.formatter.alignment_for_binary_expression"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call * - possible values: values returned by {@code createAlignmentValue(boolean, int, int)} call
* - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT) * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
* </pre> * </pre>
* @see #createAlignmentValue(boolean, int, int) * @see #createAlignmentValue(boolean, int, int)
@ -134,7 +132,7 @@ public class DefaultCodeFormatterConstants {
* <pre> * <pre>
* FORMATTER / Option for alignment of compact if * FORMATTER / Option for alignment of compact if
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_compact_if" * - option id: "org.eclipse.cdt.core.formatter.alignment_for_compact_if"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call * - possible values: values returned by {@code createAlignmentValue(boolean, int, int)} call
* - default: createAlignmentValue(false, WRAP_ONE_PER_LINE, INDENT_BY_ONE) * - default: createAlignmentValue(false, WRAP_ONE_PER_LINE, INDENT_BY_ONE)
* </pre> * </pre>
* @see #createAlignmentValue(boolean, int, int) * @see #createAlignmentValue(boolean, int, int)
@ -144,7 +142,7 @@ public class DefaultCodeFormatterConstants {
* <pre> * <pre>
* FORMATTER / Option for alignment of conditional expression * FORMATTER / Option for alignment of conditional expression
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_conditional_expression" * - option id: "org.eclipse.cdt.core.formatter.alignment_for_conditional_expression"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call * - possible values: values returned by {@code createAlignmentValue(boolean, int, int)} call
* - default: createAlignmentValue(false, WRAP_COMPACT_FIRST_BREAK, INDENT_ON_COLUMN) * - default: createAlignmentValue(false, WRAP_COMPACT_FIRST_BREAK, INDENT_ON_COLUMN)
* </pre> * </pre>
* @see #createAlignmentValue(boolean, int, int) * @see #createAlignmentValue(boolean, int, int)
@ -154,7 +152,7 @@ public class DefaultCodeFormatterConstants {
* <pre> * <pre>
* FORMATTER / Option for alignment of a chain of conditional expressions. * FORMATTER / Option for alignment of a chain of conditional expressions.
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain" * - option id: "org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call * - possible values: values returned by {@code createAlignmentValue(boolean, int, int)} call
* - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_ON_COLUMN) * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_ON_COLUMN)
* </pre> * </pre>
* @see #createAlignmentValue(boolean, int, int) * @see #createAlignmentValue(boolean, int, int)
@ -165,7 +163,7 @@ public class DefaultCodeFormatterConstants {
* <pre> * <pre>
* FORMATTER / Option for alignment of a declarator list * FORMATTER / Option for alignment of a declarator list
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_declarator_list" * - option id: "org.eclipse.cdt.core.formatter.alignment_for_declarator_list"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call * - possible values: values returned by {@code createAlignmentValue(boolean, int, int)} call
* - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT) * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
* </pre> * </pre>
* @see #createAlignmentValue(boolean, int, int) * @see #createAlignmentValue(boolean, int, int)
@ -175,7 +173,7 @@ public class DefaultCodeFormatterConstants {
* <pre> * <pre>
* FORMATTER / Option for alignment of a enumerator list * FORMATTER / Option for alignment of a enumerator list
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_enumerator_list" * - option id: "org.eclipse.cdt.core.formatter.alignment_for_enumerator_list"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call * - possible values: values returned by {@code createAlignmentValue(boolean, int, int)} call
* - default: createAlignmentValue(false, WRAP_ONE_PER_LINE, INDENT_DEFAULT) * - default: createAlignmentValue(false, WRAP_ONE_PER_LINE, INDENT_DEFAULT)
* </pre> * </pre>
* @see #createAlignmentValue(boolean, int, int) * @see #createAlignmentValue(boolean, int, int)
@ -185,7 +183,7 @@ public class DefaultCodeFormatterConstants {
* <pre> * <pre>
* FORMATTER / Option for alignment of a expression list (except arguments in a method invocation) * FORMATTER / Option for alignment of a expression list (except arguments in a method invocation)
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_expression_list" * - option id: "org.eclipse.cdt.core.formatter.alignment_for_expression_list"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call * - possible values: values returned by {@code createAlignmentValue(boolean, int, int)} call
* - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT) * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
* </pre> * </pre>
* @see #createAlignmentValue(boolean, int, int) * @see #createAlignmentValue(boolean, int, int)
@ -195,7 +193,7 @@ public class DefaultCodeFormatterConstants {
* <pre> * <pre>
* FORMATTER / Option for alignment of expressions in initializer list * FORMATTER / Option for alignment of expressions in initializer list
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer" * - option id: "org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call * - possible values: values returned by {@code createAlignmentValue(boolean, int, int)} call
* - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT) * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
* </pre> * </pre>
* @see #createAlignmentValue(boolean, int, int) * @see #createAlignmentValue(boolean, int, int)
@ -205,7 +203,7 @@ public class DefaultCodeFormatterConstants {
* <pre> * <pre>
* FORMATTER / Option for alignment of member access * FORMATTER / Option for alignment of member access
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_member_access" * - option id: "org.eclipse.cdt.core.formatter.alignment_for_member_access"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call * - possible values: values returned by {@code createAlignmentValue(boolean, int, int)} call
* - default: createAlignmentValue(false, M_NO_ALIGNMENT, INDENT_DEFAULT) * - default: createAlignmentValue(false, M_NO_ALIGNMENT, INDENT_DEFAULT)
* </pre> * </pre>
* @see #createAlignmentValue(boolean, int, int) * @see #createAlignmentValue(boolean, int, int)
@ -217,7 +215,7 @@ public class DefaultCodeFormatterConstants {
* FORMATTER / Option for alignment of stream output expression consisting of a chain of * FORMATTER / Option for alignment of stream output expression consisting of a chain of
* overloaded &lt;&lt; operators. * overloaded &lt;&lt; operators.
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chainn" * - option id: "org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chainn"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call * - possible values: values returned by {@code createAlignmentValue(boolean, int, int)} call
* - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT) * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
* </pre> * </pre>
* @see #createAlignmentValue(boolean, int, int) * @see #createAlignmentValue(boolean, int, int)
@ -228,7 +226,7 @@ public class DefaultCodeFormatterConstants {
* <pre> * <pre>
* FORMATTER / Option for alignment of parameters in method declaration * FORMATTER / Option for alignment of parameters in method declaration
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration" * - option id: "org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call * - possible values: values returned by {@code createAlignmentValue(boolean, int, int)} call
* - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT) * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
* </pre> * </pre>
* @see #createAlignmentValue(boolean, int, int) * @see #createAlignmentValue(boolean, int, int)
@ -238,7 +236,7 @@ public class DefaultCodeFormatterConstants {
// * <pre> // * <pre>
// * FORMATTER / Option for alignment of selector in method invocation // * FORMATTER / Option for alignment of selector in method invocation
// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_selector_in_method_invocation" // * - option id: "org.eclipse.cdt.core.formatter.alignment_for_selector_in_method_invocation"
// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call // * - possible values: values returned by {@code createAlignmentValue(boolean, int, int)} call
// * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT) // * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
// * </pre> // * </pre>
// * @see #createAlignmentValue(boolean, int, int) // * @see #createAlignmentValue(boolean, int, int)
@ -248,7 +246,7 @@ public class DefaultCodeFormatterConstants {
* <pre> * <pre>
* FORMATTER / Option for alignment of base-clause in type declaration * FORMATTER / Option for alignment of base-clause in type declaration
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration" * - option id: "org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call * - possible values: values returned by {@code createAlignmentValue(boolean, int, int)} call
* - default: createAlignmentValue(false, WRAP_NEXT_SHIFTED, INDENT_DEFAULT) * - default: createAlignmentValue(false, WRAP_NEXT_SHIFTED, INDENT_DEFAULT)
* </pre> * </pre>
* @see #createAlignmentValue(boolean, int, int) * @see #createAlignmentValue(boolean, int, int)
@ -258,7 +256,7 @@ public class DefaultCodeFormatterConstants {
* <pre> * <pre>
* FORMATTER / Option for alignment of constructor initializer list * FORMATTER / Option for alignment of constructor initializer list
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list" * - option id: "org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call * - possible values: values returned by {@code createAlignmentValue(boolean, int, int)} call
* - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT) * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
* </pre> * </pre>
* @see #createAlignmentValue(boolean, int, int) * @see #createAlignmentValue(boolean, int, int)
@ -269,7 +267,7 @@ public class DefaultCodeFormatterConstants {
* <pre> * <pre>
* FORMATTER / Option for alignment of throws clause in method declaration * FORMATTER / Option for alignment of throws clause in method declaration
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration" * - option id: "org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration"
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call * - possible values: values returned by {@code createAlignmentValue(boolean, int, int)} call
* - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT) * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
* </pre> * </pre>
* @see #createAlignmentValue(boolean, int, int) * @see #createAlignmentValue(boolean, int, int)
@ -2393,7 +2391,7 @@ public class DefaultCodeFormatterConstants {
/** /**
* <p>Return the force value of the given alignment value. * <p>Return the force value of the given alignment value.
* The given alignment value should be created using the <code>createAlignmentValue(boolean, int, int)</code> * The given alignment value should be created using the {@code createAlignmentValue(boolean, int, int)}
* API. * API.
* </p> * </p>
* *
@ -2417,7 +2415,7 @@ public class DefaultCodeFormatterConstants {
/** /**
* <p>Return the indentation style of the given alignment value. * <p>Return the indentation style of the given alignment value.
* The given alignment value should be created using the <code>createAlignmentValue(boolean, int, int)</code> * The given alignment value should be created using the {@code createAlignmentValue(boolean, int, int)}
* API. * API.
* </p> * </p>
* *
@ -2447,7 +2445,7 @@ public class DefaultCodeFormatterConstants {
/** /**
* <p>Return the wrapping style of the given alignment value. * <p>Return the wrapping style of the given alignment value.
* The given alignment value should be created using the <code>createAlignmentValue(boolean, int, int)</code> * The given alignment value should be created using the {@code createAlignmentValue(boolean, int, int)}
* API. * API.
* </p> * </p>
* *
@ -2483,7 +2481,7 @@ public class DefaultCodeFormatterConstants {
} }
/** /**
* <p>Set the force value of the given alignment value and return the new value. * <p>Set the force value of the given alignment value and return the new value.
* The given alignment value should be created using the <code>createAlignmentValue(boolean, int, int)</code> * The given alignment value should be created using the {@code createAlignmentValue(boolean, int, int)}
* API. * API.
* </p> * </p>
* *
@ -2513,7 +2511,7 @@ public class DefaultCodeFormatterConstants {
/** /**
* <p>Set the indentation style of the given alignment value and return the new value. * <p>Set the indentation style of the given alignment value and return the new value.
* The given value should be created using the <code>createAlignmentValue(boolean, int, int)</code> * The given value should be created using the {@code createAlignmentValue(boolean, int, int)}
* API. * API.
* </p> * </p>
* *
@ -2558,7 +2556,7 @@ public class DefaultCodeFormatterConstants {
} }
/** /**
* <p>Set the wrapping style of the given alignment value and return the new value. * <p>Set the wrapping style of the given alignment value and return the new value.
* The given value should be created using the <code>createAlignmentValue(boolean, int, int)</code> * The given value should be created using the {@link #createAlignmentValue(boolean, int, int)}
* API. * API.
* </p> * </p>
* *

View file

@ -26,36 +26,34 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.SelectionDialog; import org.eclipse.ui.dialogs.SelectionDialog;
/** /**
* An abstract base class for dialogs with a status bar and ok/cancel buttons. * An abstract base class for dialogs with a status bar and OK/Cancel buttons.
* The status message must be passed over as StatusInfo object and can be * The status message must be passed over as StatusInfo object and can be
* an error, warning or ok. The OK button is enabled / disabled depending * an error, warning or ok. The OK button is enabled / disabled depending
* on the status. * on the status.
*/ */
public abstract class SelectionStatusDialog extends SelectionDialog { public abstract class SelectionStatusDialog extends SelectionDialog {
private MessageLine fStatusLine; private MessageLine fStatusLine;
private IStatus fLastStatus; private IStatus fLastStatus;
private Image fImage; private Image fImage;
private boolean fInitialSelectionSet; private boolean fInitialSelectionSet;
private boolean fStatusLineAboveButtons= false; private boolean fStatusLineAboveButtons;
public SelectionStatusDialog(Shell parent) {
super(parent);
}
/** /**
* Compute the result and return it. * Computes the result and returns it.
*/ */
protected abstract void computeResult(); protected abstract void computeResult();
/* (non-Javadoc)
* Method declared in Window.
*/
@Override @Override
protected void configureShell(Shell shell) { protected void configureShell(Shell shell) {
super.configureShell(shell); super.configureShell(shell);
if (fImage != null) if (fImage != null)
shell.setImage(fImage); shell.setImage(fImage);
} }
/* (non-Javadoc)
* Method declared in Dialog.
*/
@Override @Override
protected Control createButtonBar(Composite parent) { protected Control createButtonBar(Composite parent) {
Composite composite= new Composite(parent, SWT.NULL); Composite composite= new Composite(parent, SWT.NULL);
@ -77,9 +75,7 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
super.createButtonBar(composite); super.createButtonBar(composite);
return composite; return composite;
} }
/* (non-Javadoc)
* Method declared in Dialog.
*/
@Override @Override
public void create() { public void create() {
super.create(); super.create();
@ -87,9 +83,11 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
updateStatus(fLastStatus); updateStatus(fLastStatus);
} }
} }
/** /**
* Returns the first element of the initial selection or <code>null<code> * Returns the first element of the initial selection or {@code null}
* if there isn't any initial selection. * if there isn't any initial selection.
*
* @return the first element of the initial selection. * @return the first element of the initial selection.
*/ */
protected Object getPrimaryInitialSelection() { protected Object getPrimaryInitialSelection() {
@ -98,12 +96,13 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
return null; return null;
return result.get(0); return result.get(0);
} }
/** /**
* Returns the first element from the list of results. Returns <code>null</code> * Returns the first element from the list of results. Returns {@code null}
* if no element has been selected. * if no element has been selected.
* *
* @return the first result element if one exists. Otherwise <code>null</code> is * @return the first result element if one exists. Otherwise {@code null} is
* returned. * returned.
*/ */
public Object getPrimaryResult() { public Object getPrimaryResult() {
Object[] result= getResult(); Object[] result= getResult();
@ -111,18 +110,13 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
return null; return null;
return result[0]; return result[0];
} }
public SelectionStatusDialog(Shell parent) {
super(parent);
fInitialSelectionSet= false;
}
/* (non-Javadoc)
* Method declared in Dialog.
*/
@Override @Override
protected void okPressed() { protected void okPressed() {
computeResult(); computeResult();
super.okPressed(); super.okPressed();
} }
/** /**
* Sets the image for this dialog. * Sets the image for this dialog.
* *
@ -131,12 +125,14 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
public void setImage(Image image) { public void setImage(Image image) {
fImage= image; fImage= image;
} }
protected void setInitialSelection(int position, Object element) { protected void setInitialSelection(int position, Object element) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<Object> l= getInitialElementSelections(); List<Object> l= getInitialElementSelections();
l.set(position, element); l.set(position, element);
fInitialSelectionSet= true; fInitialSelectionSet= true;
} }
/** /**
* Sets the initial selection to the given element. * Sets the initial selection to the given element.
*/ */
@ -151,11 +147,13 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
setInitialSelections(new Object[0]); setInitialSelections(new Object[0]);
} }
} }
@Override @Override
public void setInitialSelections(Object[] selectedElements) { public void setInitialSelections(Object[] selectedElements) {
super.setInitialSelections(selectedElements); super.setInitialSelections(selectedElements);
fInitialSelectionSet= true; fInitialSelectionSet= true;
} }
/** /**
* Sets a result element at the given position. * Sets a result element at the given position.
*/ */
@ -164,18 +162,20 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
result[position]= element; result[position]= element;
setResult(Arrays.asList(result)); setResult(Arrays.asList(result));
} }
/** /**
* Controls whether status line appears to the left of the buttons (default) * Controls whether status line appears to the left of the buttons (default)
* or above them. * or above them.
* *
* @param aboveButtons if <code>true</code> status line is placed above buttons; if * @param aboveButtons if {@code true} status line is placed above buttons; if
* <code>false</code> to the right * {@code false} to the right
*/ */
public void setStatusLineAboveButtons(boolean aboveButtons) { public void setStatusLineAboveButtons(boolean aboveButtons) {
fStatusLineAboveButtons= aboveButtons; fStatusLineAboveButtons= aboveButtons;
} }
/** /**
* Update the status of the ok button to reflect the given status. Subclasses * Update the status of the OK button to reflect the given status. Subclasses
* may override this method to update additional buttons. * may override this method to update additional buttons.
*/ */
protected void updateButtonsEnableState(IStatus status) { protected void updateButtonsEnableState(IStatus status) {
@ -183,6 +183,7 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
if (okButton != null && !okButton.isDisposed()) if (okButton != null && !okButton.isDisposed())
okButton.setEnabled(!status.matches(IStatus.ERROR)); okButton.setEnabled(!status.matches(IStatus.ERROR));
} }
/** /**
* Update the dialog's status line to reflect the given status. It is safe to call * Update the dialog's status line to reflect the given status. It is safe to call
* this method before the dialog has been opened. * this method before the dialog has been opened.

View file

@ -365,17 +365,18 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
Map<String, Object> preferences; Map<String, Object> preferences;
ICElement inputCElement= getInputCElement(); ICElement inputCElement= getInputCElement();
ICProject cProject= inputCElement != null ? inputCElement.getCProject() : null; ICProject cProject= inputCElement != null ? inputCElement.getCProject() : null;
if (cProject == null) if (cProject == null) {
preferences= new HashMap<String, Object>(CCorePlugin.getOptions()); preferences= new HashMap<String, Object>(CCorePlugin.getOptions());
else } else {
preferences= new HashMap<String, Object>(cProject.getOptions(true)); preferences= new HashMap<String, Object>(cProject.getOptions(true));
}
if (inputCElement instanceof ITranslationUnit) { if (inputCElement instanceof ITranslationUnit) {
ITranslationUnit tu= (ITranslationUnit) inputCElement; ITranslationUnit tu= (ITranslationUnit) inputCElement;
ILanguage language= null; ILanguage language;
try { try {
language= tu.getLanguage(); language= tu.getLanguage();
} catch (CoreException exc) { } catch (CoreException e) {
// Use fallback CPP // Use fallback CPP
language= GPPLanguage.getDefault(); language= GPPLanguage.getDefault();
} }

View file

@ -7,12 +7,13 @@
* *
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * IBM Corporation - initial API and implementation
* Sergey Prigogin, Google * Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.ui.preferences.formatter; package org.eclipse.cdt.internal.ui.preferences.formatter;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.StatusDialog;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.ModifyListener;
@ -27,19 +28,14 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.StatusDialog;
import org.eclipse.cdt.internal.ui.util.Messages;
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo; import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
import org.eclipse.cdt.internal.ui.preferences.formatter.ProfileManager.CustomProfile; import org.eclipse.cdt.internal.ui.preferences.formatter.ProfileManager.CustomProfile;
import org.eclipse.cdt.internal.ui.util.Messages;
/** /**
* The dialog to rename an imported profile. * The dialog to rename an imported profile.
*/ */
public class AlreadyExistsDialog extends StatusDialog { public class AlreadyExistsDialog extends StatusDialog {
private Composite fComposite; private Composite fComposite;
protected Text fNameText; protected Text fNameText;
private Button fRenameRadio, fOverwriteRadio; private Button fRenameRadio, fOverwriteRadio;
@ -61,8 +57,7 @@ public class AlreadyExistsDialog extends StatusDialog {
fDuplicate= new StatusInfo(IStatus.ERROR, FormatterMessages.AlreadyExistsDialog_message_profile_already_exists); fDuplicate= new StatusInfo(IStatus.ERROR, FormatterMessages.AlreadyExistsDialog_message_profile_already_exists);
fEmpty= new StatusInfo(IStatus.ERROR, FormatterMessages.AlreadyExistsDialog_message_profile_name_empty); fEmpty= new StatusInfo(IStatus.ERROR, FormatterMessages.AlreadyExistsDialog_message_profile_name_empty);
} }
@Override @Override
public void create() { public void create() {
super.create(); super.create();
@ -71,7 +66,6 @@ public class AlreadyExistsDialog extends StatusDialog {
@Override @Override
public Control createDialogArea(Composite parent) { public Control createDialogArea(Composite parent) {
initializeComposite(parent); initializeComposite(parent);
createLabel(Messages.format(FormatterMessages.AlreadyExistsDialog_dialog_label, fProfile.getName())); createLabel(Messages.format(FormatterMessages.AlreadyExistsDialog_dialog_label, fProfile.getName()));
@ -87,7 +81,7 @@ public class AlreadyExistsDialog extends StatusDialog {
fNameText.setSelection(0, fProfile.getName().length()); fNameText.setSelection(0, fProfile.getName().length());
fNameText.setFocus(); fNameText.setFocus();
fNameText.addModifyListener( new ModifyListener() { fNameText.addModifyListener(new ModifyListener() {
@Override @Override
public void modifyText(ModifyEvent e) { public void modifyText(ModifyEvent e) {
doValidation(); doValidation();
@ -170,13 +164,12 @@ public class AlreadyExistsDialog extends StatusDialog {
* Validate the current settings * Validate the current settings
*/ */
protected void doValidation() { protected void doValidation() {
if (fOverwriteRadio.getSelection()) { if (fOverwriteRadio.getSelection()) {
updateStatus(fOk); updateStatus(fOk);
return; return;
} }
final String name= fNameText.getText().trim(); String name= fNameText.getText().trim();
if (name.length() == 0) { if (name.length() == 0) {
updateStatus(fEmpty); updateStatus(fEmpty);

View file

@ -11,8 +11,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui; package org.eclipse.cdt.ui;
import java.util.HashSet; import java.util.HashSet;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
@ -69,7 +67,6 @@ C model (<code>ICModel</code>)<br>
* </pre> * </pre>
*/ */
public class CElementContentProvider extends BaseCElementContentProvider implements IElementChangedListener, IInformationProvider, IInformationProviderExtension{ public class CElementContentProvider extends BaseCElementContentProvider implements IElementChangedListener, IInformationProvider, IInformationProviderExtension{
/** Editor. */ /** Editor. */
protected ITextEditor fEditor; protected ITextEditor fEditor;
protected StructuredViewer fViewer; protected StructuredViewer fViewer;
@ -81,8 +78,7 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
/** /**
* Creates a new content provider for C elements. * Creates a new content provider for C elements.
*/ */
public CElementContentProvider() public CElementContentProvider() {
{
// Empty. // Empty.
} }
@ -90,8 +86,7 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
* Creates a new content provider for C elements. * Creates a new content provider for C elements.
* @param editor Editor. * @param editor Editor.
*/ */
public CElementContentProvider(ITextEditor editor) public CElementContentProvider(ITextEditor editor) {
{
fEditor = editor; fEditor = editor;
} }
@ -102,21 +97,14 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
super(provideMembers, provideWorkingCopy); super(provideMembers, provideWorkingCopy);
} }
/**
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
@Override @Override
public void dispose() { public void dispose() {
super.dispose(); super.dispose();
CoreModel.getDefault().removeElementChangedListener(this); CoreModel.getDefault().removeElementChangedListener(this);
} }
/**
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
@Override @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
super.inputChanged(viewer, oldInput, newInput); super.inputChanged(viewer, oldInput, newInput);
fViewer = (StructuredViewer) viewer; fViewer = (StructuredViewer) viewer;
@ -129,9 +117,6 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
fInput= newInput; fInput= newInput;
} }
/**
* @see org.eclipse.cdt.core.model.IElementChangedListener#elementChanged(org.eclipse.cdt.core.model.ElementChangedEvent)
*/
@Override @Override
public void elementChanged(final ElementChangedEvent event) { public void elementChanged(final ElementChangedEvent event) {
try { try {
@ -235,7 +220,7 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
} }
/** /**
* Process resource deltas. * Processes resource deltas.
* *
* @return true if the parent got refreshed * @return true if the parent got refreshed
*/ */
@ -260,7 +245,7 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
} }
/** /**
* Process a resource delta. * Processes a resource delta.
* *
* @return true if the parent got refreshed * @return true if the parent got refreshed
*/ */
@ -318,14 +303,17 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
protected interface IRefreshable { protected interface IRefreshable {
public void refresh(); public void refresh();
} }
protected final class RefreshContainer implements IRefreshable { protected final class RefreshContainer implements IRefreshable {
private IParent container; private IParent container;
private Object project; private Object project;
public RefreshContainer(IParent container, Object project) { public RefreshContainer(IParent container, Object project) {
this.container = container; this.container = container;
this.project = project; this.project = project;
} }
@Override
@Override
public void refresh() { public void refresh() {
if (container.hasChildren()) { if (container.hasChildren()) {
if (fViewer.testFindItem(container) != null) { if (fViewer.testFindItem(container) != null) {
@ -337,7 +325,8 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
fViewer.refresh(project); fViewer.refresh(project);
} }
} }
@Override
@Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (o instanceof RefreshContainer) { if (o instanceof RefreshContainer) {
RefreshContainer c = (RefreshContainer)o; RefreshContainer c = (RefreshContainer)o;
@ -345,16 +334,20 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
} }
return false; return false;
} }
@Override
@Override
public int hashCode() { public int hashCode() {
return container.hashCode()*10903143 + 31181; return container.hashCode() * 10903143 + 31181;
} }
} }
protected final class RefreshElement implements IRefreshable { protected final class RefreshElement implements IRefreshable {
private Object element; private Object element;
public RefreshElement(Object element) { public RefreshElement(Object element) {
this.element = element; this.element = element;
} }
@Override @Override
public void refresh() { public void refresh() {
if (element instanceof IWorkingCopy){ if (element instanceof IWorkingCopy){
@ -369,7 +362,8 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
fViewer.refresh(element); fViewer.refresh(element);
} }
} }
@Override
@Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (o instanceof RefreshElement) { if (o instanceof RefreshElement) {
RefreshElement c = (RefreshElement)o; RefreshElement c = (RefreshElement)o;
@ -377,17 +371,20 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
} }
return false; return false;
} }
@Override
@Override
public int hashCode() { public int hashCode() {
return element.hashCode()*7 + 490487; return element.hashCode() * 7 + 490487;
} }
} }
protected final class RefreshProjectState implements IRefreshable { protected final class RefreshProjectState implements IRefreshable {
private Object element; private Object element;
public RefreshProjectState(Object element) { public RefreshProjectState(Object element) {
this.element = element; this.element = element;
} }
@Override @Override
public void refresh() { public void refresh() {
fViewer.refresh(element, true); fViewer.refresh(element, true);
@ -395,7 +392,8 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
// enable state. // enable state.
fViewer.setSelection(fViewer.getSelection()); fViewer.setSelection(fViewer.getSelection());
} }
@Override
@Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (o instanceof RefreshElement) { if (o instanceof RefreshElement) {
RefreshElement c = (RefreshElement)o; RefreshElement c = (RefreshElement)o;
@ -403,9 +401,10 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
} }
return false; return false;
} }
@Override
@Override
public int hashCode() { public int hashCode() {
return element.hashCode()*11 + 490487; return element.hashCode() * 11 + 490487;
} }
} }
@ -452,9 +451,6 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
} }
} }
/*
* @see org.eclipse.jface.text.information.IInformationProvider#getSubject(org.eclipse.jface.text.ITextViewer, int)
*/
@Override @Override
public IRegion getSubject(ITextViewer textViewer, int offset) { public IRegion getSubject(ITextViewer textViewer, int offset) {
if (textViewer != null && fEditor != null) { if (textViewer != null && fEditor != null) {
@ -468,10 +464,6 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
return null; return null;
} }
/*
* @see org.eclipse.jface.text.information.IInformationProvider#getInformation(org.eclipse.jface.text.ITextViewer,
* org.eclipse.jface.text.IRegion)
*/
@Override @Override
public String getInformation(ITextViewer textViewer, IRegion subject) { public String getInformation(ITextViewer textViewer, IRegion subject) {
// deprecated API - not used anymore // deprecated API - not used anymore
@ -482,9 +474,6 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
return null; return null;
} }
/*
* @see org.eclipse.jface.text.information.IInformationProviderExtension#getInformation2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
*/
@Override @Override
public Object getInformation2(ITextViewer textViewer, IRegion subject) { public Object getInformation2(ITextViewer textViewer, IRegion subject) {
if (fEditor == null) if (fEditor == null)

View file

@ -18,16 +18,15 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.model.WorkbenchLabelProvider; import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.internal.ui.viewsupport.CElementLabels;
import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider; import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider;
import org.eclipse.cdt.internal.ui.viewsupport.CElementLabels;
import org.eclipse.cdt.internal.ui.viewsupport.CUILabelProvider; import org.eclipse.cdt.internal.ui.viewsupport.CUILabelProvider;
/** /**
* The label provider for the c model elements. * The label provider for the c model elements.
*/ */
public class CElementLabelProvider extends LabelProvider { public class CElementLabelProvider extends LabelProvider {
/** /**
* Flag (bit mask) indicating that methods labels include the method return type. (appended) * Flag (bit mask) indicating that methods labels include the method return type. (appended)
*/ */

View file

@ -39,10 +39,6 @@ import org.eclipse.cdt.internal.ui.refactoring.includes.IncludePreferences;
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
*/ */
public class CUIPreferenceInitializer extends AbstractPreferenceInitializer { public class CUIPreferenceInitializer extends AbstractPreferenceInitializer {
/* (non-Javadoc)
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
*/
@Override @Override
public void initializeDefaultPreferences() { public void initializeDefaultPreferences() {
final IPreferenceStore store = CUIPlugin.getDefault().getPreferenceStore(); final IPreferenceStore store = CUIPlugin.getDefault().getPreferenceStore();