Search in sources :

Example 1 with HgProjectSettings

use of org.zmlx.hg4idea.HgProjectSettings in project intellij-community by JetBrains.

the class HgBranchPopup method getInstance.

/**
   * @param currentRepository Current repository, which means the repository of the currently open or selected file.
   */
public static HgBranchPopup getInstance(@NotNull Project project, @NotNull HgRepository currentRepository) {
    HgRepositoryManager manager = HgUtil.getRepositoryManager(project);
    HgProjectSettings hgProjectSettings = ServiceManager.getService(project, HgProjectSettings.class);
    HgMultiRootBranchConfig hgMultiRootBranchConfig = new HgMultiRootBranchConfig(manager.getRepositories());
    Condition<AnAction> preselectActionCondition = new Condition<AnAction>() {

        @Override
        public boolean value(AnAction action) {
            return false;
        }
    };
    return new HgBranchPopup(currentRepository, manager, hgMultiRootBranchConfig, hgProjectSettings, preselectActionCondition);
}
Also used : Condition(com.intellij.openapi.util.Condition) HgRepositoryManager(org.zmlx.hg4idea.repo.HgRepositoryManager) HgProjectSettings(org.zmlx.hg4idea.HgProjectSettings) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 2 with HgProjectSettings

use of org.zmlx.hg4idea.HgProjectSettings in project intellij-community by JetBrains.

the class HgRemoteChangesetsCommand method executeCommandInCurrentThread.

@Override
protected HgCommandResult executeCommandInCurrentThread(VirtualFile repo, List<String> args) {
    String repositoryURL = getRepositoryUrl(repo);
    if (repositoryURL == null) {
        LOG.info("executeCommand no default path configured");
        return null;
    }
    HgRemoteCommandExecutor executor = new HgRemoteCommandExecutor(project, repositoryURL);
    HgCommandResult result = executor.executeInCurrentThread(repo, command, args);
    if (result == HgCommandResult.CANCELLED || HgErrorUtil.isAuthorizationError(result)) {
        final HgVcs vcs = HgVcs.getInstance(project);
        if (vcs == null) {
            return result;
        }
        new HgCommandResultNotifier(project).notifyError(result, "Checking for incoming/outgoing changes disabled", "Authentication is required to check incoming/outgoing changes in " + repositoryURL + "<br/>You may enable checking for changes <a href='#'>in the Settings</a>.", new NotificationListener() {

            @Override
            public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
                ShowSettingsUtil.getInstance().showSettingsDialog(project, vcs.getConfigurable().getDisplayName());
            }
        });
        final HgProjectSettings projectSettings = vcs.getProjectSettings();
        projectSettings.setCheckIncomingOutgoing(false);
        project.getMessageBus().syncPublisher(HgVcs.INCOMING_OUTGOING_CHECK_TOPIC).hide();
    }
    return result;
}
Also used : HgCommandResult(org.zmlx.hg4idea.execution.HgCommandResult) HgVcs(org.zmlx.hg4idea.HgVcs) HyperlinkEvent(javax.swing.event.HyperlinkEvent) HgProjectSettings(org.zmlx.hg4idea.HgProjectSettings) HgRemoteCommandExecutor(org.zmlx.hg4idea.execution.HgRemoteCommandExecutor) HgCommandResultNotifier(org.zmlx.hg4idea.action.HgCommandResultNotifier) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Aggregations

HgProjectSettings (org.zmlx.hg4idea.HgProjectSettings)2 Notification (com.intellij.notification.Notification)1 NotificationListener (com.intellij.notification.NotificationListener)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1 Condition (com.intellij.openapi.util.Condition)1 HyperlinkEvent (javax.swing.event.HyperlinkEvent)1 HgVcs (org.zmlx.hg4idea.HgVcs)1 HgCommandResultNotifier (org.zmlx.hg4idea.action.HgCommandResultNotifier)1 HgCommandResult (org.zmlx.hg4idea.execution.HgCommandResult)1 HgRemoteCommandExecutor (org.zmlx.hg4idea.execution.HgRemoteCommandExecutor)1 HgRepositoryManager (org.zmlx.hg4idea.repo.HgRepositoryManager)1