From 797a24a4948002f048a1fcc1731f1e1640378691 Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Sun, 11 Dec 2016 15:50:29 +0100 Subject: [PATCH 01/21] encode content entered in user filters fixes #252 --- .../intellij/plugin/gerrit/ui/filter/AbstractUserFilter.java | 4 +++- .../intellij/plugin/gerrit/ui/filter/FulltextFilter.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/filter/AbstractUserFilter.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/filter/AbstractUserFilter.java index f816a99a..749e884c 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/filter/AbstractUserFilter.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/filter/AbstractUserFilter.java @@ -67,7 +67,9 @@ public AnAction getAction(final Project project) { @Nullable public String getSearchQueryPart() { if (value.isPresent() && value.get().forQuery.isPresent()) { - return String.format("%s:%s", getQueryField(), value.get().forQuery.get()); + String queryValue = value.get().forQuery.get(); + queryValue = FulltextFilter.specialEncodeFulltextQuery(queryValue); + return String.format("%s:%s", getQueryField(), queryValue); } else { return null; } diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/filter/FulltextFilter.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/filter/FulltextFilter.java index 1df5fb41..9e6c8def 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/filter/FulltextFilter.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/filter/FulltextFilter.java @@ -62,7 +62,7 @@ public String getSearchQueryPart() { * @param query a query string to encode * @return an encoded version of the passed {@code query} */ - private String specialEncodeFulltextQuery(String query) { + public static String specialEncodeFulltextQuery(String query) { return query .replace("+", "%2B") .replace(' ', '+') From af556f4b27d2540af632fb467552d21a2feed45d Mon Sep 17 00:00:00 2001 From: Vainyksi Date: Wed, 7 Dec 2016 07:49:24 +0100 Subject: [PATCH 02/21] replace not recognized chars by gerrit in names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit if gerrit can not recognize char in user name it wil replace it with "?" and this char is not acceptable in git branch name, the chars like ň,č,... --- .../intellij/plugin/gerrit/ui/action/CheckoutAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CheckoutAction.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CheckoutAction.java index ea5d2640..3f2830af 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CheckoutAction.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CheckoutAction.java @@ -98,7 +98,7 @@ private String buildBranchName(ChangeInfo changeDetails) { if (topic == null) { topic = "" + changeDetails._number; } - String branchName = "review/" + changeDetails.owner.name.toLowerCase().replace(" ", "_") + '/' + topic; + String branchName = "review/" + changeDetails.owner.name.toLowerCase().replace(" ", "_").replace("?", "_") + '/' + topic; if (revisionInfo._number != changeDetails.revisions.size()) { branchName += "-patch" + revisionInfo._number; } From ce5a09cdc2d945b49bc4c2f7e58eda479856eb17 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Tue, 20 Dec 2016 13:27:52 +0100 Subject: [PATCH 03/21] Use a dedicated description for review actions that allow to add a comment --- .../intellij/plugin/gerrit/ui/action/ReviewAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/ReviewAction.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/ReviewAction.java index 203de7f0..636aa521 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/ReviewAction.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/ReviewAction.java @@ -61,7 +61,7 @@ public ReviewAction(String label, SubmitAction submitAction, NotificationService notificationService, GerritSettings gerritSettings) { - super((rating > 0 ? "+" : "") + rating + (showDialog ? "..." : ""), "Review Change with " + rating, icon); + super((rating > 0 ? "+" : "") + rating + (showDialog ? "..." : ""), "Review Change with " + rating + (showDialog ? " adding Comment" : ""), icon); this.label = label; this.rating = rating; this.showDialog = showDialog; From e6a6e8a101a921a8f4a15fc203e46ba36baf1899 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Wed, 1 Feb 2017 17:00:54 +0100 Subject: [PATCH 04/21] Do not error if a local repo cannot be found when just browsing changes --- .../intellij/plugin/gerrit/git/GerritGitUtil.java | 10 ++++++---- .../plugin/gerrit/ui/action/CheckoutAction.java | 6 ++++++ .../plugin/gerrit/ui/action/CompareBranchAction.java | 11 ++++++++++- .../plugin/gerrit/ui/action/FetchAction.java | 12 ++++++++++-- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/git/GerritGitUtil.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/git/GerritGitUtil.java index 8b7695b5..63edc74e 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/git/GerritGitUtil.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/git/GerritGitUtil.java @@ -111,9 +111,6 @@ public Optional getRepositoryForGerritProject(Project project, St } } } - NotificationBuilder notification = new NotificationBuilder(project, "Error", - String.format("No repository found for Gerrit project: '%s'.", gerritProjectName)); - notificationService.notifyError(notification); return Optional.absent(); } @@ -162,7 +159,12 @@ public void cherryPickChange(final Project project, final ChangeInfo changeInfo, public void run(@NotNull ProgressIndicator indicator) { try { Optional gitRepositoryOptional = getRepositoryForGerritProject(project, changeInfo.project); - if (!gitRepositoryOptional.isPresent()) return; + if (!gitRepositoryOptional.isPresent()) { + NotificationBuilder notification = new NotificationBuilder(project, "Error", + String.format("No repository found for Gerrit project: '%s'.", changeInfo.project)); + notificationService.notifyError(notification); + return; + } GitRepository gitRepository = gitRepositoryOptional.get(); final VirtualFile virtualFile = gitRepository.getGitDir(); diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CheckoutAction.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CheckoutAction.java index 3f2830af..9f9ac3da 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CheckoutAction.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CheckoutAction.java @@ -74,6 +74,12 @@ public Void call() throws Exception { GitBrancher brancher = ServiceManager.getService(project, GitBrancher.class); Optional gitRepositoryOptional = gerritGitUtil. getRepositoryForGerritProject(project, changeDetails.project); + if (!gitRepositoryOptional.isPresent()) { + NotificationBuilder notification = new NotificationBuilder(project, "Error", + String.format("No repository found for Gerrit project: '%s'.", changeDetails.project)); + notificationService.notifyError(notification); + return null; + } String branchName = buildBranchName(changeDetails); final GitRepository repository = gitRepositoryOptional.get(); List gitRepositories = Collections.singletonList(repository); diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CompareBranchAction.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CompareBranchAction.java index 94fd4a34..d1c221dc 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CompareBranchAction.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/CompareBranchAction.java @@ -25,6 +25,8 @@ import com.intellij.openapi.project.Project; import com.urswolfer.intellij.plugin.gerrit.GerritModule; import com.urswolfer.intellij.plugin.gerrit.git.GerritGitUtil; +import com.urswolfer.intellij.plugin.gerrit.util.NotificationBuilder; +import com.urswolfer.intellij.plugin.gerrit.util.NotificationService; import git4idea.GitLocalBranch; import git4idea.repo.GitRepository; import git4idea.ui.branch.GitCompareBranchesDialog; @@ -42,6 +44,8 @@ public class CompareBranchAction extends AbstractChangeAction { private GerritGitUtil gerritGitUtil; @Inject private FetchAction fetchAction; + @Inject + private NotificationService notificationService; public CompareBranchAction() { super("Compare with Branch", "Compare change with current branch", AllIcons.Actions.DiffWithCurrent); @@ -66,7 +70,12 @@ public Void call() throws Exception { private void diffChange(Project project, ChangeInfo changeInfo) { Optional gitRepositoryOptional = gerritGitUtil.getRepositoryForGerritProject(project, changeInfo.project); - if (!gitRepositoryOptional.isPresent()) return; + if (!gitRepositoryOptional.isPresent()) { + NotificationBuilder notification = new NotificationBuilder(project, "Error", + String.format("No repository found for Gerrit project: '%s'.", changeInfo.project)); + notificationService.notifyError(notification); + return; + } GitRepository gitRepository = gitRepositoryOptional.get(); final String branchName = "FETCH_HEAD"; diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/FetchAction.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/FetchAction.java index 75fc7917..2b90d825 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/FetchAction.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/FetchAction.java @@ -24,6 +24,8 @@ import com.intellij.util.Consumer; import com.urswolfer.intellij.plugin.gerrit.git.GerritGitUtil; import com.urswolfer.intellij.plugin.gerrit.rest.GerritUtil; +import com.urswolfer.intellij.plugin.gerrit.util.NotificationBuilder; +import com.urswolfer.intellij.plugin.gerrit.util.NotificationService; import git4idea.repo.GitRepository; import java.util.concurrent.Callable; @@ -36,7 +38,8 @@ public class FetchAction { private GerritUtil gerritUtil; @Inject private GerritGitUtil gerritGitUtil; - + @Inject + private NotificationService notificationService; public void fetchChange(ChangeInfo selectedChange, final Project project, final Callable successCallable) { gerritUtil.getChangeDetails(selectedChange._number, project, new Consumer() { @@ -44,7 +47,12 @@ public void fetchChange(ChangeInfo selectedChange, final Project project, final public void consume(ChangeInfo changeDetails) { Optional gitRepository = gerritGitUtil.getRepositoryForGerritProject(project, changeDetails.project); - if (!gitRepository.isPresent()) return; + if (!gitRepository.isPresent()) { + NotificationBuilder notification = new NotificationBuilder(project, "Error", + String.format("No repository found for Gerrit project: '%s'.", changeDetails.project)); + notificationService.notifyError(notification); + return; + } FetchInfo firstFetchInfo = gerritUtil.getFirstFetchInfo(changeDetails); if (firstFetchInfo == null) { From 9b73e12fa4edcc0cd6ac4ce8fa57daf45c06afec Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Wed, 1 Feb 2017 17:13:43 +0100 Subject: [PATCH 05/21] Show a proper message in the viewer if the diff cannot be displayed --- .../plugin/gerrit/ui/RepositoryChangesBrowserProvider.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/RepositoryChangesBrowserProvider.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/RepositoryChangesBrowserProvider.java index a75bd6e9..002654de 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/RepositoryChangesBrowserProvider.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/RepositoryChangesBrowserProvider.java @@ -156,7 +156,10 @@ protected void updateChangesBrowser() { getViewer().setEmptyText("Loading..."); setChangesToDisplay(Collections.emptyList()); Optional gitRepositoryOptional = gerritGitUtil.getRepositoryForGerritProject(project, selectedChange.project); - if (!gitRepositoryOptional.isPresent()) return; + if (!gitRepositoryOptional.isPresent()) { + getViewer().setEmptyText("Diff cannot be displayed as no local repository was found"); + return; + } final GitRepository gitRepository = gitRepositoryOptional.get(); Map revisions = selectedChange.revisions; From 3db2859da35b2d2dffe5fd7b4c79830037b4db75 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Wed, 1 Feb 2017 17:19:11 +0100 Subject: [PATCH 06/21] Reword Gerrit error messages to not end in a dot As usuall the message from the excpetion is appended with a ":", having a "." just in front looks weird. --- .../plugin/gerrit/rest/GerritUtil.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) 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 be8af194..8ad710c2 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 @@ -141,7 +141,7 @@ public Void get() { } } }; - accessGerrit(supplier, consumer, project, "Failed to post Gerrit review."); + accessGerrit(supplier, consumer, project, "Failed to post Gerrit review"); } public void postSubmit(final String changeId, @@ -159,7 +159,7 @@ public Void get() { } } }; - accessGerrit(supplier, consumer, project, "Failed to submit Gerrit change."); + accessGerrit(supplier, consumer, project, "Failed to submit Gerrit change"); } @SuppressWarnings("unchecked") @@ -176,7 +176,7 @@ public Void get() { } } }; - accessGerrit(supplier, Consumer.EMPTY_CONSUMER, project, "Failed to publish Gerrit change."); + accessGerrit(supplier, Consumer.EMPTY_CONSUMER, project, "Failed to publish Gerrit change"); } @SuppressWarnings("unchecked") @@ -193,7 +193,7 @@ public Void get() { } } }; - accessGerrit(supplier, Consumer.EMPTY_CONSUMER, project, "Failed to delete Gerrit change."); + accessGerrit(supplier, Consumer.EMPTY_CONSUMER, project, "Failed to delete Gerrit change"); } @SuppressWarnings("unchecked") @@ -211,7 +211,7 @@ public Void get() { } } }; - accessGerrit(supplier, Consumer.EMPTY_CONSUMER, project, "Failed to abandon Gerrit change."); + accessGerrit(supplier, Consumer.EMPTY_CONSUMER, project, "Failed to abandon Gerrit change"); } @SuppressWarnings("unchecked") @@ -229,7 +229,7 @@ public Void get() { } } }; - accessGerrit(supplier, Consumer.EMPTY_CONSUMER, project, "Failed to add reviewer."); + accessGerrit(supplier, Consumer.EMPTY_CONSUMER, project, "Failed to add reviewer"); } /** @@ -254,8 +254,8 @@ public Void get() { } } }; - accessGerrit(supplier, Consumer.EMPTY_CONSUMER, project, "Failed to star Gerrit change." + - "
Not supported for Gerrit instances older than version 2.8."); + accessGerrit(supplier, Consumer.EMPTY_CONSUMER, project, "Failed to star Gerrit change " + + "(not supported for Gerrit versions older than 2.8)"); } @SuppressWarnings("unchecked") @@ -277,7 +277,7 @@ public Void get() { } } }; - accessGerrit(supplier, Consumer.EMPTY_CONSUMER, project, "Failed set file review status for Gerrit change."); + accessGerrit(supplier, Consumer.EMPTY_CONSUMER, project, "Failed set file review status for Gerrit change"); } public void getChangesToReview(Project project, Consumer> consumer) { @@ -543,7 +543,7 @@ public CommentInfo get() { } } }; - accessGerrit(supplier, consumer, project, "Failed to save draft comment."); + accessGerrit(supplier, consumer, project, "Failed to save draft comment"); } public void deleteDraftComment(final int changeNr, @@ -562,7 +562,7 @@ public Void get() { } } }; - accessGerrit(supplier, consumer, project, "Failed to delete draft comment."); + accessGerrit(supplier, consumer, project, "Failed to delete draft comment"); } private boolean testConnection(GerritAuthData gerritAuthData) throws RestApiException { From fe708c404ffd68e67ba8bf7ce8519c2523f23fb6 Mon Sep 17 00:00:00 2001 From: Stephen Friedrich Date: Thu, 2 Feb 2017 17:29:19 +0100 Subject: [PATCH 07/21] Adds (optional) topic column to changes list --- .../intellij/plugin/gerrit/GerritSettings.java | 12 ++++++++++++ .../gerrit/ui/GerritChangeListPanel.java | 18 ++++++++++++++++++ .../gerrit/ui/GerritSettingsConfigurable.java | 5 ++++- .../plugin/gerrit/ui/SettingsPanel.form | 12 ++++++++++-- .../plugin/gerrit/ui/SettingsPanel.java | 9 +++++++++ 5 files changed, 53 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/GerritSettings.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/GerritSettings.java index ce924f6e..c17ec532 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/GerritSettings.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/GerritSettings.java @@ -59,6 +59,7 @@ public class GerritSettings implements PersistentStateComponent, Gerrit private static final String PUSH_TO_GERRIT = "PushToGerrit"; private static final String SHOW_CHANGE_NUMBER_COLUMN = "ShowChangeNumberColumn"; private static final String SHOW_CHANGE_ID_COLUMN = "ShowChangeIdColumn"; + private static final String SHOW_TOPIC_COLUMN = "ShowTopicColumn"; private static final String GERRIT_SETTINGS_PASSWORD_KEY = "GERRIT_SETTINGS_PASSWORD_KEY"; private String login; @@ -70,6 +71,7 @@ public class GerritSettings implements PersistentStateComponent, Gerrit private boolean pushToGerrit; private boolean showChangeNumberColumn; private boolean showChangeIdColumn; + private boolean showTopicColumn; private Logger log; @@ -84,6 +86,7 @@ public Element getState() { element.setAttribute(PUSH_TO_GERRIT, Boolean.toString(getPushToGerrit())); element.setAttribute(SHOW_CHANGE_NUMBER_COLUMN, Boolean.toString(getShowChangeNumberColumn())); element.setAttribute(SHOW_CHANGE_ID_COLUMN, Boolean.toString(getShowChangeIdColumn())); + element.setAttribute(SHOW_TOPIC_COLUMN, Boolean.toString(getShowTopicColumn())); return element; } @@ -100,6 +103,7 @@ public void loadState(@NotNull final Element element) { setPushToGerrit(getBooleanValue(element, PUSH_TO_GERRIT)); setShowChangeNumberColumn(getBooleanValue(element, SHOW_CHANGE_NUMBER_COLUMN)); setShowChangeIdColumn(getBooleanValue(element, SHOW_CHANGE_ID_COLUMN)); + setShowTopicColumn(getBooleanValue(element, SHOW_TOPIC_COLUMN)); } catch (Exception e) { log.error("Error happened while loading gerrit settings: " + e); } @@ -232,6 +236,14 @@ public void setShowChangeIdColumn(boolean showChangeIdColumn) { this.showChangeIdColumn = showChangeIdColumn; } + public boolean getShowTopicColumn() { + return showTopicColumn; + } + + public void setShowTopicColumn(boolean showTopicColumn) { + this.showTopicColumn = showTopicColumn; + } + public void setLog(Logger log) { this.log = log; } diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritChangeListPanel.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritChangeListPanel.java index 238f0b18..574f693f 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritChangeListPanel.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritChangeListPanel.java @@ -232,6 +232,7 @@ private void updateModel(List changes) { private ColumnInfo[] generateColumnsInfo(@NotNull List changes) { ItemAndWidth number = new ItemAndWidth("", 0); ItemAndWidth hash = new ItemAndWidth("", 0); + ItemAndWidth topic = new ItemAndWidth("", 0); ItemAndWidth subject = new ItemAndWidth("", 0); ItemAndWidth status = new ItemAndWidth("", 0); ItemAndWidth author = new ItemAndWidth("", 0); @@ -242,6 +243,7 @@ private ColumnInfo[] generateColumnsInfo(@NotNull List changes) { for (ChangeInfo change : changes) { number = getMax(number, getNumber(change)); hash = getMax(hash, getHash(change)); + topic = getMax(topic, getTopic(change)); subject = getMax(subject, getShortenedSubject(change)); status = getMax(status, getStatus(change)); author = getMax(author, getOwner(change)); @@ -279,6 +281,18 @@ public String valueOf(ChangeInfo change) { } ); } + boolean showTopicColumn = gerritSettings.getShowTopicColumn(); + if (showTopicColumn) { + columnList.add( + new GerritChangeColumnInfo("Topic", topic.item) { + @Override + public String valueOf(ChangeInfo change) { + return getTopic(change); + } + } + ); + } + columnList.add( new GerritChangeColumnInfo("Subject", subject.item) { @Override @@ -384,6 +398,10 @@ private static String getHash(ChangeInfo change) { return change.changeId.substring(0, 9); } + private static String getTopic(ChangeInfo change) { + return change.topic; + } + private static String getShortenedSubject(ChangeInfo change) { if (change.subject.length() > 80) { return change.subject.substring(0, 80); diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritSettingsConfigurable.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritSettingsConfigurable.java index 4376465b..9d9790d1 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritSettingsConfigurable.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritSettingsConfigurable.java @@ -75,7 +75,8 @@ public boolean isModified() { !Comparing.equal(gerritSettings.getReviewNotifications(), settingsPane.getReviewNotifications()) || !Comparing.equal(gerritSettings.getPushToGerrit(), settingsPane.getPushToGerrit()) || !Comparing.equal(gerritSettings.getShowChangeNumberColumn(), settingsPane.getShowChangeNumberColumn()) || - !Comparing.equal(gerritSettings.getShowChangeIdColumn(), settingsPane.getShowChangeIdColumn())); + !Comparing.equal(gerritSettings.getShowChangeIdColumn(), settingsPane.getShowChangeIdColumn()) || + !Comparing.equal(gerritSettings.getShowTopicColumn(), settingsPane.getShowTopicColumn())); } private boolean isPasswordModified() { @@ -97,6 +98,7 @@ public void apply() throws ConfigurationException { gerritSettings.setPushToGerrit(settingsPane.getPushToGerrit()); gerritSettings.setShowChangeNumberColumn(settingsPane.getShowChangeNumberColumn()); gerritSettings.setShowChangeIdColumn(settingsPane.getShowChangeIdColumn()); + gerritSettings.setShowTopicColumn(settingsPane.getShowTopicColumn()); gerritUpdatesNotificationComponent.handleConfigurationChange(); } @@ -116,6 +118,7 @@ public void reset() { settingsPane.setPushToGerrit(gerritSettings.getPushToGerrit()); settingsPane.setShowChangeNumberColumn(gerritSettings.getShowChangeNumberColumn()); settingsPane.setShowChangeIdColumn(gerritSettings.getShowChangeIdColumn()); + settingsPane.setShowTopicColumn(gerritSettings.getShowTopicColumn()); } } diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/SettingsPanel.form b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/SettingsPanel.form index 9fc8823a..15dcb54f 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/SettingsPanel.form +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/SettingsPanel.form @@ -3,7 +3,7 @@ - + @@ -100,7 +100,7 @@ - + @@ -191,6 +191,14 @@ + + + + + + + + diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/SettingsPanel.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/SettingsPanel.java index d8b9f932..4ca77734 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/SettingsPanel.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/SettingsPanel.java @@ -58,6 +58,7 @@ public class SettingsPanel { private JCheckBox pushToGerritCheckbox; private JCheckBox showChangeNumberColumnCheckBox; private JCheckBox showChangeIdColumnCheckBox; + private JCheckBox showTopicColumnCheckBox; private boolean passwordModified; @@ -228,6 +229,14 @@ public void setShowChangeIdColumn(final boolean showChangeIdColumn) { showChangeIdColumnCheckBox.setSelected(showChangeIdColumn); } + public boolean getShowTopicColumn() { + return showTopicColumnCheckBox.isSelected(); + } + + public void setShowTopicColumn(final boolean showTopicColumn) { + showTopicColumnCheckBox.setSelected(showTopicColumn); + } + public boolean isPasswordModified() { return passwordModified; } From ef224f086a7191786785e249bab14608130d80f7 Mon Sep 17 00:00:00 2001 From: Stephen Friedrich Date: Sun, 12 Feb 2017 17:11:29 +0100 Subject: [PATCH 08/21] Handle hyperlinks in gerrit change details, fixes #265 --- .../gerrit/ui/GerritChangeDetailsPanel.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritChangeDetailsPanel.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritChangeDetailsPanel.java index 0a4930c5..713384fb 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritChangeDetailsPanel.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritChangeDetailsPanel.java @@ -20,6 +20,7 @@ import com.google.common.collect.Lists; import com.google.gerrit.extensions.common.*; +import com.intellij.ide.BrowserUtil; import com.intellij.openapi.project.Project; import com.intellij.openapi.vcs.changes.issueLinks.IssueLinkHtmlRenderer; import com.intellij.ui.components.JBScrollPane; @@ -30,6 +31,8 @@ import org.jetbrains.annotations.NotNull; import javax.swing.*; +import javax.swing.event.HyperlinkEvent; +import javax.swing.event.HyperlinkListener; import java.awt.*; import java.text.DecimalFormat; import java.util.List; @@ -73,6 +76,12 @@ public GerritChangeDetailsPanel(final Project project) { jEditorPane.setPreferredSize(new Dimension(150, 100)); jEditorPane.setEditable(false); jEditorPane.setBackground(UIUtil.getComboBoxDisabledBackground()); + jEditorPane.addHyperlinkListener(new HyperlinkListener() { + @Override + public void hyperlinkUpdate(HyperlinkEvent e) { + GerritChangeDetailsPanel.this.handleHyperlinkEvent(e); + } + }); final JBScrollPane tableScroll = new JBScrollPane(jEditorPane); tableScroll.setBorder(null); @@ -105,6 +114,12 @@ public void setData(@NotNull final ChangeInfo changeInfo) { changeDetailsText(); } + private void handleHyperlinkEvent(HyperlinkEvent e) { + if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + BrowserUtil.browse(e.getURL()); + } + } + private void changeDetailsText() { if (presentationData.isReady()) { jEditorPane.setText(presentationData.getText()); From f6f84463b4353c37c6b47b9a1fa8aa9bf2f9fc3a Mon Sep 17 00:00:00 2001 From: Stephen Friedrich Date: Thu, 16 Feb 2017 22:44:28 +0100 Subject: [PATCH 09/21] Make "Project" column optional, fixes #268 --- .../plugin/gerrit/GerritSettings.java | 25 +++++++++++-- .../gerrit/ui/GerritChangeListPanel.java | 35 +++++++++++++++---- .../gerrit/ui/GerritSettingsConfigurable.java | 5 ++- .../plugin/gerrit/ui/GerritToolWindow.java | 1 + .../plugin/gerrit/ui/SettingsPanel.form | 28 +++++++++++++-- .../plugin/gerrit/ui/SettingsPanel.java | 12 +++++++ .../plugin/gerrit/ui/ShowProjectColumn.java | 18 ++++++++++ 7 files changed, 111 insertions(+), 13 deletions(-) create mode 100644 src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/ShowProjectColumn.java diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/GerritSettings.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/GerritSettings.java index c17ec532..22c5f02e 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/GerritSettings.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/GerritSettings.java @@ -27,13 +27,11 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.text.StringUtil; import com.urswolfer.gerrit.client.rest.GerritAuthData; +import com.urswolfer.intellij.plugin.gerrit.ui.ShowProjectColumn; import org.jdom.Element; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; -import java.util.Collection; - /** * Parts based on org.jetbrains.plugins.github.GithubSettings * @@ -60,6 +58,7 @@ public class GerritSettings implements PersistentStateComponent, Gerrit private static final String SHOW_CHANGE_NUMBER_COLUMN = "ShowChangeNumberColumn"; private static final String SHOW_CHANGE_ID_COLUMN = "ShowChangeIdColumn"; private static final String SHOW_TOPIC_COLUMN = "ShowTopicColumn"; + private static final String SHOW_PROJECT_COLUMN = "ShowProjectColumn"; private static final String GERRIT_SETTINGS_PASSWORD_KEY = "GERRIT_SETTINGS_PASSWORD_KEY"; private String login; @@ -72,6 +71,7 @@ public class GerritSettings implements PersistentStateComponent, Gerrit private boolean showChangeNumberColumn; private boolean showChangeIdColumn; private boolean showTopicColumn; + private ShowProjectColumn showProjectColumn; private Logger log; @@ -87,6 +87,7 @@ public Element getState() { element.setAttribute(SHOW_CHANGE_NUMBER_COLUMN, Boolean.toString(getShowChangeNumberColumn())); element.setAttribute(SHOW_CHANGE_ID_COLUMN, Boolean.toString(getShowChangeIdColumn())); element.setAttribute(SHOW_TOPIC_COLUMN, Boolean.toString(getShowTopicColumn())); + element.setAttribute(SHOW_PROJECT_COLUMN, getShowProjectColumn().name()); return element; } @@ -104,6 +105,7 @@ public void loadState(@NotNull final Element element) { setShowChangeNumberColumn(getBooleanValue(element, SHOW_CHANGE_NUMBER_COLUMN)); setShowChangeIdColumn(getBooleanValue(element, SHOW_CHANGE_ID_COLUMN)); setShowTopicColumn(getBooleanValue(element, SHOW_TOPIC_COLUMN)); + setShowProjectColumn(getShowProjectColumnValue(element, SHOW_PROJECT_COLUMN)); } catch (Exception e) { log.error("Error happened while loading gerrit settings: " + e); } @@ -127,6 +129,15 @@ private int getIntegerValue(Element element, String attributeName) { } } + private ShowProjectColumn getShowProjectColumnValue(Element element, String attributeName) { + String attributeValue = element.getAttributeValue(attributeName); + if (attributeValue != null) { + return ShowProjectColumn.valueOf(attributeValue); + } else { + return ShowProjectColumn.AUTO; + } + } + @Override @Nullable public String getLogin() { @@ -240,6 +251,14 @@ public boolean getShowTopicColumn() { return showTopicColumn; } + public ShowProjectColumn getShowProjectColumn() { + return showProjectColumn; + } + + public void setShowProjectColumn(ShowProjectColumn showProjectColumn) { + this.showProjectColumn = showProjectColumn; + } + public void setShowTopicColumn(boolean showTopicColumn) { this.showTopicColumn = showTopicColumn; } diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritChangeListPanel.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritChangeListPanel.java index 574f693f..024d809a 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritChangeListPanel.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritChangeListPanel.java @@ -50,6 +50,8 @@ import com.urswolfer.intellij.plugin.gerrit.SelectedRevisions; import com.urswolfer.intellij.plugin.gerrit.rest.LoadChangesProxy; import com.urswolfer.intellij.plugin.gerrit.util.GerritDataKeys; +import git4idea.GitUtil; +import git4idea.repo.GitRepositoryManager; import icons.Git4ideaIcons; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -86,6 +88,8 @@ public class GerritChangeListPanel extends JPanel implements TypeSafeDataProvide private GerritToolWindow gerritToolWindow; private LoadChangesProxy loadChangesProxy = null; + private Project project; + private volatile boolean loadingMoreChanges = false; private final JScrollPane scrollPane; @@ -134,6 +138,10 @@ public void consume(List changeInfos) { add(scrollPane); } + public void setProject(Project project) { + this.project = project; + } + @Override public void consume(LoadChangesProxy proxy) { loadChangesProxy = proxy; @@ -317,14 +325,19 @@ public String valueOf(ChangeInfo change) { } } ); - columnList.add( - new GerritChangeColumnInfo("Project", project.item) { - @Override - public String valueOf(ChangeInfo change) { - return getProject(change); + ShowProjectColumn showProjectColumn = gerritSettings.getShowProjectColumn(); + boolean listAllChanges = gerritSettings.getListAllChanges(); + if (showProjectColumn == ShowProjectColumn.ALWAYS + || (showProjectColumn == ShowProjectColumn.AUTO && (listAllChanges || hasProjectMultipleRepos()))) { + columnList.add( + new GerritChangeColumnInfo("Project", project.item) { + @Override + public String valueOf(ChangeInfo change) { + return getProject(change); + } } - } - ); + ); + } columnList.add( new GerritChangeColumnInfo("Branch", branch.item) { @Override @@ -356,6 +369,14 @@ public LabelInfo getLabelInfo(ChangeInfo change) { return columnList.toArray(new ColumnInfo[columnList.size()]); } + private boolean hasProjectMultipleRepos() { + if (project == null) { + return false; + } + GitRepositoryManager repositoryManager = GitUtil.getRepositoryManager(project); + return repositoryManager.getRepositories().size() > 1; + } + /** * Builds "Gerrit-like" short display of label: * Code-Review -> CR: collect first letter of every word part. diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritSettingsConfigurable.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritSettingsConfigurable.java index 9d9790d1..96a38d47 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritSettingsConfigurable.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritSettingsConfigurable.java @@ -76,7 +76,8 @@ public boolean isModified() { !Comparing.equal(gerritSettings.getPushToGerrit(), settingsPane.getPushToGerrit()) || !Comparing.equal(gerritSettings.getShowChangeNumberColumn(), settingsPane.getShowChangeNumberColumn()) || !Comparing.equal(gerritSettings.getShowChangeIdColumn(), settingsPane.getShowChangeIdColumn()) || - !Comparing.equal(gerritSettings.getShowTopicColumn(), settingsPane.getShowTopicColumn())); + !Comparing.equal(gerritSettings.getShowTopicColumn(), settingsPane.getShowTopicColumn())) || + !Comparing.equal(gerritSettings.getShowProjectColumn(), settingsPane.getShowProjectColumn()); } private boolean isPasswordModified() { @@ -99,6 +100,7 @@ public void apply() throws ConfigurationException { gerritSettings.setShowChangeNumberColumn(settingsPane.getShowChangeNumberColumn()); gerritSettings.setShowChangeIdColumn(settingsPane.getShowChangeIdColumn()); gerritSettings.setShowTopicColumn(settingsPane.getShowTopicColumn()); + gerritSettings.setShowProjectColumn(settingsPane.getShowProjectColumn()); gerritUpdatesNotificationComponent.handleConfigurationChange(); } @@ -119,6 +121,7 @@ public void reset() { settingsPane.setShowChangeNumberColumn(gerritSettings.getShowChangeNumberColumn()); settingsPane.setShowChangeIdColumn(gerritSettings.getShowChangeIdColumn()); settingsPane.setShowTopicColumn(gerritSettings.getShowTopicColumn()); + settingsPane.setShowProjectColumn(gerritSettings.getShowProjectColumn()); } } diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritToolWindow.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritToolWindow.java index 2f5390ad..cd4bb173 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritToolWindow.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritToolWindow.java @@ -67,6 +67,7 @@ public class GerritToolWindow { public SimpleToolWindowPanel createToolWindowContent(final Project project) { changeListPanel.registerChangeListPanel(this); + changeListPanel.setProject(project); diffManager.registerDiffTool(commentsDiffTool); SimpleToolWindowPanel panel = new SimpleToolWindowPanel(true, true); diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/SettingsPanel.form b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/SettingsPanel.form index 15dcb54f..9f19b90e 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/SettingsPanel.form +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/SettingsPanel.form @@ -3,7 +3,7 @@ - + @@ -100,7 +100,7 @@ - + @@ -199,6 +199,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/SettingsPanel.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/SettingsPanel.java index 4ca77734..3b2ce2a5 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/SettingsPanel.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/SettingsPanel.java @@ -23,6 +23,7 @@ import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.ui.EnumComboBoxModel; import com.intellij.ui.GuiUtils; import com.urswolfer.gerrit.client.rest.GerritAuthData; import com.urswolfer.intellij.plugin.gerrit.GerritSettings; @@ -59,6 +60,7 @@ public class SettingsPanel { private JCheckBox showChangeNumberColumnCheckBox; private JCheckBox showChangeIdColumnCheckBox; private JCheckBox showTopicColumnCheckBox; + private JComboBox showProjectColumnComboBox; private boolean passwordModified; @@ -126,6 +128,8 @@ public void actionPerformed(ActionEvent e) { updateAutomaticRefresh(); } }); + + showProjectColumnComboBox.setModel(new EnumComboBoxModel(ShowProjectColumn.class)); } public static void fixUrl(JTextField textField) { @@ -237,6 +241,14 @@ public void setShowTopicColumn(final boolean showTopicColumn) { showTopicColumnCheckBox.setSelected(showTopicColumn); } + public ShowProjectColumn getShowProjectColumn() { + return (ShowProjectColumn) showProjectColumnComboBox.getModel().getSelectedItem(); + } + + public void setShowProjectColumn(ShowProjectColumn showProjectColumn) { + showProjectColumnComboBox.getModel().setSelectedItem(showProjectColumn); + } + public boolean isPasswordModified() { return passwordModified; } diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/ShowProjectColumn.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/ShowProjectColumn.java new file mode 100644 index 00000000..a29f971d --- /dev/null +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/ShowProjectColumn.java @@ -0,0 +1,18 @@ +package com.urswolfer.intellij.plugin.gerrit.ui; + +public enum ShowProjectColumn { + ALWAYS("Always"), + AUTO("Automatic (if multiple git repositories)"), + NEVER("Never"); + + ShowProjectColumn(String label) { + this.label = label; + } + + private String label; + + @Override + public String toString() { + return label; + } +} From 064f840cb297f8318de125e64d0a597377499b48 Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Tue, 18 Apr 2017 21:33:08 +0200 Subject: [PATCH 10/21] prevent exception (and thus broken UI) when no revisions are available related to issue #247 --- .../urswolfer/intellij/plugin/gerrit/SelectedRevisions.java | 2 +- .../com/urswolfer/intellij/plugin/gerrit/rest/GerritUtil.java | 3 +++ .../plugin/gerrit/ui/GerritSelectRevisionInfoColumn.java | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/SelectedRevisions.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/SelectedRevisions.java index b2fb8f5c..08712030 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/SelectedRevisions.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/SelectedRevisions.java @@ -54,7 +54,7 @@ public String get(ChangeInfo changeInfo) { currentRevision = Iterables.getLast(revisionKeys); } } - return get(changeInfo.id).or(currentRevision); + return get(changeInfo.id).or(Optional.fromNullable(currentRevision)).orNull(); } public void put(String changeId, String revisionHash) { 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 8ad710c2..87d4078e 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 @@ -634,6 +634,9 @@ public FetchInfo getFirstFetchInfo(ChangeInfo changeDetails) { } public FetchInfo getFirstFetchInfo(RevisionInfo revisionInfo) { + if (revisionInfo == null) { + return null; + } return Iterables.getFirst(revisionInfo.fetch.values(), null); } diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritSelectRevisionInfoColumn.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritSelectRevisionInfoColumn.java index a20595e6..79875573 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritSelectRevisionInfoColumn.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/GerritSelectRevisionInfoColumn.java @@ -69,6 +69,9 @@ public GerritSelectRevisionInfoColumn() { @Override public String valueOf(ChangeInfo changeInfo) { String activeRevision = selectedRevisions.get(changeInfo); + if (activeRevision == null) { + return ""; + } RevisionInfo revisionInfo = changeInfo.revisions.get(activeRevision); return getRevisionLabelFunction(changeInfo).apply(Pair.create(activeRevision, revisionInfo)); } From 709efed1ea1bda8fe647f2113f24e5c10e449a70 Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Sat, 29 Apr 2017 14:24:57 +0200 Subject: [PATCH 11/21] update README - fix markdown links - update list of supported products --- README.md | 45 ++++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 59af4e8a..333c5b33 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ gerrit-intellij-plugin Introduction ----------- -Unofficial [IntelliJ Platform] plugin for the [Gerrit Code Review] tool. It supports any product based on the IntelliJ platform: +Unofficial [IntelliJ Platform](http://www.jetbrains.com/idea/) plugin for the +[Gerrit Code Review](https://www.gerritcodereview.com/) tool. It supports any product based on the IntelliJ platform: * IntelliJ IDEA * IntelliJ IDEA CE * RubyMine @@ -16,18 +17,15 @@ Unofficial [IntelliJ Platform] plugin for the [Gerrit Code Review] tool. It supp * PyCharm CE * AppCode * Android Studio -* 0xDBE +* DataGrip * CLion +* Gogland * Rider Only Gerrit 2.6 or newer is supported (missing / incomplete REST API in older versions). -[IntelliJ Platform]: http://www.jetbrains.com/idea/ -[Gerrit Code Review]: https://www.gerritcodereview.com/ - -You can install this plugin from the [IntelliJ Plugin Manager]. +You can install this plugin from the [IntelliJ Plugin Manager](http://plugins.jetbrains.com/plugin/7272). If you install this plugin directly in your IDE's plugin manager, you will get notified when a new release is available. -[IntelliJ Plugin Manager]: http://plugins.jetbrains.com/plugin/7272 ###### Pre-Releases If you want to get new releases earlier, you can subscribe to the release-candidate plugin channel: @@ -41,12 +39,10 @@ Your Support ------------ If you like this plugin, you can support it: * Spread it: Tell your friends who are using IntelliJ and Gerrit about this plugin (or even encourage them to use these fantastic products!) -* Vote for it: Write your review and vote for it at the [IntelliJ plugin repository]. -* Star it: [Star it at GitHub]. GitHub account required. +* Vote for it: Write your review and vote for it at the [IntelliJ plugin repository](http://plugins.jetbrains.com/plugin/7272). +* Star it: [Star it at GitHub](https://github.com/uwolfer/gerrit-intellij-plugin). GitHub account required. * Improve it: Report bugs or feature requests. Or even fix / implement them by yourself - everything is open source! * Donate: You can find donation-possibilities at the bottom of this file. -[IntelliJ plugin repository]: http://plugins.jetbrains.com/plugin/7272 -[Star it at GitHub]: https://github.com/uwolfer/gerrit-intellij-plugin Troubleshooting --------------- @@ -78,32 +74,27 @@ error or checking out does not properly finish, you can try to: * use SSH clone URL in checkout dialog (you can find the SSH URL in the Gerrit Web UI project settings) * or: check out with the default Git plugin and set up the Gerrit plugin manually afterwards -You can find background information about this issue in a [Gerrit mailing list topic]. -[Gerrit mailing list topic]: https://groups.google.com/forum/#!topic/repo-discuss/UnQd3HsL820 +You can find background information about this issue in a [Gerrit mailing list topic](https://groups.google.com/forum/#!topic/repo-discuss/UnQd3HsL820). ### Loading file-diff-list is slow Diff viewing is based on Git operations (i.e. it fetches the commit from the Gerrit remote). When loading the file list -takes a lot of time, you can run a local "[git gc]" and ask your Gerrit administrator to do run a "[gerrit gc]". -[git gc]: https://www.kernel.org/pub/software/scm/git/docs/git-gc.html -[gerrit gc]: https://gerrit-review.googlesource.com/Documentation/cmd-gc.html +takes a lot of time, you can run a local "[git gc](https://www.kernel.org/pub/software/scm/git/docs/git-gc.html)" +and ask your Gerrit administrator to do run a "[gerrit gc](https://gerrit-review.googlesource.com/Documentation/cmd-gc.html)". Architecture ------------ ### IntelliJ Integration -The plugin is integrated into the IntelliJ IDE with a [tool window]. -[tool window]: http://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+Tool+Windows +The plugin is integrated into the IntelliJ IDE with a [tool window](http://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+Tool+Windows). See package com.urswolfer.intellij.plugin.gerrit.ui. ### REST API -Most of the communication between the plugin and a Gerrit instance is based on the [Gerrit REST API]. -The REST specific part is available as [standalone implementation]. -[Gerrit REST API]: https://gerrit-review.googlesource.com/Documentation/rest-api.html -[standalone implementation]: https://github.com/uwolfer/gerrit-rest-java-client +Most of the communication between the plugin and a Gerrit instance is based on the [Gerrit REST API](https://gerrit-review.googlesource.com/Documentation/rest-api.html). +The REST specific part is available as [standalone implementation](https://github.com/uwolfer/gerrit-rest-java-client). See package com.urswolfer.intellij.plugin.gerrit.rest. ### Git -Some actions like comparing and listing files are based on Git operations. [IntelliJ Git4Idea] is used for these operations. -[IntelliJ Git4Idea]:http://git.jetbrains.org/?p=idea/community.git;a=tree;f=plugins/git4idea +Some actions like comparing and listing files are based on Git operations. +[IntelliJ Git4Idea](http://git.jetbrains.org/?p=idea/community.git;a=tree;f=plugins/git4idea) is used for these operations. See package com.urswolfer.intellij.plugin.gerrit.git. @@ -129,10 +120,10 @@ Credits Donations -------- -If you like this work, you can support it with [this donation link]. If you don't like Paypal -(Paypal takes 2.9% plus $0.30 per transaction fee from your donation), please contact me. +If you like this work, you can support it with +[this donation link](https://www.paypal.com/webscr?cmd=_s-xclick&hosted_button_id=8F2GZVBCVEDUQ). +If you don't like Paypal (Paypal takes 2.9% plus $0.30 per transaction fee from your donation), please contact me. Please only use the link from github.com/uwolfer/gerrit-intellij-plugin to verify that it is correct. -[this donation link]: https://www.paypal.com/webscr?cmd=_s-xclick&hosted_button_id=8F2GZVBCVEDUQ Copyright and license From b055da2694269abee47b8a0d0de4fca377bee47c Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Sat, 29 Apr 2017 14:34:57 +0200 Subject: [PATCH 12/21] update gerrit-rest-java-client to v0.8.12 --- build.gradle | 2 +- .../com/urswolfer/intellij/plugin/gerrit/GerritSettings.java | 5 +++++ .../intellij/plugin/gerrit/ui/action/ReviewAction.java | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index a7f69b14..1e17f6bc 100644 --- a/build.gradle +++ b/build.gradle @@ -47,7 +47,7 @@ dependencies { compile ('com.google.inject.extensions:guice-multibindings:4.0') { exclude group: 'com.google.guava', module: 'guava' } - compile ('com.urswolfer.gerrit.client.rest:gerrit-rest-java-client:0.8.8') { + compile ('com.urswolfer.gerrit.client.rest:gerrit-rest-java-client:0.8.12') { exclude group: 'com.google.code.gson', module: 'gson' exclude group: 'com.google.guava', module: 'guava' exclude group: 'commons-logging', module: 'commons-logging' diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/GerritSettings.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/GerritSettings.java index 22c5f02e..2eb5426b 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/GerritSettings.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/GerritSettings.java @@ -157,6 +157,11 @@ public String getPassword() { return StringUtil.notNullize(password); } + @Override + public boolean isHttpPassword() { + return false; + } + @Override public String getHost() { return host; diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/ReviewAction.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/ReviewAction.java index 636aa521..2729aaf2 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/ReviewAction.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/ReviewAction.java @@ -21,6 +21,7 @@ import com.google.common.base.Strings; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import com.google.gerrit.extensions.api.changes.NotifyHandling; import com.google.gerrit.extensions.api.changes.ReviewInput; import com.google.gerrit.extensions.common.ChangeInfo; import com.google.gerrit.extensions.common.CommentInfo; @@ -108,7 +109,7 @@ public void consume(Map> draftComments) { submitChange = dialog.getReviewPanel().getSubmitChange(); if (!dialog.getReviewPanel().getDoNotify()) { - reviewInput.notify = ReviewInput.NotifyHandling.NONE; + reviewInput.notify = NotifyHandling.NONE; } } From d4c6da8098d77a064e0920a8b630a43a5dc23791 Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Sat, 29 Apr 2017 14:36:58 +0200 Subject: [PATCH 13/21] update org.jetbrains.intellij plugin to v0.2.9 --- README.md | 2 +- build.gradle | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 333c5b33..62343d89 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ It's very easy to set it up as an IntelliJ project. 1. Activate plugins ```Gradle```, ```Plugin DevKit``` and ```UI Designer``` in IntelliJ. 2. ```git clone https://github.com/uwolfer/gerrit-intellij-plugin``` (probably switch to ```intellij{version}``` branch, but keep in mind that pull-requests should be against the default branch ("intellij13" and older are not supported anymore)) 3. Open checked out project in IntelliJ ("File" -> "New" -> "Project from Existing Sources" -> select file ```build.gradle``` in ```gerrit-intellij-plugin``` folder and press "OK") -4. Create a new run configuration: "Gradle" -> "Gradle project": select the only project -> "Tasks": "runIdea" +4. Create a new run configuration: "Gradle" -> "Gradle project": select the only project -> "Tasks": "runIde" 5. Press "Debug" button. IntelliJ should start with a clean workspace (development sandbox). You need to checkout a project to see changes (it shows only changes for Git repositories that are set up in current workspace by default). diff --git a/build.gradle b/build.gradle index 1e17f6bc..a3124fa1 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ */ plugins { - id 'org.jetbrains.intellij' version '0.1.10' + id 'org.jetbrains.intellij' version '0.2.9' } apply plugin: 'java' @@ -66,8 +66,8 @@ intellij { downloadSources Boolean.valueOf(downloadIdeaSources) plugins 'git4idea' - publish { - channel ijPluginRepoChannel + publishPlugin { + channels ijPluginRepoChannel username System.getenv('IJ_REPO_USERNAME') password System.getenv('IJ_REPO_PASSWORD') } From 16c0125834f7778b57ed9e2fa13d7f6cb2d61f32 Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Sat, 29 Apr 2017 14:37:40 +0200 Subject: [PATCH 14/21] update easymock to v3.4 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a3124fa1..8493e548 100644 --- a/build.gradle +++ b/build.gradle @@ -56,7 +56,7 @@ dependencies { compile 'org.javassist:javassist:3.19.0-GA' testCompile 'org.testng:testng:6.8.7' - testCompile 'org.easymock:easymock:3.2' + testCompile 'org.easymock:easymock:3.4' } intellij { From f096e8b8190a9e596a12a453ac8234ab0dd3aaa3 Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Sat, 29 Apr 2017 14:39:21 +0200 Subject: [PATCH 15/21] update testng to v6.8.21 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 8493e548..eafcf5b9 100644 --- a/build.gradle +++ b/build.gradle @@ -55,7 +55,7 @@ dependencies { } compile 'org.javassist:javassist:3.19.0-GA' - testCompile 'org.testng:testng:6.8.7' + testCompile 'org.testng:testng:6.8.21' testCompile 'org.easymock:easymock:3.4' } From 2ea096437ff1d539c7284c26edc16f635134523b Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Sat, 29 Apr 2017 14:43:17 +0200 Subject: [PATCH 16/21] update javassist to v3.21.0-GA --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index eafcf5b9..dc9ab0cd 100644 --- a/build.gradle +++ b/build.gradle @@ -53,7 +53,7 @@ dependencies { exclude group: 'commons-logging', module: 'commons-logging' exclude group: 'org.apache.httpcomponents', module: 'httpclient' } - compile 'org.javassist:javassist:3.19.0-GA' + compile 'org.javassist:javassist:3.21.0-GA' testCompile 'org.testng:testng:6.8.21' testCompile 'org.easymock:easymock:3.4' From f26e5836a0a832143cad9206dd8081ffb36b78f1 Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Sat, 29 Apr 2017 14:47:14 +0200 Subject: [PATCH 17/21] update guice to v4.1 --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index dc9ab0cd..8d9b503e 100644 --- a/build.gradle +++ b/build.gradle @@ -41,10 +41,10 @@ repositories { } dependencies { - compile ('com.google.inject:guice:4.0') { + compile ('com.google.inject:guice:4.1') { exclude group: 'com.google.guava', module: 'guava' } - compile ('com.google.inject.extensions:guice-multibindings:4.0') { + compile ('com.google.inject.extensions:guice-multibindings:4.1.0') { exclude group: 'com.google.guava', module: 'guava' } compile ('com.urswolfer.gerrit.client.rest:gerrit-rest-java-client:0.8.12') { From 7cb61ea2dba9f61fbc3cfd4a64a8ec20746b98e3 Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Wed, 28 Jun 2017 19:41:22 +0200 Subject: [PATCH 18/21] prevent NPE when change has no permitted labels - I cannot reproduce this issue, but got it as an exception report by several users --- .../intellij/plugin/gerrit/ui/action/ReviewActionGroup.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/ReviewActionGroup.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/ReviewActionGroup.java index 822bb343..b40d2991 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/ReviewActionGroup.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/ui/action/ReviewActionGroup.java @@ -85,8 +85,10 @@ public AnAction[] getChildren(@Nullable AnActionEvent anActionEvent) { } Map> permittedLabels = selectedChange.get().permittedLabels; List labels = Lists.newArrayList(); - for (Map.Entry> entry : permittedLabels.entrySet()) { - labels.add(createLabelGroup(entry)); + if (permittedLabels != null) { + for (Map.Entry> entry : permittedLabels.entrySet()) { + labels.add(createLabelGroup(entry)); + } } return labels.toArray(new AnAction[labels.size()]); } From ee736c4ffc02af52d512cc5997c03b9f389a88f6 Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Wed, 28 Jun 2017 20:01:51 +0200 Subject: [PATCH 19/21] bump version to v1.0.0-140 --- gradle.properties | 2 +- src/main/resources/META-INF/plugin.xml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 12e9a031..ae97b47a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ ideaVersion=IC-14.0.4 ijPluginRepoChannel= downloadIdeaSources=false -version=0.9.9.1-140 +version=1.0.0-140 javaVersion=1.6 diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index e799b566..354444e3 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. +
  • 1.0.0
  • +
      +
    • add columns "Project" and "Topic" (optional) (thanks to eekboom)
    • +
    • handle hyperlinks in change details (thanks to eekboom)
    • +
    • minor fixes and improvements
    • +
  • 0.9.9.1
    • fix compatibility with IntelliJ 2016.3 EAP (tool window is blank)
    • From 3bdff677d846b2682a6d4fd577169ca3c0e024c7 Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Wed, 28 Jun 2017 20:46:28 +0200 Subject: [PATCH 20/21] fix NPE when starting clean IDEA (without settings) --- .../com/urswolfer/intellij/plugin/gerrit/GerritSettings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/urswolfer/intellij/plugin/gerrit/GerritSettings.java b/src/main/java/com/urswolfer/intellij/plugin/gerrit/GerritSettings.java index 2eb5426b..2e3d824c 100644 --- a/src/main/java/com/urswolfer/intellij/plugin/gerrit/GerritSettings.java +++ b/src/main/java/com/urswolfer/intellij/plugin/gerrit/GerritSettings.java @@ -71,7 +71,7 @@ public class GerritSettings implements PersistentStateComponent, Gerrit private boolean showChangeNumberColumn; private boolean showChangeIdColumn; private boolean showTopicColumn; - private ShowProjectColumn showProjectColumn; + private ShowProjectColumn showProjectColumn = ShowProjectColumn.AUTO; private Logger log; From c513c5fd218cf99380de0e9e4794087b6892a0c0 Mon Sep 17 00:00:00 2001 From: Urs Wolfer Date: Wed, 28 Jun 2017 20:46:50 +0200 Subject: [PATCH 21/21] bump version to v1.0.0.1-140 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index ae97b47a..090a2d57 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ ideaVersion=IC-14.0.4 ijPluginRepoChannel= downloadIdeaSources=false -version=1.0.0-140 +version=1.0.0.1-140 javaVersion=1.6