diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2e270f41..543e37bd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. diff --git a/gradle.properties b/gradle.properties index fc8a52f9..5d4b99e0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/rest/GerritUtil.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/rest/GerritUtil.java index cba7242e..be8af194 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/rest/GerritUtil.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/rest/GerritUtil.java @@ -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()); } @@ -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; } diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritToolWindowFactory.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritToolWindowFactory.java index f1cd842b..27eec071 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritToolWindowFactory.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritToolWindowFactory.java @@ -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); } } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index b8249b8f..76c386c9 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -89,6 +89,12 @@ href="https://github.com/uwolfer/gerrit-intellij-plugin#pre-releases"> https://github.com/uwolfer/gerrit-intellij-plugin#pre-releases. +