Merge remote-tracking branch 'origin/master'

This commit is contained in:
Ilya.Kazakevich
2014-02-03 18:36:11 +04:00
16 changed files with 78 additions and 246 deletions
+1 -1
View File
@@ -268,7 +268,7 @@ public def layoutCommunityPlugins(String home) {
}
}
dir("properties") {
pluginDir("properties") {
dir("lib") {
jar("properties.jar") {
module("properties-psi-api")
@@ -22,7 +22,6 @@ import com.intellij.openapi.editor.event.EditorMouseMotionListener;
import com.intellij.openapi.editor.markup.MarkupModel;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.UserDataHolder;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -27,7 +27,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import static com.intellij.util.net.ssl.CertificateWrapper.CommonField.COMMON_NAME;
import static com.intellij.util.net.ssl.CertificateUtil.getCommonName;
import static com.intellij.util.net.ssl.ConfirmingTrustManager.MutableTrustManager;
/**
@@ -63,7 +63,7 @@ public class CertificateConfigurable implements SearchableConfigurable, Configur
if (!new CertificateWrapper(certificate).isValid()) {
setForeground(UIUtil.getLabelDisabledForeground());
}
setText(new CertificateWrapper(certificate).getSubjectField(COMMON_NAME));
setText(getCommonName(certificate));
}
});
@@ -136,7 +136,7 @@ public class CertificateConfigurable implements SearchableConfigurable, Configur
myDetailsPanel.add(scrollPane, uniqueName);
}
private String getCardName(X509Certificate certificate) {
private static String getCardName(X509Certificate certificate) {
return certificate.getSubjectX500Principal().getName();
}
@@ -203,13 +203,13 @@ public class CertificateConfigurable implements SearchableConfigurable, Configur
for (X509Certificate certificate : added) {
if (!myTrustManager.addCertificate(certificate)) {
throw new ConfigurationException("Cannot add certificate", "Cannot Add Certificate");
throw new ConfigurationException("Cannot add certificate for " + getCommonName(certificate), "Cannot Add Certificate");
}
}
for (X509Certificate certificate : removed) {
if (!myTrustManager.removeCertificate(certificate)) {
throw new ConfigurationException("Cannot remove certificate", "Cannot Remove Certificate");
throw new ConfigurationException("Cannot remove certificate for " + getCommonName(certificate), "Cannot Remove Certificate");
}
}
@@ -256,12 +256,18 @@ public class CertificateConfigurable implements SearchableConfigurable, Configur
@Override
public void certificateAdded(X509Certificate certificate) {
getListModel().add(certificate);
CollectionListModel<X509Certificate> model = getListModel();
if (model.getElementIndex(certificate) < 0) {
model.add(certificate);
}
addCertificatePanel(certificate);
}
@Override
public void certificateRemoved(X509Certificate certificate) {
getListModel().remove(certificate);
CollectionListModel<X509Certificate> model = getListModel();
if (model.getElementIndex(certificate) >= 0) {
model.remove(certificate);
}
}
}
@@ -63,4 +63,11 @@ public class CertificateUtil {
StreamUtil.closeStream(stream);
}
}
/**
* @return subjects common name, usually it's domain name pattern, e.g. *.github.com
*/
public static String getCommonName(@NotNull X509Certificate certificate) {
return new CertificateWrapper(certificate).getSubjectField(CertificateWrapper.CommonField.COMMON_NAME);
}
}
@@ -260,7 +260,7 @@ public class ConfirmingTrustManager extends ClientOnlyTrustManager {
}
private static String createAlias(@NotNull X509Certificate certificate) {
return new CertificateWrapper(certificate).getSubjectField(CertificateWrapper.CommonField.COMMON_NAME);
return CertificateUtil.getCommonName(certificate);
}
/**
@@ -287,6 +287,10 @@ public class ConfirmingTrustManager extends ClientOnlyTrustManager {
}
// for listeners
X509Certificate certificate = getCertificate(alias);
if (certificate == null) {
LOG.error("No certificate found for alias: " + alias);
return false;
}
myKeyStore.deleteEntry(alias);
flushKeyStore();
// trust manager should be updated each time its key store was modified
@@ -151,6 +151,8 @@ Tree.paintLines=false
Tree.textBackground=ffffff
Tree.selectionBorderColor=3875d6
EditorPane.background=ffffff
List.background=ffffff
Hyperlink.linkColor=589df6
@@ -38,6 +38,7 @@ public class EditorComboBoxEditor implements ComboBoxEditor{
myTextField.setName(NAME);
}
@Override
public void selectAll() {
myTextField.selectAll();
myTextField.requestFocus();
@@ -48,18 +49,22 @@ public class EditorComboBoxEditor implements ComboBoxEditor{
return myTextField.getEditor();
}
@Override
public EditorTextField getEditorComponent() {
return myTextField;
}
@Override
public void addActionListener(ActionListener l) {
}
@Override
public void removeActionListener(ActionListener l) {
}
@Override
public Object getItem() {
return getDocument();
}
@@ -68,6 +73,7 @@ public class EditorComboBoxEditor implements ComboBoxEditor{
return myTextField.getDocument();
}
@Override
public void setItem(Object anObject) {
myTextField.setDocument((Document)anObject);
}
@@ -262,9 +262,13 @@ public class XDebuggerUtilImpl extends XDebuggerUtil {
@Override
@Nullable
public PsiElement findContextElement(@NotNull VirtualFile virtualFile, int offset, @NotNull Project project, boolean checkXml) {
if (!virtualFile.isValid()) {
return null;
}
Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
PsiFile file = PsiManager.getInstance(project).findFile(virtualFile);
if (file == null || document == null) {
PsiFile file = document == null ? null : PsiManager.getInstance(project).findFile(virtualFile);
if (file == null) {
return null;
}
@@ -60,6 +60,7 @@ public class XDebuggerExpressionComboBox extends XDebuggerEditorBase {
return myComboBox;
}
@Override
public JComponent getComponent() {
return myComboBox;
}
@@ -70,7 +71,7 @@ public class XDebuggerExpressionComboBox extends XDebuggerEditorBase {
}
public JComponent getEditorComponent() {
return (JComponent)myEditor.getEditorComponent();
return myEditor.getEditorComponent();
}
public void setEnabled(boolean enable) {
@@ -89,13 +90,12 @@ public class XDebuggerExpressionComboBox extends XDebuggerEditorBase {
private void initEditor() {
myEditor = new EditorComboBoxEditor(getProject(), myDebuggerEditorsProvider.getFileType()) {
@Override
public void setItem(Object anObject) {
if (anObject == null) {
anObject = "";
}
super.setItem(createDocument((String)anObject));
super.setItem(createDocument(StringUtil.notNullize((String)anObject)));
}
@Override
public Object getItem() {
return ((Document)super.getItem()).getText();
}
@@ -106,6 +106,7 @@ public class XDebuggerExpressionComboBox extends XDebuggerEditorBase {
myComboBox.setMaximumRowCount(XDebuggerHistoryManager.MAX_RECENT_EXPRESSIONS);
}
@Override
protected void onHistoryChanged() {
fillComboBox();
}
@@ -120,6 +121,7 @@ public class XDebuggerExpressionComboBox extends XDebuggerEditorBase {
}
}
@Override
protected void doSetText(String text) {
if (myComboBox.getItemCount() > 0) {
myComboBox.setSelectedIndex(0);
@@ -133,15 +135,18 @@ public class XDebuggerExpressionComboBox extends XDebuggerEditorBase {
}
}
@Override
public String getText() {
final Object value = myComboBox.isPopupVisible() ? myComboBox.getPopup().getList().getSelectedValue() : myEditor.getItem();
return StringUtil.notNullize((String)value);
}
@Override
public JComponent getPreferredFocusedComponent() {
return (JComponent)myComboBox.getEditor().getEditorComponent();
}
@Override
public void selectAll() {
myComboBox.getEditor().selectAll();
}
@@ -110,22 +110,16 @@ public class GitCheckinEnvironment implements CheckinEnvironment {
for (VirtualFile root : GitUtil.gitRoots(Arrays.asList(filesToCheckin))) {
VirtualFile mergeMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_MERGE_MSG);
VirtualFile squashMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_SQUASH_MSG);
VirtualFile normalMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_COMMIT_EDITMSG);
try {
if (mergeMsg == null && squashMsg == null && normalMsg == null) {
if (mergeMsg == null && squashMsg == null) {
continue;
}
String encoding = GitConfigUtil.getCommitEncoding(myProject, root);
if (mergeMsg != null) {
messages.add(loadMessage(mergeMsg, encoding));
}
else if (squashMsg != null) {
messages.add(loadMessage(squashMsg, encoding));
}
else {
messages.add(loadMessage(normalMsg, encoding));
messages.add(loadMessage(squashMsg, encoding));
}
}
catch (IOException e) {
@@ -61,8 +61,7 @@ public class GenericRepositoryType extends BaseRepositoryType<GenericRepository>
this,
new AsanaRepository(),
new AssemblaRepository(),
new SprintlyRepository(),
new GitlabRepository()
new SprintlyRepository()
);
}
@@ -127,10 +126,4 @@ public class GenericRepositoryType extends BaseRepositoryType<GenericRepository>
super("Sprintly", TasksIcons.Sprintly);
}
}
public final class GitlabRepository extends GenericSubtype {
public GitlabRepository() {
super("Gitlab", TasksIcons.Gitlab);
}
}
}
@@ -1,75 +0,0 @@
<Generic shared="false" url="">
<commitMessageFormat>{id} {summary}</commitMessageFormat>
<option name="downloadTasksInSeparateRequests" value="false" />
<password />
<option name="loginAnonymously" value="true" />
<option name="loginMethodType" value="GET" />
<option name="loginUrl" value="" />
<option name="responseHandlers">
<XPathResponseHandler>
<selectors>
<selector name="tasks" path="" />
<selector name="id" path="" />
<selector name="summary" path="" />
<selector name="description" path="" />
<selector name="updated" path="" />
<selector name="created" path="" />
<selector name="closed" path="" />
<selector name="issueUrl" path="" />
<selector name="singleTask-id" path="" />
<selector name="singleTask-summary" path="" />
<selector name="singleTask-description" path="" />
<selector name="singleTask-updated" path="" />
<selector name="singleTask-created" path="" />
<selector name="singleTask-closed" path="" />
<selector name="singleTask-issueUrl" path="" />
</selectors>
</XPathResponseHandler>
<JsonResponseHandler>
<selectors>
<selector name="tasks" path="[*]" />
<selector name="id" path="id" />
<selector name="summary" path="title" />
<selector name="description" path="description" />
<selector name="updated" path="updated_at" />
<selector name="created" path="created_at" />
<selector name="closed" path="" />
<selector name="issueUrl" path="" />
<selector name="singleTask-id" path="id" />
<selector name="singleTask-summary" path="title" />
<selector name="singleTask-description" path="description" />
<selector name="singleTask-updated" path="updated_at" />
<selector name="singleTask-created" path="created_at" />
<selector name="singleTask-closed" path="" />
<selector name="singleTask-issueUrl" path="" />
</selectors>
</JsonResponseHandler>
<RegExResponseHandler>
<option name="taskRegex" value="" />
</RegExResponseHandler>
</option>
<option name="responseType" value="JSON" />
<option name="shouldFormatCommitMessage" value="false" />
<option name="singleTaskMethodType" value="GET" />
<option name="singleTaskUrl" value="{serverUrl}/api/v3/projects/{project_ID}/issues?private_token={token}" />
<option name="subtypeName" />
<option name="tasksListMethodType" value="GET" />
<option name="tasksListUrl" value="{serverUrl}/api/v3/projects/{project_ID}/issues?private_token={token}" />
<option name="templateVariables">
<list>
<TemplateVariable hidden="true" readOnly="false" shownOnFirstTab="true">
<option name="description" value="" />
<option name="name" value="token" />
<option name="value" value="" />
</TemplateVariable>
<TemplateVariable hidden="false" readOnly="false" shownOnFirstTab="true">
<option name="description" value="" />
<option name="name" value="project_ID" />
<option name="value" value="" />
</TemplateVariable>
</list>
</option>
<option name="useHttpAuthentication" value="false" />
<option name="useProxy" value="false" />
<username />
</Generic>
@@ -1,129 +0,0 @@
package com.intellij.tasks.integration;
import com.intellij.tasks.Task;
import com.intellij.tasks.TaskTestUtil;
import com.intellij.tasks.generic.GenericRepository;
import com.intellij.tasks.generic.GenericRepositoryType;
import org.jetbrains.annotations.NotNull;
/**
* @author Mikhail Golubev
*/
public class GitlabIntegrationTest extends GenericSubtypeTestCase {
private static final String TASK_LIST_RESPONSE = "[\n" +
" {\n" +
" \"id\": 2,\n" +
" \"iid\": 2,\n" +
" \"project_id\": 1,\n" +
" \"title\": \"Drink more tea\",\n" +
" \"description\": \"It\\u0027s healthy.\",\n" +
" \"labels\": [],\n" +
" \"assignee\": {\n" +
" \"id\": 4,\n" +
" \"username\": \"deva\",\n" +
" \"email\": \"deva@somemail.com\",\n" +
" \"name\": \"John Smith\",\n" +
" \"state\": \"active\",\n" +
" \"created_at\": \"2013-11-14T12:34:37Z\"\n" +
" },\n" +
" \"author\": {\n" +
" \"id\": 1,\n" +
" \"username\": \"root\",\n" +
" \"email\": \"admin@local.host\",\n" +
" \"name\": \"Administrator\",\n" +
" \"state\": \"active\",\n" +
" \"created_at\": \"2013-11-14T12:19:43Z\"\n" +
" },\n" +
" \"state\": \"opened\",\n" +
" \"updated_at\": \"2013-11-14T12:38:51Z\",\n" +
" \"created_at\": \"2013-11-14T12:33:07Z\"\n" +
" },\n" +
" {\n" +
" \"id\": 1,\n" +
" \"iid\": 1,\n" +
" \"project_id\": 1,\n" +
" \"title\": \"Eat more bananas\",\n" +
" \"description\": \"They're tasty.\",\n" +
" \"labels\": [\n" +
" \"spam\"\n" +
" ],\n" +
" \"assignee\": {\n" +
" \"id\": 1,\n" +
" \"username\": \"root\",\n" +
" \"email\": \"admin@local.host\",\n" +
" \"name\": \"Administrator\",\n" +
" \"state\": \"active\",\n" +
" \"created_at\": \"2013-11-14T12:19:43Z\"\n" +
" },\n" +
" \"author\": {\n" +
" \"id\": 1,\n" +
" \"username\": \"root\",\n" +
" \"email\": \"admin@local.host\",\n" +
" \"name\": \"Administrator\",\n" +
" \"state\": \"active\",\n" +
" \"created_at\": \"2013-11-14T12:19:43Z\"\n" +
" },\n" +
" \"state\": \"opened\",\n" +
" \"updated_at\": \"2013-11-14T12:30:39Z\",\n" +
" \"created_at\": \"2013-11-14T12:30:39Z\"\n" +
" }\n" +
"] ";
private static final String SINGLE_TASK_RESPONSE = "{\n" +
" \"id\": 2,\n" +
" \"iid\": 2,\n" +
" \"project_id\": 1,\n" +
" \"title\": \"Drink more tea\",\n" +
" \"description\": \"It\\u0027s healthy.\",\n" +
" \"labels\": [],\n" +
" \"assignee\": {\n" +
" \"id\": 4,\n" +
" \"username\": \"deva\",\n" +
" \"email\": \"deva@somemail.com\",\n" +
" \"name\": \"John Smith\",\n" +
" \"state\": \"active\",\n" +
" \"created_at\": \"2013-11-14T12:34:37Z\"\n" +
" },\n" +
" \"author\": {\n" +
" \"id\": 1,\n" +
" \"username\": \"root\",\n" +
" \"email\": \"admin@local.host\",\n" +
" \"name\": \"Administrator\",\n" +
" \"state\": \"active\",\n" +
" \"created_at\": \"2013-11-14T12:19:43Z\"\n" +
" },\n" +
" \"state\": \"opened\",\n" +
" \"updated_at\": \"2013-11-14T12:38:51Z\",\n" +
" \"created_at\": \"2013-11-14T12:33:07Z\"\n" +
"}";
private Task getTask1() {
return new TaskTestUtil.TaskBuilder("1", "Eat more bananas", myRepository)
.withDescription("They're tasty.")
.withUpdated("2013-11-14T12:30:39Z")
.withCreated("2013-11-14T12:30:39Z");
}
private Task getTask2() {
return new TaskTestUtil.TaskBuilder("2", "Drink more tea", myRepository)
.withDescription("It's healthy.")
.withUpdated("2013-11-14T12:38:51Z")
.withCreated("2013-11-14T12:33:07Z");
}
@NotNull
@Override
protected GenericRepository createRepository(GenericRepositoryType genericType) {
return (GenericRepository)genericType.new GitlabRepository().createRepository();
}
public void testParsingTaskList() throws Exception {
Task[] tasks = myRepository.getActiveResponseHandler().parseIssues(TASK_LIST_RESPONSE, 50);
TaskTestUtil.assertTasksEqual(new Task[]{getTask2(), getTask1()}, tasks);
}
public void testParsingSingleTask() throws Exception {
Task task = myRepository.getActiveResponseHandler().parseIssue(SINGLE_TASK_RESPONSE);
TaskTestUtil.assertTasksEqual(getTask2(), task);
}
}
@@ -238,6 +238,9 @@ public class PyNamedParameterImpl extends PyPresentableElementImpl<PyNamedParame
if (defaultValue != null) {
final PyType type = context.getType(defaultValue);
if (type != null && !(type instanceof PyNoneType)) {
if (type instanceof PyTupleType) {
return PyTypeParser.getTypeByName(this, "collections.Iterable");
}
return type;
}
}
@@ -249,15 +252,18 @@ public class PyNamedParameterImpl extends PyPresentableElementImpl<PyNamedParame
@Override
public boolean process(@NotNull PyCallExpression call) {
final PyResolveContext resolveContext = PyResolveContext.noImplicits().withTypeEvalContext(context);
final CallArgumentsMapping mapping = call.getArgumentList().analyzeCall(resolveContext);
for (Map.Entry<PyExpression, PyNamedParameter> entry : mapping.getPlainMappedParams().entrySet()) {
if (entry.getValue() == PyNamedParameterImpl.this) {
final PyExpression argument = entry.getKey();
if (argument != null) {
final PyType type = context.getType(argument);
if (type != null) {
types.add(type);
return true;
final PyArgumentList argumentList = call.getArgumentList();
if (argumentList != null) {
final CallArgumentsMapping mapping = argumentList.analyzeCall(resolveContext);
for (Map.Entry<PyExpression, PyNamedParameter> entry : mapping.getPlainMappedParams().entrySet()) {
if (entry.getValue() == PyNamedParameterImpl.this) {
final PyExpression argument = entry.getKey();
if (argument != null) {
final PyType type = context.getType(argument);
if (type != null) {
types.add(type);
return true;
}
}
}
}
@@ -0,0 +1,5 @@
def f(x=(), y=('foo', 'bar')):
pass
f([1, 2, 3], ['foo'])
@@ -232,4 +232,9 @@ public class PyTypeCheckerInspectionTest extends PyTestCase {
public void testMetaClassIteration() {
doTest();
}
// PY-10967
public void testDefaultTupleParameter() {
doTest();
}
}