diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java index 20f0cb122cad..24224f93c530 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java @@ -26,10 +26,7 @@ import com.intellij.debugger.engine.events.SuspendContextCommandImpl; import com.intellij.debugger.engine.jdi.ThreadReferenceProxy; import com.intellij.debugger.engine.requests.MethodReturnValueWatcher; import com.intellij.debugger.engine.requests.RequestManagerImpl; -import com.intellij.debugger.impl.DebuggerContextImpl; -import com.intellij.debugger.impl.DebuggerSession; -import com.intellij.debugger.impl.DebuggerUtilsEx; -import com.intellij.debugger.impl.PrioritizedTask; +import com.intellij.debugger.impl.*; import com.intellij.debugger.jdi.StackFrameProxyImpl; import com.intellij.debugger.jdi.ThreadReferenceProxyImpl; import com.intellij.debugger.jdi.VirtualMachineProxyImpl; @@ -89,6 +86,7 @@ import javax.swing.*; import java.io.IOException; import java.net.UnknownHostException; import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; public abstract class DebugProcessImpl extends UserDataHolderBase implements DebugProcess { @@ -1852,7 +1850,7 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb final Semaphore semaphore = new Semaphore(); semaphore.down(); - final Ref connectorIsReady = Ref.create(false); + final AtomicBoolean connectorIsReady = new AtomicBoolean(false); myDebugProcessDispatcher.addListener(new DebugProcessAdapter() { @Override public void connectorIsReady() { @@ -1890,17 +1888,17 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb } else { fail(); - if (myExecutionResult != null || !connectorIsReady.get()) { - // propagate exception only in case we succeeded to obtain execution result, - // otherwise if the error is induced by the fact that there is nothing to debug, and there is no need to show - // this problem to the user - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { + DebuggerInvocationUtil.swingInvokeLater(myProject, new Runnable() { + @Override + public void run() { + // propagate exception only in case we succeeded to obtain execution result, + // otherwise if the error is induced by the fact that there is nothing to debug, and there is no need to show + // this problem to the user + if (myExecutionResult != null || !connectorIsReady.get()) { ExecutionUtil.handleExecutionError(myProject, ToolWindowId.DEBUG, sessionName, e); } - }); - } + } + }); break; } } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreatePropertyFromUsageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreatePropertyFromUsageFix.java index ac2e35b9b776..72b608bfce94 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreatePropertyFromUsageFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreatePropertyFromUsageFix.java @@ -37,7 +37,9 @@ import com.intellij.psi.codeStyle.VariableKind; import com.intellij.psi.util.PropertyUtil; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiUtil; +import com.intellij.util.Function; import com.intellij.util.IncorrectOperationException; +import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -120,12 +122,17 @@ public class CreatePropertyFromUsageFix extends CreateFromUsageBaseFix implement private final String myDefaultFieldName; private final PsiField myField; private final PsiClass myClass; - private final PsiType[] myExpectedTypes; + private final List myExpectedTypes; - public FieldExpression(PsiField field, PsiClass aClass, PsiType[] expectedTypes) { + public FieldExpression(final PsiField field, PsiClass aClass, PsiType[] expectedTypes) { myField = field; myClass = aClass; - myExpectedTypes = expectedTypes; + myExpectedTypes = ContainerUtil.map(expectedTypes, new Function() { + @Override + public SmartTypePointer fun(PsiType type) { + return SmartTypePointerManager.getInstance(field.getProject()).createSmartTypePointer(type); + } + }); myDefaultFieldName = field.getName(); } @@ -143,12 +150,11 @@ public class CreatePropertyFromUsageFix extends CreateFromUsageBaseFix implement public LookupElement[] calculateLookupItems(ExpressionContext context) { Set set = new LinkedHashSet(); set.add(JavaLookupElementBuilder.forField(myField).withTypeText(myField.getType().getPresentableText())); - PsiField[] fields = myClass.getFields(); - for (PsiField otherField : fields) { + for (PsiField otherField : myClass.getFields()) { if (!myDefaultFieldName.equals(otherField.getName())) { PsiType otherType = otherField.getType(); - for (PsiType type : myExpectedTypes) { - if (type.equals(otherType)) { + for (SmartTypePointer pointer : myExpectedTypes) { + if (otherType.equals(pointer.getType())) { set.add(JavaLookupElementBuilder.forField(otherField).withTypeText(otherType.getPresentableText())); } } diff --git a/platform/platform-api/src/com/intellij/util/net/HttpConfigurable.java b/platform/platform-api/src/com/intellij/util/net/HttpConfigurable.java index ae8f942dc15c..f0c915913b84 100644 --- a/platform/platform-api/src/com/intellij/util/net/HttpConfigurable.java +++ b/platform/platform-api/src/com/intellij/util/net/HttpConfigurable.java @@ -44,8 +44,10 @@ import gnu.trove.THashSet; import gnu.trove.TObjectObjectProcedure; import org.apache.http.HttpHost; import org.apache.http.auth.AuthScope; +import org.apache.http.auth.NTCredentials; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.CredentialsProvider; +import org.apache.http.client.config.AuthSchemes; import org.apache.http.client.config.RequestConfig; import org.jdom.Element; import org.jetbrains.annotations.NotNull; @@ -439,6 +441,8 @@ public class HttpConfigurable implements PersistentStateComponent requestor) { super(safe, "Enter"); - String requestorName = TypePresentationService.getDefaultTypeName(requestor); // requestor.getSimpleName(); + String requestorName = getRequestorTitle(requestor); myPromptLabel.setText("
Master password is required to unlock the password database.
" + "The password database will be unlocked during this session
" + "for all subsystems.
" + diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterKeyUtils.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterKeyUtils.java deleted file mode 100644 index bd3203a4bc8f..000000000000 --- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterKeyUtils.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2000-2010 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.ide.passwordSafe.impl.providers.masterKey; - -import com.intellij.ui.DocumentAdapter; -import com.intellij.util.Processor; - -import javax.swing.*; -import javax.swing.event.DocumentEvent; -import java.util.Arrays; - -/** - * Utilities for master key provider - */ -class MasterKeyUtils { - /** - * The private constructor for utility class - */ - private MasterKeyUtils() { - } - - /** - * Match passwords - * - * @param passwordField1 the first password field - * @param passwordField2 the second password field - * @param setError the callback used to set or to clear an error - */ - static void matchPasswords(final JPasswordField passwordField1, final JPasswordField passwordField2, final Processor setError) { - DocumentAdapter l = new DocumentAdapter() { - @Override - protected void textChanged(DocumentEvent e) { - if (Arrays.equals(passwordField1.getPassword(), passwordField2.getPassword())) { - setError.process(null); - } - else { - setError.process("The new password and confirm passwords do not match."); - } - } - }; - passwordField1.getDocument().addDocumentListener(l); - passwordField2.getDocument().addDocumentListener(l); - } -} diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterPasswordDialog.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterPasswordDialog.java index f81d328c7049..f9d16b0bc63c 100644 --- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterPasswordDialog.java +++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterPasswordDialog.java @@ -63,7 +63,7 @@ public class MasterPasswordDialog extends DialogWrapper { } if (!enterMasterPasswordDialog(project, safe, requestor).showAndGet()) { - throw new MasterPasswordUnavailableException("Cancelled by user"); + throw new MasterPasswordUnavailableException(PasswordComponentBase.getRequestorTitle(requestor) + ": Cancelled by user"); } } diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/PasswordComponentBase.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/PasswordComponentBase.java index 2307fa9464f1..453fd0f133ac 100644 --- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/PasswordComponentBase.java +++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/PasswordComponentBase.java @@ -16,6 +16,7 @@ package com.intellij.ide.passwordSafe.impl.providers.masterKey; import com.intellij.icons.AllIcons; +import com.intellij.ide.TypePresentationService; import com.intellij.openapi.ui.ValidationInfo; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; @@ -100,4 +101,9 @@ public abstract class PasswordComponentBase { } return null; } + + @NotNull + public static String getRequestorTitle(@NotNull Class requestor) { + return TypePresentationService.getDefaultTypeName(requestor); + } } diff --git a/plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java b/plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java index c5931f98df10..cf6b81c36cd6 100644 --- a/plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java +++ b/plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java @@ -15,6 +15,7 @@ */ package git4idea.commands; +import com.intellij.ide.passwordSafe.MasterPasswordUnavailableException; import com.intellij.ide.passwordSafe.PasswordSafe; import com.intellij.ide.passwordSafe.PasswordSafeException; import com.intellij.ide.passwordSafe.impl.PasswordSafeImpl; @@ -169,6 +170,8 @@ class GitHttpGuiAuthenticator implements GitHttpAuthenticator { passwordSafe.getMasterKeyProvider().storePassword(myProject, PASS_REQUESTER, myPasswordKey, myPassword); } } + catch (MasterPasswordUnavailableException ignored) { + } catch (PasswordSafeException e) { LOG.error("Couldn't remember password for " + myPasswordKey, e); } diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubCreatePullRequestWorker.java b/plugins/github/src/org/jetbrains/plugins/github/GithubCreatePullRequestWorker.java index 8a818cac09b7..b65e7f204ef1 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/GithubCreatePullRequestWorker.java +++ b/plugins/github/src/org/jetbrains/plugins/github/GithubCreatePullRequestWorker.java @@ -503,13 +503,15 @@ public class GithubCreatePullRequestWorker { String targetBranchName = "'" + fork.getRemoteName() + "/" + branch.getRemoteName() + "'"; if (info.getInfo().getBranchToHeadCommits(myGitRepository).isEmpty()) { return GithubNotifications - .showYesNoDialog(myProject, "Do you want to proceed anyway?", - "Empty pull request: the branch " + localBranchName + " is fully merged to the branch " + targetBranchName); + .showYesNoDialog(myProject, "Empty Pull Request", + "The branch " + localBranchName + " is fully merged to the branch " + targetBranchName + '\n' + + "Do you want to proceed anyway?"); } if (!info.getInfo().getHeadToBranchCommits(myGitRepository).isEmpty()) { return GithubNotifications - .showYesNoDialog(myProject, "Do you want to proceed anyway?", - "The branch " + targetBranchName + " is not fully merged to the branch " + localBranchName); + .showYesNoDialog(myProject, "Target Branch Is Not Fully Merged", + "The branch " + targetBranchName + " is not fully merged to the branch " + localBranchName + '\n' + + "Do you want to proceed anyway?"); } return true; diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java b/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java index 537a580775c8..dd19041da102 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java +++ b/plugins/github/src/org/jetbrains/plugins/github/GithubShareAction.java @@ -15,6 +15,7 @@ */ package org.jetbrains.plugins.github; +import com.intellij.ide.BrowserUtil; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.ServiceManager; @@ -23,6 +24,7 @@ import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.Task; import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.project.Project; +import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.Splitter; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Ref; @@ -33,6 +35,7 @@ import com.intellij.openapi.vcs.changes.ChangeListManager; import com.intellij.openapi.vcs.changes.ui.SelectFilesDialog; import com.intellij.openapi.vcs.ui.CommitMessage; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.Function; import com.intellij.util.ThrowableConvertor; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.HashSet; @@ -44,6 +47,7 @@ import git4idea.actions.BasicAction; import git4idea.actions.GitInit; import git4idea.commands.*; import git4idea.i18n.GitBundle; +import git4idea.repo.GitRemote; import git4idea.repo.GitRepository; import git4idea.repo.GitRepositoryManager; import git4idea.util.GitFileUtils; @@ -62,9 +66,7 @@ import org.jetbrains.plugins.github.util.GithubUtil; import javax.swing.*; import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; +import java.util.*; import static org.jetbrains.plugins.github.util.GithubUtil.setVisibleEnabled; @@ -119,13 +121,19 @@ public class GithubShareAction extends DumbAwareAction { final GithubAuthDataHolder authHolder = GithubAuthDataHolder.createFromSettings(); // check for existing git repo - boolean externalRemoteDetected = false; + Set existingRemotes = Collections.emptySet(); if (gitDetected) { final String githubRemote = GithubUtil.findGithubRemoteUrl(gitRepository); if (githubRemote != null) { if (!checkExistingRemote(project, authHolder, githubRemote)) return; } - externalRemoteDetected = !gitRepository.getRemotes().isEmpty(); + + existingRemotes = ContainerUtil.map2Set(gitRepository.getRemotes(), new Function() { + @Override + public String fun(GitRemote remote) { + return remote.getName(); + } + }); } // get available GitHub repos with modal progress @@ -136,7 +144,7 @@ public class GithubShareAction extends DumbAwareAction { // Show dialog (window) final GithubShareDialog shareDialog = - new GithubShareDialog(project, githubInfo.getRepositoryNames(), githubInfo.getUser().canCreatePrivateRepo()); + new GithubShareDialog(project, githubInfo.getRepositoryNames(), existingRemotes, githubInfo.getUser().canCreatePrivateRepo()); DialogManager.show(shareDialog); if (!shareDialog.isOK()) { return; @@ -144,9 +152,8 @@ public class GithubShareAction extends DumbAwareAction { final boolean isPrivate = shareDialog.isPrivate(); final String name = shareDialog.getRepositoryName(); final String description = shareDialog.getDescription(); + final String remoteName = shareDialog.getRemoteName(); - // finish the job in background - final boolean finalExternalRemoteDetected = externalRemoteDetected; new Task.Backgroundable(project, "Sharing project on GitHub...") { @Override public void run(@NotNull ProgressIndicator indicator) { @@ -178,7 +185,6 @@ public class GithubShareAction extends DumbAwareAction { } final String remoteUrl = GithubUrlUtil.getCloneUrl(githubInfo.getUser().getLogin(), name); - final String remoteName = finalExternalRemoteDetected ? "github" : "origin"; //git remote add origin git@github.com:login/name.git LOG.info("Adding GitHub as a remote host"); @@ -210,7 +216,7 @@ public class GithubShareAction extends DumbAwareAction { final GithubFullPath path = GithubUrlUtil.getUserAndRepositoryFromRemoteUrl(remote); if (path == null) { return GithubNotifications.showYesNoDialog(project, - "Project is already on GitHub", + "Project Is Already on GitHub", "Can't connect to repository from configured remote. You could want to check .git config.\n" + "Do you want to proceed anyway?"); } @@ -231,22 +237,30 @@ public class GithubShareAction extends DumbAwareAction { }); } }); - GithubNotifications.showInfoURL(project, "Project is already on GitHub", "GitHub", repo.getHtmlUrl()); + int result = Messages.showDialog(project, + "Successfully connected to " + repo.getHtmlUrl() + ".\n" + + "Do you want to proceed anyway?", + "Project Is Already on GitHub", + new String[]{"Continue", "Open in Browser", Messages.CANCEL_BUTTON}, 2, Messages.getQuestionIcon()); + if (result == 0) return true; + if (result == 1) { + BrowserUtil.browse(repo.getHtmlUrl()); + } return false; } catch (GithubStatusCodeException e) { if (e.getStatusCode() == HttpStatus.SC_NOT_FOUND) { return GithubNotifications.showYesNoDialog(project, - "Project is already on GitHub", + "Project Is Already on GitHub", "Can't connect to repository from configured remote. You could want to check .git config.\n" + "Do you want to proceed anyway?"); } - GithubNotifications.showErrorDialog(project, "Failed to connect to GitHub", e); + GithubNotifications.showErrorDialog(project, "Failed to Connect to GitHub", e); return false; } catch (IOException e) { - GithubNotifications.showErrorDialog(project, "Failed to connect to GitHub", e); + GithubNotifications.showErrorDialog(project, "Failed to Connect to GitHub", e); return false; } } @@ -278,7 +292,7 @@ public class GithubShareAction extends DumbAwareAction { }); } catch (IOException e) { - GithubNotifications.showErrorDialog(project, "Failed to connect to GitHub", e); + GithubNotifications.showErrorDialog(project, "Failed to Connect to GitHub", e); return null; } } diff --git a/plugins/github/src/org/jetbrains/plugins/github/extensions/GithubCheckoutProvider.java b/plugins/github/src/org/jetbrains/plugins/github/extensions/GithubCheckoutProvider.java index 1364e4ad7c66..260a7b36e88b 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/extensions/GithubCheckoutProvider.java +++ b/plugins/github/src/org/jetbrains/plugins/github/extensions/GithubCheckoutProvider.java @@ -33,6 +33,7 @@ import org.jetbrains.plugins.github.api.GithubConnection; import org.jetbrains.plugins.github.api.GithubRepo; import org.jetbrains.plugins.github.util.GithubAuthDataHolder; import org.jetbrains.plugins.github.util.GithubNotifications; +import org.jetbrains.plugins.github.util.GithubUrlUtil; import org.jetbrains.plugins.github.util.GithubUtil; import java.io.File; @@ -88,7 +89,7 @@ public class GithubCheckoutProvider implements CheckoutProvider { // Add predefined repositories to history dialog.prependToHistory("-----------------------------------------------"); for (int i = availableRepos.size() - 1; i >= 0; i--) { - dialog.prependToHistory(availableRepos.get(i).getCloneUrl()); + dialog.prependToHistory(GithubUrlUtil.getCloneUrl(availableRepos.get(i).getFullPath())); } if (!dialog.showAndGet()) { return; diff --git a/plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepositoryEditor.java b/plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepositoryEditor.java index e3e8daabb56a..d826763e1667 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepositoryEditor.java +++ b/plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepositoryEditor.java @@ -139,7 +139,7 @@ public class GithubRepositoryEditor extends BaseRepositoryEditor
- + @@ -28,7 +28,7 @@ - + @@ -167,7 +167,7 @@ - + @@ -204,7 +204,15 @@ - + + + + + + + + + diff --git a/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSettingsPanel.java b/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSettingsPanel.java index f9d32e171af4..7b9d1368c487 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSettingsPanel.java +++ b/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSettingsPanel.java @@ -25,6 +25,7 @@ import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.text.StringUtil; import com.intellij.ui.DocumentAdapter; import com.intellij.ui.HyperlinkAdapter; +import com.intellij.ui.components.JBCheckBox; import com.intellij.ui.components.JBLabel; import com.intellij.util.ThrowableConvertor; import org.jetbrains.annotations.NotNull; @@ -33,7 +34,6 @@ import org.jetbrains.plugins.github.api.GithubApiUtil; import org.jetbrains.plugins.github.api.GithubConnection; import org.jetbrains.plugins.github.api.GithubUser; import org.jetbrains.plugins.github.exceptions.GithubAuthenticationException; -import org.jetbrains.plugins.github.exceptions.GithubOperationCanceledException; import org.jetbrains.plugins.github.util.*; import javax.swing.*; @@ -71,6 +71,7 @@ public class GithubSettingsPanel { private JBLabel myAuthTypeLabel; private JSpinner myTimeoutSpinner; private JButton myCreateTokenButton; + private JBCheckBox myCloneUsingSshCheckBox; private boolean myCredentialsModified; @@ -145,7 +146,7 @@ public class GithubSettingsPanel { ); } catch (IOException ex) { - GithubNotifications.showErrorDialog(myPane, "Can't create API token", ex); + GithubNotifications.showErrorDialog(myPane, "Can't Create API Token", ex); } } }); @@ -286,6 +287,7 @@ public class GithubSettingsPanel { setPassword(mySettings.isAuthConfigured() ? DEFAULT_PASSWORD_TEXT : ""); setAuthType(mySettings.getAuthType()); setConnectionTimeout(mySettings.getConnectionTimeout()); + myCloneUsingSshCheckBox.setSelected(mySettings.isCloneGitUsingSsh()); resetCredentialsModification(); } @@ -294,12 +296,15 @@ public class GithubSettingsPanel { mySettings.setAuthData(getAuthData(), true); } mySettings.setConnectionTimeout(getConnectionTimeout()); + mySettings.setCloneGitUsingSsh(myCloneUsingSshCheckBox.isSelected()); resetCredentialsModification(); } public boolean isModified() { - return myCredentialsModified || !Comparing.equal(mySettings.getHost(), getHost()) || - !Comparing.equal(mySettings.getConnectionTimeout(), getConnectionTimeout()); + return myCredentialsModified || + !Comparing.equal(mySettings.getHost(), getHost()) || + !Comparing.equal(mySettings.getConnectionTimeout(), getConnectionTimeout()) || + !Comparing.equal(mySettings.isCloneGitUsingSsh(), myCloneUsingSshCheckBox.isSelected()); } public void resetCredentialsModification() { diff --git a/plugins/github/src/org/jetbrains/plugins/github/ui/GithubShareDialog.java b/plugins/github/src/org/jetbrains/plugins/github/ui/GithubShareDialog.java index 3b464b2828ac..a6a537faf74f 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/ui/GithubShareDialog.java +++ b/plugins/github/src/org/jetbrains/plugins/github/ui/GithubShareDialog.java @@ -18,15 +18,18 @@ public class GithubShareDialog extends DialogWrapper { private static final Pattern GITHUB_REPO_PATTERN = Pattern.compile("[a-zA-Z0-9_.-]+"); private final GithubSharePanel myGithubSharePanel; private final Set myAvailableNames; + private final Set myAvailableRemotes; - public GithubShareDialog(final Project project, final Set availableNames, final boolean privateRepoAllowed) { + public GithubShareDialog(Project project, Set availableNames, Set availableRemotes, boolean privateRepoAllowed) { super(project); myAvailableNames = availableNames; + myAvailableRemotes = availableRemotes; myGithubSharePanel = new GithubSharePanel(this); init(); setTitle("Share Project On GitHub"); setOKButtonText("Share"); myGithubSharePanel.setRepositoryName(project.getName()); + myGithubSharePanel.setRemoteName(availableRemotes.isEmpty() ? "origin" : "github"); myGithubSharePanel.setPrivateRepoAvailable(privateRepoAllowed); init(); updateOkButton(); @@ -53,7 +56,8 @@ public class GithubShareDialog extends DialogWrapper { } public void updateOkButton() { - final String repositoryName = getRepositoryName(); + String repositoryName = getRepositoryName(); + String remoteName = getRemoteName(); if (StringUtil.isEmpty(repositoryName)){ setErrorText("No repository name selected"); setOKActionEnabled(false); @@ -64,6 +68,11 @@ public class GithubShareDialog extends DialogWrapper { setOKActionEnabled(false); return; } + if (myAvailableRemotes.contains(remoteName)) { + setErrorText("Remote with selected name already exists"); + setOKActionEnabled(false); + return; + } if (!GITHUB_REPO_PATTERN.matcher(repositoryName).matches()){ setErrorText("Invalid repository name. Name should consist of letters, numbers, dashes, dots and underscores"); setOKActionEnabled(false); @@ -85,6 +94,10 @@ public class GithubShareDialog extends DialogWrapper { return myGithubSharePanel.getDescription(); } + public String getRemoteName() { + return myGithubSharePanel.getRemoteName(); + } + @TestOnly public void testSetRepositoryName(@NotNull String name) { myGithubSharePanel.setRepositoryName(name); diff --git a/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSharePanel.form b/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSharePanel.form index 31fa28e4c1c9..f8493892389d 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSharePanel.form +++ b/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSharePanel.form @@ -1,9 +1,9 @@ - + - + @@ -26,7 +26,7 @@ - + @@ -41,7 +41,7 @@ - + @@ -57,9 +57,25 @@ - + + + + + + + + + + + + + + + + + diff --git a/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSharePanel.java b/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSharePanel.java index 647a811320b8..18eb66b1292a 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSharePanel.java +++ b/plugins/github/src/org/jetbrains/plugins/github/ui/GithubSharePanel.java @@ -14,17 +14,21 @@ public class GithubSharePanel { private JTextField myRepositoryTextField; private JCheckBox myPrivateCheckBox; private JTextArea myDescriptionTextArea; + private JTextField myRemoteTextField; private final GithubShareDialog myGithubShareDialog; public GithubSharePanel(final GithubShareDialog githubShareDialog) { myGithubShareDialog = githubShareDialog; - myRepositoryTextField.getDocument().addDocumentListener(new DocumentAdapter() { + myPrivateCheckBox.setSelected(false); + + DocumentAdapter changeListener = new DocumentAdapter() { @Override protected void textChanged(DocumentEvent e) { myGithubShareDialog.updateOkButton(); } - }); - myPrivateCheckBox.setSelected(false); + }; + myRepositoryTextField.getDocument().addDocumentListener(changeListener); + myRemoteTextField.getDocument().addDocumentListener(changeListener); } public JPanel getPanel() { @@ -43,6 +47,14 @@ public class GithubSharePanel { myRepositoryTextField.setText(name); } + public String getRemoteName() { + return myRemoteTextField.getText().trim(); + } + + public void setRemoteName(final String name) { + myRemoteTextField.setText(name); + } + public boolean isPrivate() { return myPrivateCheckBox.isSelected(); } diff --git a/plugins/github/src/org/jetbrains/plugins/github/util/GithubSettings.java b/plugins/github/src/org/jetbrains/plugins/github/util/GithubSettings.java index 7e98d47d8220..e86ffab49e4d 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/util/GithubSettings.java +++ b/plugins/github/src/org/jetbrains/plugins/github/util/GithubSettings.java @@ -62,6 +62,7 @@ public class GithubSettings implements PersistentStateComponent getLocation(@NotNull String protocolId, @NotNull String locationData, Project project) { if (!PROTOCOL_ID.equals(protocolId)) return Collections.emptyList(); + if (DumbService.isDumb(project)) return Collections.emptyList(); final String className = extractFullClassName(locationData); if (className == null) return Collections.emptyList(); diff --git a/plugins/testng/src/com/theoryinpractice/testng/configuration/SearchingForTestsTask.java b/plugins/testng/src/com/theoryinpractice/testng/configuration/SearchingForTestsTask.java index 3e532757c54a..538a4bb005b6 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/configuration/SearchingForTestsTask.java +++ b/plugins/testng/src/com/theoryinpractice/testng/configuration/SearchingForTestsTask.java @@ -123,10 +123,15 @@ public class SearchingForTestsTask extends Task.Backgroundable { @Override public void onSuccess() { - writeTempFile(); - finish(); + DumbService.getInstance(myProject).runWhenSmart(new Runnable() { + @Override + public void run() { + writeTempFile(); + finish(); - if (!Registry.is("testng_sm_runner")) myClient.startListening(myConfig); + if (!Registry.is("testng_sm_runner")) myClient.startListening(myConfig); + } + }); } @Override