2323import java .io .FileNotFoundException ;
2424
2525import net .sf .eclipsecs .core .CheckstylePlugin ;
26+ import net .sf .eclipsecs .core .Messages ;
2627import net .sf .eclipsecs .core .transformer .FormatterConfigParser ;
2728import net .sf .eclipsecs .core .transformer .FormatterConfiguration ;
2829import net .sf .eclipsecs .core .transformer .FormatterTransformer ;
3435import org .eclipse .core .runtime .IProgressMonitor ;
3536import org .eclipse .core .runtime .IStatus ;
3637import org .eclipse .core .runtime .Status ;
38+ import org .eclipse .core .runtime .SubMonitor ;
3739
3840/**
3941 * Job who starts transforming the formatter-rules to checkstyle-settings.
@@ -47,18 +49,20 @@ public class TransformFormatterRulesJob extends WorkspaceJob {
4749 * Job for transforming formatter-rules to checkstyle-settings.
4850 */
4951 public TransformFormatterRulesJob () {
50- super ("transformFormatter" );
52+ super (Messages . TransformFormatterRulesJob_name );
5153 }
5254
5355 @ Override
54- public IStatus runInWorkspace (final IProgressMonitor arg0 ) throws CoreException {
56+ public IStatus runInWorkspace (final IProgressMonitor monitor ) throws CoreException {
57+ SubMonitor subMonitor = SubMonitor .convert (monitor );
58+ subMonitor .setWorkRemaining (IProgressMonitor .UNKNOWN );
5559
5660 // TODO this way of loading formatter profiles is very dubious, to say
5761 // the least, refer to FormatterConfigWriter for a better API
5862 final String workspace = ResourcesPlugin .getWorkspace ().getRoot ().getLocation ().toString ();
5963
6064 final String configLocation = workspace
61- + "/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" ;
65+ + "/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" ; //$NON-NLS-1$
6266
6367 FormatterConfigParser parser = null ;
6468
@@ -75,7 +79,7 @@ public IStatus runInWorkspace(final IProgressMonitor arg0) throws CoreException
7579
7680 try {
7781 FormatterTransformer transformer = new FormatterTransformer (rules );
78- transformer .transformRules (workspace + "/test-checkstyle.xml" );
82+ transformer .transformRules (workspace + "/test-checkstyle.xml" ); //$NON-NLS-1$
7983 } catch (CheckstylePluginException ex ) {
8084 Status status = new Status (IStatus .ERROR , CheckstylePlugin .PLUGIN_ID , IStatus .ERROR ,
8185 ex .getMessage (), ex );
@@ -84,4 +88,10 @@ public IStatus runInWorkspace(final IProgressMonitor arg0) throws CoreException
8488
8589 return Status .OK_STATUS ;
8690 }
91+
92+ @ Override
93+ public boolean belongsTo (Object family ) {
94+ return AbstractCheckJob .CHECKSTYLE_JOB_FAMILY .equals (family ) || super .belongsTo (family );
95+ }
96+
8797}
0 commit comments