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 /org.eclipse.ui.workbench.texteditor | |
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>
Diffstat (limited to 'org.eclipse.ui.workbench.texteditor')
3 files changed, 12 insertions, 12 deletions
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()) { |