1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +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.internal.formatter.align.Alignment;
/**
* 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.
*/
public class DefaultCodeFormatterConstants {
/**
* <pre>
* FORMATTER / Option for the 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
* </pre>
*/
@ -41,7 +39,7 @@ public class DefaultCodeFormatterConstants {
* <pre>
* FORMATTER / Option for the 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
* </pre>
*/
@ -51,7 +49,7 @@ public class DefaultCodeFormatterConstants {
* <pre>
* FORMATTER / Option for the 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
* </pre>
*/
@ -92,7 +90,7 @@ public class DefaultCodeFormatterConstants {
// * <pre>
// * FORMATTER / Option for alignment of 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)
// * </pre>
// * @see #createAlignmentValue(boolean, int, int)
@ -102,7 +100,7 @@ public class DefaultCodeFormatterConstants {
* <pre>
* FORMATTER / Option for alignment of 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)
* </pre>
* @see #createAlignmentValue(boolean, int, int)
@ -112,7 +110,7 @@ public class DefaultCodeFormatterConstants {
* <pre>
* FORMATTER / Option for alignment of 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)
* </pre>
* @see #createAlignmentValue(boolean, int, int)
@ -123,7 +121,7 @@ public class DefaultCodeFormatterConstants {
* <pre>
* FORMATTER / Option for alignment of 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)
* </pre>
* @see #createAlignmentValue(boolean, int, int)
@ -134,7 +132,7 @@ public class DefaultCodeFormatterConstants {
* <pre>
* FORMATTER / Option for alignment of 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)
* </pre>
* @see #createAlignmentValue(boolean, int, int)
@ -144,7 +142,7 @@ public class DefaultCodeFormatterConstants {
* <pre>
* FORMATTER / Option for alignment of 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)
* </pre>
* @see #createAlignmentValue(boolean, int, int)
@ -154,7 +152,7 @@ public class DefaultCodeFormatterConstants {
* <pre>
* FORMATTER / Option for alignment of a chain of conditional expressions.
* - 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)
* </pre>
* @see #createAlignmentValue(boolean, int, int)
@ -165,7 +163,7 @@ public class DefaultCodeFormatterConstants {
* <pre>
* FORMATTER / Option for alignment of a 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)
* </pre>
* @see #createAlignmentValue(boolean, int, int)
@ -175,7 +173,7 @@ public class DefaultCodeFormatterConstants {
* <pre>
* FORMATTER / Option for alignment of a 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)
* </pre>
* @see #createAlignmentValue(boolean, int, int)
@ -185,7 +183,7 @@ public class DefaultCodeFormatterConstants {
* <pre>
* 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"
* - 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)
* </pre>
* @see #createAlignmentValue(boolean, int, int)
@ -195,7 +193,7 @@ public class DefaultCodeFormatterConstants {
* <pre>
* FORMATTER / Option for alignment of expressions in initializer list
* - 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)
* </pre>
* @see #createAlignmentValue(boolean, int, int)
@ -205,7 +203,7 @@ public class DefaultCodeFormatterConstants {
* <pre>
* FORMATTER / Option for alignment of 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)
* </pre>
* @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
* overloaded &lt;&lt; operators.
* - 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)
* </pre>
* @see #createAlignmentValue(boolean, int, int)
@ -228,7 +226,7 @@ public class DefaultCodeFormatterConstants {
* <pre>
* FORMATTER / Option for alignment of 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)
* </pre>
* @see #createAlignmentValue(boolean, int, int)
@ -238,7 +236,7 @@ public class DefaultCodeFormatterConstants {
// * <pre>
// * FORMATTER / Option for alignment of 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)
// * </pre>
// * @see #createAlignmentValue(boolean, int, int)
@ -248,7 +246,7 @@ public class DefaultCodeFormatterConstants {
* <pre>
* FORMATTER / Option for alignment of 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)
* </pre>
* @see #createAlignmentValue(boolean, int, int)
@ -258,7 +256,7 @@ public class DefaultCodeFormatterConstants {
* <pre>
* FORMATTER / Option for alignment of 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)
* </pre>
* @see #createAlignmentValue(boolean, int, int)
@ -269,7 +267,7 @@ public class DefaultCodeFormatterConstants {
* <pre>
* FORMATTER / Option for alignment of 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)
* </pre>
* @see #createAlignmentValue(boolean, int, int)
@ -2393,7 +2391,7 @@ public class DefaultCodeFormatterConstants {
/**
* <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.
* </p>
*
@ -2417,7 +2415,7 @@ public class DefaultCodeFormatterConstants {
/**
* <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.
* </p>
*
@ -2447,7 +2445,7 @@ public class DefaultCodeFormatterConstants {
/**
* <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.
* </p>
*
@ -2483,7 +2481,7 @@ public class DefaultCodeFormatterConstants {
}
/**
* <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.
* </p>
*
@ -2513,7 +2511,7 @@ public class DefaultCodeFormatterConstants {
/**
* <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.
* </p>
*
@ -2558,7 +2556,7 @@ public class DefaultCodeFormatterConstants {
}
/**
* <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.
* </p>
*

View file

@ -26,36 +26,34 @@ import org.eclipse.swt.widgets.Shell;
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
* an error, warning or ok. The OK button is enabled / disabled depending
* on the status.
*/
public abstract class SelectionStatusDialog extends SelectionDialog {
private MessageLine fStatusLine;
private IStatus fLastStatus;
private Image fImage;
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();
/* (non-Javadoc)
* Method declared in Window.
*/
@Override
protected void configureShell(Shell shell) {
super.configureShell(shell);
if (fImage != null)
shell.setImage(fImage);
}
/* (non-Javadoc)
* Method declared in Dialog.
*/
@Override
protected Control createButtonBar(Composite parent) {
Composite composite= new Composite(parent, SWT.NULL);
@ -77,9 +75,7 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
super.createButtonBar(composite);
return composite;
}
/* (non-Javadoc)
* Method declared in Dialog.
*/
@Override
public void create() {
super.create();
@ -87,9 +83,11 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
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.
*
* @return the first element of the initial selection.
*/
protected Object getPrimaryInitialSelection() {
@ -98,12 +96,13 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
return null;
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.
*
* @return the first result element if one exists. Otherwise <code>null</code> is
* returned.
* @return the first result element if one exists. Otherwise {@code null} is
* returned.
*/
public Object getPrimaryResult() {
Object[] result= getResult();
@ -111,18 +110,13 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
return null;
return result[0];
}
public SelectionStatusDialog(Shell parent) {
super(parent);
fInitialSelectionSet= false;
}
/* (non-Javadoc)
* Method declared in Dialog.
*/
@Override
protected void okPressed() {
computeResult();
super.okPressed();
}
/**
* Sets the image for this dialog.
*
@ -131,12 +125,14 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
public void setImage(Image image) {
fImage= image;
}
protected void setInitialSelection(int position, Object element) {
@SuppressWarnings("unchecked")
List<Object> l= getInitialElementSelections();
l.set(position, element);
fInitialSelectionSet= true;
}
/**
* Sets the initial selection to the given element.
*/
@ -151,11 +147,13 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
setInitialSelections(new Object[0]);
}
}
@Override
public void setInitialSelections(Object[] selectedElements) {
super.setInitialSelections(selectedElements);
fInitialSelectionSet= true;
}
/**
* Sets a result element at the given position.
*/
@ -164,18 +162,20 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
result[position]= element;
setResult(Arrays.asList(result));
}
/**
* Controls whether status line appears to the left of the buttons (default)
* or above them.
*
* @param aboveButtons if <code>true</code> status line is placed above buttons; if
* <code>false</code> to the right
* @param aboveButtons if {@code true} status line is placed above buttons; if
* {@code false} to the right
*/
public void setStatusLineAboveButtons(boolean 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.
*/
protected void updateButtonsEnableState(IStatus status) {
@ -183,6 +183,7 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
if (okButton != null && !okButton.isDisposed())
okButton.setEnabled(!status.matches(IStatus.ERROR));
}
/**
* Update the dialog's status line to reflect the given status. It is safe to call
* 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;
ICElement inputCElement= getInputCElement();
ICProject cProject= inputCElement != null ? inputCElement.getCProject() : null;
if (cProject == null)
if (cProject == null) {
preferences= new HashMap<String, Object>(CCorePlugin.getOptions());
else
} else {
preferences= new HashMap<String, Object>(cProject.getOptions(true));
}
if (inputCElement instanceof ITranslationUnit) {
ITranslationUnit tu= (ITranslationUnit) inputCElement;
ILanguage language= null;
ILanguage language;
try {
language= tu.getLanguage();
} catch (CoreException exc) {
} catch (CoreException e) {
// Use fallback CPP
language= GPPLanguage.getDefault();
}

View file

@ -7,12 +7,13 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
* Sergey Prigogin, Google
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.preferences.formatter;
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.events.ModifyEvent;
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.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.preferences.formatter.ProfileManager.CustomProfile;
import org.eclipse.cdt.internal.ui.util.Messages;
/**
* The dialog to rename an imported profile.
*/
public class AlreadyExistsDialog extends StatusDialog {
private Composite fComposite;
protected Text fNameText;
private Button fRenameRadio, fOverwriteRadio;
@ -61,8 +57,7 @@ public class AlreadyExistsDialog extends StatusDialog {
fDuplicate= new StatusInfo(IStatus.ERROR, FormatterMessages.AlreadyExistsDialog_message_profile_already_exists);
fEmpty= new StatusInfo(IStatus.ERROR, FormatterMessages.AlreadyExistsDialog_message_profile_name_empty);
}
@Override
public void create() {
super.create();
@ -71,7 +66,6 @@ public class AlreadyExistsDialog extends StatusDialog {
@Override
public Control createDialogArea(Composite parent) {
initializeComposite(parent);
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.setFocus();
fNameText.addModifyListener( new ModifyListener() {
fNameText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
doValidation();
@ -170,13 +164,12 @@ public class AlreadyExistsDialog extends StatusDialog {
* Validate the current settings
*/
protected void doValidation() {
if (fOverwriteRadio.getSelection()) {
updateStatus(fOk);
return;
}
final String name= fNameText.getText().trim();
String name= fNameText.getText().trim();
if (name.length() == 0) {
updateStatus(fEmpty);

View file

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

View file

@ -18,16 +18,15 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.model.WorkbenchLabelProvider;
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.CElementLabels;
import org.eclipse.cdt.internal.ui.viewsupport.CUILabelProvider;
/**
* The label provider for the c model elements.
*/
public class CElementLabelProvider extends LabelProvider {
/**
* 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.
*/
public class CUIPreferenceInitializer extends AbstractPreferenceInitializer {
/* (non-Javadoc)
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
*/
@Override
public void initializeDefaultPreferences() {
final IPreferenceStore store = CUIPlugin.getDefault().getPreferenceStore();