Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Keppler2019-12-26 12:35:05 +0000
committerMichael Keppler2019-12-28 08:40:51 +0000
commit32d478d9c89f7ad230dd64ad4c2e594140ca176a (patch)
treebf032cd6dd9b699becca05e0854c8df9faa5aaa6
parent5faa290913b7fd297f6608e16be9a17c5830aa29 (diff)
downloadegit-32d478d9c89f7ad230dd64ad4c2e594140ca176a.tar.gz
egit-32d478d9c89f7ad230dd64ad4c2e594140ca176a.tar.xz
egit-32d478d9c89f7ad230dd64ad4c2e594140ca176a.zip
Enable and execute cleanup "Push down negations"
Push down negations to make reading of complex expressions with negations easier. Also enable the cleanup as a save action. There is a bug in the cleanup (not adding braces around instanceof expressions), but whenever that occurs, the developer can just add the braces manually, and the bug will not occur again for that location. Therefore that bug should not stop us from using the cleanup. Change-Id: I1a5026304b080b0ccebe06e6829857b784541f99 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
-rw-r--r--org.eclipse.egit.core.junit/.settings/org.eclipse.jdt.ui.prefs2
-rw-r--r--org.eclipse.egit.core.test/.settings/org.eclipse.jdt.ui.prefs2
-rw-r--r--org.eclipse.egit.core/.settings/org.eclipse.jdt.ui.prefs2
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffData.java14
-rw-r--r--org.eclipse.egit.gitflow.test/.settings/org.eclipse.jdt.ui.prefs2
-rw-r--r--org.eclipse.egit.gitflow.ui/.settings/org.eclipse.jdt.ui.prefs2
-rw-r--r--org.eclipse.egit.gitflow/.settings/org.eclipse.jdt.ui.prefs2
-rw-r--r--org.eclipse.egit.mylyn.ui.test/.settings/org.eclipse.jdt.ui.prefs2
-rw-r--r--org.eclipse.egit.mylyn.ui/.settings/org.eclipse.jdt.ui.prefs2
-rw-r--r--org.eclipse.egit.ui.test/.settings/org.eclipse.jdt.ui.prefs2
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/decorators/TestDecoratableResource.java10
-rw-r--r--org.eclipse.egit.ui/.settings/org.eclipse.jdt.ui.prefs2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitCombo.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiff.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GenerateHistoryJob.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitCreatePatchWizard.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/LocationPage.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewContentProvider.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/FixedJFaceToolTip.java2
20 files changed, 31 insertions, 31 deletions
diff --git a/org.eclipse.egit.core.junit/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.egit.core.junit/.settings/org.eclipse.jdt.ui.prefs
index 086d01c0a..0f1ae3acf 100644
--- a/org.eclipse.egit.core.junit/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.egit.core.junit/.settings/org.eclipse.jdt.ui.prefs
@@ -35,7 +35,7 @@ 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.push_down_negation=false
+sp_cleanup.push_down_negation=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
diff --git a/org.eclipse.egit.core.test/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.egit.core.test/.settings/org.eclipse.jdt.ui.prefs
index 086d01c0a..0f1ae3acf 100644
--- a/org.eclipse.egit.core.test/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.egit.core.test/.settings/org.eclipse.jdt.ui.prefs
@@ -35,7 +35,7 @@ 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.push_down_negation=false
+sp_cleanup.push_down_negation=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
diff --git a/org.eclipse.egit.core/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.egit.core/.settings/org.eclipse.jdt.ui.prefs
index 086d01c0a..0f1ae3acf 100644
--- a/org.eclipse.egit.core/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.egit.core/.settings/org.eclipse.jdt.ui.prefs
@@ -35,7 +35,7 @@ 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.push_down_negation=false
+sp_cleanup.push_down_negation=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
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffData.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffData.java
index a3f9f8a88..e96153d64 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffData.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffData.java
@@ -127,7 +127,7 @@ public class IndexDiffData {
Collection<IResource> changedResources,
IndexDiff diffForChangedFiles) {
this.changedResources = Collections
- .unmodifiableCollection(new HashSet<IResource>(changedResources));
+ .unmodifiableCollection(new HashSet<>(changedResources));
Set<String> added2 = new HashSet<>(baseDiff.getAdded());
Set<String> assumeUnchanged2 = new HashSet<>(
baseDiff.getAssumeUnchanged());
@@ -356,12 +356,12 @@ public class IndexDiffData {
* @return {@code true} if there are changes; {@code false} otherwise
*/
public boolean hasChanges() {
- return !(getAdded().isEmpty() //
- && getChanged().isEmpty() //
- && getRemoved().isEmpty() //
- && getUntracked().isEmpty() //
- && getModified().isEmpty() //
- && getMissing().isEmpty());
+ return !getAdded().isEmpty() //
+ || !getChanged().isEmpty() //
+ || !getRemoved().isEmpty() //
+ || !getUntracked().isEmpty() //
+ || !getModified().isEmpty() //
+ || !getMissing().isEmpty();
}
/**
diff --git a/org.eclipse.egit.gitflow.test/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.egit.gitflow.test/.settings/org.eclipse.jdt.ui.prefs
index 086d01c0a..0f1ae3acf 100644
--- a/org.eclipse.egit.gitflow.test/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.egit.gitflow.test/.settings/org.eclipse.jdt.ui.prefs
@@ -35,7 +35,7 @@ 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.push_down_negation=false
+sp_cleanup.push_down_negation=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
diff --git a/org.eclipse.egit.gitflow.ui/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.egit.gitflow.ui/.settings/org.eclipse.jdt.ui.prefs
index 086d01c0a..0f1ae3acf 100644
--- a/org.eclipse.egit.gitflow.ui/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.egit.gitflow.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -35,7 +35,7 @@ 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.push_down_negation=false
+sp_cleanup.push_down_negation=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
diff --git a/org.eclipse.egit.gitflow/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.egit.gitflow/.settings/org.eclipse.jdt.ui.prefs
index 086d01c0a..0f1ae3acf 100644
--- a/org.eclipse.egit.gitflow/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.egit.gitflow/.settings/org.eclipse.jdt.ui.prefs
@@ -35,7 +35,7 @@ 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.push_down_negation=false
+sp_cleanup.push_down_negation=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
diff --git a/org.eclipse.egit.mylyn.ui.test/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.egit.mylyn.ui.test/.settings/org.eclipse.jdt.ui.prefs
index 086d01c0a..0f1ae3acf 100644
--- a/org.eclipse.egit.mylyn.ui.test/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.egit.mylyn.ui.test/.settings/org.eclipse.jdt.ui.prefs
@@ -35,7 +35,7 @@ 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.push_down_negation=false
+sp_cleanup.push_down_negation=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
diff --git a/org.eclipse.egit.mylyn.ui/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.egit.mylyn.ui/.settings/org.eclipse.jdt.ui.prefs
index 086d01c0a..0f1ae3acf 100644
--- a/org.eclipse.egit.mylyn.ui/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.egit.mylyn.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -35,7 +35,7 @@ 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.push_down_negation=false
+sp_cleanup.push_down_negation=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
diff --git a/org.eclipse.egit.ui.test/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.egit.ui.test/.settings/org.eclipse.jdt.ui.prefs
index 086d01c0a..0f1ae3acf 100644
--- a/org.eclipse.egit.ui.test/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.egit.ui.test/.settings/org.eclipse.jdt.ui.prefs
@@ -35,7 +35,7 @@ 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.push_down_negation=false
+sp_cleanup.push_down_negation=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
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/decorators/TestDecoratableResource.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/decorators/TestDecoratableResource.java
index 06a19957f..b208ec6c9 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/decorators/TestDecoratableResource.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/decorators/TestDecoratableResource.java
@@ -92,17 +92,17 @@ public class TestDecoratableResource extends DecoratableResource {
return false;
IDecoratableResource decoratableResource = (IDecoratableResource) obj;
- if (!(decoratableResource.getType() == getType()))
+ if (decoratableResource.getType() != getType())
return false;
if (!decoratableResource.getName().equals(getName()))
return false;
- if (!(decoratableResource.isTracked() == isTracked()))
+ if (decoratableResource.isTracked() != isTracked())
return false;
- if (!(decoratableResource.isIgnored() == isIgnored()))
+ if (decoratableResource.isIgnored() != isIgnored())
return false;
- if (!(decoratableResource.isDirty() == isDirty()))
+ if (decoratableResource.isDirty() != isDirty())
return false;
- if (!(decoratableResource.hasConflicts() == hasConflicts()))
+ if (decoratableResource.hasConflicts() != hasConflicts())
return false;
if (!decoratableResource.getStagingState().equals(getStagingState()))
return false;
diff --git a/org.eclipse.egit.ui/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.egit.ui/.settings/org.eclipse.jdt.ui.prefs
index 086d01c0a..0f1ae3acf 100644
--- a/org.eclipse.egit.ui/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.egit.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -35,7 +35,7 @@ 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.push_down_negation=false
+sp_cleanup.push_down_negation=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
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitCombo.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitCombo.java
index 1615b2f96..28b19f405 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitCombo.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitCombo.java
@@ -174,7 +174,7 @@ public class CommitCombo extends Composite {
public ObjectId getItem(int index) {
checkWidget();
- if (!(0 <= index && index < commits.size())) {
+ if (index < 0 || commits.size() <= index) {
SWT.error(SWT.ERROR_INVALID_RANGE);
}
return commits.get(index).objectId;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiff.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiff.java
index 0f96fe36d..c90b2a47d 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiff.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiff.java
@@ -287,7 +287,7 @@ public class FileDiff {
private void outputEclipseDiff(final StringBuilder d, final Repository db,
final ObjectReader reader, final DiffFormatter diffFmt)
throws IOException {
- if (!(getBlobs().length == 2))
+ if (getBlobs().length != 2)
throw new UnsupportedOperationException(
"Not supported yet if the number of parents is different from one"); //$NON-NLS-1$
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GenerateHistoryJob.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GenerateHistoryJob.java
index af70a46a2..ad95a3f29 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GenerateHistoryJob.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GenerateHistoryJob.java
@@ -148,7 +148,7 @@ class GenerateHistoryJob extends Job {
GitTraceLocation.getTrace().traceEntry(
GitTraceLocation.HISTORYVIEW.getLocation());
try {
- if (!(forcedRedrawsAfterListIsCompleted == 1) && !incomplete
+ if (forcedRedrawsAfterListIsCompleted != 1 && !incomplete
&& loadedCommits.size() == lastUpdateCnt)
return;
if (forcedRedrawsAfterListIsCompleted == 1)
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitCreatePatchWizard.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitCreatePatchWizard.java
index 449dea923..c4c74ed40 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitCreatePatchWizard.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitCreatePatchWizard.java
@@ -162,7 +162,7 @@ public class GitCreatePatchWizard extends Wizard {
final File file = locationPage.getFile();
- if (!(file == null || validateFile(file)))
+ if (file != null && !validateFile(file))
return false;
try {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/LocationPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/LocationPage.java
index 2d19675e6..a68bc2d6f 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/LocationPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/LocationPage.java
@@ -580,7 +580,7 @@ public class LocationPage extends WizardPage {
}
final File parent = file.getParentFile();
- if (!(parent.exists() && parent.isDirectory())) {
+ if (!parent.isDirectory()) {
setErrorMessage(UIText.GitCreatePatchWizard_FilesystemDirectoryNotExistsError);
return false;
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java
index ae1ccdb53..a96dda7a5 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java
@@ -1156,8 +1156,8 @@ public class RepositoriesView extends CommonNavigator implements IShowInSource,
showResource(adapted);
return;
}
- if (!(selected instanceof RepositoryNode
- || selected instanceof RepositoryVirtualNode)) {
+ if ((!(selected instanceof RepositoryNode)
+ && !(selected instanceof RepositoryVirtualNode))) {
File file = Adapters.adapt(selected, File.class);
if (file != null) {
IPath path = new Path(file.getAbsolutePath());
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewContentProvider.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewContentProvider.java
index a6435f960..6d25ca5d6 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewContentProvider.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewContentProvider.java
@@ -230,7 +230,7 @@ public class RepositoriesViewContentProvider implements ITreeContentProvider {
try {
for (Entry<String, Ref> refEntry : getRefs(repo, RefDatabase.ALL).entrySet()) {
String name=refEntry.getKey();
- if (!(name.startsWith(Constants.R_HEADS) || name.startsWith(Constants.R_TAGS)|| name.startsWith(Constants.R_REMOTES)))
+ if (!name.startsWith(Constants.R_HEADS) && !name.startsWith(Constants.R_TAGS) && !name.startsWith(Constants.R_REMOTES))
refs.add(new AdditionalRefNode(node, repo, refEntry
.getValue()));
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/FixedJFaceToolTip.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/FixedJFaceToolTip.java
index 04c1b1f74..62244208a 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/FixedJFaceToolTip.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/FixedJFaceToolTip.java
@@ -390,7 +390,7 @@ public abstract class FixedJFaceToolTip {
bounds = control.getDisplay().getBounds();
}
- if (!(bounds.contains(location) && bounds.contains(rightBounds))) {
+ if (!bounds.contains(location) || !bounds.contains(rightBounds)) {
if (rightBounds.x > bounds.x + bounds.width) {
location.x -= rightBounds.x - (bounds.x + bounds.width);
}

Back to the top