Skip to content

Commit a9478b5

Browse files
committed
Merge remote-tracking branch 'remotes/origin/intellij15' into intellij2016.2
2 parents 75fc5fc + 3073137 commit a9478b5

6 files changed

Lines changed: 30 additions & 8 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ Contributions are very welcome.
55
Please check out the following points for code contributions:
66
* Licence for your contribution must be Apache 2.0.
77
* Please try to follow coding style of the file you are editing.
8-
* When possible, create pull requests against the master branch
8+
* When possible, create pull requests against the GitHub default branch
99
(which is the plugin for the oldest supported IntelliJ version).
1010
This way your feature / fix will be included in all future versions.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ideaVersion=IC-2016.2.5
22
ijPluginRepoChannel=
33
downloadIdeaSources=false
4-
version=0.9.9.0-146
4+
version=0.9.9.1-146
55
javaVersion=1.8

src/main/java/com/urswolfer/intellij/plugin/gerrit/rest/GerritUtil.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ private String getProjectName(String repositoryUrl, String url) {
407407
String basePath = UrlUtils.createUriFromGitConfigString(repositoryUrl).getPath();
408408
String path = UrlUtils.createUriFromGitConfigString(url).getPath();
409409

410-
if (path.length() >= basePath.length()) {
410+
if (path.length() >= basePath.length() && path.startsWith(basePath)) {
411411
path = path.substring(basePath.length());
412412
}
413413

@@ -416,6 +416,10 @@ private String getProjectName(String repositoryUrl, String url) {
416416
if (path.endsWith("/")) {
417417
path = path.substring(0, path.length() - 1);
418418
}
419+
// gerrit project names usually dont start with a slash
420+
if (path.startsWith("/")) {
421+
path = path.substring(1, path.length());
422+
}
419423

420424
return path;
421425
}

src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritToolWindowFactory.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,29 @@
1616

1717
package com.urswolfer.intellij.plugin.gerrit.ui;
1818

19+
import com.intellij.openapi.project.DumbAware;
1920
import com.intellij.openapi.project.Project;
2021
import com.intellij.openapi.ui.SimpleToolWindowPanel;
2122
import com.intellij.openapi.wm.ToolWindow;
2223
import com.intellij.openapi.wm.ToolWindowFactory;
24+
import com.intellij.ui.content.Content;
25+
import com.intellij.ui.content.ContentFactory;
26+
import com.intellij.ui.content.ContentManager;
2327
import com.urswolfer.intellij.plugin.gerrit.GerritModule;
2428

25-
import java.awt.*;
26-
2729
/**
2830
* @author Urs Wolfer
2931
*/
30-
public class GerritToolWindowFactory implements ToolWindowFactory {
32+
public class GerritToolWindowFactory implements ToolWindowFactory, DumbAware {
3133
@Override
3234
public void createToolWindowContent(final Project project, ToolWindow toolWindow) {
3335
GerritToolWindow gerritToolWindow = GerritModule.getInstance(GerritToolWindow.class);
3436

35-
Component component = toolWindow.getComponent();
3637
SimpleToolWindowPanel toolWindowContent = gerritToolWindow.createToolWindowContent(project);
37-
component.getParent().add(toolWindowContent);
38+
39+
ContentManager contentManager = toolWindow.getContentManager();
40+
Content content = ContentFactory.SERVICE.getInstance().createContent(toolWindowContent, "", false);
41+
contentManager.addContent(content);
42+
contentManager.setSelectedContent(content);
3843
}
3944
}

src/main/resources/META-INF/plugin.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@
8989
href="https://github.com/uwolfer/gerrit-intellij-plugin#pre-releases">
9090
https://github.com/uwolfer/gerrit-intellij-plugin#pre-releases</a>.</li>
9191
92+
<li>0.9.9.1</li>
93+
<ul>
94+
<li>fix compatibility with IntelliJ 2016.3 EAP (tool window is blank)</li>
95+
<li>allow using the tool window while IntelliJ is creating index</li>
96+
<li>minor fixes and improvements</li>
97+
</ul>
9298
<li>0.9.9.0</li>
9399
<ul>
94100
<li>fix automatic update for IntelliJ 2016.2 (by bumping version number)</li>

src/test/java/com/urswolfer/intellij/plugin/gerrit/rest/GerritUtilTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,13 @@ public void testProjectNames() throws Exception {
130130
"http://gerrit.server/r/project/blah/test.git"
131131
));
132132

133+
// specific case where gerrit URL is provided via HTTP but git is configured to use ssh
134+
Assert.assertEquals("project/blah",
135+
getProjectName.invoke(gerritUtil,
136+
"http://gerrit.server/gerrit",
137+
"ssh://git@gerrit.server:29418/project/blah"
138+
));
139+
133140
// should not fail with an StringIndexOutOfBoundsException
134141
Assert.assertEquals("",
135142
getProjectName.invoke(gerritUtil,

0 commit comments

Comments
 (0)