Package org.codinjutsu.tools.jenkins.model

Examples of org.codinjutsu.tools.jenkins.model.Job


    }


    @Override
    public String getUrl() {
        Job job = browserPanel.getSelectedJob();
        return job.getLastBuild().getUrl();
    }
View Full Code Here


    }


    @Override
    public void update(AnActionEvent event) {
        Job job = browserPanel.getSelectedJob();
        event.getPresentation().setVisible(job != null
                && job.getLastBuild() != null
                && !job.isInQueue());
    }
View Full Code Here

        browserPanel.setAsFavorite(selectedJobs);
    }

    @Override
    public void update(AnActionEvent event) {
        Job selectedJob = browserPanel.getSelectedJob();
        event.getPresentation().setVisible(selectedJob != null && !browserPanel.isAFavoriteJob(selectedJob.getName()));
    }
View Full Code Here

    public void actionPerformed(AnActionEvent event) {
        Project project = ActionUtil.getProject(event);

        final BrowserPanel browserPanel = BrowserPanel.getInstance(project);
        try {
            Job job = browserPanel.getSelectedJob();

            RequestManager requestManager = browserPanel.getJenkinsManager();
            if (job.hasParameters()) {
                BuildParamDialog.showDialog(job, JenkinsAppSettings.getSafeInstance(project), requestManager, new BuildParamDialog.RunBuildCallback() {

                    public void notifyOnOk(Job job) {
                        notifyOnGoingMessage(job);
                    }

                    public void notifyOnError(Job job, Exception ex) {
                        browserPanel.notifyErrorJenkinsToolWindow("Build '" + job.getName() + "' cannot be run: " + ex.getMessage());
                    }
                });
            } else {
                requestManager.runBuild(job, JenkinsAppSettings.getSafeInstance(project));
                notifyOnGoingMessage(job);
View Full Code Here

        }
    }

    @Override
    public void update(AnActionEvent event) {
        Job selectedJob = browserPanel.getSelectedJob();
        event.getPresentation().setVisible(selectedJob != null && selectedJob.isBuildable());
    }
View Full Code Here

        browserPanel.removeFavorite(selectedJobs);
    }

    @Override
    public void update(AnActionEvent event) {
        Job selectedJob = browserPanel.getSelectedJob();
        event.getPresentation().setVisible(selectedJob != null && browserPanel.isAFavoriteJob(selectedJob.getName()));
    }
View Full Code Here

        String message = "";
        final BrowserPanel browserPanel = BrowserPanel.getInstance(project);

        try {
            Job job = browserPanel.getSelectedJob();

            RequestManager requestManager = browserPanel.getJenkinsManager();

            if (job.hasParameters()) {
                if (job.hasParameter(PARAMETER_NAME)) {

                    JenkinsAppSettings settings = JenkinsAppSettings.getSafeInstance(project);

                    final VirtualFile virtualFile =
                        prepareFile(browserPanel, FileChooser.chooseFile(
                                browserPanel,
                                new FileChooserDescriptor(true, false, false, false, false, false))
                        , settings, job);

                    if ((null != virtualFile)) {
                        if (virtualFile.exists()) {
                            Map<String, VirtualFile> files = new HashMap<String, VirtualFile>();
                            files.put(PARAMETER_NAME, virtualFile);
                            requestManager.runBuild(job, settings, files);
                            notifyOnGoingMessage(job);
                            browserPanel.loadSelectedJob();
                        } else {
                            message = String.format("File \"%s\" not exists", virtualFile.getPath());
                        }
                    }
                } else {
                    message = String.format("Job \"%s\" should has parameter with name \"%s\"", job.getName(), PARAMETER_NAME);

                }
            } else {
                message = String.format("Job \"%s\" has no parameters", job.getName());
            }

        } catch (Exception e) {
            message = String.format("Build cannot be run: " + e.getMessage());
            e.printStackTrace();
View Full Code Here

        return file;
    }

    @Override
    public void update(AnActionEvent event) {
        Job selectedJob = browserPanel.getSelectedJob();
        event.getPresentation().setEnabled(selectedJob != null && selectedJob.hasParameters() && selectedJob.hasParameter(PARAMETER_NAME));
    }
View Full Code Here

        try {
            if (createPatch()) {
                RequestManager requestManager = browserPanel.getJenkinsManager();
                String selectedJobName = (String) jobsList.getSelectedItem();
                if (selectedJobName != null && !selectedJobName.isEmpty()) {
                    Job selectedJob = browserPanel.getJob(selectedJobName);
                    if (selectedJob != null) {
                        if (selectedJob.hasParameters()) {
                            if (selectedJob.hasParameter(UploadPatchToJob.PARAMETER_NAME)) {
                                JenkinsAppSettings settings = JenkinsAppSettings.getSafeInstance(project);
                                Map<String, VirtualFile> files = new HashMap<String, VirtualFile>();
                                VirtualFile virtualFile = UploadPatchToJob.prepareFile(browserPanel, LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(FILENAME)), settings, selectedJob);
                                if (virtualFile != null && virtualFile.exists()) {
                                    files.put(UploadPatchToJob.PARAMETER_NAME, virtualFile);
                                    requestManager.runBuild(selectedJob, settings, files);
                                    //browserPanel.loadSelectedJob();
                                    browserPanel.notifyInfoJenkinsToolWindow(HtmlUtil.createHtmlLinkMessage(
                                        selectedJob.getName() + " build is on going",
                                        selectedJob.getUrl())
                                    );

                                    watchJob(browserPanel, selectedJob);

                                } else {
                                    throw new ConfigurationException(String.format("File \"%s\" not found", virtualFile.getPath()));
                                }
                            } else {
                                throw new ConfigurationException(String.format("Job \"%s\" should has parameter with name \"%s\"", selectedJob.getName(), UploadPatchToJob.PARAMETER_NAME));
                            }
                        } else {
                            throw new ConfigurationException(String.format("Job \"%s\" has no parameters", selectedJob.getName()));
                        }
                    }
                }
            }
        } catch (Exception e) {
View Full Code Here

            append(buildLabel(jenkins), SimpleTextAttributes.REGULAR_ITALIC_ATTRIBUTES);
            setToolTipText(jenkins.getServerUrl());
            setIcon(SERVER_ICON);

        } else if (userObject instanceof Job) {
            Job job = (Job) node.getUserObject();

            append(buildLabel(job), getAttribute(job));

            setToolTipText(job.findHealthDescription());
            if (isFavoriteJob(job)) {
                setIcon(new CompositeIcon(job.getStateIcon(), job.getHealthIcon(), FAVORITE_ICON));
            } else {
                setIcon(new CompositeIcon(job.getStateIcon(), job.getHealthIcon()));
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.codinjutsu.tools.jenkins.model.Job

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.