Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add disable option in Preferences #212

Open
RichMacDonald opened this issue Jul 23, 2024 · 3 comments
Open

Add disable option in Preferences #212

RichMacDonald opened this issue Jul 23, 2024 · 3 comments

Comments

@RichMacDonald
Copy link

RichMacDonald commented Jul 23, 2024

PMD continues to operate in the background in Eclipse even when it isn't "being used". I know this because I can see items in the Error log that are pmd-related.

Every Eclipse developer knows the cycle of installing a "fresh eclipse" with no plugins, gradually adding plugins over time, eclipse becoming sluggish, then repeating the cycle.

Is it possible to add a button to the main PMD preferences tab that "turns it off"? That would be much better than installing and uninstalling PMD every few months for a code review.

@adangel
Copy link
Member

adangel commented Jul 25, 2024

PMD can be run automatically, whenever the project is built or when a file is saved.

You can disable, that PMD is executed automatically, if a file is saved in "Window > Preferences > PMD: Check code after saving".

If Eclipse builds your projects automatically (Menu "Project > Build automatically" is enabled), then PMD will be executed, if it is enabled for the project. You can disable PMD for a single project via "Project Properties > PMD: Enable PMD". You can still run PMD manually, e.g. via context menu of a project "PMD > Check code".

Does this help?

@RichMacDonald
Copy link
Author

Thank you. I will give this a try.

The "Project > Build automatically" is concerning because most developers will keep this turned on. However, I see that the projects all default to "Enable PMD"=false. Is that sufficient to disable PMD even when "build automatically" is enabled? I think your answer was "yes".

What does "enable using java project build path" do? I cannot find documentation.

@RichMacDonald
Copy link
Author

Even with "everything turned off", it isn't. Even when I am not doing anything with PMD (i.e., simply writing java code), I see issues in the Error Log:

org.eclipse.core.internal.resources.ResourceException(/vaadin_mri/src/main/java/com/mri/ui/components/builder/CometAssociationLinkBuilder.java)[376]: java.lang.IllegalStateException
	at org.eclipse.core.internal.resources.Marker.checkInfo(Marker.java:63)
	at org.eclipse.core.internal.resources.Marker.getType(Marker.java:214)
	at net.sourceforge.pmd.eclipse.ui.properties.MarkerPropertyTester.test(MarkerPropertyTester.java:23)
	at org.eclipse.core.internal.expressions.Property.test(Property.java:65)
	at org.eclipse.core.expressions.TestExpression.evaluate(TestExpression.java:107)
	at org.eclipse.core.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:54)
	at org.eclipse.core.internal.expressions.AdaptExpression.evaluate(AdaptExpression.java:121)
	at org.eclipse.core.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:54)
	at org.eclipse.core.internal.expressions.IterateExpression.evaluate(IterateExpression.java:202)
	at org.eclipse.core.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:54)
	at org.eclipse.core.expressions.WithExpression.evaluate(WithExpression.java:84)
	at org.eclipse.ui.internal.services.EvaluationReference.evaluate(EvaluationReference.java:76)
	at org.eclipse.ui.internal.services.EvaluationReference.evaluate(EvaluationReference.java:106)
	at org.eclipse.ui.internal.services.EvaluationReference.changed(EvaluationReference.java:100)
	at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:105)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:358)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.set(EclipseContext.java:374)
	at org.eclipse.ui.internal.services.EvaluationService$1.changed(EvaluationService.java:78)
	at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:105)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:358)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.set(EclipseContext.java:374)
	at org.eclipse.ui.internal.e4.compatibility.SelectionService.updateSelection(SelectionService.java:156)
	at org.eclipse.ui.internal.WorkbenchPage$E4PartListener.partActivated(WorkbenchPage.java:212)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl$2.run(PartServiceImpl.java:250)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.firePartActivated(PartServiceImpl.java:247)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:780)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:686)
	at org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer.activate(AbstractPartRenderer.java:95)
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.lambda$28(StackRenderer.java:1164)
	at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:84)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:265)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4285)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1160)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1184)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1169)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:841)
	at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3259)
	at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1898)
	at org.eclipse.swt.custom.CTabFolder.lambda$0(CTabFolder.java:333)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4285)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1160)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4083)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3673)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:152)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:639)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:546)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:143)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:439)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:271)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1481)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants