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:
+7
-2
@@ -5,7 +5,9 @@
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="529" height="177"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<properties>
|
||||
<opaque value="false"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="6805" class="javax.swing.JLabel">
|
||||
@@ -45,7 +47,9 @@
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<properties>
|
||||
<opaque value="false"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="50d71" binding="myButton" custom-create="true" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
@@ -54,6 +58,7 @@
|
||||
</constraints>
|
||||
<properties>
|
||||
<background color="-16750951"/>
|
||||
<opaque value="false"/>
|
||||
</properties>
|
||||
<border type="empty">
|
||||
<size top="2" left="10" bottom="2" right="8"/>
|
||||
|
||||
+2
-2
@@ -316,9 +316,9 @@ class ToolWindowsWidget extends JLabel implements CustomStatusBarWidget, StatusB
|
||||
GraphicsUtil.setupAAPainting(g);
|
||||
((Graphics2D)g).setPaint(new GradientPaint(0, 0, new JBColor(new Color(77, 143, 253), new Color(52, 74, 100)), 0, getHeight(),
|
||||
new JBColor(new Color(71, 135, 237), new Color(38, 53, 73))));
|
||||
g.fillRoundRect(0,0,getWidth(), getHeight(), 5,5);
|
||||
g.fillRoundRect(0,0,getWidth()-1, getHeight()-1, 5,5);
|
||||
g.setColor(new JBColor(new Color(48, 121, 237), new Color(87, 93, 101)));
|
||||
g.drawRoundRect(0,0,getWidth(), getHeight(), 5,5);
|
||||
g.drawRoundRect(0,0,getWidth()-1, getHeight()-1, 5,5);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
<html>
|
||||
<body>
|
||||
It's almost always a mistake to add a <b>boolean</b> parameter to a public method (part of an API). When reading code using such a method
|
||||
it can be difficult to decipher what the <b>boolean</b> stands for without looking at the source or documentation. This is also known as
|
||||
<a href="http://ariya.ofilabs.com/2011/08/hall-of-api-shame-boolean-trap.html">the boolean trap</a>. The <b>boolean</b> parameter can often
|
||||
be profitably replaced with an <b>enum</b>
|
||||
It's almost always a mistake to add a <b>boolean</b> parameter to a public method (part of an API) if that method is not a setter.
|
||||
When reading code using such a method, it can be difficult to decipher what the <b>boolean</b> stands for without looking at
|
||||
the source or documentation.
|
||||
This problem is also known as <a href="http://ariya.ofilabs.com/2011/08/hall-of-api-shame-boolean-trap.html">the boolean trap</a>.
|
||||
The <b>boolean</b> parameter can often be profitably replaced with an <b>enum</b>
|
||||
<!-- tooltip end -->
|
||||
<p>
|
||||
Use the option below to only warn when a method contains more than one boolean parameter.
|
||||
<p>
|
||||
<small>New in 13</small>
|
||||
</body>
|
||||
</html>
|
||||
@@ -20,6 +20,8 @@
|
||||
<orderEntry type="library" name="gson" level="project" />
|
||||
<orderEntry type="module" module-name="dvcs" />
|
||||
<orderEntry type="module" module-name="testFramework" scope="TEST" />
|
||||
<orderEntry type="module" module-name="xml-openapi" />
|
||||
<orderEntry type="module" module-name="xml" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
<applicationService serviceInterface="org.jetbrains.plugins.github.util.GithubSslSupport"
|
||||
serviceImplementation="org.jetbrains.plugins.github.util.GithubSslSupport"/>
|
||||
<webBrowserUrlProvider implementation="org.jetbrains.plugins.github.extensions.GithubWebBrowserUrlProvider"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="Git4Idea">
|
||||
|
||||
@@ -92,10 +92,20 @@ public class GithubOpenInBrowserAction extends DumbAwareAction {
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
final Project project = e.getData(PlatformDataKeys.PROJECT);
|
||||
final VirtualFile virtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE);
|
||||
final Editor editor = e.getData(PlatformDataKeys.EDITOR);
|
||||
if (virtualFile == null || project == null || project.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String urlToOpen = getGithubUrl(project, virtualFile, editor);
|
||||
if (urlToOpen != null) {
|
||||
BrowserUtil.launchBrowser(urlToOpen);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getGithubUrl(@NotNull Project project, @NotNull VirtualFile virtualFile, @Nullable Editor editor) {
|
||||
|
||||
GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
|
||||
final GitRepository repository = manager.getRepositoryForFile(virtualFile);
|
||||
if (repository == null) {
|
||||
@@ -104,13 +114,13 @@ public class GithubOpenInBrowserAction extends DumbAwareAction {
|
||||
details.append(repo.getPresentableUrl()).append("; ");
|
||||
}
|
||||
GithubNotifications.showError(project, CANNOT_OPEN_IN_BROWSER, "Can't find git repository", details.toString());
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
final String githubRemoteUrl = GithubUtil.findGithubRemoteUrl(repository);
|
||||
if (githubRemoteUrl == null) {
|
||||
GithubNotifications.showError(project, CANNOT_OPEN_IN_BROWSER, "Can't find github remote");
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
final String rootPath = repository.getRoot().getPath();
|
||||
@@ -118,25 +128,28 @@ public class GithubOpenInBrowserAction extends DumbAwareAction {
|
||||
if (!path.startsWith(rootPath)) {
|
||||
GithubNotifications
|
||||
.showError(project, CANNOT_OPEN_IN_BROWSER, "File is not under repository root", "Root: " + rootPath + ", file: " + path);
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
String branch = getBranchNameOnRemote(project, repository);
|
||||
if (branch == null) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
String relativePath = path.substring(rootPath.length());
|
||||
String urlToOpen = makeUrlToOpen(e, relativePath, branch, githubRemoteUrl);
|
||||
String urlToOpen = makeUrlToOpen(editor, relativePath, branch, githubRemoteUrl);
|
||||
if (urlToOpen == null) {
|
||||
GithubNotifications.showError(project, CANNOT_OPEN_IN_BROWSER, "Can't create properly url", githubRemoteUrl);
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
BrowserUtil.launchBrowser(urlToOpen);
|
||||
|
||||
return urlToOpen;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String makeUrlToOpen(@NotNull AnActionEvent e, @NotNull String relativePath, @NotNull String branch,
|
||||
private static String makeUrlToOpen(@Nullable Editor editor,
|
||||
@NotNull String relativePath,
|
||||
@NotNull String branch,
|
||||
@NotNull String githubRemoteUrl) {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
final String githubRepoUrl = GithubUrlUtil.makeGithubRepoUrlFromRemoteUrl(githubRemoteUrl);
|
||||
@@ -145,7 +158,6 @@ public class GithubOpenInBrowserAction extends DumbAwareAction {
|
||||
}
|
||||
builder.append(githubRepoUrl).append("/blob/").append(branch).append(relativePath);
|
||||
|
||||
final Editor editor = e.getData(PlatformDataKeys.EDITOR);
|
||||
if (editor != null && editor.getDocument().getLineCount() >= 1) {
|
||||
// lines are counted internally from 0, but from 1 on github
|
||||
SelectionModel selectionModel = editor.getSelectionModel();
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ import org.jetbrains.plugins.github.util.GithubUtil;
|
||||
abstract class GithubShowCommitInBrowserAction extends DumbAwareAction {
|
||||
|
||||
public GithubShowCommitInBrowserAction() {
|
||||
super("Open in Browser", "Open the selected commit in browser", GithubIcons.Github_icon);
|
||||
super("Open op GitHub", "Open the selected commit in browser", GithubIcons.Github_icon);
|
||||
}
|
||||
|
||||
protected static void openInBrowser(Project project, GitRepository repository, String revisionHash) {
|
||||
|
||||
@@ -135,7 +135,7 @@ public class GithubApiUtil {
|
||||
@Nullable final String requestBody,
|
||||
@NotNull final Collection<Header> headers,
|
||||
@NotNull final HttpVerb verb) throws IOException {
|
||||
HttpClient client = getHttpClient(auth.getBasicAuth());
|
||||
HttpClient client = getHttpClient(auth.getBasicAuth(), auth.isUseProxy());
|
||||
return GithubSslSupport.getInstance()
|
||||
.executeSelfSignedCertificateAwareRequest(client, uri, new ThrowableConvertor<String, HttpMethod, IOException>() {
|
||||
@Override
|
||||
@@ -173,7 +173,7 @@ public class GithubApiUtil {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static HttpClient getHttpClient(@Nullable GithubAuthData.BasicAuth basicAuth) {
|
||||
private static HttpClient getHttpClient(@Nullable GithubAuthData.BasicAuth basicAuth, boolean useProxy) {
|
||||
final HttpClient client = new HttpClient();
|
||||
HttpConnectionManagerParams params = client.getHttpConnectionManager().getParams();
|
||||
params.setConnectionTimeout(CONNECTION_TIMEOUT); //set connection timeout (how long it takes to connect to remote host)
|
||||
@@ -182,7 +182,7 @@ public class GithubApiUtil {
|
||||
client.getParams().setContentCharset("UTF-8");
|
||||
// Configure proxySettings if it is required
|
||||
final HttpConfigurable proxySettings = HttpConfigurable.getInstance();
|
||||
if (proxySettings.USE_HTTP_PROXY && !StringUtil.isEmptyOrSpaces(proxySettings.PROXY_HOST)) {
|
||||
if (useProxy && proxySettings.USE_HTTP_PROXY && !StringUtil.isEmptyOrSpaces(proxySettings.PROXY_HOST)) {
|
||||
client.getHostConfiguration().setProxy(proxySettings.PROXY_HOST, proxySettings.PROXY_PORT);
|
||||
if (proxySettings.PROXY_AUTHENTICATION) {
|
||||
client.getState().setProxyCredentials(AuthScope.ANY, new UsernamePasswordCredentials(proxySettings.PROXY_LOGIN,
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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 org.jetbrains.plugins.github.extensions;
|
||||
|
||||
import com.intellij.ide.browsers.Url;
|
||||
import com.intellij.ide.browsers.UrlImpl;
|
||||
import com.intellij.ide.browsers.WebBrowserUrlProvider;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.github.GithubOpenInBrowserAction;
|
||||
|
||||
/**
|
||||
* @author Aleksey Pivovarov
|
||||
*/
|
||||
public class GithubWebBrowserUrlProvider extends WebBrowserUrlProvider {
|
||||
@Nullable
|
||||
@Override
|
||||
public Url getUrl(@NotNull PsiElement element, @NotNull PsiFile psiFile, @NotNull VirtualFile virtualFile) throws BrowserException {
|
||||
String url = GithubOpenInBrowserAction.getGithubUrl(element.getProject(), virtualFile, null);
|
||||
return new UrlImpl(url, "https", null, null, null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getOpenInBrowserActionText(@NotNull PsiFile file) {
|
||||
return "Open on GitHub";
|
||||
}
|
||||
}
|
||||
@@ -269,7 +269,7 @@ public class GithubRepository extends BaseRepositoryImpl {
|
||||
}
|
||||
|
||||
private GithubAuthData getAuthData() {
|
||||
return GithubAuthData.createTokenAuth(getUrl(), getToken());
|
||||
return GithubAuthData.createTokenAuth(getUrl(), getToken(), isUseProxy());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
package org.jetbrains.plugins.github.tasks;
|
||||
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.Task;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.tasks.config.BaseRepositoryEditor;
|
||||
import com.intellij.ui.DocumentAdapter;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import com.intellij.ui.components.JBTextField;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.ThrowableConvertor;
|
||||
import com.intellij.util.ui.FormBuilder;
|
||||
import com.intellij.util.ui.GridBag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.github.util.GithubAuthData;
|
||||
@@ -31,25 +31,29 @@ import java.io.IOException;
|
||||
* @author Dennis.Ushakov
|
||||
*/
|
||||
public class GithubRepositoryEditor extends BaseRepositoryEditor<GithubRepository> {
|
||||
private JTextField myToken;
|
||||
private JTextField myRepoName;
|
||||
private JTextField myRepoAuthor;
|
||||
private MyTextField myHost;
|
||||
private MyTextField myRepoAuthor;
|
||||
private MyTextField myRepoName;
|
||||
private MyTextField myToken;
|
||||
private JButton myTokenButton;
|
||||
private JBLabel myRepoAuthorLabel;
|
||||
private JBLabel myRepoLabel;
|
||||
private JBLabel myHostLabel;
|
||||
private JBLabel myRepositoryLabel;
|
||||
private JBLabel myTokenLabel;
|
||||
|
||||
public GithubRepositoryEditor(final Project project, final GithubRepository repository, Consumer<GithubRepository> changeListener) {
|
||||
super(project, repository, changeListener);
|
||||
myUserNameText.setVisible(false);
|
||||
myUrlLabel.setVisible(false);
|
||||
myURLText.setVisible(false);
|
||||
myUsernameLabel.setVisible(false);
|
||||
myPasswordText.setVisible(false);
|
||||
myUserNameText.setVisible(false);
|
||||
myPasswordLabel.setVisible(false);
|
||||
myPasswordText.setVisible(false);
|
||||
myUseHttpAuthenticationCheckBox.setVisible(false);
|
||||
|
||||
myToken.setText(repository.getToken());
|
||||
myHost.setText(repository.getUrl());
|
||||
myRepoAuthor.setText(repository.getRepoAuthor());
|
||||
myRepoName.setText(repository.getRepoName());
|
||||
myToken.setText(repository.getToken());
|
||||
|
||||
DocumentListener buttonUpdater = new DocumentAdapter() {
|
||||
@Override
|
||||
@@ -58,29 +62,36 @@ public class GithubRepositoryEditor extends BaseRepositoryEditor<GithubRepositor
|
||||
}
|
||||
};
|
||||
|
||||
myHost.getDocument().addDocumentListener(buttonUpdater);
|
||||
myRepoAuthor.getDocument().addDocumentListener(buttonUpdater);
|
||||
myRepoName.getDocument().addDocumentListener(buttonUpdater);
|
||||
myURLText.getDocument().addDocumentListener(buttonUpdater);
|
||||
|
||||
setAnchor(myRepoAuthorLabel);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected JComponent createCustomPanel() {
|
||||
myUrlLabel.setText("Host:");
|
||||
myHostLabel = new JBLabel("Host:", SwingConstants.RIGHT);
|
||||
myHost = new MyTextField("Github host");
|
||||
|
||||
myRepoAuthorLabel = new JBLabel("Repository Owner:", SwingConstants.RIGHT);
|
||||
myRepoAuthor = new JTextField();
|
||||
installListener(myRepoAuthor);
|
||||
JPanel myHostPanel = new JPanel(new BorderLayout(5, 0));
|
||||
myHostPanel.add(myHost, BorderLayout.CENTER);
|
||||
myHostPanel.add(myShareUrlCheckBox, BorderLayout.EAST);
|
||||
|
||||
myRepoLabel = new JBLabel("Repository:", SwingConstants.RIGHT);
|
||||
myRepoName = new JTextField();
|
||||
installListener(myRepoName);
|
||||
myRepositoryLabel = new JBLabel("Repository:", SwingConstants.RIGHT);
|
||||
myRepoAuthor = new MyTextField("Repository Owner");
|
||||
myRepoName = new MyTextField("Repository Name");
|
||||
myRepoAuthor.setPreferredSize("SomelongNickname");
|
||||
myRepoName.setPreferredSize("SomelongReponame-with-suffixes");
|
||||
|
||||
JPanel myRepoPanel = new JPanel(new GridBagLayout());
|
||||
GridBag bag = new GridBag().setDefaultWeightX(1).setDefaultFill(GridBagConstraints.HORIZONTAL);
|
||||
myRepoPanel.add(myRepoAuthor, bag.nextLine().next());
|
||||
myRepoPanel.add(new JLabel("/"), bag.next().fillCellNone().insets(0, 5, 0, 5).weightx(0));
|
||||
myRepoPanel.add(myRepoName, bag.next());
|
||||
|
||||
myTokenLabel = new JBLabel("API Token:", SwingConstants.RIGHT);
|
||||
myToken = new JTextField();
|
||||
installListener(myToken);
|
||||
myToken = new MyTextField("OAuth2 token");
|
||||
myTokenButton = new JButton("Create API token");
|
||||
myTokenButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -94,8 +105,13 @@ public class GithubRepositoryEditor extends BaseRepositoryEditor<GithubRepositor
|
||||
myTokenPanel.add(myToken, BorderLayout.CENTER);
|
||||
myTokenPanel.add(myTokenButton, BorderLayout.EAST);
|
||||
|
||||
return FormBuilder.createFormBuilder().setAlignLabelOnRight(true).addLabeledComponent(myRepoAuthorLabel, myRepoAuthor)
|
||||
.addLabeledComponent(myRepoLabel, myRepoName).addLabeledComponent(myTokenLabel, myTokenPanel).getPanel();
|
||||
installListener(myHost);
|
||||
installListener(myRepoAuthor);
|
||||
installListener(myRepoName);
|
||||
installListener(myToken);
|
||||
|
||||
return FormBuilder.createFormBuilder().setAlignLabelOnRight(true).addLabeledComponent(myHostLabel, myHostPanel)
|
||||
.addLabeledComponent(myRepositoryLabel, myRepoPanel).addLabeledComponent(myTokenLabel, myTokenPanel).getPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,8 +149,8 @@ public class GithubRepositoryEditor extends BaseRepositoryEditor<GithubRepositor
|
||||
@Override
|
||||
public void setAnchor(@Nullable final JComponent anchor) {
|
||||
super.setAnchor(anchor);
|
||||
myRepoAuthorLabel.setAnchor(anchor);
|
||||
myRepoLabel.setAnchor(anchor);
|
||||
myHostLabel.setAnchor(anchor);
|
||||
myRepositoryLabel.setAnchor(anchor);
|
||||
myTokenLabel.setAnchor(anchor);
|
||||
}
|
||||
|
||||
@@ -149,9 +165,14 @@ public class GithubRepositoryEditor extends BaseRepositoryEditor<GithubRepositor
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent getPreferredFocusedComponent() {
|
||||
return myHost;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getHost() {
|
||||
return myURLText.getText().trim();
|
||||
return myHost.getText().trim();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -168,4 +189,25 @@ public class GithubRepositoryEditor extends BaseRepositoryEditor<GithubRepositor
|
||||
private String getToken() {
|
||||
return myToken.getText().trim();
|
||||
}
|
||||
|
||||
public static class MyTextField extends JBTextField {
|
||||
private int myWidth = -1;
|
||||
|
||||
public MyTextField(@NotNull String hintCaption) {
|
||||
getEmptyText().setText(hintCaption);
|
||||
}
|
||||
|
||||
public void setPreferredSize(@NotNull String sampleSizeString) {
|
||||
myWidth = getFontMetrics(getFont()).stringWidth(sampleSizeString);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
Dimension size = super.getPreferredSize();
|
||||
if (myWidth != -1) {
|
||||
size.width = myWidth;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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="5" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="27dc6" binding="myPane" layout-manager="GridLayoutManager" row-count="4" 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="563" height="400"/>
|
||||
@@ -8,25 +8,9 @@
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="e76ec" class="javax.swing.JTextField" binding="myLoginTextField">
|
||||
<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>
|
||||
<component id="c0234" class="javax.swing.JLabel" binding="myLoginLabel">
|
||||
<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="Login:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="28ddd" class="javax.swing.JTextPane" binding="mySignupTextField">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="2" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||
<grid row="2" column="0" row-span="1" col-span="4" vsize-policy="0" hsize-policy="2" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="10"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@@ -39,38 +23,23 @@
|
||||
<JEditorPane.honorDisplayProperties class="java.lang.Boolean" value="true"/>
|
||||
</clientProperties>
|
||||
</component>
|
||||
<component id="9edbd" class="javax.swing.JPasswordField" binding="myPasswordField">
|
||||
<constraints>
|
||||
<grid row="2" 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>
|
||||
<component id="8a6dd" class="javax.swing.JButton" binding="myTestButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="3" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Test"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="6ace">
|
||||
<constraints>
|
||||
<grid row="4" 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="3" 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="javax.swing.JLabel">
|
||||
<component id="45bab" class="com.intellij.ui.components.JBLabel">
|
||||
<constraints>
|
||||
<grid row="0" 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>
|
||||
<anchor value="e4416"/>
|
||||
<text value="Host:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="3352a" class="javax.swing.JTextField" binding="myHostTextField">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@@ -78,10 +47,110 @@
|
||||
</component>
|
||||
<component id="5a680" class="com.intellij.openapi.ui.ComboBox" binding="myAuthTypeComboBox">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="0" column="3" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<grid id="bda15" binding="myCardPanel" layout-manager="CardLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="1" 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/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="e4354" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<card name="Password"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="c0234" class="com.intellij.ui.components.JBLabel">
|
||||
<constraints>
|
||||
<grid row="0" 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>
|
||||
<anchor value="e4416"/>
|
||||
<text value="Login:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="e76ec" class="javax.swing.JTextField" binding="myLoginTextField">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" 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>
|
||||
<component id="e4416" class="com.intellij.ui.components.JBLabel">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Password:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="9edbd" class="javax.swing.JPasswordField" binding="myPasswordField" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" 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>
|
||||
<grid id="6d9fb" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<card name="Token"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="3cdb8" class="com.intellij.ui.components.JBLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<anchor value="e4416"/>
|
||||
<text value="Token:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="dd543" class="javax.swing.JPasswordField" binding="myTokenField" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" 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>
|
||||
<vspacer id="21b9e">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<component id="8a6dd" class="javax.swing.JButton" binding="myTestButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="2" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Test"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="b276a" class="com.intellij.ui.components.JBLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Auth Type:"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
|
||||
@@ -22,6 +22,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.JBLabel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.github.util.GithubAuthData;
|
||||
@@ -35,6 +36,8 @@ import javax.swing.*;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import javax.swing.event.HyperlinkEvent;
|
||||
import javax.swing.text.Document;
|
||||
import javax.swing.text.PlainDocument;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.IOException;
|
||||
@@ -54,12 +57,13 @@ public class GithubSettingsPanel {
|
||||
|
||||
private JTextField myLoginTextField;
|
||||
private JPasswordField myPasswordField;
|
||||
private JPasswordField myTokenField;
|
||||
private JTextPane mySignupTextField;
|
||||
private JPanel myPane;
|
||||
private JButton myTestButton;
|
||||
private JTextField myHostTextField;
|
||||
private ComboBox myAuthTypeComboBox;
|
||||
private JLabel myLoginLabel;
|
||||
private JPanel myCardPanel;
|
||||
|
||||
private boolean myCredentialsModified;
|
||||
|
||||
@@ -84,18 +88,18 @@ public class GithubSettingsPanel {
|
||||
try {
|
||||
GithubUser user = GithubUtil.checkAuthData(getAuthData());
|
||||
if (GithubAuthData.AuthType.TOKEN.equals(getAuthType())) {
|
||||
GithubNotifications.showInfoDialog(myPane, "Connection successful for user " + user.getLogin(), "Success");
|
||||
GithubNotifications.showInfoDialog(myPane, "Success", "Connection successful for user " + user.getLogin());
|
||||
}
|
||||
else {
|
||||
GithubNotifications.showInfoDialog(myPane, "Connection successful", "Success");
|
||||
GithubNotifications.showInfoDialog(myPane, "Success", "Connection successful");
|
||||
}
|
||||
}
|
||||
catch (GithubAuthenticationException ex) {
|
||||
GithubNotifications.showErrorDialog(myPane, "Can't login using given credentials: " + ex.getMessage(), "Login Failure");
|
||||
GithubNotifications.showErrorDialog(myPane, "Login Failure", "Can't login using given credentials: " + ex.getMessage());
|
||||
}
|
||||
catch (IOException ex) {
|
||||
LOG.info(ex);
|
||||
GithubNotifications.showErrorDialog(myPane, "Can't login: " + GithubUtil.getErrorTextFromException(ex), "Login Failure");
|
||||
GithubNotifications.showErrorDialog(myPane, "Login Failure", "Can't login: " + GithubUtil.getErrorTextFromException(ex));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -137,14 +141,11 @@ public class GithubSettingsPanel {
|
||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||
String item = e.getItem().toString();
|
||||
if (AUTH_PASSWORD.equals(item)) {
|
||||
myLoginLabel.setVisible(true);
|
||||
myLoginTextField.setVisible(true);
|
||||
((CardLayout)myCardPanel.getLayout()).show(myCardPanel, AUTH_PASSWORD);
|
||||
}
|
||||
else if (AUTH_TOKEN.equals(item)) {
|
||||
myLoginLabel.setVisible(false);
|
||||
myLoginTextField.setVisible(false);
|
||||
((CardLayout)myCardPanel.getLayout()).show(myCardPanel, AUTH_TOKEN);
|
||||
}
|
||||
myPane.validate();
|
||||
erasePassword();
|
||||
}
|
||||
}
|
||||
@@ -240,5 +241,10 @@ public class GithubSettingsPanel {
|
||||
public void resetCredentialsModification() {
|
||||
myCredentialsModified = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
Document doc = new PlainDocument();
|
||||
myPasswordField = new JPasswordField(doc, null, 0);
|
||||
myTokenField = new JPasswordField(doc, null, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,15 +36,19 @@ public class GithubAuthData {
|
||||
@NotNull private final String myHost;
|
||||
@Nullable private final BasicAuth myBasicAuth;
|
||||
@Nullable private final TokenAuth myTokenAuth;
|
||||
private final boolean myUseProxy;
|
||||
|
||||
|
||||
private GithubAuthData(@NotNull AuthType authType,
|
||||
@NotNull String host,
|
||||
@Nullable BasicAuth basicAuth,
|
||||
@Nullable TokenAuth tokenAuth) {
|
||||
@Nullable TokenAuth tokenAuth,
|
||||
boolean useProxy) {
|
||||
myAuthType = authType;
|
||||
myHost = host;
|
||||
myBasicAuth = basicAuth;
|
||||
myTokenAuth = tokenAuth;
|
||||
myUseProxy = useProxy;
|
||||
}
|
||||
|
||||
public static GithubAuthData createAnonymous() {
|
||||
@@ -52,15 +56,19 @@ public class GithubAuthData {
|
||||
}
|
||||
|
||||
public static GithubAuthData createAnonymous(@NotNull String host) {
|
||||
return new GithubAuthData(AuthType.ANONYMOUS, host, null, null);
|
||||
return new GithubAuthData(AuthType.ANONYMOUS, host, null, null, true);
|
||||
}
|
||||
|
||||
public static GithubAuthData createBasicAuth(@NotNull String host, @NotNull String login, @NotNull String password) {
|
||||
return new GithubAuthData(AuthType.BASIC, host, new BasicAuth(login, password), null);
|
||||
return new GithubAuthData(AuthType.BASIC, host, new BasicAuth(login, password), null, true);
|
||||
}
|
||||
|
||||
public static GithubAuthData createTokenAuth(@NotNull String host, @NotNull String token) {
|
||||
return new GithubAuthData(AuthType.TOKEN, host, null, new TokenAuth(token));
|
||||
return new GithubAuthData(AuthType.TOKEN, host, null, new TokenAuth(token), true);
|
||||
}
|
||||
|
||||
public static GithubAuthData createTokenAuth(@NotNull String host, @NotNull String token, boolean useProxy) {
|
||||
return new GithubAuthData(AuthType.TOKEN, host, null, new TokenAuth(token), useProxy);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -83,6 +91,10 @@ public class GithubAuthData {
|
||||
return myTokenAuth;
|
||||
}
|
||||
|
||||
public boolean isUseProxy() {
|
||||
return myUseProxy;
|
||||
}
|
||||
|
||||
public static class BasicAuth {
|
||||
@NotNull private final String myLogin;
|
||||
@NotNull private final String myPassword;
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
<membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebModuleMemberContributor"/>
|
||||
|
||||
<membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebJUnitTestMemberContributor"/>
|
||||
<membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebTestNGTestMemberContributor"/>
|
||||
<membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebBrowserMemberContributor"/>
|
||||
|
||||
<membersContributor implementation="org.jetbrains.plugins.groovy.gant.GantMemberContributor"/>
|
||||
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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 org.jetbrains.plugins.groovy.geb;
|
||||
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.intellij.psi.ResolveState;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor;
|
||||
|
||||
/**
|
||||
* @author zolotov
|
||||
*/
|
||||
public class GebTestNGTestMemberContributor extends NonCodeMembersContributor {
|
||||
|
||||
@Override
|
||||
protected String getParentClassName() {
|
||||
return "geb.testng.GebTest";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processDynamicElements(@NotNull PsiType qualifierType,
|
||||
PsiClass aClass,
|
||||
PsiScopeProcessor processor,
|
||||
PsiElement place,
|
||||
ResolveState state) {
|
||||
GebUtil.contributeMembersInsideTest(processor, place, state);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,6 +43,18 @@ class FooTest extends geb.junit4.GebReportingTest {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
""")
|
||||
|
||||
TestUtils.checkCompletionContains(myFixture, "\$()", "to()", "go()", "currentWindow", "verifyAt()", "title")
|
||||
}
|
||||
|
||||
void testTestNGTestMemberCompletion() {
|
||||
myFixture.configureByText("FooTest.groovy", """
|
||||
class FooTest extends geb.testng.GebReportingTest {
|
||||
def testFoo() {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
""")
|
||||
|
||||
TestUtils.checkCompletionContains(myFixture, "\$()", "to()", "go()", "currentWindow", "verifyAt()", "title")
|
||||
|
||||
Binary file not shown.
@@ -12,6 +12,7 @@
|
||||
<orderEntry type="module" module-name="images" exported="" />
|
||||
<orderEntry type="module" module-name="community-resources" exported="" />
|
||||
<orderEntry type="module" module-name="util" />
|
||||
<orderEntry type="module" module-name="manifest" scope="RUNTIME" />
|
||||
</component>
|
||||
<component name="copyright">
|
||||
<Base>
|
||||
|
||||
Reference in New Issue
Block a user