private boolean inCloud(Collection<BugInstance> bugs) { final Cloud cloud = _bugCollection.getCloud(); for (BugInstance b : bugs) { if (cloud.isInCloud(b)) { return true; } } return false; }
private @CheckForNull Cloud getCloud() { MainFrame instance = MainFrame.getInstance(); BugCollection bugCollection = instance.getBugCollection(); if (bugCollection == null) { return null; } return bugCollection.getCloud(); }
@Override public boolean isAvailable(MainFrame mf) { BugCollection bugCollection = mf.getBugCollection(); if (bugCollection == null) { return false; } return bugCollection.getCloud().getMode() == Mode.COMMUNAL; } },
@Override public void unregisterCloud(Project project, BugCollection collection, Cloud plugin) { assert collection.getCloud() == plugin; if (MainFrame.this.bugCollection == collection) { plugin.removeListener(userAnnotationListener); plugin.removeStatusListener(cloudStatusListener); } }
public boolean canSetDesignations() { List<BugInstance> bugs = getSelectedBugs(); if (bugs.isEmpty()) { return true; } Cloud plugin = _bugCollection != null ? _bugCollection.getCloud() : null; if (plugin == null) { return false; } for(BugInstance b : bugs) { if (plugin.canStoreUserAnnotation(b)) { return true; } } return false; }
@Override public void actionPerformed(ActionEvent arg0) { Cloud cloud = getBugCollection().getCloud(); if (cloud instanceof DoNothingCloud) { JOptionPane.showMessageDialog(MainFrame.this, "No cloud selected; enable and select optional Bug Collection XML Pseudo-Cloud plugin to store designations in XML"); } else if (comments.canSetDesignations()) { comments.setDesignation(key); } else { JOptionPane.showMessageDialog(MainFrame.this, "The currently selected cloud cannot store these designations"); } } });
@Override public boolean show(MainFrame mf, BugInstance b) { Cloud cloud = mf.getBugCollection().getCloud(); if (!cloud.isInCloud(b)) { return false; } long firstSeen = cloud.getFirstSeen(b); long time = System.currentTimeMillis() - firstSeen; long days = TimeUnit.SECONDS.convert(time, TimeUnit.MILLISECONDS) / 3600 / 24; return days < this.maxDays; }
public void displayCloudReport() { Cloud cloud = this.bugCollection.getCloud(); cloud.waitUntilIssueDataDownloaded(); StringWriter stringWriter = new StringWriter(); PrintWriter writer = new PrintWriter(stringWriter); cloud.printCloudSummary(writer, getDisplayedBugs(), viewFilter.getPackagePrefixes()); writer.close(); String report = stringWriter.toString(); DisplayNonmodelMessage.displayNonmodelMessage("Cloud summary", report, this, false); }
private void updateCloudListeners(BugCollection newBugCollection) { final Cloud newCloud = newBugCollection == null ? null : newBugCollection.getCloud(); if (_bugCollection != null) { //noinspection ObjectEquality if (lastCloud != newCloud) { if (lastCloud != null) { lastCloud.removeStatusListener(_cloudStatusListener); } } } if (lastCloud != newCloud && newCloud != null) { lastCloud = newCloud; newCloud.addStatusListener(_cloudStatusListener); } }
public void setUserDesignationKey(String key, @CheckForNull BugCollection bugCollection) { BugDesignation userDesignation = key.length() > 0 ? getNonnullUserDesignation() : getUserDesignation(); if (userDesignation == null) { return; } if (userDesignation.getDesignationKey().equals(key)) { return; } userDesignation.setDesignationKey(key); Cloud plugin = bugCollection != null ? bugCollection.getCloud() : null; if (plugin != null) { plugin.storeUserAnnotation(this); } }
@Override public boolean show(MainFrame mf, BugInstance b) { Cloud c = mf.getBugCollection().getCloud(); return c.isInCloud(b) && show(c, b); }
@Override public boolean show(MainFrame mf, BugInstance b) { Cloud c = mf.getBugCollection().getCloud(); return c.isInCloud(b) && show(c, b); }
private String updateCloudSigninStatus(String msg) { if (getBugCollection() != null) { Cloud cloud = getBugCollection().getCloud(); String pluginMsg = cloud.getStatusMsg(); if (pluginMsg != null && pluginMsg.length() > 1) { msg = join(msg, pluginMsg); } } return msg; }
@Override public void run() { _bugCollection.reinitializeCloud(); Cloud cloud = _bugCollection.getCloud(); if (cloud != null) { cloud.waitUntilIssueDataDownloaded(); } updateCloudListeners(_bugCollection); refresh(); } });
/** * @param bug * @return */ private long getFirstSeen(BugInstance bug) { BugCollection bugCollection = MainFrame.getInstance().getBugCollection(); long firstSeen = bugCollection.getCloud().getFirstSeen(bug); return firstSeen; }
@Override public String getFrom(BugInstance bug) { BugCollection bugCollection = MainFrame.getInstance().getBugCollection(); return bugCollection.getCloud().getConsensusDesignation(bug).name(); }
@Override public String getFrom(BugInstance bug) { BugCollection bugCollection = MainFrame.getInstance().getBugCollection(); Cloud cloud = bugCollection.getCloud(); assert cloud != null; BugFilingStatus status = cloud.getBugLinkStatus(bug); if (status == BugFilingStatus.VIEW_BUG) { String bugStatus = cloud.getBugStatus(bug); if (bugStatus != null) { return bugStatus; } } return CONSENSUS.getFrom(bug); }
protected void changeCloud(String newCloudId) { final String oldCloudId = _bugCollection.getCloud().getPlugin().getId(); if (!oldCloudId.equals(newCloudId)) { _bugCollection.getProject().setCloudId(newCloudId); MainFrame.getInstance().setProjectChanged(true); backgroundExecutor.execute(new Runnable() { @Override public void run() { _bugCollection.reinitializeCloud(); Cloud cloud = _bugCollection.getCloud(); if (cloud != null) { cloud.waitUntilIssueDataDownloaded(); } updateCloudListeners(_bugCollection); refresh(); } }); refresh(); } }
private void addLink(JComponent component, URL source) { this.sourceLink = source; component.setEnabled(true); if (!listenerAdded) { listenerAdded = true; component.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { URL u = sourceLink; if (u != null) { LaunchBrowser.showDocument(u); } } }); } component.setCursor(new Cursor(Cursor.HAND_CURSOR)); Cloud plugin = mainFrame.getBugCollection().getCloud(); if (plugin != null) { component.setToolTipText(plugin.getSourceLinkToolTip(null)); } }