Package edu.umd.cs.findbugs.cloud

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


    @Override
    protected void showCloudChooser(List<CloudPlugin> plugins, List<String> descriptions) {
        JPopupMenu popup = new JPopupMenu();
        for (int i = 0; i < plugins.size(); i++) {
            final CloudPlugin plugin = plugins.get(i);
            String id = _bugCollection.getCloud().getPlugin().getId();
            String thisid = plugin.getId();
            boolean selected = id.equals(thisid);
            JRadioButtonMenuItem item = new JRadioButtonMenuItem(descriptions.get(i), selected);
            item.setToolTipText(plugin.getDetails());
            item.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    changeCloud(plugin.getId());
                }
            });
            popup.add(item);
        }
        popup.show(signInOutLink, 0, signInOutLink.getHeight() + 5);
View Full Code Here


        if (selectedValue != null) {
          final int index = descriptions.indexOf(selectedValue);
          if (index == -1) {
            LOGGER.error("Error - not found - '" + selectedValue + "' among " + descriptions);
          } else {
            final CloudPlugin newPlugin = plugins.get(index);
            final String newCloudId = newPlugin.getId();
            changeCloud(newCloudId);
          }
        }
        return super.onChosen(selectedValue, finalChoice);
      }
View Full Code Here

            XMLAttributeList pluginAttributeList = new XMLAttributeList();
            pluginAttributeList.addAttribute(PLUGIN_ID_ATTRIBUTE_NAME, plugin.getPluginId());
            pluginAttributeList.addAttribute(PLUGIN_STATUS_ELEMENT_NAME, enabled.toString());
            xmlOutput.openCloseTag(PLUGIN_ELEMENT_NAME, pluginAttributeList);
        }
        CloudPlugin cloudPlugin = bugCollection == null ? null : CloudFactory.getCloudPlugin(bugCollection);
        if (cloudPlugin != null) {
            String id = cloudPlugin.getId();
            if (id == null) {
                id = cloudId;
            }
            xmlOutput.startTag(CLOUD_ELEMENT_NAME);
            xmlOutput.addAttribute(CLOUD_ID_ATTRIBUTE_NAME, id);
            boolean onlineCloud = cloudPlugin.isOnline();
            xmlOutput.addAttribute("online", Boolean.toString(onlineCloud));
            String url = cloudPlugin.getProperties().getProperty("cloud.detailsUrl");
            if (url != null) {
                xmlOutput.addAttribute("detailsUrl", url);
            }
            xmlOutput.stopTag(false);
            for (Map.Entry<?,?> e : cloudProperties.entrySet()) {
View Full Code Here

                String key = node.valueOf("@key");
                String value = node.getText().trim();
                properties.setProperty(key, value);
            }

            CloudPlugin cloudPlugin = new CloudPluginBuilder().setFindbugsPluginId(plugin.getPluginId()).setCloudid(cloudId).setClassLoader(classLoader)
                    .setCloudClass(cloudClass).setUsernameClass(usernameClass).setHidden(hidden).setProperties(properties)
                    .setDescription(description).setDetails(details).setOnlineStorage(onlineStorage).createCloudPlugin();
            plugin.addCloudPlugin(cloudPlugin);
        }
View Full Code Here

                cloudSelector.addItem(c);
            }
        }

        if (cloudId != null) {
            CloudPlugin c = DetectorFactoryCollection.instance().getRegisteredClouds().get(project.getCloudId());
            cloudSelector.setSelectedItem(c);
        }
        JPanel buttons = new JPanel();
        buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
        if (MainFrameHelper.isMacLookAndFeel()) {
            buttons.add(Box.createHorizontalStrut(5));
            buttons.add(cancelButton);
            buttons.add(Box.createHorizontalStrut(5));
            buttons.add(finishButton);
        } else {
            buttons.add(Box.createHorizontalStrut(5));
            buttons.add(finishButton);
            buttons.add(Box.createHorizontalStrut(5));
            buttons.add(cancelButton);
        }
        finishButton.addActionListener(new ActionListener() {
            boolean keepGoing = false;

            private boolean displayWarningAndAskIfWeShouldContinue(String msg, String title) {
                if (keepGoing) {
                    return true;
                }
                boolean result = JOptionPane.showConfirmDialog(NewProjectWizard.this, msg, title, JOptionPane.OK_CANCEL_OPTION,
                        JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION;
                if (result) {
                    keepGoing = true;
                }
                return result;

            }

            @Override
            public void actionPerformed(ActionEvent evt) {

                if (displayWarnings()) {
                    return;
                }
                Project p;
                String oldCloudId = null;
                p = project;
                oldCloudId = project.getCloudId();
                p.setGuiCallback(MainFrame.getInstance().getGuiCallback());
                clearProjectSettings(p);


                // Now that p is cleared, we can add in all the correct files.
                for (int i = 0; i < analyzeModel.getSize(); i++) {
                    p.addFile(analyzeModel.get(i));
                }
                for (int i = 0; i < auxModel.getSize(); i++) {
                    p.addAuxClasspathEntry(auxModel.get(i));
                }
                for (int i = 0; i < sourceModel.getSize(); i++) {
                    p.addSourceDir(sourceModel.get(i));
                }
                p.setProjectName(projectName.getText());
                CloudPlugin cloudPlugin = (CloudPlugin) cloudSelector.getSelectedItem();
                String newCloudId;
                if (cloudPlugin == null || cloudSelector.getSelectedIndex() == 0) {
                    newCloudId = null;
                } else {
                    newCloudId = cloudPlugin.getId();
                }
                p.setCloudId(newCloudId);

                MainFrame mainFrame = MainFrame.getInstance();
                if (keepGoing) {
View Full Code Here

    static class CloudComboBoxRenderer extends BasicComboBoxRenderer {
        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            CloudPlugin plugin = (CloudPlugin) value;
            if (isSelected) {
                setBackground(list.getSelectionBackground());
                setForeground(list.getSelectionForeground());
                if (-1 < index) {
                    if (plugin == null) {
                        list.setToolTipText("No cloud plugin specified by project");
                    } else {
                        list.setToolTipText(plugin.getDetails());
                    }
                }
            } else {
                setBackground(list.getBackground());
                setForeground(list.getForeground());
            }
            setFont(list.getFont());
            setText((value == null) ? "<default>" : plugin.getDescription());
            return this;
        }
View Full Code Here

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

            workspaceSettingsTab.performOK();
        }

        IProject eclipseProj = getProject();
        if (eclipseProj != null) {
            CloudPlugin item = clouds.get(cloudCombo.getSelectionIndex());
            if (item != null) {
                currentUserPreferences.setCloudId(item.getId());

                SortedBugCollection collection = FindbugsPlugin.getBugCollectionIfSet(eclipseProj);
                if (collection != null) {
                    Project fbProject = collection.getProject();
                    if (fbProject != null && !item.getId().equals(fbProject.getCloudId())) {
                        fbProject.setCloudId(item.getId());
                        collection.reinitializeCloud();
                        IWorkbenchPage page = FindbugsPlugin.getActiveWorkbenchWindow().getActivePage();
                        if (page != null) {
                            IViewPart view = page.findView(FindbugsPlugin.TREE_VIEW_ID);
                            if (view instanceof CommonNavigator) {
View Full Code Here

TOP

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

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.