diff options
author | Karsten Thoms | 2017-09-12 19:53:59 +0000 |
---|---|---|
committer | Sopot Cela | 2017-09-15 12:34:36 +0000 |
commit | e341a61b8c18b906a60eee6886b5d0fc452797e1 (patch) | |
tree | 0f045e9031df603bb04442d322da96d390aaf436 | |
parent | 436cf72b5d16b64ce88662e468a4839ed8dd99e9 (diff) | |
download | eclipse.platform.text-e341a61b8c18b906a60eee6886b5d0fc452797e1.tar.gz eclipse.platform.text-e341a61b8c18b906a60eee6886b5d0fc452797e1.tar.xz eclipse.platform.text-e341a61b8c18b906a60eee6886b5d0fc452797e1.zip |
Bug 522212 - Resolve redundant null checks
Change-Id: Iaea3ee9df3771e40bc1d5bc58cd96b871c576406
Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
6 files changed, 9 insertions, 16 deletions
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferCreation.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferCreation.java index 7c0bc37b52f..ca3652397af 100644 --- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferCreation.java +++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferCreation.java @@ -69,12 +69,12 @@ public class FileBufferCreation { private IPath createLinkedFile(String linkedFileName, String linkedFileTarget) throws CoreException { IFile linkedFile= ResourceHelper.createLinkedFile(fProject, new Path(linkedFileName), FileBuffersTestPlugin.getDefault(), new Path(linkedFileTarget)); - return linkedFile != null ? linkedFile.getFullPath() : null; + return linkedFile.getFullPath(); } private IPath createLinkedFolder(String linkedFolderName, String linkedFolderTarget) throws CoreException { IFolder linkedFolder= ResourceHelper.createLinkedFolder(fProject, new Path(linkedFolderName), FileBuffersTestPlugin.getDefault(), new Path(linkedFolderTarget)); - return linkedFolder != null ? linkedFolder.getFullPath() : null; + return linkedFolder.getFullPath(); } /* diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java index 82ecddf1978..43bc6bc4ca7 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java @@ -590,7 +590,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem return null; GC gc= new GC(fBrowser); - Font font= fSymbolicFontName == null ? JFaceResources.getDialogFont() : JFaceResources.getFont(fSymbolicFontName); + Font font= JFaceResources.getFont(fSymbolicFontName); gc.setFont(font); int width= gc.getFontMetrics().getAverageCharWidth(); int height= gc.getFontMetrics().getHeight(); diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/source/DiffPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/source/DiffPainter.java index 33a6fea6471..73c52f65db6 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/source/DiffPainter.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/source/DiffPainter.java @@ -141,7 +141,7 @@ public final class DiffPainter { /** * Sets the zoom level for the current painting operation. Workaround for bug 516293. - * + * * @param zoom the zoom to set * @since 3.12 */ @@ -369,8 +369,7 @@ public final class DiffPainter { if (fLineDiffer != null) ((IAnnotationModel) fLineDiffer).removeAnnotationModelListener(fAnnotationListener); fLineDiffer= (ILineDiffer) differ; - if (fLineDiffer != null) - ((IAnnotationModel) fLineDiffer).addAnnotationModelListener(fAnnotationListener); + ((IAnnotationModel) fLineDiffer).addAnnotationModelListener(fAnnotationListener); } } } diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java index 61a1164e20b..6d15992a71c 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java @@ -41,7 +41,7 @@ import org.eclipse.jface.text.TextUtilities; * This class is used to present proposals asynchronously to the user. If additional information * exists for a proposal, then selecting that proposal will result in the information being * displayed in a secondary window. - * + * * @since 3.12 */ class AsyncCompletionProposalPopup extends CompletionProposalPopup { @@ -173,7 +173,7 @@ class AsyncCompletionProposalPopup extends CompletionProposalPopup { } fComputedProposals = computedProposals; if (stillRemainingThreeshold > 0) { // everything ready in time, go synchronous - int count= (computedProposals == null ? 0 : computedProposals.size()); + int count= computedProposals.size(); if (count == 0 && hideWhenNoProposals(autoActivated)) return null; diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesDialog.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesDialog.java index bb651be0b72..7a3db4da6ed 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesDialog.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesDialog.java @@ -349,7 +349,7 @@ class SelectResourcesDialog extends Dialog { private void updateSelectionCount() { List<Object> listItems= fResourceGroup.getAllCheckedListItems(); - int checkedFiles= listItems == null ? 0 : listItems.size(); + int checkedFiles= listItems.size(); StringBuilder buffer= new StringBuilder(); switch (checkedFiles) { case 0: 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 7c9377d1c8d..c90f6e50e4c 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 @@ -6546,13 +6546,7 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit Caret caret= new Caret(styledText, SWT.NULL); Image image= createRawInsertModeCaretImage(styledText); - if (image != null) - caret.setImage(image); - else { - // XXX: Filed request to get a caret with auto-height: https://bugs.eclipse.org/bugs/show_bug.cgi?id=118612 - caret.setSize(getCaretWidthPreference(), styledText.getLineHeight()); - } - + caret.setImage(image); caret.setFont(styledText.getFont()); return caret; |