mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -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<Boolean> 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;
|
||||
}
|
||||
}
|
||||
|
||||
+13
-7
@@ -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<SmartTypePointer> 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<PsiType, SmartTypePointer>() {
|
||||
@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<LookupElement> set = new LinkedHashSet<LookupElement>();
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<HttpConfigurab
|
||||
@NotNull
|
||||
public CredentialsProvider setProxyCredentials(@NotNull CredentialsProvider provider, boolean useProxy) {
|
||||
if (useProxy && PROXY_AUTHENTICATION) {
|
||||
String ntlmUserPassword = PROXY_LOGIN.replace('\\', '/') + ":" + getPlainProxyPassword();
|
||||
provider.setCredentials(new AuthScope(PROXY_HOST, PROXY_PORT, AuthScope.ANY_REALM, AuthSchemes.NTLM), new NTCredentials(ntlmUserPassword));
|
||||
provider.setCredentials(new AuthScope(PROXY_HOST, PROXY_PORT), new UsernamePasswordCredentials(PROXY_LOGIN, getPlainProxyPassword()));
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.ide.passwordSafe.impl.providers.masterKey;
|
||||
|
||||
import com.intellij.ide.TypePresentationService;
|
||||
import com.intellij.ide.passwordSafe.HelpID;
|
||||
import com.intellij.openapi.ui.ValidationInfo;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -28,7 +27,7 @@ public class EnterPasswordComponent extends PasswordComponentBase {
|
||||
|
||||
public EnterPasswordComponent(@NotNull MasterKeyPasswordSafe safe, @NotNull Class<?> requestor) {
|
||||
super(safe, "Enter");
|
||||
String requestorName = TypePresentationService.getDefaultTypeName(requestor); // requestor.getSimpleName();
|
||||
String requestorName = getRequestorTitle(requestor);
|
||||
myPromptLabel.setText("<html><br>Master password is required to unlock the password database.<br>" +
|
||||
"The password database will be unlocked during this session<br>" +
|
||||
"for all subsystems.<br>" +
|
||||
|
||||
-57
@@ -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<String> 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);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<String> 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<GitRemote, String>() {
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -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;
|
||||
|
||||
@@ -139,7 +139,7 @@ public class GithubRepositoryEditor extends BaseRepositoryEditor<GithubRepositor
|
||||
);
|
||||
}
|
||||
catch (IOException e) {
|
||||
GithubNotifications.showErrorDialog(myProject, "Can't get access token", e);
|
||||
GithubNotifications.showErrorDialog(myProject, "Can't Get Access Token", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.plugins.github.ui.GithubSettingsPanel">
|
||||
<grid id="27dc6" binding="myPane" layout-manager="GridLayoutManager" row-count="6" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="27dc6" binding="myPane" layout-manager="GridLayoutManager" row-count="7" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="646" height="400"/>
|
||||
@@ -28,7 +28,7 @@
|
||||
</component>
|
||||
<vspacer id="6ace">
|
||||
<constraints>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="45bab" class="com.intellij.ui.components.JBLabel">
|
||||
@@ -167,7 +167,7 @@
|
||||
<grid id="d384a" layout-manager="GridLayoutManager" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="5" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<grid row="5" column="0" row-span="1" col-span="5" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<clientProperties>
|
||||
@@ -204,7 +204,15 @@
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<vspacer id="2a9d8">
|
||||
<component id="e2613" class="com.intellij.ui.components.JBCheckBox" binding="myCloneUsingSshCheckBox" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="5" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Clone git repositories using ssh"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="5f470">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="5" vsize-policy="0" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="-1" height="15"/>
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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<String> myAvailableNames;
|
||||
private final Set<String> myAvailableRemotes;
|
||||
|
||||
public GithubShareDialog(final Project project, final Set<String> availableNames, final boolean privateRepoAllowed) {
|
||||
public GithubShareDialog(Project project, Set<String> availableNames, Set<String> 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);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.plugins.github.ui.GithubSharePanel">
|
||||
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="4" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="376" height="98"/>
|
||||
<xy x="20" y="20" width="383" height="98"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -26,7 +26,7 @@
|
||||
</component>
|
||||
<scrollpane id="83208" class="com.intellij.ui.components.JBScrollPane">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="2" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<grid row="2" column="1" row-span="1" col-span="2" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="250" height="100"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@@ -41,7 +41,7 @@
|
||||
</scrollpane>
|
||||
<component id="d1ca7" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Description"/>
|
||||
@@ -57,9 +57,25 @@
|
||||
</component>
|
||||
<vspacer id="18a1f">
|
||||
<constraints>
|
||||
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="3" column="2" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="539e4" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Remote name:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="7cb3e" class="javax.swing.JTextField" binding="myRemoteTextField">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ public class GithubSettings implements PersistentStateComponent<GithubSettings.S
|
||||
public int CONNECTION_TIMEOUT = 5000;
|
||||
public boolean VALID_GIT_AUTH = true;
|
||||
public ThreeState CREATE_PULL_REQUEST_CREATE_REMOTE = ThreeState.UNSURE;
|
||||
public boolean CLONE_GIT_USING_SSH = false;
|
||||
}
|
||||
|
||||
public static GithubSettings getInstance() {
|
||||
@@ -132,6 +133,10 @@ public class GithubSettings implements PersistentStateComponent<GithubSettings.S
|
||||
return passwordSafe.getSettings().getProviderType() == PasswordSafeSettings.ProviderType.MASTER_PASSWORD;
|
||||
}
|
||||
|
||||
public boolean isCloneGitUsingSsh() {
|
||||
return myState.CLONE_GIT_USING_SSH;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ThreeState getCreatePullRequestCreateRemote() {
|
||||
return myState.CREATE_PULL_REQUEST_CREATE_REMOTE;
|
||||
@@ -161,6 +166,10 @@ public class GithubSettings implements PersistentStateComponent<GithubSettings.S
|
||||
myState.OPEN_IN_BROWSER_GIST = openInBrowserGist;
|
||||
}
|
||||
|
||||
public void setCloneGitUsingSsh(boolean value) {
|
||||
myState.CLONE_GIT_USING_SSH = value;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getPassword() {
|
||||
String password;
|
||||
|
||||
@@ -209,6 +209,11 @@ public class GithubUrlUtil {
|
||||
|
||||
@NotNull
|
||||
public static String getCloneUrl(@NotNull String user, @NotNull String repo) {
|
||||
return getGithubHost() + "/" + user + "/" + repo + ".git";
|
||||
if (GithubSettings.getInstance().isCloneGitUsingSsh()) {
|
||||
return "git@" + getGitHostWithoutProtocol() + ":" + user + "/" + repo + ".git";
|
||||
}
|
||||
else {
|
||||
return "https://" + getGitHostWithoutProtocol() + "/" + user + "/" + repo + ".git";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -17,13 +17,13 @@ package org.jetbrains.plugins.gradle.execution.test.runner;
|
||||
|
||||
import com.intellij.execution.Location;
|
||||
import com.intellij.execution.PsiLocation;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.testIntegration.TestLocationProvider;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -43,6 +43,7 @@ public class GradleUrlProvider implements TestLocationProvider {
|
||||
@NotNull
|
||||
public List<Location> 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();
|
||||
|
||||
+8
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user