diff options
author | Lars Vogel | 2017-01-11 20:42:01 +0000 |
---|---|---|
committer | Lars Vogel | 2017-01-11 20:42:01 +0000 |
commit | 1e5d8f21feb0e2fe7c1bdc264d01677edde4365b (patch) | |
tree | 41d904986cceee1564067b1d53f718a77f279c98 | |
parent | f4fbf4ecf56758b9443f635bf187d4638a99e91e (diff) | |
download | eclipse.platform.text-1e5d8f21feb0e2fe7c1bdc264d01677edde4365b.tar.gz eclipse.platform.text-1e5d8f21feb0e2fe7c1bdc264d01677edde4365b.tar.xz eclipse.platform.text-1e5d8f21feb0e2fe7c1bdc264d01677edde4365b.zip |
Bug 510312 - Replace usage of new Integer(int) with Integer.valueOf() in
eclipse.platform.text plug-ins - Part 1
Change-Id: I8cd43f97a0e3d4ea32e11a2b3cf8898b6be3bc5c
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
15 files changed, 28 insertions, 28 deletions
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileCharSequenceProvider.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileCharSequenceProvider.java index 284d0fa4075..120fa839908 100644 --- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileCharSequenceProvider.java +++ b/org.eclipse.search/search/org/eclipse/search/internal/core/text/FileCharSequenceProvider.java @@ -375,7 +375,7 @@ public class FileCharSequenceProvider { boolean endReached= buffer.fill(fReader, fReaderPos); fReaderPos= buffer.getEndOffset(); if (endReached) { - fLength= new Integer(fReaderPos); // at least we know the size of the file now + fLength= Integer.valueOf(fReaderPos); // at least we know the size of the file now fReaderPos= Integer.MAX_VALUE; // will have to reset next time return true; } diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/EditorOpener.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/EditorOpener.java index f907e685d61..551840b5bf1 100644 --- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/EditorOpener.java +++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/EditorOpener.java @@ -128,8 +128,8 @@ public class EditorOpener { try { marker= file.createMarker(NewSearchUI.SEARCH_MARKER); HashMap<String, Integer> attributes= new HashMap<>(4); - attributes.put(IMarker.CHAR_START, new Integer(offset)); - attributes.put(IMarker.CHAR_END, new Integer(offset + length)); + attributes.put(IMarker.CHAR_START, Integer.valueOf(offset)); + attributes.put(IMarker.CHAR_END, Integer.valueOf(offset + length)); marker.setAttributes(attributes); IDE.gotoMarker(editor, marker); } catch (CoreException e) { diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileLabelProvider.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileLabelProvider.java index 797e7f7a278..07940450834 100644 --- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileLabelProvider.java +++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileLabelProvider.java @@ -112,7 +112,7 @@ public class FileLabelProvider extends LabelProvider implements IStyledLabelProv private StyledString getLineElementLabel(LineElement lineElement) { int lineNumber= lineElement.getLine(); - String lineNumberString= Messages.format(SearchMessages.FileLabelProvider_line_number, new Integer(lineNumber)); + String lineNumberString= Messages.format(SearchMessages.FileLabelProvider_line_number, Integer.valueOf(lineNumber)); StyledString str= new StyledString(lineNumberString, StyledString.QUALIFIER_STYLER); @@ -220,7 +220,7 @@ public class FileLabelProvider extends LabelProvider implements IStyledLabelProv if (matchCount <= 1) return coloredName; - String countInfo= Messages.format(SearchMessages.FileLabelProvider_count_format, new Integer(matchCount)); + String countInfo= Messages.format(SearchMessages.FileLabelProvider_count_format, Integer.valueOf(matchCount)); coloredName.append(' ').append(countInfo, StyledString.COUNTER_STYLER); return coloredName; } 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 8084345a09f..4673b3eaaf1 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 @@ -137,7 +137,7 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt fSortByNameAction= new SortAction(SearchMessages.FileSearchPage_sort_name_label, this, FileLabelProvider.SHOW_LABEL_PATH); fSortByPathAction= new SortAction(SearchMessages.FileSearchPage_sort_path_label, this, FileLabelProvider.SHOW_PATH_LABEL); - setElementLimit(new Integer(DEFAULT_ELEMENT_LIMIT)); + setElementLimit(Integer.valueOf(DEFAULT_ELEMENT_LIMIT)); } @Override @@ -360,7 +360,7 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt if (value != null) elementLimit= value.intValue(); } - setElementLimit(new Integer(elementLimit)); + setElementLimit(Integer.valueOf(elementLimit)); } @Override public void saveState(IMemento memento) { @@ -419,12 +419,12 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt if (showLineMatches()) { int matchCount= getInput().getMatchCount(); if (itemCount < matchCount) { - return Messages.format(SearchMessages.FileSearchPage_limited_format_matches, new Object[]{label, new Integer(itemCount), new Integer(matchCount)}); + return Messages.format(SearchMessages.FileSearchPage_limited_format_matches, new Object[]{label, Integer.valueOf(itemCount), Integer.valueOf(matchCount)}); } } else { int fileCount= getInput().getElements().length; if (itemCount < fileCount) { - return Messages.format(SearchMessages.FileSearchPage_limited_format_files, new Object[]{label, new Integer(itemCount), new Integer(fileCount)}); + return Messages.format(SearchMessages.FileSearchPage_limited_format_files, new Object[]{label, Integer.valueOf(itemCount), Integer.valueOf(fileCount)}); } } } diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchQuery.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchQuery.java index 1b47a288596..84d3e7d20e2 100644 --- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchQuery.java +++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchQuery.java @@ -287,7 +287,7 @@ public class FileSearchQuery implements ISearchQuery { Object[] args= { searchString, fScope.getDescription() }; return Messages.format(SearchMessages.FileSearchQuery_singularLabel, args); } - Object[] args= { searchString, new Integer(nMatches), fScope.getDescription() }; + Object[] args= { searchString, Integer.valueOf(nMatches), fScope.getDescription() }; return Messages.format(SearchMessages.FileSearchQuery_pluralPattern, args); } // search selected file extensions @@ -295,7 +295,7 @@ public class FileSearchQuery implements ISearchQuery { Object[] args= { searchString, fScope.getDescription(), fScope.getFilterDescription() }; return Messages.format(SearchMessages.FileSearchQuery_singularPatternWithFileExt, args); } - Object[] args= { searchString, new Integer(nMatches), fScope.getDescription(), fScope.getFilterDescription() }; + Object[] args= { searchString, Integer.valueOf(nMatches), fScope.getDescription(), fScope.getFilterDescription() }; return Messages.format(SearchMessages.FileSearchQuery_pluralPatternWithFileExt, args); } // file search @@ -303,7 +303,7 @@ public class FileSearchQuery implements ISearchQuery { Object[] args= { fScope.getFilterDescription(), fScope.getDescription() }; return Messages.format(SearchMessages.FileSearchQuery_singularLabel_fileNameSearch, args); } - Object[] args= { fScope.getFilterDescription(), new Integer(nMatches), fScope.getDescription() }; + Object[] args= { fScope.getFilterDescription(), Integer.valueOf(nMatches), fScope.getDescription() }; return Messages.format(SearchMessages.FileSearchQuery_pluralPattern_fileNameSearch, args); } diff --git a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/GotoLineTest.java b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/GotoLineTest.java index 28fb433e282..f3d106a8207 100644 --- a/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/GotoLineTest.java +++ b/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/GotoLineTest.java @@ -98,7 +98,7 @@ public class GotoLineTest { ITextEditor editor= (ITextEditor) part; IAction action= editor.getAction(ITextEditorActionConstants.GOTO_LINE); Accessor accessor= new Accessor(action, GotoLineAction.class); - accessor.invoke("gotoLine", new Class[] {int.class}, new Integer[] {new Integer(line)}); + accessor.invoke("gotoLine", new Class[] {int.class}, new Integer[] {Integer.valueOf(line)}); Control control= part.getAdapter(Control.class); if (control instanceof StyledText) { int caretLine= -1; diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java index f24c70aee1b..af304113562 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractMarkerAnnotationModel.java @@ -273,7 +273,7 @@ public abstract class AbstractMarkerAnnotationModel extends AnnotationModel impl IConfigurationElement[] elements= extensionPoint.getConfigurationElements(); for (int i= 0; i < elements.length; i++) { markerUpdaterSpecificationsLinkedList.add(elements[i]); - markerUpdaterOrderMap.put(elements[i].getAttribute(ID), new Integer(i)); + markerUpdaterOrderMap.put(elements[i].getAttribute(ID), Integer.valueOf(i)); } //start sorting based on required-updater definition HashMap<String, ArrayList<String>> markerUpdaterRequiredByOrderMap= new HashMap<>(2); @@ -319,8 +319,8 @@ public abstract class AbstractMarkerAnnotationModel extends AnnotationModel impl .getAttribute(ID)).intValue() - 1); IConfigurationElement requiredMarker= markerUpdaterSpecificationsLinkedList.remove(requiredLocation.intValue()); markerUpdaterSpecificationsLinkedList.add(newLocation, requiredMarker); // Put the required location before the marker - markerUpdaterOrderMap.put(requiredID, new Integer(newLocation)); - markerUpdaterOrderMap.put(elements[i].getAttribute(ID), new Integer(newLocation + 1)); + markerUpdaterOrderMap.put(requiredID, Integer.valueOf(newLocation)); + markerUpdaterOrderMap.put(elements[i].getAttribute(ID), Integer.valueOf(newLocation + 1)); } } } diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ChainedPreferenceStore.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ChainedPreferenceStore.java index 7f4e30cd27f..1a9fb178e1d 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ChainedPreferenceStore.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ChainedPreferenceStore.java @@ -438,7 +438,7 @@ public class ChainedPreferenceStore implements IPreferenceStore { else if (thisValue instanceof Float) return new Float(store.getFloat(property)); else if (thisValue instanceof Integer) - return new Integer(store.getInt(property)); + return Integer.valueOf(store.getInt(property)); else if (thisValue instanceof Long) return new Long(store.getLong(property)); else if (thisValue instanceof String) diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaCompletionProcessor.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaCompletionProcessor.java index 5a45d1cc6a1..eae6b3f2ae6 100644 --- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaCompletionProcessor.java +++ b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/java/JavaCompletionProcessor.java @@ -72,8 +72,8 @@ public class JavaCompletionProcessor implements IContentAssistProcessor { IContextInformation[] result= new IContextInformation[5]; for (int i= 0; i < result.length; i++) result[i]= new ContextInformation( - MessageFormat.format(JavaEditorMessages.getString("CompletionProcessor.ContextInfo.display.pattern"), new Object[] { new Integer(i), new Integer(documentOffset) }), //$NON-NLS-1$ - MessageFormat.format(JavaEditorMessages.getString("CompletionProcessor.ContextInfo.value.pattern"), new Object[] { new Integer(i), new Integer(documentOffset - 5), new Integer(documentOffset + 5)})); //$NON-NLS-1$ + MessageFormat.format(JavaEditorMessages.getString("CompletionProcessor.ContextInfo.display.pattern"), new Object[] { Integer.valueOf(i), Integer.valueOf(documentOffset) }), //$NON-NLS-1$ + MessageFormat.format(JavaEditorMessages.getString("CompletionProcessor.ContextInfo.value.pattern"), new Object[] { Integer.valueOf(i), Integer.valueOf(documentOffset - 5), Integer.valueOf(documentOffset + 5)})); //$NON-NLS-1$ return result; } diff --git a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java index 5bd3e9ef3b2..7bce9329bc3 100644 --- a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java +++ b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java @@ -449,7 +449,7 @@ public class HippieCompletionTest { private Accessor createAccessor(Iterator<String> suggestions, int startOffset) { return new Accessor("org.eclipse.ui.texteditor.HippieCompleteAction$CompletionState", getClass().getClassLoader(), new Class[] { Iterator.class, int.class }, new - Object[] { suggestions, new Integer(startOffset) }); + Object[] { suggestions, Integer.valueOf(startOffset) }); } private String next(Accessor state) { diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DiffRegion.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DiffRegion.java index cbf11320944..c52d0316d81 100644 --- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DiffRegion.java +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/quickdiff/DiffRegion.java @@ -165,12 +165,12 @@ public final class DiffRegion extends Annotation implements ILineDiffInfo { int l= fDifference.leftLength(); int c= Math.min(r, l); int a= r - l; - String changed= c > 0 ? NLSUtility.format(QuickDiffMessages.quickdiff_annotation_changed, new Integer(c)) : null; + String changed= c > 0 ? NLSUtility.format(QuickDiffMessages.quickdiff_annotation_changed, Integer.valueOf(c)) : null; String added; if (a > 0) - added= NLSUtility.format(QuickDiffMessages.quickdiff_annotation_added, new Integer(a)); + added= NLSUtility.format(QuickDiffMessages.quickdiff_annotation_added, Integer.valueOf(a)); else if (a < 0) - added= NLSUtility.format(QuickDiffMessages.quickdiff_annotation_deleted, new Integer(-a)); + added= NLSUtility.format(QuickDiffMessages.quickdiff_annotation_deleted, Integer.valueOf(-a)); else added= null; String line= c > 1 || c == 0 && Math.abs(a) > 1 ? QuickDiffMessages.quickdiff_annotation_line_plural : QuickDiffMessages.quickdiff_annotation_line_singular; diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java index 118cb06a39e..64c72acccdd 100644 --- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java @@ -3838,7 +3838,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit IStatusField statusField= getStatusField(ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION); if (statusField != null) { int newHeight= styledText.getFont().getFontData()[0].getHeight(); - statusField.setText(NLSUtility.format(EditorMessages.Editor_font_reset_message, new Integer(newHeight))); + statusField.setText(NLSUtility.format(EditorMessages.Editor_font_reset_message, Integer.valueOf(newHeight))); } } } else if (e.detail == SWT.GESTURE_MAGNIFY && fMagnificationStartFont != null) { @@ -3854,7 +3854,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit updateCaret(); IStatusField statusField= getStatusField(ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION); if (statusField != null) { - statusField.setText(NLSUtility.format(EditorMessages.Editor_font_zoom_message, new Object[] { new Integer(startHeight), new Integer(newHeight) })); + statusField.setText(NLSUtility.format(EditorMessages.Editor_font_zoom_message, new Object[] { Integer.valueOf(startHeight), Integer.valueOf(newHeight) })); } } } diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java index 96183bb9ccf..2a446f49754 100644 --- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AnnotationPreference.java @@ -366,7 +366,7 @@ public class AnnotationPreference { * @since 3.0 */ protected void setValue(Object attribute, int value) { - fAttributes.put(attribute, new Integer(value)); + fAttributes.put(attribute, Integer.valueOf(value)); } /** diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoLineAction.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoLineAction.java index 258de321354..02741c0e48b 100644 --- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoLineAction.java +++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/GotoLineAction.java @@ -199,7 +199,7 @@ public class GotoLineAction extends TextEditorAction { } String title= fBundle.getString(fPrefix + "dialog.title"); //$NON-NLS-1$ - String message= NLSUtility.format(fBundle.getString(fPrefix + "dialog.message"), new Integer(fLastLine)); //$NON-NLS-1$ + String message= NLSUtility.format(fBundle.getString(fPrefix + "dialog.message"), Integer.valueOf(fLastLine)); //$NON-NLS-1$ String currentLineStr= ""; //$NON-NLS-1$ ISelection selection= editor.getSelectionProvider().getSelection(); 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 0fcb13d7ddd..f783dcfb705 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 @@ -1390,7 +1390,7 @@ public abstract class AbstractTemplatesPage extends Page implements ITemplatesPa message= TemplatesMessages.TemplatesPage_remove_message_single; else message= NLSUtility.format(TemplatesMessages.TemplatesPage_remove_message_multi, - new Object[] { new Integer(selectedTemplates.length) }); + new Object[] { Integer.valueOf(selectedTemplates.length) }); if (!MessageDialog.openQuestion(getShell(), title, message)) return; for (int i= 0; i < selectedTemplates.length; i++) { |