package de.retest.recheck.review.ignore;

import de.retest.recheck.ignore.ShouldIgnore;
import de.retest.recheck.review.ignore.IgnoreCommentLoader.ShouldIgnoreComment;
import de.retest.recheck.review.ignore.io.Loader;
import de.retest.recheck.ui.descriptors.Element;
import de.retest.recheck.ui.diff.AttributeDifference;

public class IgnoreCommentLoader implements Loader<ShouldIgnoreComment> {

	public static class ShouldIgnoreComment implements ShouldIgnore {

		private final String comment;

		public ShouldIgnoreComment( final String comment ) {
			this.comment = comment;
		}

		@Override
		public boolean shouldIgnoreElement( final Element element ) {
			return false;
		}

		@Override
		public boolean shouldIgnoreAttributeDifference( final Element element,
				final AttributeDifference attributeDifference ) {
			return false;
		}

		@Override
		public String toString() {
			return "# " + comment;
		}
	}

	@Override
	public boolean canLoad( final String line ) {
		return line.trim().startsWith( "#" );
	}

	@Override
	public ShouldIgnoreComment load( final String line ) {
		return new ShouldIgnoreComment( line.replaceFirst( "#", "" ).trim() );
	}

	@Override
	public String save( final ShouldIgnoreComment ignore ) {
		return ignore.toString();
	}
}

@@ -458,16 +458,73 @@
 nore %7B%0A%0A
+%09%09public static final String SINGLE_LINE_COMMENT = %22#%22;%0A%0A
 %09%09privat
@@ -948,15 +948,8 @@
 turn
- %22# %22 +
  com
@@ -950,24 +950,24 @@
 rn comment;%0A
+
 %09%09%7D%0A%09%7D%0A%0A%09@Ov
@@ -1038,15 +1038,8 @@
 ine.
-trim().
 star
@@ -1046,19 +1046,55 @@
 tsWith( 
-%22#%22
+ShouldIgnoreComment.SINGLE_LINE_COMMENT
  );%0A%09%7D%0A%0A
@@ -1152,32 +1152,32 @@
 String line ) %7B%0A
+
 %09%09return new Sho
@@ -1202,39 +1202,8 @@
 line
-.replaceFirst( %22#%22, %22%22 ).trim()
  );%0A

Simplify ignore comment