diff options
author | Alexander Kurtakov | 2018-04-19 19:04:25 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2018-04-19 19:04:25 +0000 |
commit | d353d2648d4e1313a0c76cbd2333ead791caa3bb (patch) | |
tree | 5a919ebc3819fb567172ce9974169b5e159edebd | |
parent | bb7af253bd288e46ef1df9328d7bd26d53f5a9eb (diff) | |
download | eclipse.platform.text-d353d2648d4e1313a0c76cbd2333ead791caa3bb.tar.gz eclipse.platform.text-d353d2648d4e1313a0c76cbd2333ead791caa3bb.tar.xz eclipse.platform.text-d353d2648d4e1313a0c76cbd2333ead791caa3bb.zip |
Bug 533837 - Direct use of IStructuredSelection
Instead of getSelection and cast.
Enable save actions to automate cleanup actions.
Change-Id: I94a0037f7af2fa9d213a00f2bc385507891ae8e4
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
15 files changed, 155 insertions, 44 deletions
diff --git a/org.eclipse.search/new search/org/eclipse/search/ui/text/AbstractTextSearchViewPage.java b/org.eclipse.search/new search/org/eclipse/search/ui/text/AbstractTextSearchViewPage.java index fcc481a5b0d..44af5ee4363 100644 --- a/org.eclipse.search/new search/org/eclipse/search/ui/text/AbstractTextSearchViewPage.java +++ b/org.eclipse.search/new search/org/eclipse/search/ui/text/AbstractTextSearchViewPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -1121,7 +1121,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch } private Object getFirstSelectedElement() { - IStructuredSelection selection = (IStructuredSelection) fViewer.getSelection(); + IStructuredSelection selection = fViewer.getStructuredSelection(); if (selection.size() > 0) return selection.getFirstElement(); return null; @@ -1349,7 +1349,7 @@ public abstract class AbstractTextSearchViewPage extends Page implements ISearch if (result == null) return; StructuredViewer viewer = getViewer(); - IStructuredSelection selection = (IStructuredSelection) viewer.getSelection(); + IStructuredSelection selection = viewer.getStructuredSelection(); HashSet<Match> set = new HashSet<>(); if (viewer instanceof TreeViewer) { diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java index 8ee3db7c335..cfbd37dbf52 100644 --- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java +++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/MatchFilterSelectionDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,7 +35,6 @@ import org.eclipse.jface.viewers.CheckStateChangedEvent; import org.eclipse.jface.viewers.CheckboxTableViewer; import org.eclipse.jface.viewers.ICheckStateListener; import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.SelectionChangedEvent; @@ -230,7 +229,7 @@ public class MatchFilterSelectionDialog extends StatusDialog { } private void performFilterListSelectionChanged() { - Object selectedElement = ((IStructuredSelection) fListViewer.getSelection()).getFirstElement(); + Object selectedElement = fListViewer.getStructuredSelection().getFirstElement(); if (selectedElement != null) fDescription.setText(((MatchFilter) selectedElement).getDescription()); else diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistorySelectionDialog.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistorySelectionDialog.java index 5d41472ecc9..fdcb97b791a 100644 --- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistorySelectionDialog.java +++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchHistorySelectionDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -365,7 +365,7 @@ public class SearchHistorySelectionDialog extends SelectionDialog { } protected final void validateDialogState() { - IStructuredSelection sel= (IStructuredSelection) fViewer.getSelection(); + IStructuredSelection sel = fViewer.getStructuredSelection(); int elementsSelected= sel.toList().size(); fRemoveButton.setEnabled(elementsSelected > 0); @@ -390,7 +390,7 @@ public class SearchHistorySelectionDialog extends SelectionDialog { @Override protected void buttonPressed(int buttonId) { if (buttonId == REMOVE_ID) { - IStructuredSelection selection= (IStructuredSelection) fViewer.getSelection(); + IStructuredSelection selection = fViewer.getStructuredSelection(); Iterator<?> searchResults= selection.iterator(); while (searchResults.hasNext()) { ISearchResult curr= (ISearchResult) searchResults.next(); @@ -418,7 +418,7 @@ public class SearchHistorySelectionDialog extends SelectionDialog { // Build a list of selected children. ISelection selection= fViewer.getSelection(); if (selection instanceof IStructuredSelection) - setResult(((IStructuredSelection) fViewer.getSelection()).toList()); + setResult(fViewer.getStructuredSelection().toList()); // remove queries for (ISearchResult result : fRemovedEntries) { diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchPage.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchPage.java index 6d42528559f..dea9cb47a19 100644 --- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchPage.java +++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -268,7 +268,7 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt fActionGroup.fillContextMenu(mgr); FileSearchQuery query= (FileSearchQuery) getInput().getQuery(); if (query.getSearchString().length() > 0) { - IStructuredSelection selection= (IStructuredSelection) getViewer().getSelection(); + IStructuredSelection selection = getViewer().getStructuredSelection(); if (!selection.isEmpty()) { ReplaceAction replaceSelection= new ReplaceAction(getSite().getShell(), (FileSearchResult)getInput(), selection.toArray()); replaceSelection.setText(SearchMessages.ReplaceAction_label_selected); diff --git a/org.eclipse.ui.editors/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.ui.editors/.settings/org.eclipse.jdt.ui.prefs index b73bfac6f0d..ec0e1c727d3 100644 --- a/org.eclipse.ui.editors/.settings/org.eclipse.jdt.ui.prefs +++ b/org.eclipse.ui.editors/.settings/org.eclipse.jdt.ui.prefs @@ -1,4 +1,5 @@ eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_JDT UI Code Style Conventions formatter_settings_version=12 org.eclipse.jdt.ui.exception.name=e @@ -9,3 +10,60 @@ org.eclipse.jdt.ui.keywordthis=false org.eclipse.jdt.ui.ondemandthreshold=99 org.eclipse.jdt.ui.overrideannotation=true org.eclipse.jdt.ui.staticondemandthreshold=99 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_functional_interfaces=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=true +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_type_arguments=false +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=true +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java index cf0695a4c5e..70601ed1290 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -44,7 +44,6 @@ import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; @@ -317,7 +316,7 @@ class AnnotationsConfigurationBlock implements IPreferenceConfigurationBlock { final boolean value= fShowInTextCheckBox.getSelection(); if (value) { // enable whatever is in the combo - String[] decoration= (String[]) ((IStructuredSelection) fDecorationViewer.getSelection()).getFirstElement(); + String[] decoration= (String[]) fDecorationViewer.getStructuredSelection().getFirstElement(); if (HIGHLIGHT.equals(decoration)) fStore.setValue(item.highlightKey, true); else @@ -395,7 +394,7 @@ class AnnotationsConfigurationBlock implements IPreferenceConfigurationBlock { @Override public void selectionChanged(SelectionChangedEvent event) { - String[] decoration= (String[]) ((IStructuredSelection) fDecorationViewer.getSelection()).getFirstElement(); + String[] decoration= (String[]) fDecorationViewer.getStructuredSelection().getFirstElement(); ListItem item= getSelectedItem(); if (fShowInTextCheckBox.getSelection()) { @@ -673,7 +672,7 @@ class AnnotationsConfigurationBlock implements IPreferenceConfigurationBlock { } private ListItem getSelectedItem() { - return (ListItem) ((IStructuredSelection) fAnnotationTypeViewer.getSelection()).getFirstElement(); + return (ListItem) fAnnotationTypeViewer.getStructuredSelection().getFirstElement(); } private void updateDecorationViewer(ListItem item, boolean changed) { diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/HyperlinkDetectorsConfigurationBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/HyperlinkDetectorsConfigurationBlock.java index d128c92316a..8b4817f3723 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/HyperlinkDetectorsConfigurationBlock.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/HyperlinkDetectorsConfigurationBlock.java @@ -53,7 +53,6 @@ import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.jface.viewers.ICheckStateListener; import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.jface.viewers.Viewer; @@ -543,7 +542,7 @@ class HyperlinkDetectorsConfigurationBlock implements IPreferenceConfigurationBl } private ListItem getSelectedItem() { - return (ListItem)((IStructuredSelection) fHyperlinkDetectorsViewer.getSelection()).getFirstElement(); + return (ListItem) fHyperlinkDetectorsViewer.getStructuredSelection().getFirstElement(); } private void handleHyperlinkKeyModifierModified() { diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java index fbaba7547e9..01f65231dae 100755 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -44,7 +44,6 @@ import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; @@ -315,7 +314,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock { final boolean value= fShowInTextCheckBox.getSelection(); if (value) { // enable whatever is in the combo - String[] decoration= (String[]) ((IStructuredSelection) fDecorationViewer.getSelection()).getFirstElement(); + String[] decoration= (String[]) fDecorationViewer.getStructuredSelection().getFirstElement(); if (HIGHLIGHT.equals(decoration)) getPreferenceStore().setValue(item.highlightKey, true); else @@ -347,7 +346,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock { @Override public void selectionChanged(SelectionChangedEvent event) { - String[] decoration= (String[]) ((IStructuredSelection) fDecorationViewer.getSelection()).getFirstElement(); + String[] decoration= (String[]) fDecorationViewer.getStructuredSelection().getFirstElement(); ListItem item= getSelectedItem(); if (fShowInTextCheckBox.getSelection()) { @@ -457,7 +456,7 @@ class LinkedModeConfigurationBlock implements IPreferenceConfigurationBlock { } private ListItem getSelectedItem() { - return (ListItem) ((IStructuredSelection) fAnnotationTypeViewer.getSelection()).getFirstElement(); + return (ListItem) fAnnotationTypeViewer.getStructuredSelection().getFirstElement(); } private void updateDecorationViewer(ListItem item, boolean changed) { diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java index 1a928e905c6..eaf450a3524 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -650,7 +650,7 @@ class SelectResourcesBlock implements ICheckStateListener, ISelectionChangedList */ @Override public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection selection= (IStructuredSelection) event.getSelection(); + IStructuredSelection selection= event.getStructuredSelection(); Object selectedElement= selection.getFirstElement(); if (selectedElement == null) { currentTreeSelection= null; diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SpellingConfigurationBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SpellingConfigurationBlock.java index 50d53dcb65e..777c9055225 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SpellingConfigurationBlock.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SpellingConfigurationBlock.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -348,7 +348,7 @@ class SpellingConfigurationBlock implements IPreferenceConfigurationBlock { @Override public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection sel= (IStructuredSelection) event.getSelection(); + IStructuredSelection sel= event.getStructuredSelection(); if (sel.isEmpty()) return; if (fCurrentBlock != null && fStatusMonitor.getStatus() != null && fStatusMonitor.getStatus().matches(IStatus.ERROR)) diff --git a/org.eclipse.ui.examples.javaeditor/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.ui.examples.javaeditor/.settings/org.eclipse.jdt.ui.prefs index b73bfac6f0d..ec0e1c727d3 100644 --- a/org.eclipse.ui.examples.javaeditor/.settings/org.eclipse.jdt.ui.prefs +++ b/org.eclipse.ui.examples.javaeditor/.settings/org.eclipse.jdt.ui.prefs @@ -1,4 +1,5 @@ eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_JDT UI Code Style Conventions formatter_settings_version=12 org.eclipse.jdt.ui.exception.name=e @@ -9,3 +10,60 @@ org.eclipse.jdt.ui.keywordthis=false org.eclipse.jdt.ui.ondemandthreshold=99 org.eclipse.jdt.ui.overrideannotation=true org.eclipse.jdt.ui.staticondemandthreshold=99 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_functional_interfaces=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=true +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_type_arguments=false +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=true +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaContentOutlinePage.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaContentOutlinePage.java index 62fa5c215de..e38eec277b5 100644 --- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaContentOutlinePage.java +++ b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaContentOutlinePage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,7 +18,6 @@ import java.util.List; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; -import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.LabelProvider; @@ -194,11 +193,11 @@ public class JavaContentOutlinePage extends ContentOutlinePage { super.selectionChanged(event); - ISelection selection= event.getSelection(); + IStructuredSelection selection= event.getStructuredSelection(); if (selection.isEmpty()) fTextEditor.resetHighlightRange(); else { - Segment segment= (Segment) ((IStructuredSelection) selection).getFirstElement(); + Segment segment= (Segment) selection.getFirstElement(); int start= segment.position.getOffset(); int length= segment.position.getLength(); try { diff --git a/org.eclipse.ui.workbench.texteditor/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.ui.workbench.texteditor/.settings/org.eclipse.jdt.ui.prefs index baeee07a50d..8913ba0f7bd 100644 --- a/org.eclipse.ui.workbench.texteditor/.settings/org.eclipse.jdt.ui.prefs +++ b/org.eclipse.ui.workbench.texteditor/.settings/org.eclipse.jdt.ui.prefs @@ -12,7 +12,7 @@ org.eclipse.jdt.ui.overrideannotation=true org.eclipse.jdt.ui.staticondemandthreshold=99 sp_cleanup.add_default_serial_version_id=false sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=false +sp_cleanup.add_missing_annotations=true sp_cleanup.add_missing_deprecated_annotations=true sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false @@ -44,11 +44,11 @@ sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class= sp_cleanup.qualify_static_member_accesses_with_declaring_class=false sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=false -sp_cleanup.remove_redundant_type_arguments=false +sp_cleanup.remove_redundant_type_arguments=true sp_cleanup.remove_trailing_whitespaces=true sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false +sp_cleanup.remove_unnecessary_casts=true sp_cleanup.remove_unnecessary_nls_tags=false sp_cleanup.remove_unused_imports=false sp_cleanup.remove_unused_local_variables=false diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/AbstractTemplatesPage.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/AbstractTemplatesPage.java index c4bc44fe167..336652ab43f 100644 --- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/AbstractTemplatesPage.java +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/AbstractTemplatesPage.java @@ -1198,7 +1198,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa * Set the selected templates */ private void setSelectedTemplates() { - IStructuredSelection selection= (IStructuredSelection) fTreeViewer.getSelection(); + IStructuredSelection selection = fTreeViewer.getStructuredSelection(); Iterator<?> it= selection.iterator(); TemplatePersistenceData[] data= new TemplatePersistenceData[selection.size()]; @@ -1245,7 +1245,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa * registry if no templates are selected */ private String getContextTypeId() { - IStructuredSelection selection= (IStructuredSelection) fTreeViewer.getSelection(); + IStructuredSelection selection = fTreeViewer.getStructuredSelection(); Object item; if (selection.size() == 0) diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java index 9f6e469babb..7c19e574d73 100644 --- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/templates/TemplatePreferencePage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -1182,7 +1182,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I * Updates the pattern viewer. */ protected void updateViewerInput() { - IStructuredSelection selection= (IStructuredSelection) fTableViewer.getSelection(); + IStructuredSelection selection = fTableViewer.getStructuredSelection(); if (selection.size() == 1) { TemplatePersistenceData data= (TemplatePersistenceData) selection.getFirstElement(); @@ -1197,7 +1197,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I * Updates the buttons. */ protected void updateButtons() { - IStructuredSelection selection= (IStructuredSelection) fTableViewer.getSelection(); + IStructuredSelection selection = fTableViewer.getStructuredSelection(); int selectionCount= selection.size(); int itemCount= fTableViewer.getTable().getItemCount(); boolean canRestore= fTemplateStore.getTemplateData(true).length != fTemplateStore.getTemplateData(false).length; @@ -1268,7 +1268,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I } private void edit() { - IStructuredSelection selection= (IStructuredSelection) fTableViewer.getSelection(); + IStructuredSelection selection = fTableViewer.getStructuredSelection(); Object[] objects= selection.toArray(); if ((objects == null) || (objects.length != 1)) @@ -1347,7 +1347,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I } private void export() { - IStructuredSelection selection= (IStructuredSelection) fTableViewer.getSelection(); + IStructuredSelection selection = fTableViewer.getStructuredSelection(); Object[] templates= selection.toArray(); TemplatePersistenceData[] datas= new TemplatePersistenceData[templates.length]; @@ -1400,7 +1400,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I } private void remove() { - IStructuredSelection selection= (IStructuredSelection) fTableViewer.getSelection(); + IStructuredSelection selection = fTableViewer.getStructuredSelection(); Iterator<?> elements= selection.iterator(); while (elements.hasNext()) { @@ -1425,7 +1425,7 @@ public abstract class TemplatePreferencePage extends PreferencePage implements I } private void revert() { - IStructuredSelection selection= (IStructuredSelection) fTableViewer.getSelection(); + IStructuredSelection selection = fTableViewer.getStructuredSelection(); Iterator<?> elements= selection.iterator(); while (elements.hasNext()) { |