Search in sources :

Example 1 with CPDView2

use of net.sourceforge.pmd.eclipse.ui.views.cpd2.CPDView2 in project pmd-eclipse-plugin by pmd.

the class CPDCheckProjectAction method showView.

/**
 * Shows the view.
 * @param matches
 */
private CPDView2 showView() {
    CPDView2 view = null;
    try {
        final IWorkbenchPage workbenchPage = targetPartSite().getPage();
        view = (CPDView2) workbenchPage.showView(PMDUiConstants.ID_CPDVIEW2);
    } catch (PartInitException pie) {
        logError(getString(StringKeys.ERROR_VIEW_EXCEPTION), pie);
    }
    return view;
}
Also used : CPDView2(net.sourceforge.pmd.eclipse.ui.views.cpd2.CPDView2) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException)

Example 2 with CPDView2

use of net.sourceforge.pmd.eclipse.ui.views.cpd2.CPDView2 in project pmd-eclipse-plugin by pmd.

the class CPDCheckProjectAction method detectCutAndPaste.

/**
 * Run the DetectCutAndPaste command against the selected project
 * and creates optionally the report file.
 *
 * @param project a project
 * @param dialog the object of the dialog with the selected values
 * @throws CommandException
 */
private void detectCutAndPaste(final IProject project, CPDCheckDialog dialog) {
    final String selectedLanguage = dialog.getSelectedLanguage();
    final int tilesize = dialog.getTileSize();
    final boolean createReport = dialog.isCreateReportSelected();
    final Renderer selectedRenderer = this.createRenderer(dialog.getSelectedFormat());
    final String fileName = this.createFileName(dialog.getSelectedFormat());
    final CPDView2 view = showView();
    try {
        final DetectCutAndPasteCmd detectCmd = new DetectCutAndPasteCmd();
        detectCmd.setProject(project);
        detectCmd.setCreateReport(createReport);
        detectCmd.setLanguage(selectedLanguage);
        detectCmd.setMinTileSize(tilesize);
        detectCmd.setRenderer(selectedRenderer);
        detectCmd.setReportName(fileName);
        detectCmd.setUserInitiated(true);
        detectCmd.addPropertyListener(view);
        detectCmd.performExecute();
    } catch (CommandException e) {
        logError(getString(StringKeys.ERROR_PMD_EXCEPTION), e);
    }
}
Also used : CPDView2(net.sourceforge.pmd.eclipse.ui.views.cpd2.CPDView2) DetectCutAndPasteCmd(net.sourceforge.pmd.eclipse.runtime.cmd.DetectCutAndPasteCmd) XMLRenderer(net.sourceforge.pmd.cpd.XMLRenderer) CSVRenderer(net.sourceforge.pmd.cpd.CSVRenderer) Renderer(net.sourceforge.pmd.cpd.Renderer) SimpleRenderer(net.sourceforge.pmd.cpd.SimpleRenderer) CommandException(name.herlin.command.CommandException)

Aggregations

CPDView2 (net.sourceforge.pmd.eclipse.ui.views.cpd2.CPDView2)2 CommandException (name.herlin.command.CommandException)1 CSVRenderer (net.sourceforge.pmd.cpd.CSVRenderer)1 Renderer (net.sourceforge.pmd.cpd.Renderer)1 SimpleRenderer (net.sourceforge.pmd.cpd.SimpleRenderer)1 XMLRenderer (net.sourceforge.pmd.cpd.XMLRenderer)1 DetectCutAndPasteCmd (net.sourceforge.pmd.eclipse.runtime.cmd.DetectCutAndPasteCmd)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 PartInitException (org.eclipse.ui.PartInitException)1