Remove unneeded @SuppressWarnings.
Change-Id: Iac4da4f06d3bb25cd5c54eee2e5305fc0788c073
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptTemplatesPage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptTemplatesPage.java
index aa4ef24..99e19bd 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptTemplatesPage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/ScriptTemplatesPage.java
@@ -109,8 +109,9 @@
return;
}
if (prefix.length() > 0) {
- contextViewer.setSelectedRange(textSelection.getOffset()
- - prefix.length(), prefix.length());
+ contextViewer.setSelectedRange(
+ textSelection.getOffset() - prefix.length(),
+ prefix.length());
textSelection = (ITextSelection) contextViewer
.getSelectionProvider().getSelection();
}
@@ -124,13 +125,13 @@
}
Position position = new Position(textSelection.getOffset() + 1, 0);
Region region = new Region(textSelection.getOffset() + 1, 0);
- contextViewer.getSelectionProvider().setSelection(
- new TextSelection(textSelection.getOffset(), 1));
+ contextViewer.getSelectionProvider()
+ .setSelection(new TextSelection(textSelection.getOffset(), 1));
ISourceModule compilationUnit = EditorUtility
.getEditorInputModelElement(fScriptEditor, true);
- TemplateContextType type = getContextTypeRegistry().getContextType(
- template.getContextTypeId());
+ TemplateContextType type = getContextTypeRegistry()
+ .getContextType(template.getContextTypeId());
DocumentTemplateContext context = ((ScriptTemplateContextType) type)
.createContext(document, position, compilationUnit);
context.setVariable("selection", savedText); //$NON-NLS-1$
@@ -170,8 +171,8 @@
String[] contextIds = getContextTypeIds(document, offset);
for (int i = 0; i < contextIds.length; i++) {
if (contextIds[i].equals(template.getContextTypeId())) {
- DocumentTemplateContext context = getContext(document,
- template, offset, length);
+ DocumentTemplateContext context = getContext(document, template,
+ offset, length);
return context.canEvaluate(template)
|| isTemplateAllowed(context, template);
}
@@ -199,8 +200,8 @@
new ScriptSourcePreviewerUpdater(viewer, configuration, store);
Control control = viewer.getControl();
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.FILL_VERTICAL);
+ GridData data = new GridData(
+ GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
control.setLayoutData(data);
viewer.setEditable(false);
@@ -224,8 +225,8 @@
}
protected IDLTKUILanguageToolkit uiToolkit() {
- return DLTKUILanguageManager.getLanguageToolkit(fScriptEditor
- .getLanguageToolkit());
+ return DLTKUILanguageManager
+ .getLanguageToolkit(fScriptEditor.getLanguageToolkit());
}
@Override
@@ -235,8 +236,8 @@
return;
}
String contextId = template.getContextTypeId();
- TemplateContextType type = getContextTypeRegistry().getContextType(
- contextId);
+ TemplateContextType type = getContextTypeRegistry()
+ .getContextType(contextId);
fTemplateProcessor.setContextType(type);
IDocument doc = getPatternViewer().getDocument();
@@ -302,8 +303,9 @@
// && Character.isWhitespace(context.getDocument()
// .getChar(offset - 1));
// } else {
- return ((offset = context.getCompletionOffset()) > 0 && !isTemplateNamePart(context
- .getDocument().getChar(offset - 1)));
+ return ((offset = context.getCompletionOffset()) > 0
+ && !isTemplateNamePart(
+ context.getDocument().getChar(offset - 1)));
// }
} catch (BadLocationException e) {
}
@@ -359,7 +361,6 @@
@Override
protected String[] getContextTypeIds(IDocument document, int offset) {
final Set<String> ids = new HashSet<String>();
- @SuppressWarnings("unchecked")
final Iterator<TemplateContextType> i = getContextTypeRegistry()
.contextTypes();
while (i.hasNext()) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/ScriptFormattingStrategy.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/ScriptFormattingStrategy.java
index f9a47b3..2dc51a5 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/ScriptFormattingStrategy.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/ScriptFormattingStrategy.java
@@ -94,11 +94,11 @@
try {
int offset = partition.getOffset();
- final IScriptFormatterFactory formatterFactory = selectFormatterFactory(job);
+ final IScriptFormatterFactory formatterFactory = selectFormatterFactory(
+ job);
if (formatterFactory != null) {
final String lineDelimiter = TextUtilities
.getDefaultLineDelimiter(document);
- @SuppressWarnings("unchecked")
final Map<String, String> prefs = getPreferences();
final IScriptFormatter formatter = formatterFactory
.createFormatter(lineDelimiter, prefs);
@@ -124,26 +124,26 @@
}
}
} catch (FormatterSyntaxProblemException e) {
- reportFormatError(NLS
- .bind(FormatterMessages.ScriptFormattingStrategy_unableToFormatSourceContainingSyntaxError,
- e.getMessage()));
+ reportFormatError(NLS.bind(
+ FormatterMessages.ScriptFormattingStrategy_unableToFormatSourceContainingSyntaxError,
+ e.getMessage()));
} catch (FormatterException e) {
- reportFormatError(NLS
- .bind(FormatterMessages.ScriptFormattingStrategy_unableToFormat,
- e.getMessage()));
+ reportFormatError(NLS.bind(
+ FormatterMessages.ScriptFormattingStrategy_unableToFormat,
+ e.getMessage()));
} catch (MalformedTreeException e) {
- DLTKUIPlugin
- .warn(FormatterMessages.ScriptFormattingStrategy_formattingError,
- e);
+ DLTKUIPlugin.warn(
+ FormatterMessages.ScriptFormattingStrategy_formattingError,
+ e);
} catch (BadLocationException e) {
// Can only happen on concurrent document modification
- DLTKUIPlugin
- .warn(FormatterMessages.ScriptFormattingStrategy_formattingError,
- e);
+ DLTKUIPlugin.warn(
+ FormatterMessages.ScriptFormattingStrategy_formattingError,
+ e);
} catch (Exception e) {
- final String msg = NLS
- .bind(FormatterMessages.ScriptFormattingStrategy_unexpectedFormatterError,
- e.toString());
+ final String msg = NLS.bind(
+ FormatterMessages.ScriptFormattingStrategy_unexpectedFormatterError,
+ e.toString());
DLTKUIPlugin.logErrorMessage(msg, e);
} finally {
if (partitioners != null)
@@ -183,8 +183,8 @@
.getProperty(ScriptFormattingContextProperties.MODULE);
final IProject project = (IProject) context
.getProperty(ScriptFormattingContextProperties.CONTEXT_PROJECT);
- final String formatterId = (String) context
- .getProperty(ScriptFormattingContextProperties.CONTEXT_FORMATTER_ID);
+ final String formatterId = (String) context.getProperty(
+ ScriptFormattingContextProperties.CONTEXT_FORMATTER_ID);
fJobs.addLast(new FormatJob(document, partition, module, project,
formatterId));
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractTodoTaskOptionsBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractTodoTaskOptionsBlock.java
index edfb93e..e3d1550 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractTodoTaskOptionsBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/AbstractTodoTaskOptionsBlock.java
@@ -35,15 +35,16 @@
* Abstract options block that can be used by an
* {@link AbstractConfigurationBlockPropertyAndPreferencePage} implementation to
* create a preferences/property page for task tags.
- *
+ *
* <p>
* It is recommended to instantiate {@link TodoTaskOptionsBlock} instead.
* </p>
*/
-public abstract class AbstractTodoTaskOptionsBlock extends AbstractOptionsBlock {
+public abstract class AbstractTodoTaskOptionsBlock
+ extends AbstractOptionsBlock {
- private static class TodoTaskLabelProvider extends LabelProvider implements
- ITableLabelProvider {
+ private static class TodoTaskLabelProvider extends LabelProvider
+ implements ITableLabelProvider {
@Override
public Image getImage(Object element) {
@@ -86,7 +87,6 @@
private static class TodoTaskSorter extends ViewerSorter {
@Override
- @SuppressWarnings("unchecked")
public int compare(Viewer viewer, Object e1, Object e2) {
return getComparator().compare(((TodoTask) e1).name,
((TodoTask) e2).name);
@@ -179,8 +179,8 @@
final String[] columnsHeaders = new String[] {
PreferencesMessages.TodoTaskConfigurationBlock_markers_tasks_name_column,
PreferencesMessages.TodoTaskConfigurationBlock_markers_tasks_priority_column, };
- fTodoTasksList.setTableColumns(new ListDialogField.ColumnsDescription(
- columnsHeaders, true));
+ fTodoTasksList.setTableColumns(
+ new ListDialogField.ColumnsDescription(columnsHeaders, true));
fTodoTasksList.setViewerSorter(new TodoTaskSorter());
final GridLayout layout = new GridLayout();
@@ -200,11 +200,9 @@
null, false, 2);
bindControl(enableCheckbox, getEnabledKey(), null);
- fCaseSensitiveCheckbox = SWTFactory
- .createCheckButton(
- markersComposite,
- PreferencesMessages.TodoTaskConfigurationBlock_casesensitive_label,
- null, false, 2);
+ fCaseSensitiveCheckbox = SWTFactory.createCheckButton(markersComposite,
+ PreferencesMessages.TodoTaskConfigurationBlock_casesensitive_label,
+ null, false, 2);
bindControl(fCaseSensitiveCheckbox, getCaseSensitiveKey(), null);
@@ -212,8 +210,8 @@
data.widthHint = conv.convertWidthInCharsToPixels(50);
fTodoTasksList.getListControl(markersComposite).setLayoutData(data);
- fTodoTasksList.getButtonBox(markersComposite).setLayoutData(
- new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ fTodoTasksList.getButtonBox(markersComposite)
+ .setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
| GridData.VERTICAL_ALIGN_BEGINNING));
enableCheckbox.addSelectionListener(new SelectionAdapter() {
@@ -232,7 +230,7 @@
/**
* Returns the preference key that will be used to store the 'case
* sensitive' preference
- *
+ *
* @see #createCaseSensitiveKey(String)
*/
protected abstract PreferenceKey getCaseSensitiveKey();
@@ -240,14 +238,14 @@
/**
* Returns the preference key that will be used to store the 'enabled'
* preference
- *
+ *
* @see #createEnabledKey(String)
*/
protected abstract PreferenceKey getEnabledKey();
/**
* Returns the preference key that will be used to store the task tags
- *
+ *
* @see #createTagKey(String)
*/
protected abstract PreferenceKey getTags();
@@ -274,18 +272,17 @@
@SuppressWarnings("unchecked")
protected final void updateModel(DialogField field) {
- setValue(getTags(), TaskTagUtils.encodeTaskTags(fTodoTasksList
- .getElements()));
+ setValue(getTags(),
+ TaskTagUtils.encodeTaskTags(fTodoTasksList.getElements()));
}
@Override
protected IPreferenceChangeRebuildPrompt getPreferenceChangeRebuildPrompt(
- boolean workspaceSettings, Collection<PreferenceKey> changedOptions) {
- return PreferenceChangeRebuildPrompt
- .create(
- workspaceSettings,
- PreferencesMessages.TodoTaskConfigurationBlock_needsbuild_title,
- PreferencesMessages.TodoTaskConfigurationBlock_needsbuild_message);
+ boolean workspaceSettings,
+ Collection<PreferenceKey> changedOptions) {
+ return PreferenceChangeRebuildPrompt.create(workspaceSettings,
+ PreferencesMessages.TodoTaskConfigurationBlock_needsbuild_title,
+ PreferencesMessages.TodoTaskConfigurationBlock_needsbuild_message);
}
private void doTodoButtonPressed(int index) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableProcessor.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableProcessor.java
index 619f058..136d531 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableProcessor.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableProcessor.java
@@ -27,8 +27,9 @@
public class TemplateVariableProcessor implements IContentAssistProcessor {
- private static Comparator<TemplateVariableProposal> fgTemplateVariableProposalComparator = (proposal0, proposal1) -> proposal0.getDisplayString().compareTo(
- proposal1.getDisplayString());
+ private static Comparator<TemplateVariableProposal> fgTemplateVariableProposalComparator = (
+ proposal0, proposal1) -> proposal0.getDisplayString()
+ .compareTo(proposal1.getDisplayString());
/** the context type */
private TemplateContextType fContextType;
@@ -87,11 +88,9 @@
int length = end - offset;
- for (@SuppressWarnings("unchecked")
- Iterator<TemplateVariableResolver> iterator = fContextType.resolvers(); iterator
- .hasNext();) {
- TemplateVariableResolver variable = iterator
- .next();
+ for (Iterator<TemplateVariableResolver> iterator = fContextType
+ .resolvers(); iterator.hasNext();) {
+ TemplateVariableResolver variable = iterator.next();
if (variable.getType().startsWith(prefix))
proposals.add(new TemplateVariableProposal(variable, offset,
@@ -115,9 +114,8 @@
if (start >= 1 && string.charAt(start - 1) == ':') {
start--;
- while ((start != 0)
- && Character.isUnicodeIdentifierPart(string
- .charAt(start - 1)))
+ while ((start != 0) && Character
+ .isUnicodeIdentifierPart(string.charAt(start - 1)))
start--;
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableTextHover.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableTextHover.java
index 0472819..cc2a7db 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableTextHover.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/templates/TemplateVariableTextHover.java
@@ -43,12 +43,10 @@
String varName = doc.get(offset, subject.getLength());
TemplateContextType contextType = fProcessor.getContextType();
if (contextType != null) {
- @SuppressWarnings("unchecked")
Iterator<TemplateVariableResolver> iter = contextType
.resolvers();
while (iter.hasNext()) {
- TemplateVariableResolver var = iter
- .next();
+ TemplateVariableResolver var = iter.next();
if (varName.equals(var.getType())) {
return var.getDescription();
}