private RepositoryChangesBrowser createRepositoryChangesBrowser(final Project project) { TableView<ChangeInfo> table = changeListPanel.getTable(); RepositoryChangesBrowser repositoryChangesBrowser = new RepositoryChangesBrowser( project, Collections.<CommittedChangeList>emptyList(), Collections.<Change>emptyList(), null); repositoryChangesBrowser .getDiffAction() .registerCustomShortcutSet(CommonShortcuts.getDiff(), table); repositoryChangesBrowser .getViewer() .setScrollPaneBorder(IdeBorderFactory.createBorder(SideBorder.LEFT | SideBorder.TOP)); changeListPanel.addListSelectionListener( new Consumer<ChangeInfo>() { @Override public void consume(ChangeInfo changeInfo) { changeSelected(changeInfo, project); } }); return repositoryChangesBrowser; }
private void reloadChanges(Project project, boolean requestSettingsIfNonExistent) { final List<ChangeInfo> commits = getChanges(project, requestSettingsIfNonExistent); changeListPanel.setChanges(commits); // if there are no changes at all, there is no point to check if new notifications should be // displayed if (!commits.isEmpty()) { handleNotification(project); } }
@Override public void createToolWindowContent(final Project project, ToolWindow toolWindow) { Component component = toolWindow.getComponent(); changeListPanel = new GerritChangeListPanel(Lists.<ChangeInfo>newArrayList(), null); SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true); ActionToolbar toolbar = createToolbar(); toolbar.setTargetComponent(changeListPanel); panel.setToolbar(toolbar.getComponent()); myRepositoryChangesBrowser = createRepositoryChangesBrowser(project); myDetailsSplitter = new Splitter(true, 0.6f); myDetailsSplitter.setShowDividerControls(true); changeListPanel.setBorder( IdeBorderFactory.createBorder(SideBorder.TOP | SideBorder.RIGHT | SideBorder.BOTTOM)); myDetailsSplitter.setFirstComponent(changeListPanel); myDetailsPanel = new GerritChangeDetailsPanel(project); JPanel details = myDetailsPanel.getComponent(); details.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP | SideBorder.RIGHT)); myDetailsSplitter.setSecondComponent(details); Splitter myHorizontalSplitter = new Splitter(false, 0.7f); myHorizontalSplitter.setShowDividerControls(true); myHorizontalSplitter.setFirstComponent(myDetailsSplitter); myHorizontalSplitter.setSecondComponent(myRepositoryChangesBrowser); panel.setContent(myHorizontalSplitter); component.getParent().add(panel); reloadChanges(project, false); setupRefreshTask(project); }