Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-04-19 19:04:25 +0000
committerAlexander Kurtakov2018-04-19 19:04:25 +0000
commitd353d2648d4e1313a0c76cbd2333ead791caa3bb (patch)
tree5a919ebc3819fb567172ce9974169b5e159edebd /org.eclipse.ui.editors
parentbb7af253bd288e46ef1df9328d7bd26d53f5a9eb (diff)
downloadeclipse.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>
Diffstat (limited to 'org.eclipse.ui.editors')
-rw-r--r--org.eclipse.ui.editors/.settings/org.eclipse.jdt.ui.prefs58
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AnnotationsConfigurationBlock.java9
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/HyperlinkDetectorsConfigurationBlock.java3
-rwxr-xr-xorg.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/LinkedModeConfigurationBlock.java9
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java4
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SpellingConfigurationBlock.java4
6 files changed, 71 insertions, 16 deletions
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 b73bfac6f..ec0e1c727 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 cf0695a4c..70601ed12 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 d128c9231..8b4817f37 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 fbaba7547..01f65231d 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 1a928e905..eaf450a35 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 50d53dcb6..777c90552 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))

Back to the top