mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
style: ternary operator used instead of several if-statements; comment added; unnecessary pool thread removed
This commit is contained in:
@@ -335,7 +335,8 @@ public class HgBranchPopupActions {
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final UpdatedFiles updatedFiles = UpdatedFiles.create();
|
||||
final HgMergeCommand hgMergeCommand = new HgMergeCommand(myProject, mySelectedRepository.getRoot());
|
||||
hgMergeCommand.setRevision(myBranchName);
|
||||
hgMergeCommand.setRevision(myBranchName);//there is no difference between branch or revision or bookmark as parameter to merge,
|
||||
// we need just a string
|
||||
final HgCommandResultNotifier notifier = new HgCommandResultNotifier(myProject);
|
||||
new Task.Backgroundable(myProject, "Merging changes...") {
|
||||
@Override
|
||||
|
||||
@@ -68,8 +68,7 @@ public class HgMerge extends HgAbstractGlobalAction {
|
||||
hgMergeCommand.setRevision(targetValue);
|
||||
|
||||
try {
|
||||
new HgHeadMerger(project, hgMergeCommand)
|
||||
.merge(repo);
|
||||
new HgHeadMerger(project, hgMergeCommand).merge(repo);
|
||||
new HgConflictResolver(project, updatedFiles).resolve(repo);
|
||||
}
|
||||
catch (VcsException e) {
|
||||
|
||||
@@ -15,6 +15,7 @@ package org.zmlx.hg4idea.action;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.Task;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.zmlx.hg4idea.HgVcsMessages;
|
||||
@@ -28,16 +29,8 @@ public class HgRunConflictResolverAction extends HgAbstractGlobalAction {
|
||||
|
||||
@Override
|
||||
public void execute(@NotNull final Project project, @NotNull Collection<HgRepository> repositories, @Nullable HgRepository selectedRepo) {
|
||||
final HgRepository repository;
|
||||
if (repositories.size() > 1) {
|
||||
repository = letUserSelectRepository(project, repositories, selectedRepo);
|
||||
}
|
||||
else if (repositories.size() == 1) {
|
||||
repository = repositories.iterator().next();
|
||||
}
|
||||
else {
|
||||
repository = null;
|
||||
}
|
||||
final HgRepository repository = repositories.size() > 1 ? letUserSelectRepository(project, repositories, selectedRepo) :
|
||||
ContainerUtil.getFirstItem(repositories);
|
||||
if (repository != null) {
|
||||
new Task.Backgroundable(project, HgVcsMessages.message("action.hg4idea.run.conflict.resolver.description")) {
|
||||
|
||||
@@ -50,17 +43,11 @@ public class HgRunConflictResolverAction extends HgAbstractGlobalAction {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
private static HgRepository letUserSelectRepository(@NotNull Project project, @NotNull Collection<HgRepository> repositories,
|
||||
@Nullable HgRepository selectedRepo) {
|
||||
HgRunConflictResolverDialog dialog = new HgRunConflictResolverDialog(project, repositories, selectedRepo);
|
||||
dialog.show();
|
||||
if (dialog.isOK()) {
|
||||
return dialog.getRepository();
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
return dialog.isOK() ? dialog.getRepository() : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,9 +144,6 @@ public class HgCommonDialogWithChoices extends DialogWrapper {
|
||||
|
||||
protected ValidationInfo doValidate() {
|
||||
String message = "You have to specify appropriate name or revision.";
|
||||
if (StringUtil.isEmptyOrSpaces(getTargetValue())) {
|
||||
return new ValidationInfo(message, myBranchesBorderPanel);
|
||||
}
|
||||
return null;
|
||||
return StringUtil.isEmptyOrSpaces(getTargetValue()) ? new ValidationInfo(message, myBranchesBorderPanel) : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
package org.zmlx.hg4idea.ui;
|
||||
|
||||
import com.intellij.dvcs.DvcsRememberedInputs;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
@@ -151,24 +149,14 @@ public class HgPushDialog extends DialogWrapper {
|
||||
}
|
||||
|
||||
public void updateRepository() {
|
||||
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final HgRepository repo = hgRepositorySelectorComponent.getRepository();
|
||||
final String defaultPath = HgUtil.getRepositoryDefaultPushPath(repo);
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
addPathsFromHgrc(repo.getRoot());
|
||||
if (defaultPath != null) {
|
||||
updateRepositoryUrlText(HgUtil.removePasswordIfNeeded(defaultPath));
|
||||
myCurrentRepositoryUrl = defaultPath;
|
||||
}
|
||||
updateComboBoxes(repo);
|
||||
}
|
||||
}, ModalityState.stateForComponent(getRootPane()));
|
||||
}
|
||||
});
|
||||
HgRepository repo = hgRepositorySelectorComponent.getRepository();
|
||||
String defaultPath = HgUtil.getRepositoryDefaultPushPath(repo);
|
||||
addPathsFromHgrc(repo.getRoot());
|
||||
if (defaultPath != null) {
|
||||
updateRepositoryUrlText(HgUtil.removePasswordIfNeeded(defaultPath));
|
||||
myCurrentRepositoryUrl = defaultPath;
|
||||
}
|
||||
updateComboBoxes(repo);
|
||||
}
|
||||
|
||||
private void updateComboBoxes(HgRepository repo) {
|
||||
|
||||
Reference in New Issue
Block a user