Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java')
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java43
1 files changed, 21 insertions, 22 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
index d6496b932f..b9a77f9349 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
@@ -1185,7 +1185,7 @@ public class StagingView extends ViewPart implements IShowInSource {
.getBoolean(UIPreferences.WARN_BEFORE_COMMITTING)
&& getPreferenceStore().getBoolean(UIPreferences.BLOCK_COMMIT);
showControl(ignoreErrors, visible);
- ignoreErrors.getParent().layout(true);
+ mainSashForm.layout();
}
private int getProblemsSeverity() {
@@ -1275,7 +1275,7 @@ public class StagingView extends ViewPart implements IShowInSource {
String[] parts = s.split(","); //$NON-NLS-1$
int[] ints = new int[parts.length];
for (int i = 0; i < parts.length; i++) {
- ints[i] = Integer.valueOf(parts[i]).intValue();
+ ints[i] = Integer.parseInt(parts[i]);
}
return ints;
}
@@ -1553,6 +1553,7 @@ public class StagingView extends ViewPart implements IShowInSource {
if (isDisposed())
return;
enableCommitWidgets(enabled);
+ commitMessageText.setEnabled(enabled);
enableStagingWidgets(enabled);
}
@@ -1564,10 +1565,9 @@ public class StagingView extends ViewPart implements IShowInSource {
}
private void enableCommitWidgets(boolean enabled) {
- if (isDisposed())
+ if (isDisposed()) {
return;
-
- commitMessageText.setEnabled(enabled);
+ }
committerText.setEnabled(enabled);
enableAuthorText(enabled);
amendPreviousCommitAction.setEnabled(enabled);
@@ -2238,15 +2238,14 @@ public class StagingView extends ViewPart implements IShowInSource {
if (files.isEmpty() || repository == null) {
return;
}
- CheckoutCommand checkoutCommand = new Git(repository)
- .checkout();
- if (headRevision) {
- checkoutCommand.setStartPoint(Constants.HEAD);
- }
- for (String path : files) {
- checkoutCommand.addPath(path);
- }
- try {
+ try (Git git = new Git(repository)) {
+ CheckoutCommand checkoutCommand = git.checkout();
+ if (headRevision) {
+ checkoutCommand.setStartPoint(Constants.HEAD);
+ }
+ for (String path : files) {
+ checkoutCommand.addPath(path);
+ }
checkoutCommand.call();
if (!inaccessibleFiles.isEmpty()) {
IndexDiffCacheEntry indexDiffCacheForRepository = org.eclipse.egit.core.Activator
@@ -2505,7 +2504,7 @@ public class StagingView extends ViewPart implements IShowInSource {
private void stage(IStructuredSelection selection) {
StagingViewContentProvider contentProvider = getContentProvider(unstagedViewer);
- final Git git = new Git(currentRepository);
+ final Repository repository = currentRepository;
Iterator iterator = selection.iterator();
final List<String> addPaths = new ArrayList<>();
final List<String> rmPaths = new ArrayList<>();
@@ -2547,7 +2546,7 @@ public class StagingView extends ViewPart implements IShowInSource {
Job addJob = new Job(UIText.StagingView_AddJob) {
@Override
protected IStatus run(IProgressMonitor monitor) {
- try {
+ try (Git git = new Git(repository)) {
AddCommand add = git.add();
for (String addPath : addPaths)
add.addFilepattern(addPath);
@@ -2576,7 +2575,7 @@ public class StagingView extends ViewPart implements IShowInSource {
Job removeJob = new Job(UIText.StagingView_RemoveJob) {
@Override
protected IStatus run(IProgressMonitor monitor) {
- try {
+ try (Git git = new Git(repository)) {
RmCommand rm = git.rm().setCached(true);
for (String rmPath : rmPaths)
rm.addFilepattern(rmPath);
@@ -2632,12 +2631,12 @@ public class StagingView extends ViewPart implements IShowInSource {
if (paths.isEmpty())
return;
- final Git git = new Git(currentRepository);
+ final Repository repository = currentRepository;
Job resetJob = new Job(UIText.StagingView_ResetJob) {
@Override
protected IStatus run(IProgressMonitor monitor) {
- try {
+ try (Git git = new Git(repository)) {
ResetCommand reset = git.reset();
for (String path : paths)
reset.addPath(path);
@@ -2970,18 +2969,18 @@ public class StagingView extends ViewPart implements IShowInSource {
private boolean hasErrorsOrWarnings() {
return getPreferenceStore()
.getBoolean(UIPreferences.WARN_BEFORE_COMMITTING)
- ? (getProblemsSeverity() >= Integer.valueOf(getPreferenceStore()
+ ? (getProblemsSeverity() >= Integer
+ .parseInt(getPreferenceStore()
.getString(UIPreferences.WARN_BEFORE_COMMITTING_LEVEL))
&& !ignoreErrors.getSelection()) : false;
}
- @SuppressWarnings("boxing")
private boolean isCommitBlocked() {
return getPreferenceStore()
.getBoolean(UIPreferences.WARN_BEFORE_COMMITTING)
&& getPreferenceStore().getBoolean(UIPreferences.BLOCK_COMMIT)
? (getProblemsSeverity() >= Integer
- .valueOf(getPreferenceStore().getString(
+ .parseInt(getPreferenceStore().getString(
UIPreferences.BLOCK_COMMIT_LEVEL))
&& !ignoreErrors.getSelection())
: false;

Back to the top