Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/intellij15' into intelli…
Browse files Browse the repository at this point in the history
…j2016.2
  • Loading branch information
uwolfer committed Oct 26, 2016
2 parents 75fc5fc + 3073137 commit a9478b5
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Contributions are very welcome.
Please check out the following points for code contributions:
* Licence for your contribution must be Apache 2.0.
* Please try to follow coding style of the file you are editing.
* When possible, create pull requests against the master branch
* When possible, create pull requests against the GitHub default branch
(which is the plugin for the oldest supported IntelliJ version).
This way your feature / fix will be included in all future versions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ideaVersion=IC-2016.2.5
ijPluginRepoChannel=
downloadIdeaSources=false
version=0.9.9.0-146
version=0.9.9.1-146
javaVersion=1.8
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ private String getProjectName(String repositoryUrl, String url) {
String basePath = UrlUtils.createUriFromGitConfigString(repositoryUrl).getPath();
String path = UrlUtils.createUriFromGitConfigString(url).getPath();

if (path.length() >= basePath.length()) {
if (path.length() >= basePath.length() && path.startsWith(basePath)) {
path = path.substring(basePath.length());
}

Expand All @@ -416,6 +416,10 @@ private String getProjectName(String repositoryUrl, String url) {
if (path.endsWith("/")) {
path = path.substring(0, path.length() - 1);
}
// gerrit project names usually dont start with a slash
if (path.startsWith("/")) {
path = path.substring(1, path.length());
}

return path;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,29 @@

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

import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.SimpleToolWindowPanel;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;
import com.intellij.ui.content.ContentManager;
import com.urswolfer.intellij.plugin.gerrit.GerritModule;

import java.awt.*;

/**
* @author Urs Wolfer
*/
public class GerritToolWindowFactory implements ToolWindowFactory {
public class GerritToolWindowFactory implements ToolWindowFactory, DumbAware {
@Override
public void createToolWindowContent(final Project project, ToolWindow toolWindow) {
GerritToolWindow gerritToolWindow = GerritModule.getInstance(GerritToolWindow.class);

Component component = toolWindow.getComponent();
SimpleToolWindowPanel toolWindowContent = gerritToolWindow.createToolWindowContent(project);
component.getParent().add(toolWindowContent);

ContentManager contentManager = toolWindow.getContentManager();
Content content = ContentFactory.SERVICE.getInstance().createContent(toolWindowContent, "", false);
contentManager.addContent(content);
contentManager.setSelectedContent(content);
}
}
6 changes: 6 additions & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@
href="https://github.com/uwolfer/gerrit-intellij-plugin#pre-releases">
https://github.com/uwolfer/gerrit-intellij-plugin#pre-releases</a>.</li>
<li>0.9.9.1</li>
<ul>
<li>fix compatibility with IntelliJ 2016.3 EAP (tool window is blank)</li>
<li>allow using the tool window while IntelliJ is creating index</li>
<li>minor fixes and improvements</li>
</ul>
<li>0.9.9.0</li>
<ul>
<li>fix automatic update for IntelliJ 2016.2 (by bumping version number)</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ public void testProjectNames() throws Exception {
"http://gerrit.server/r/project/blah/test.git"
));

// specific case where gerrit URL is provided via HTTP but git is configured to use ssh
Assert.assertEquals("project/blah",
getProjectName.invoke(gerritUtil,
"http://gerrit.server/gerrit",
"ssh://git@gerrit.server:29418/project/blah"
));

// should not fail with an StringIndexOutOfBoundsException
Assert.assertEquals("",
getProjectName.invoke(gerritUtil,
Expand Down

0 comments on commit a9478b5

Please sign in to comment.