Skip to content

Commit a7e2c88

Browse files
committed
Formatting, whitespace, checkstyle
1 parent 3d47661 commit a7e2c88

26 files changed

+1742
-1602
lines changed
Lines changed: 60 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
package net.sourceforge.pmd.eclipse.ui.actions;
21

3-
import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
4-
import net.sourceforge.pmd.eclipse.ui.views.ViolationOverview;
2+
package net.sourceforge.pmd.eclipse.ui.actions;
53

64
import org.eclipse.jface.action.IAction;
75
import org.eclipse.jface.viewers.ISelection;
@@ -10,65 +8,69 @@
108
import org.eclipse.ui.IViewPart;
119
import org.eclipse.ui.IWorkbenchPart;
1210
import org.eclipse.ui.IWorkbenchPartSite;
11+
12+
import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
13+
import net.sourceforge.pmd.eclipse.ui.views.ViolationOverview;
14+
1315
/**
1416
*
1517
* @author Brian Remedios
1618
*/
1719
public abstract class AbstractUIAction implements IObjectActionDelegate {
1820

19-
private IWorkbenchPart targetPart;
20-
21-
protected AbstractUIAction() {
22-
}
23-
24-
protected IWorkbenchPart targetPart() {
25-
return targetPart;
26-
}
27-
28-
/**
29-
* @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction,
30-
* org.eclipse.ui.IWorkbenchPart)
31-
*/
32-
public void setActivePart(IAction action, IWorkbenchPart theTargetPart) {
33-
targetPart = theTargetPart;
34-
}
35-
36-
protected boolean isViewPart() {
37-
return targetPart instanceof IViewPart;
38-
}
39-
40-
protected boolean isEditorPart() {
41-
return targetPart instanceof IEditorPart;
42-
}
43-
44-
protected boolean isViolationOverview() {
45-
return targetPart instanceof ViolationOverview;
46-
}
47-
48-
protected String targetPartClassName() {
49-
return targetPart.getClass().getName();
50-
}
51-
52-
protected IWorkbenchPartSite targetPartSite() {
53-
return targetPart.getSite();
54-
}
55-
56-
protected ISelection targetSelection() {
57-
return targetPartSite().getSelectionProvider().getSelection();
58-
}
59-
60-
/**
61-
* Helper method to return an NLS string from its key
62-
*/
63-
protected String getString(String key) {
64-
return PMDPlugin.getDefault().getStringTable().getString(key);
65-
}
66-
67-
protected void showErrorById(String errorId, Throwable th) {
68-
PMDPlugin.getDefault().showError(getString(errorId), th);
69-
}
70-
71-
protected void logError(String message, Throwable error) {
72-
PMDPlugin.getDefault().logError(message, error);
73-
}
21+
private IWorkbenchPart targetPart;
22+
23+
protected AbstractUIAction() {
24+
}
25+
26+
protected IWorkbenchPart targetPart() {
27+
return targetPart;
28+
}
29+
30+
/**
31+
* @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction,
32+
* org.eclipse.ui.IWorkbenchPart)
33+
*/
34+
public void setActivePart(IAction action, IWorkbenchPart theTargetPart) {
35+
targetPart = theTargetPart;
36+
}
37+
38+
protected boolean isViewPart() {
39+
return targetPart instanceof IViewPart;
40+
}
41+
42+
protected boolean isEditorPart() {
43+
return targetPart instanceof IEditorPart;
44+
}
45+
46+
protected boolean isViolationOverview() {
47+
return targetPart instanceof ViolationOverview;
48+
}
49+
50+
protected String targetPartClassName() {
51+
return targetPart.getClass().getName();
52+
}
53+
54+
protected IWorkbenchPartSite targetPartSite() {
55+
return targetPart.getSite();
56+
}
57+
58+
protected ISelection targetSelection() {
59+
return targetPartSite().getSelectionProvider().getSelection();
60+
}
61+
62+
/**
63+
* Helper method to return an NLS string from its key
64+
*/
65+
protected String getString(String key) {
66+
return PMDPlugin.getDefault().getStringTable().getString(key);
67+
}
68+
69+
protected void showErrorById(String errorId, Throwable th) {
70+
PMDPlugin.getDefault().showError(getString(errorId), th);
71+
}
72+
73+
protected void logError(String message, Throwable error) {
74+
PMDPlugin.getDefault().logError(message, error);
75+
}
7476
}

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/actions/CPDCheckProjectAction.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,6 @@
22

33
import java.util.Iterator;
44

5-
import name.herlin.command.CommandException;
6-
import net.sourceforge.pmd.cpd.CSVRenderer;
7-
import net.sourceforge.pmd.cpd.LanguageFactory;
8-
import net.sourceforge.pmd.cpd.Renderer;
9-
import net.sourceforge.pmd.cpd.SimpleRenderer;
10-
import net.sourceforge.pmd.cpd.XMLRenderer;
11-
import net.sourceforge.pmd.eclipse.runtime.PMDRuntimeConstants;
12-
import net.sourceforge.pmd.eclipse.runtime.cmd.DetectCutAndPasteCmd;
13-
import net.sourceforge.pmd.eclipse.ui.PMDUiConstants;
14-
import net.sourceforge.pmd.eclipse.ui.dialogs.CPDCheckDialog;
15-
import net.sourceforge.pmd.eclipse.ui.nls.StringKeys;
16-
import net.sourceforge.pmd.eclipse.ui.views.cpd2.CPDView2;
17-
185
import org.apache.log4j.Logger;
196
import org.eclipse.core.resources.IProject;
207
import org.eclipse.core.runtime.IAdaptable;
@@ -28,6 +15,20 @@
2815
import org.eclipse.ui.IWorkbenchPartSite;
2916
import org.eclipse.ui.PartInitException;
3017

18+
import net.sourceforge.pmd.cpd.CSVRenderer;
19+
import net.sourceforge.pmd.cpd.LanguageFactory;
20+
import net.sourceforge.pmd.cpd.Renderer;
21+
import net.sourceforge.pmd.cpd.SimpleRenderer;
22+
import net.sourceforge.pmd.cpd.XMLRenderer;
23+
import net.sourceforge.pmd.eclipse.runtime.PMDRuntimeConstants;
24+
import net.sourceforge.pmd.eclipse.runtime.cmd.DetectCutAndPasteCmd;
25+
import net.sourceforge.pmd.eclipse.ui.PMDUiConstants;
26+
import net.sourceforge.pmd.eclipse.ui.dialogs.CPDCheckDialog;
27+
import net.sourceforge.pmd.eclipse.ui.nls.StringKeys;
28+
import net.sourceforge.pmd.eclipse.ui.views.cpd2.CPDView2;
29+
30+
import name.herlin.command.CommandException;
31+
3132
/**
3233
* Process CPD action menu. Run CPD against the selected project.
3334
*
@@ -37,7 +38,7 @@
3738
*
3839
*/
3940
public class CPDCheckProjectAction extends AbstractUIAction {
40-
private static final Logger log = Logger.getLogger(CPDCheckProjectAction.class);
41+
private static final Logger LOG = Logger.getLogger(CPDCheckProjectAction.class);
4142

4243
private static final String XML_KEY = "XML";
4344
private static final String SIMPLE_KEY = "Simple Text";
@@ -53,9 +54,9 @@ public void run(final IAction action) { // NOPMD:UnusedFormalParameter
5354
final String[] languages = LanguageFactory.supportedLanguages;
5455

5556
final String[] formats = {
56-
SIMPLE_KEY,
57-
XML_KEY,
58-
CSV_KEY
57+
SIMPLE_KEY,
58+
XML_KEY,
59+
CSV_KEY,
5960
};
6061

6162
final CPDCheckDialog dialog = new CPDCheckDialog(shell, languages, formats);
@@ -70,14 +71,14 @@ public void run(final IAction action) { // NOPMD:UnusedFormalParameter
7071
final IProject project = (IProject) adaptable.getAdapter(IProject.class);
7172

7273
if (project == null) {
73-
log.warn("The selected object cannot adapt to a project");
74-
log.debug(" -> selected object : " + obj);
74+
LOG.warn("The selected object cannot adapt to a project");
75+
LOG.debug(" -> selected object : " + obj);
7576
} else {
7677
this.detectCutAndPaste(project, dialog);
7778
}
7879
} else {
79-
log.warn("The selected object is not adaptable");
80-
log.debug(" -> selected object : " + obj);
80+
LOG.warn("The selected object is not adaptable");
81+
LOG.debug(" -> selected object : " + obj);
8182
}
8283
}
8384
}
@@ -99,7 +100,6 @@ public void selectionChanged(final IAction action, final ISelection selection) {
99100
* @throws CommandException
100101
*/
101102
private void detectCutAndPaste(final IProject project, CPDCheckDialog dialog) {
102-
103103
final String selectedLanguage = dialog.getSelectedLanguage();
104104
final int tilesize = dialog.getTileSize();
105105
final boolean createReport = dialog.isCreateReportSelected();
@@ -133,7 +133,7 @@ private CPDView2 showView() {
133133
final IWorkbenchPage workbenchPage = targetPartSite().getPage();
134134
view = (CPDView2) workbenchPage.showView(PMDUiConstants.ID_CPDVIEW2);
135135
} catch (PartInitException pie) {
136-
logError( getString(StringKeys.ERROR_VIEW_EXCEPTION), pie);
136+
logError(getString(StringKeys.ERROR_VIEW_EXCEPTION), pie);
137137
}
138138
return view;
139139
}

0 commit comments

Comments
 (0)