Package edu.umd.cs.findbugs.cloud

Examples of edu.umd.cs.findbugs.cloud.Cloud


        }
        return in;
    }

    public void clearCloud() {
        Cloud oldCloud = cloud;
        IGuiCallback callback = project.getGuiCallback();
        if (oldCloud != null) {
            callback.unregisterCloud(project, this, oldCloud);
            oldCloud.shutdown();
        }
        cloud = null;
    }
View Full Code Here


        cloud = null;
    }

    @Override
    public @Nonnull Cloud reinitializeCloud() {
        Cloud oldCloud = cloud;
        IGuiCallback callback = project.getGuiCallback();
        if (oldCloud != null) {
            callback.unregisterCloud(project, this, oldCloud);
            oldCloud.shutdown();
        }
        cloud = null;
        @Nonnull Cloud newCloud = getCloud();
        assert newCloud == cloud;
        assert cloud != null;
        assert cloud.isInitialized();
        if (bugsPopulated ) {
            cloud.bugsPopulated();
View Full Code Here

        }
    }

    protected void signInOrOutClicked() {
        if (_bugCollection != null) {
            final Cloud cloud = _bugCollection.getCloud();
            if (cloud.getPlugin().getId().equals("edu.umd.cs.findbugs.cloud.doNothingCloud")) {
                changeClicked();
            }
            SigninState state = cloud.getSigninState();
            if (state == SigninState.SIGNED_IN) {
                backgroundExecutor.execute(new Runnable() {
                    @Override
                    public void run() {
                        cloud.signOut();
                        refresh();
                    }
                });
                refresh();
            } else if (state.couldSignIn()) {
                backgroundExecutor.execute(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            cloud.signIn();
                        } catch (Exception e) {
                            _bugCollection
                            .getProject()
                            .getGuiCallback()
                            .showMessageDialog(
View Full Code Here

    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;
    }
View Full Code Here

                String oldValue = bug.getUserDesignationKey();
                String key = designationKey;
                if (key.equals(oldValue)) {
                    return;
                }
                Cloud plugin = _bugCollection != null ? _bugCollection.getCloud() : null;
                if (plugin != null && key.equals("I_WILL_FIX") && plugin.supportsClaims()) {
                    String claimedBy = plugin.claimedBy(bug);
                    if (claimedBy != null && !plugin.getUser().equals(claimedBy)) {
                        int result = JOptionPane.showConfirmDialog(null,
                                bug.getMessage() + "\n"
                                        + claimedBy + " has already said they will fix this issue\n"
                                        + "Do you want to also be listed as fixing this issue?\n"
                                        + "If so, please coordinate with " + claimedBy,
View Full Code Here

            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();
                }
            });
View Full Code Here

        updateCloudListeners(_bugCollection);
        refresh();
    }

    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);
        }
    }
View Full Code Here

        }
    }


    private boolean inCloud(Collection<BugInstance> bugs) {
        final Cloud cloud = _bugCollection.getCloud();

        for (BugInstance b : bugs) {
            if (cloud.isInCloud(b)) {
                return true;
            }
        }
        return false;
View Full Code Here

            cloudReportPane.setText("");
            titleLabel.setText("<html>Reviews");
            return;
        }
        updateHeader();
        final Cloud cloud = _bugCollection.getCloud();
        final CloudPlugin plugin = cloud.getPlugin();
        String details = plugin.getDetails();
        cloudDetailsLabel.setText(details);

        if (bugs.isEmpty()) {
            setCanAddComments(false, false);
            return;
        }

        String report;
        long lastSaved = -1;
        if (bugs.size() > 1) {
            int totalReviews = 0;
            int bugsWithReviews = 0;
            for (BugInstance bug : bugs) {
                long newTs = cloud.getUserTimestamp(bug);
                if (bug.hasSomeUserAnnotation() && newTs > 0 && (lastSaved == -1 || lastSaved < newTs)) {
                    lastSaved = newTs;
                }
                int reviewers = cloud.getNumberReviewers(bug);
                if (reviewers > 0) {
                    bugsWithReviews++;
                }
                totalReviews += reviewers;
            }
            report = bugs.size() + " bug" + (bugs.size() == 1 ? "" : "s") + " selected\n";
            report += bugsWithReviews + " reviewed bug" + (bugsWithReviews == 1 ? "" : "s")
                    + " / " + totalReviews + " total review" + (totalReviews == 1 ? "" : "s");
        } else {
            BugInstance bug = bugs.get(0);
            if (bug.hasSomeUserAnnotation()) {
                lastSaved = bug.getUserTimestamp();
            }
            report = cloud.getCloudReportWithoutMe(bug);
        }
        setLastSaved(lastSaved);
        cloudReportPane.setText(report);
        CommentInfo commentInfo = new CommentInfo().invoke();
        boolean sameText = commentInfo.isSameText();
        String txt = commentInfo.getTxt();
        CardLayout cl = (CardLayout) (cards.getLayout());
        HashSet<BugInstance> newBugSet = new HashSet<BugInstance>(bugs);
        boolean sameBugs = newBugSet.equals(lastBugsEdited);
        if (!sameBugs) {
            lastBugsEdited = newBugSet;
            clickedBulkReview = false;
        }
        if (!inCloud(bugs)) {
            cl.show(cards, "NOT_IN_CLOUD");
        } else if (bugs.size() > 1 && !clickedBulkReview) {
            warningLabel.setText("<HTML>" + bugs.size() + " bugs are selected.<BR>Click to review them all at once.");
            cl.show(cards, "WARNING");
        } else {
            cl.show(cards, "COMMENTS");
        }
        if (!sameText) {
            txt = MessageFormat.format(MSG_OVERWRITE_REVIEW, bugs.size());
            setDefaultComment(txt);
        } else {
            if (txt == null || txt.trim().length() == 0) {
                txt = bugs.size() > 1 ? MessageFormat.format(MSG_REVIEW_MULTI, bugs.size()) : MSG_REVIEW;
                setDefaultComment(txt);
            } else {
                resetCommentBoxFont();
                setCommentText(txt);
            }
        }

        setCanAddComments(cloud.canStoreUserAnnotation(bugs.get(0)), false);
        updateSaveButton();
    }
View Full Code Here

    }

    private boolean updatingHeader = false;

    private void updateHeader() {
        final Cloud cloud = _bugCollection.getCloud();
        CloudPlugin plugin = cloud.getPlugin();
        if (hasSelectedBugs()) {
            CommentInfo commentInfo = new CommentInfo().invoke();
            boolean sameDesignation = commentInfo.isSameDesignation();
            String designation = commentInfo.getDesignation();
            if (!sameDesignation) {
                designation = null;
            }
            updatingHeader = true;
            designationCombo.setSelectedIndex(I18N.instance().getUserDesignationKeys(true).indexOf(designation));
            updatingHeader = false;
            setCanAddComments(true, true);
        } else {
            setCanAddComments(false, false);
        }

        final Cloud.SigninState state = cloud.getSigninState();
        final String stateStr = state == Cloud.SigninState.NO_SIGNIN_REQUIRED ? "" : "" + state;
        final String userStr = cloud.getUser() == null ? "" : cloud.getUser();
        if (plugin.getId().equals("edu.umd.cs.findbugs.cloud.doNothingCloud")) {
            titleLabel.setText("<html><b>No cloud selected");
        } else {
            titleLabel.setText("<html><b>Reviews - " + cloud.getCloudName() + "</b>"
                    + "<br><font style='font-size: x-small;color:darkgray'>" + stateStr
                    + (userStr.length() > 0 ? " - " + userStr : ""));
        }
        switch (state) {
        case NO_SIGNIN_REQUIRED:
        case SIGNING_IN:
            signInOutLink.setVisible(false);
            break;
        case SIGNED_IN:
            setSignInOutText("sign out");
            signInOutLink.setVisible(true);
            break;
        default:
            if (state.couldSignIn()) {
                setSignInOutText("sign in");
                signInOutLink.setVisible(true);
            }
            break;
        }
        if (cloud.getPlugin().getId().equals("edu.umd.cs.findbugs.cloud.doNothingCloud")) {
            setSignInOutText("enable cloud plugin...");
            signInOutLink.setVisible(true);
        }
    }
View Full Code Here

TOP

Related Classes of edu.umd.cs.findbugs.cloud.Cloud

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.