From d9bd735b8ac15bd86e71d2695e54dba6fdd279b8 Mon Sep 17 00:00:00 2001 From: Michael Keppler Date: Sun, 10 Sep 2023 08:25:20 +0200 Subject: [PATCH] Fix configuration transformation jobs * Job names are end user visible in the Eclipse UI, therefore just taking some unique identifier without meaning is not correct. * Always initialize the progress reporting, even if there is nothing to count. * add icon via job family registration --- .../src/net/sf/eclipsecs/core/Messages.java | 4 ++++ .../core/jobs/TransformCheckstyleRulesJob.java | 15 ++++++++++++--- .../core/jobs/TransformFormatterRulesJob.java | 18 ++++++++++++++---- .../net/sf/eclipsecs/core/messages.properties | 2 ++ 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/net.sf.eclipsecs.core/src/net/sf/eclipsecs/core/Messages.java b/net.sf.eclipsecs.core/src/net/sf/eclipsecs/core/Messages.java index f05dafbb5..c40d15b99 100644 --- a/net.sf.eclipsecs.core/src/net/sf/eclipsecs/core/Messages.java +++ b/net.sf.eclipsecs.core/src/net/sf/eclipsecs/core/Messages.java @@ -110,5 +110,9 @@ private Messages() { public static String PartsOpenedJob_title; + public static String TransformCheckstyleRulesJob_name; + + public static String TransformFormatterRulesJob_name; + // CHECKSTYLE:ON } diff --git a/net.sf.eclipsecs.core/src/net/sf/eclipsecs/core/jobs/TransformCheckstyleRulesJob.java b/net.sf.eclipsecs.core/src/net/sf/eclipsecs/core/jobs/TransformCheckstyleRulesJob.java index bc4289f7e..485699718 100644 --- a/net.sf.eclipsecs.core/src/net/sf/eclipsecs/core/jobs/TransformCheckstyleRulesJob.java +++ b/net.sf.eclipsecs.core/src/net/sf/eclipsecs/core/jobs/TransformCheckstyleRulesJob.java @@ -31,6 +31,7 @@ import java.util.List; import net.sf.eclipsecs.core.CheckstylePlugin; +import net.sf.eclipsecs.core.Messages; import net.sf.eclipsecs.core.config.CheckstyleConfigurationFile; import net.sf.eclipsecs.core.config.ICheckConfiguration; import net.sf.eclipsecs.core.config.configtypes.IContextAware; @@ -46,6 +47,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubMonitor; import org.xml.sax.InputSource; /** @@ -66,14 +68,15 @@ public class TransformCheckstyleRulesJob extends WorkspaceJob { * The current selected project in the workspace. */ public TransformCheckstyleRulesJob(final IProject project) { - super("transformCheckstyle"); + super(Messages.TransformCheckstyleRulesJob_name); this.mProject = project; } @Override - public IStatus runInWorkspace(final IProgressMonitor arg0) throws CoreException { - + public IStatus runInWorkspace(final IProgressMonitor monitor) throws CoreException { + SubMonitor subMonitor = SubMonitor.convert(monitor); + subMonitor.setWorkRemaining(IProgressMonitor.UNKNOWN); try { final IProjectConfiguration conf = ProjectConfigurationFactory.getConfiguration(mProject); @@ -135,4 +138,10 @@ private static void recurseConfiguration(Configuration module, List