Bug 535242 - Refactor CompilationUnitRewriteOperationsFix

- split CompilationUnitRewriteOperationsFix into
  CompilationUnitRewriteOperationsFixCore in jdt.core.manipulation
  and have CompilationUnitRewriteOperationsFix extend it and
  implement ILinkedFix
- move AbstractFix, and IProposableFix as well, but
  change IProposableFix to depend on new
  ICleanUpFixCore class (essentially copy of ICleanUpFix)
- create a core version of ILinkedFix called ILinkedFixCore
  in jdt.core.manipulation and have AbstractFix refer to it
  instead of ILinkedFix
- create new ICleanUpFixCore and ICleanUpCore interfaces to be
  used in place of ICleanUpFix and ICleanUp public interfaces
- move CompilationUnitChange, CompilationUnitRewrite,
  ContextSensitiveImportRewriteContext, FixMessages,
  ImportRemover, RedundantNullnessTypeAnnotationsFilter,
  RefactoringASTParser, and RefactoringCoreMessages
- split CleanUpConstants into two classes: CleanUpConstants
  which resides in jdt.core.manipulation and only contains
  static constant values and CleanUpConstantsOptions which
  extends CleanUpConstants and implements methods that manipulate
  the IPreferenceStore
- copy CleanUpRequirements, CleanUpOptions, and CleanUpContext
  to jdt.core.manipulation/corext and have the jdt.ui public
  versions use an instance of their internal counterpart
  to perform the logic
- modify the various users of above classes in jdt.ui

Change-Id: Iaf63c45d282c6902bc230a56bbad590bea66bb47
Signed-off-by: Jeff Johnston <jjohnstn@redhat.com>
diff --git a/org.eclipse.jdt.core.manipulation/META-INF/MANIFEST.MF b/org.eclipse.jdt.core.manipulation/META-INF/MANIFEST.MF
index db12e16..6370d56 100644
--- a/org.eclipse.jdt.core.manipulation/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core.manipulation/META-INF/MANIFEST.MF
@@ -24,9 +24,12 @@
  org.eclipse.jdt.internal.core.manipulation.search;x-friends:="org.eclipse.jdt.ui,org.eclipse.jdt.text.tests",
  org.eclipse.jdt.internal.core.manipulation.util;x-friends:="org.eclipse.jdt.junit,org.eclipse.jdt.text.tests,org.eclipse.jdt.ui",
  org.eclipse.jdt.internal.core.refactoring.descriptors;x-friends:="org.eclipse.jdt.ui",
+ org.eclipse.jdt.internal.corext.codemanipulation;x-friends:="org.eclipse.jdt.ui",
  org.eclipse.jdt.internal.corext.dom;manipulation=split;mandatory:=manipulation;x-friends:="org.eclipse.jdt.ui,org.eclipse.jdt.junit",
  org.eclipse.jdt.internal.corext.fix;x-friends:="org.eclipse.jdt.ui",
+ org.eclipse.jdt.internal.corext.refactoring;x-friends:="org.eclipse.jdt.ui",
  org.eclipse.jdt.internal.corext.refactoring.changes;manipulation=split;mandatory:=manipulation;x-friends:="org.eclipse.jdt.ui.examples.javafamily,org.eclipse.jdt.ui",
+ org.eclipse.jdt.internal.corext.refactoring.structure;x-friends:="org.eclipse.jdt.ui",
  org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types;manipulation=split;mandatory:=manipulation;x-friends:="org.eclipse.jdt.ui",
  org.eclipse.jdt.internal.corext.refactoring.util;manipulation=split;mandatory:=manipulation;x-friends:="org.eclipse.jdt.ui",
  org.eclipse.jdt.internal.corext.template.java;manipulation=split;mandatory:=manipulation;x-friends:="org.eclipse.jdt.ui",
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/ContextSensitiveImportRewriteContext.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/codemanipulation/ContextSensitiveImportRewriteContext.java
similarity index 99%
rename from org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/ContextSensitiveImportRewriteContext.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/codemanipulation/ContextSensitiveImportRewriteContext.java
index 711573e..1a289a5 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/ContextSensitiveImportRewriteContext.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/codemanipulation/ContextSensitiveImportRewriteContext.java
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - moved to jdt.core.manipulation
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.codemanipulation;
 
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/RedundantNullnessTypeAnnotationsFilter.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/codemanipulation/RedundantNullnessTypeAnnotationsFilter.java
similarity index 99%
rename from org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/RedundantNullnessTypeAnnotationsFilter.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/codemanipulation/RedundantNullnessTypeAnnotationsFilter.java
index 4dcb357..10eef0a 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/RedundantNullnessTypeAnnotationsFilter.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/codemanipulation/RedundantNullnessTypeAnnotationsFilter.java
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     Till Brychcy - initial API and implementation
+ *     Red Hat Inc. - refactored to jdt.core.manipulation
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.codemanipulation;
 
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/AbstractFix.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/AbstractFix.java
similarity index 83%
rename from org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/AbstractFix.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/AbstractFix.java
index de90f06..41a00ab 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/AbstractFix.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/AbstractFix.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,13 +7,14 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - moved to jdt.core.manipulation and modified
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.fix;
 
 import org.eclipse.core.runtime.IStatus;
 
 
-public abstract class AbstractFix implements IProposableFix, ILinkedFix {
+public abstract class AbstractFix implements IProposableFix, ILinkedFixCore {
 
 	private final String fDisplayString;
 
@@ -32,7 +33,7 @@
 	}
 
 	@Override
-	public LinkedProposalModel getLinkedPositions() {
+	public LinkedProposalModelCore getLinkedPositionsCore() {
 		return null;
 	}
 
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstants.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstants.java
similarity index 74%
rename from org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstants.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstants.java
index f1be858..3b839b4 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstants.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstants.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -8,23 +8,12 @@
  * Contributors:
  *     IBM Corporation - initial API and implementation
  *     Alex Blewitt - https://bugs.eclipse.org/bugs/show_bug.cgi?id=168954
+ *     Red Hat Inc. - refactored to jdt.core.manipulation
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.fix;
 
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.Assert;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-
 import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
 
-import org.eclipse.jdt.ui.cleanup.CleanUpOptions;
-
-import org.eclipse.jdt.internal.ui.JavaPlugin;
-import org.eclipse.jdt.internal.ui.fix.UnimplementedCodeCleanUp;
-import org.eclipse.jdt.internal.ui.preferences.cleanup.CleanUpProfileVersioner;
-
 public class CleanUpConstants {
 
 	/**
@@ -883,7 +872,7 @@
 	 * @since 3.3
 	 */
 	public static final String ADD_MISSING_ANNOTATIONS= "cleanup.add_missing_annotations"; //$NON-NLS-1$
-
+	
 	/**
 	 * Add '@Override' annotation in front of overriding methods.
 	 * <p>
@@ -932,7 +921,7 @@
 	 * @since 3.6
 	 */
 	public static final String ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION= "cleanup.add_missing_override_annotations_interface_methods"; //$NON-NLS-1$
-	
+
 	/**
 	 * Add '@Deprecated' annotation in front of deprecated members.
 	 * <p>
@@ -1133,7 +1122,7 @@
 	 * A key to the version of the profile stored in the preferences.<br>
 	 * <br>
 	 * Possible values: Integer value<br>
-	 * Default value: {@link CleanUpProfileVersioner#CURRENT_VERSION} <br>
+	 * Default value: CleanUpProfileVersioner#CURRENT_VERSION <br>
 	 * 
 	 * @since 3.3
 	 */
@@ -1177,208 +1166,4 @@
 	 */
 	public final static String DEFAULT_SAVE_PARTICIPANT_PROFILE= SAVE_PARTICIPANT_PROFILE;
 
-	private static void setEclipseDefaultSettings(CleanUpOptions options) {
-
-		//Member Accesses
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
-
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
-
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS, CleanUpOptions.TRUE);
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_FIELD, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_METHOD, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS, CleanUpOptions.TRUE);
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS, CleanUpOptions.TRUE);
-
-		//Control Statements
-		options.setOption(CONTROL_STATEMENTS_USE_BLOCKS, CleanUpOptions.FALSE);
-		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_ALWAYS, CleanUpOptions.TRUE);
-		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NO_FOR_RETURN_AND_THROW, CleanUpOptions.FALSE);
-		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NEVER, CleanUpOptions.FALSE);
-
-		options.setOption(CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED, CleanUpOptions.FALSE);
-
-		//Expressions
-		options.setOption(EXPRESSIONS_USE_PARENTHESES, CleanUpOptions.FALSE);
-		options.setOption(EXPRESSIONS_USE_PARENTHESES_NEVER, CleanUpOptions.TRUE);
-		options.setOption(EXPRESSIONS_USE_PARENTHESES_ALWAYS, CleanUpOptions.FALSE);
-
-		//Variable Declarations
-		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL, CleanUpOptions.FALSE);
-		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_LOCAL_VARIABLES, CleanUpOptions.TRUE);
-		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PARAMETERS, CleanUpOptions.FALSE);
-		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PRIVATE_FIELDS, CleanUpOptions.TRUE);
-
-		//Functional Interfaces
-		options.setOption(CONVERT_FUNCTIONAL_INTERFACES, CleanUpOptions.FALSE);
-		options.setOption(USE_LAMBDA, CleanUpOptions.TRUE);
-		options.setOption(USE_ANONYMOUS_CLASS_CREATION, CleanUpOptions.FALSE);
-
-		//Unused Code
-		options.setOption(REMOVE_UNUSED_CODE_IMPORTS, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_MEMBERS, CleanUpOptions.FALSE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_CONSTRUCTORS, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_FELDS, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_METHODS, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_TYPES, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNUSED_CODE_LOCAL_VARIABLES, CleanUpOptions.FALSE);
-
-		//Unnecessary Code
-		options.setOption(REMOVE_UNNECESSARY_CASTS, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNNECESSARY_NLS_TAGS, CleanUpOptions.TRUE);
-		options.setOption(INSERT_INFERRED_TYPE_ARGUMENTS, CleanUpOptions.FALSE);
-		options.setOption(REMOVE_REDUNDANT_TYPE_ARGUMENTS, CleanUpOptions.FALSE);
-		options.setOption(REMOVE_REDUNDANT_MODIFIERS, CleanUpOptions.FALSE);
-
-		//Missing Code
-		options.setOption(ADD_MISSING_ANNOTATIONS, CleanUpOptions.TRUE);
-		options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE, CleanUpOptions.TRUE);
-		options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION, CleanUpOptions.TRUE);
-		options.setOption(ADD_MISSING_ANNOTATIONS_DEPRECATED, CleanUpOptions.TRUE);
-
-		options.setOption(ADD_MISSING_SERIAL_VERSION_ID, CleanUpOptions.FALSE);
-		options.setOption(ADD_MISSING_SERIAL_VERSION_ID_GENERATED, CleanUpOptions.FALSE);
-		options.setOption(ADD_MISSING_SERIAL_VERSION_ID_DEFAULT, CleanUpOptions.TRUE);
-
-		options.setOption(ADD_MISSING_NLS_TAGS, CleanUpOptions.FALSE);
-
-		options.setOption(ADD_MISSING_METHODES, CleanUpOptions.FALSE);
-		options.setOption(UnimplementedCodeCleanUp.MAKE_TYPE_ABSTRACT, CleanUpOptions.FALSE);
-
-		//Code Organizing
-		options.setOption(FORMAT_SOURCE_CODE, CleanUpOptions.FALSE);
-		options.setOption(FORMAT_SOURCE_CODE_CHANGES_ONLY, CleanUpOptions.FALSE);
-
-		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES, CleanUpOptions.FALSE);
-		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_ALL, CleanUpOptions.TRUE);
-		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY, CleanUpOptions.FALSE);
-
-		options.setOption(FORMAT_CORRECT_INDENTATION, CleanUpOptions.FALSE);
-
-		options.setOption(ORGANIZE_IMPORTS, CleanUpOptions.FALSE);
-
-		options.setOption(SORT_MEMBERS, CleanUpOptions.FALSE);
-		options.setOption(SORT_MEMBERS_ALL, CleanUpOptions.FALSE);
-	}
-
-	private static void setSaveParticipantSettings(CleanUpOptions options) {
-
-		//Member Accesses
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
-
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
-
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_FIELD, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_METHOD, CleanUpOptions.FALSE);
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS, CleanUpOptions.TRUE);
-		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS, CleanUpOptions.TRUE);
-
-		//Control Statements
-		options.setOption(CONTROL_STATEMENTS_USE_BLOCKS, CleanUpOptions.FALSE);
-		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_ALWAYS, CleanUpOptions.TRUE);
-		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NO_FOR_RETURN_AND_THROW, CleanUpOptions.FALSE);
-		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NEVER, CleanUpOptions.FALSE);
-
-		options.setOption(CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED, CleanUpOptions.FALSE);
-
-		//Expressions
-		options.setOption(EXPRESSIONS_USE_PARENTHESES, CleanUpOptions.FALSE);
-		options.setOption(EXPRESSIONS_USE_PARENTHESES_NEVER, CleanUpOptions.TRUE);
-		options.setOption(EXPRESSIONS_USE_PARENTHESES_ALWAYS, CleanUpOptions.FALSE);
-
-		//Variable Declarations
-		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL, CleanUpOptions.FALSE);
-		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_LOCAL_VARIABLES, CleanUpOptions.TRUE);
-		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PARAMETERS, CleanUpOptions.FALSE);
-		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PRIVATE_FIELDS, CleanUpOptions.TRUE);
-
-		//Functional Interfaces
-		options.setOption(CONVERT_FUNCTIONAL_INTERFACES, CleanUpOptions.FALSE);
-		options.setOption(USE_LAMBDA, CleanUpOptions.TRUE);
-		options.setOption(USE_ANONYMOUS_CLASS_CREATION, CleanUpOptions.FALSE);
-
-		//Unused Code
-		options.setOption(REMOVE_UNUSED_CODE_IMPORTS, CleanUpOptions.FALSE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_MEMBERS, CleanUpOptions.FALSE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_CONSTRUCTORS, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_FELDS, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_METHODS, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_TYPES, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNUSED_CODE_LOCAL_VARIABLES, CleanUpOptions.FALSE);
-
-		//Unnecessary Code
-		options.setOption(REMOVE_UNNECESSARY_CASTS, CleanUpOptions.TRUE);
-		options.setOption(REMOVE_UNNECESSARY_NLS_TAGS, CleanUpOptions.FALSE);
-		options.setOption(INSERT_INFERRED_TYPE_ARGUMENTS, CleanUpOptions.FALSE);
-		options.setOption(REMOVE_REDUNDANT_TYPE_ARGUMENTS, CleanUpOptions.FALSE);
-		options.setOption(REMOVE_REDUNDANT_MODIFIERS, CleanUpOptions.FALSE);
-
-		//Missing Code
-		options.setOption(ADD_MISSING_ANNOTATIONS, CleanUpOptions.TRUE);
-		options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE, CleanUpOptions.TRUE);
-		options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION, CleanUpOptions.TRUE);
-		options.setOption(ADD_MISSING_ANNOTATIONS_DEPRECATED, CleanUpOptions.TRUE);
-
-		options.setOption(ADD_MISSING_SERIAL_VERSION_ID, CleanUpOptions.FALSE);
-		options.setOption(ADD_MISSING_SERIAL_VERSION_ID_GENERATED, CleanUpOptions.FALSE);
-		options.setOption(ADD_MISSING_SERIAL_VERSION_ID_DEFAULT, CleanUpOptions.TRUE);
-
-		options.setOption(ADD_MISSING_NLS_TAGS, CleanUpOptions.FALSE);
-
-		options.setOption(ADD_MISSING_METHODES, CleanUpOptions.FALSE);
-		options.setOption(UnimplementedCodeCleanUp.MAKE_TYPE_ABSTRACT, CleanUpOptions.FALSE);
-
-		//Code Organizing
-		options.setOption(FORMAT_SOURCE_CODE, CleanUpOptions.FALSE);
-		options.setOption(FORMAT_SOURCE_CODE_CHANGES_ONLY, CleanUpOptions.FALSE);
-
-		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES, CleanUpOptions.FALSE);
-		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_ALL, CleanUpOptions.TRUE);
-		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY, CleanUpOptions.FALSE);
-
-		options.setOption(FORMAT_CORRECT_INDENTATION, CleanUpOptions.FALSE);
-
-		options.setOption(ORGANIZE_IMPORTS, CleanUpOptions.TRUE);
-
-		options.setOption(SORT_MEMBERS, CleanUpOptions.FALSE);
-		options.setOption(SORT_MEMBERS_ALL, CleanUpOptions.FALSE);
-
-		options.setOption(CLEANUP_ON_SAVE_ADDITIONAL_OPTIONS, CleanUpOptions.FALSE);
-	}
-
-	public static void initDefaults(IPreferenceStore store) {
-		CleanUpOptions settings= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS);
-		for (Iterator<String> iterator= settings.getKeys().iterator(); iterator.hasNext();) {
-			String key= iterator.next();
-			store.setDefault(key, settings.getValue(key));
-		}
-
-		store.setDefault(SHOW_CLEAN_UP_WIZARD, true);
-		store.setDefault(CLEANUP_PROFILE, DEFAULT_PROFILE);
-		store.setDefault(CLEANUP_ON_SAVE_PROFILE, DEFAULT_SAVE_PARTICIPANT_PROFILE);
-	}
-
-	public static void setDefaultOptions(int kind, CleanUpOptions options) {
-		switch (kind) {
-			case CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS:
-				CleanUpConstants.setEclipseDefaultSettings(options);
-				break;
-			case CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS:
-				CleanUpConstants.setSaveParticipantSettings(options);
-				break;
-			default:
-				Assert.isTrue(false, "Unknown Clean Up option kind: " + kind); //$NON-NLS-1$
-				break;
-		}
-	}
-
 }
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpContext.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpContext.java
new file mode 100644
index 0000000..01f6764
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpContext.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - refactored to jdt.core.manipultion
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+import org.eclipse.core.runtime.Assert;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+
+
+/**
+ * The context that contains all information required by a clean up to create a fix.
+ * 
+ * @since 3.5
+ */
+public class CleanUpContext {
+
+	private final ICompilationUnit fUnit;
+
+	private final CompilationUnit fAst;
+
+	/**
+	 * Creates a new clean up context.
+	 * 
+	 * @param unit the compilation unit
+	 * @param ast the AST, can be <code>null</code> if {@link CleanUpRequirements#requiresAST()}
+	 *            returns <code>false</code>. The AST is guaranteed to contain changes made by
+	 *            previous clean ups only if {@link CleanUpRequirements#requiresFreshAST()} returns
+	 *            <code>true</code>.
+	 */
+	public CleanUpContext(ICompilationUnit unit, CompilationUnit ast) {
+		Assert.isLegal(unit != null);
+		fUnit= unit;
+		fAst= ast;
+	}
+
+	/**
+	 * The compilation unit to clean up.
+	 * 
+	 * @return the compilation unit to clean up
+	 */
+	public ICompilationUnit getCompilationUnit() {
+		return fUnit;
+	}
+
+	/**
+	 * An AST built from the compilation unit to fix.
+	 * <p>
+	 * Can be <code>null</code> if {@link CleanUpRequirements#requiresAST()} returns
+	 * <code>false</code>. The AST is guaranteed to contain changes made by previous clean ups only
+	 * if {@link CleanUpRequirements#requiresFreshAST()} returns <code>true</code>.
+	 * </p>
+	 * <p>Clients should check the AST API level and do nothing if they are given an AST
+	 * they can't handle (see {@link org.eclipse.jdt.core.dom.AST#apiLevel()}).
+	 * 
+	 * @return an AST or <code>null</code> if none required
+	 */
+	public CompilationUnit getAST() {
+		return fAst;
+	}
+}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpOptions.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpOptions.java
new file mode 100644
index 0000000..1177e49
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpOptions.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - refactored to jdt.core.manipulation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.Assert;
+
+import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
+
+
+/**
+ * Allows to set and retrieve clean up settings for given options keys.
+ * 
+ * @since 3.5
+ * @noextend This class is not intended to be subclassed by clients.
+ */
+public class CleanUpOptions {
+
+	private final Map<String, String> fOptions;
+
+	/**
+	 * True value
+	 */
+	public static final String TRUE= "true"; //$NON-NLS-1$
+
+	/**
+	 * False value
+	 */
+	public static final String FALSE= "false"; //$NON-NLS-1$
+
+	/**
+	 * Creates a new CleanUpOptions instance with the given options.
+	 * 
+	 * @param options map that maps clean ups keys (<code>String</code>) to a non-<code>null</code>
+	 *            string value
+	 */
+	public CleanUpOptions(Map<String, String> options) {
+		fOptions= options;
+	}
+
+	/**
+	 * Creates a new instance.
+	 */
+	public CleanUpOptions() {
+		fOptions= new Hashtable<>();
+	}
+
+	/**
+	 * Tells whether the option with the given <code>key</code> is enabled.
+	 * 
+	 * @param key the name of the option
+	 * @return <code>true</code> if enabled, <code>false</code> if not enabled or unknown key
+	 * @throws IllegalArgumentException if the key is <code>null</code>
+	 * @see CleanUpConstants
+	 */
+	public boolean isEnabled(String key) {
+		Assert.isLegal(key != null);
+		Object value= fOptions.get(key);
+		return CleanUpOptions.TRUE == value || CleanUpOptions.TRUE.equals(value);
+	}
+
+	/**
+	 * Returns the value for the given key.
+	 * 
+	 * @param key the key of the value
+	 * @return the value associated with the key
+	 * @throws IllegalArgumentException if the key is null or unknown
+	 */
+	public String getValue(String key) {
+		Assert.isLegal(key != null);
+		String value= fOptions.get(key);
+		Assert.isLegal(value != null);
+		return value;
+	}
+
+	/**
+	 * Sets the option for the given key to the given value.
+	 * 
+	 * @param key the name of the option to set
+	 * @param value the value of the option
+	 * @throws IllegalArgumentException if the key is <code>null</code>
+	 * @see CleanUpOptions#TRUE
+	 * @see CleanUpOptions#FALSE
+	 */
+	public void setOption(String key, String value) {
+		Assert.isLegal(key != null);
+		Assert.isLegal(value != null);
+		fOptions.put(key, value);
+	}
+
+	/**
+	 * Returns an unmodifiable set of all known keys.
+	 * 
+	 * @return an unmodifiable set of all keys
+	 */
+	public Set<String> getKeys() {
+		return Collections.unmodifiableSet(fOptions.keySet());
+	}
+}
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpRequirements.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpRequirements.java
new file mode 100644
index 0000000..288d258
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpRequirements.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - refactored to jdt.core.manipulation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+
+import org.eclipse.jdt.core.JavaCore;
+
+
+/**
+ * Specifies the requirements of a clean up.
+ * 
+ * @since 3.5
+ */
+public final class CleanUpRequirements {
+
+	private final boolean fRequiresAST;
+
+	private final Map<String, String> fCompilerOptions;
+
+	private final boolean fRequiresFreshAST;
+
+	private final boolean fRequiresChangedRegions;
+
+
+	/**
+	 * Create a new instance
+	 * 
+	 * @param requiresAST <code>true</code> if an AST is required
+	 * @param requiresFreshAST <code>true</code> if a fresh AST is required
+	 * @param requiresChangedRegions <code>true</code> if changed regions are required
+	 * @param compilerOptions map of compiler options or <code>null</code> if no requirements
+	 */
+	public CleanUpRequirements(boolean requiresAST, boolean requiresFreshAST, boolean requiresChangedRegions, Map<String, String> compilerOptions) {
+		Assert.isLegal(!requiresFreshAST || requiresAST, "Must not request fresh AST if no AST is required"); //$NON-NLS-1$
+		Assert.isLegal(compilerOptions == null || requiresAST, "Must not provide options if no AST is required"); //$NON-NLS-1$
+		fRequiresAST= requiresAST;
+		fRequiresFreshAST= requiresFreshAST;
+		fRequiresChangedRegions= requiresChangedRegions;
+
+		fCompilerOptions= compilerOptions;
+		// Make sure that compile warnings are not suppressed since some clean ups work on reported warnings
+		if (fCompilerOptions != null)
+			fCompilerOptions.put(JavaCore.COMPILER_PB_SUPPRESS_WARNINGS, JavaCore.DISABLED);
+	}
+
+	/**
+	 * Tells whether the clean up requires an AST.
+	 * <p>
+	 * <strong>Note:</strong> This should return <code>false</code> whenever possible because
+	 * creating an AST is expensive.
+	 * </p>
+	 * 
+	 * @return <code>true</code> if the {@linkplain CleanUpContext context} must provide an AST
+	 */
+	public boolean requiresAST() {
+		return fRequiresAST;
+	}
+
+	/**
+	 * Tells whether a fresh AST, containing all the changes from previous clean ups, will be
+	 * needed.
+	 * 
+	 * @return <code>true</code> if the caller needs an up to date AST
+	 */
+	public boolean requiresFreshAST() {
+		return fRequiresFreshAST;
+	}
+
+	/**
+	 * Required compiler options.
+	 * 
+	 * @return the compiler options map or <code>null</code> if none
+	 * @see JavaCore
+	 */
+	public Map<String, String> getCompilerOptions() {
+		return fCompilerOptions;
+	}
+
+	/**
+	 * Tells whether this clean up requires to be informed about changed regions. The changed regions are the
+	 * regions which have been changed between the last save state of the compilation unit and its
+	 * current state.
+	 * <p>
+	 * Has only an effect if the clean up is used as save action.
+	 * </p>
+	 * <p>
+	 * <strong>Note:</strong>: This should return <code>false</code> whenever possible because
+	 * calculating the changed regions is expensive.
+	 * </p>
+	 * 
+	 * @return <code>true</code> if the {@linkplain CleanUpContext context} must provide changed
+	 *         regions
+	 */
+	public boolean requiresChangedRegions() {
+		return fRequiresChangedRegions;
+	}
+
+}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CompilationUnitRewriteOperationsFixCore.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CompilationUnitRewriteOperationsFixCore.java
new file mode 100644
index 0000000..aef8f2b
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/CompilationUnitRewriteOperationsFixCore.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - copied over to jdt.core.manipulation and renamed
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+import org.eclipse.text.edits.TextEditGroup;
+
+import org.eclipse.ltk.core.refactoring.GroupCategory;
+import org.eclipse.ltk.core.refactoring.GroupCategorySet;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.Type;
+import org.eclipse.jdt.core.dom.rewrite.ImportRewrite;
+import org.eclipse.jdt.core.dom.rewrite.ImportRewrite.ImportRewriteContext;
+import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
+
+import org.eclipse.jdt.internal.core.manipulation.JavaManipulationPlugin;
+import org.eclipse.jdt.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext;
+import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite;
+
+public class CompilationUnitRewriteOperationsFixCore extends AbstractFix {
+
+	public abstract static class CompilationUnitRewriteOperation {
+
+		public abstract void rewriteAST(CompilationUnitRewrite cuRewrite, LinkedProposalModelCore linkedModel) throws CoreException;
+
+		protected Type importType(final ITypeBinding toImport, final ASTNode accessor, ImportRewrite imports, final CompilationUnit compilationUnit) {
+			ImportRewriteContext importContext= new ContextSensitiveImportRewriteContext(compilationUnit, accessor.getStartPosition(), imports);
+			return imports.addImport(toImport, compilationUnit.getAST(), importContext);
+		}
+
+		protected TextEditGroup createTextEditGroup(String label, CompilationUnitRewrite rewrite) {
+			if (label.length() > 0) {
+				return rewrite.createCategorizedGroupDescription(label, new GroupCategorySet(new GroupCategory(label, label, label)));
+			} else {
+				return rewrite.createGroupDescription(label);
+			}
+		}
+
+		public String getAdditionalInfo() {
+			return null;
+		}
+	}
+
+	private final CompilationUnitRewriteOperation[] fOperations;
+	private final CompilationUnit fCompilationUnit;
+	protected LinkedProposalModelCore fLinkedProposalModel;
+
+	public CompilationUnitRewriteOperationsFixCore(String name, CompilationUnit compilationUnit, CompilationUnitRewriteOperation operation) {
+		this(name, compilationUnit, new CompilationUnitRewriteOperation[] { operation });
+		Assert.isNotNull(operation);
+	}
+
+	public CompilationUnitRewriteOperationsFixCore(String name, CompilationUnit compilationUnit, CompilationUnitRewriteOperation[] operations) {
+		super(name);
+		Assert.isNotNull(operations);
+		Assert.isLegal(operations.length > 0);
+		fCompilationUnit= compilationUnit;
+		fOperations= operations;
+		fLinkedProposalModel= new LinkedProposalModelCore();
+	}
+
+	@Override
+	public LinkedProposalModelCore getLinkedPositionsCore() {
+		if (!fLinkedProposalModel.hasLinkedPositions())
+			return null;
+
+		return fLinkedProposalModel;
+	}
+
+	@Override
+	public CompilationUnitChange createChange(IProgressMonitor progressMonitor) throws CoreException {
+		CompilationUnitRewrite cuRewrite= new CompilationUnitRewrite((ICompilationUnit)fCompilationUnit.getJavaElement(), fCompilationUnit);
+
+		fLinkedProposalModel.clear();
+		for (int i= 0; i < fOperations.length; i++) {
+			CompilationUnitRewriteOperation operation= fOperations[i];
+			operation.rewriteAST(cuRewrite, fLinkedProposalModel);
+		}
+
+		CompilationUnitChange result= cuRewrite.createChange(getDisplayString(), true, null);
+		if (result == null)
+			throw new CoreException(new Status(IStatus.ERROR, JavaManipulationPlugin.getPluginId(), Messages.format(FixMessages.CompilationUnitRewriteOperationsFix_nullChangeError, getDisplayString())));
+
+		return result;
+	}
+
+	@Override
+	public String getAdditionalProposalInfo(){
+		StringBuilder sb= new StringBuilder();
+		for (int i= 0; i < fOperations.length; i++) {
+			CompilationUnitRewriteOperation operation= fOperations[i];
+			String info= operation.getAdditionalInfo();
+			if (info != null)
+				sb.append(info);
+		}
+
+		if (sb.length() == 0)
+			return null;
+
+		return sb.toString();
+	}
+
+}
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.java
similarity index 98%
rename from org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.java
index 5e51ed6..f21a4e1 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
  *								[quick fix] Add quick fixes for null annotations - https://bugs.eclipse.org/337977
  *								[quick fix] The fix change parameter type to @Nonnull generated a null change - https://bugs.eclipse.org/400668
  *								[null] "Annotate" proposals for adding external null annotations to library classes - https://bugs.eclipse.org/458200
+ *     Red Hat Inc - refactored to jdt.core.manipulation
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.fix;
 
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.properties b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.properties
similarity index 98%
rename from org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.properties
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.properties
index bc5699b..8629387 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.properties
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/FixMessages.properties
@@ -1,5 +1,5 @@
 ###############################################################################
-# Copyright (c) 2005, 2017 IBM Corporation and others.
+# Copyright (c) 2005, 2018 IBM Corporation and others.
 # All rights reserved. This program and the accompanying materials
 # are made available under the terms of the Eclipse Public License v1.0
 # which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
 #								[quick fix] Add quick fixes for null annotations - https://bugs.eclipse.org/337977
 #								[quick fix] The fix change parameter type to @Nonnull generated a null change - https://bugs.eclipse.org/400668
 #								[null] "Annotate" proposals for adding external null annotations to library classes - https://bugs.eclipse.org/458200
+#     Red Hat Inc. - refactored to jdt.core.manipulation
 ###############################################################################
 CleanUpRefactoring_Refactoring_name=Clean Up
 CleanUpRefactoring_Initialize_message=Checking preconditions for project ''{0}''
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/ICleanUpCore.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/ICleanUpCore.java
new file mode 100644
index 0000000..dba67f3
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/ICleanUpCore.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - copied and renamed in jdt.core.manipulation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+
+
+/**
+ * A clean up solves problems in a compilation unit.
+ * <p>
+ * The clean up is asked for its requirements through a call to {@link #getRequirements()}. The
+ * clean up can request an AST and define how to build this AST. It can base its requirements on the
+ * options passed through {@link #setOptions(CleanUpOptions)}.
+ * </p>
+ * <p>
+ * A context containing the information requested by the requirements are passed to
+ * {@link #createFix(CleanUpContext)}. A fix capable of fixing the problems is returned by this
+ * function if {@link #checkPreConditions(IJavaProject, ICompilationUnit[], IProgressMonitor)} has
+ * returned a non fatal error status.
+ * </p>
+ * <p>
+ * At the end {@link #checkPostConditions(IProgressMonitor)} is called.
+ * </p>
+ * 
+ * @since 3.5
+ */
+public interface ICleanUpCore {
+
+	/**
+	 * Sets the options that will be used.
+	 * 
+	 * @param options the options to use
+	 */
+	void setOptions(CleanUpOptions options);
+
+	/**
+	 * Human readable description for each step this clean up will execute.
+	 * <p>
+	 * <strong>Note:</strong> This method must only be called after the options have been set.
+	 * </p>
+	 * 
+	 * @return descriptions an array of {@linkplain String strings} or <code>null</code>
+	 */
+	String[] getStepDescriptions();
+
+	/**
+	 * The requirements of this clean up.
+	 * <p>
+	 * <strong>Note:</strong> This method must only be called after the options have been set.
+	 * </p>
+	 * 
+	 * @return the requirements used for {@link #createFix(CleanUpContext)} to work
+	 */
+	CleanUpRequirements getRequirements();
+
+	/**
+	 * After call to checkPreConditions clients will start creating fixes for
+	 * <code>compilationUnits</code> in <code>project</code> unless the result of checkPreConditions
+	 * contains a fatal error
+	 * 
+	 * @param project the project to clean up
+	 * @param compilationUnits an array of compilation units to clean up, all member of <code>project</code>
+	 * @param monitor the monitor to show progress
+	 * @return the result of the precondition check
+	 * @throws CoreException if an unexpected error occurred
+	 */
+	RefactoringStatus checkPreConditions(IJavaProject project, ICompilationUnit[] compilationUnits, IProgressMonitor monitor) throws CoreException;
+
+	/**
+	 * Create an <code>ICleanUpFixCore</code> which fixes all problems in <code>context</code> or
+	 * <code>null</code> if nothing to fix.
+	 * 
+	 * @param context a context containing all information requested by {@link #getRequirements()}
+	 * @return the fix for the problems or <code>null</code> if nothing to fix
+	 * @throws CoreException if an unexpected error occurred
+	 */
+	ICleanUpFixCore createFix(CleanUpContext context) throws CoreException;
+
+	/**
+	 * Called when done cleaning up.
+	 * 
+	 * @param monitor the monitor to show progress
+	 * @return the result of the postcondition check, not null
+	 * @throws CoreException if an unexpected error occurred
+	 */
+	RefactoringStatus checkPostConditions(IProgressMonitor monitor) throws CoreException;
+
+}
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/ICleanUpFixCore.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/ICleanUpFixCore.java
new file mode 100644
index 0000000..1391c80
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/ICleanUpFixCore.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - copied and renamed in jdt.core.manipulation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
+
+
+/**
+ * A clean up fix calculates a {@link CompilationUnitChange} which can be applied on a document to
+ * fix one or more problems in a compilation unit.
+ * 
+ * @since 1.10
+ */
+public interface ICleanUpFixCore {
+
+	/**
+	 * Calculates and returns a {@link CompilationUnitChange} which can be applied on a document to
+	 * fix one or more problems in a compilation unit.
+	 * 
+	 * @param progressMonitor the progress monitor or <code>null</code> if none
+	 * @return a compilation unit change change which should not be empty
+	 * @throws CoreException if something went wrong while calculating the change
+	 */
+	public CompilationUnitChange createChange(IProgressMonitor progressMonitor) throws CoreException;
+
+}
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/ILinkedFixCore.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/ILinkedFixCore.java
new file mode 100644
index 0000000..c18568a
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/ILinkedFixCore.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - modified and renamed to ILinkedFixCore
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+/**
+ * A fix which when executed can set up a linked mode model
+ * and put an editor into linked mode.
+ *
+ * @since 1.10
+ */
+public interface ILinkedFixCore extends ICleanUpFixCore {
+
+	/**
+	 * @return the linked proposal model to use to set up linked positions or <b>null</b>
+	 */
+	public LinkedProposalModelCore getLinkedPositionsCore();
+}
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/IProposableFix.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/IProposableFix.java
similarity index 88%
rename from org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/IProposableFix.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/IProposableFix.java
index 6201112..ed52c9e 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/IProposableFix.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/IProposableFix.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,22 +7,21 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - moved to jdt.core.manipulation and modified
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.fix;
 
 import org.eclipse.core.runtime.IStatus;
 
-import org.eclipse.jdt.ui.cleanup.ICleanUpFix;
-
 /**
  * A <code>ICleanUpFix</code> which can be used in a
  * correction proposal environment. A proposal
  * will be shown to the user and if chosen the
  * fix is executed.
  *
- * @since 3.4
+ * @since 1.10
  */
-public interface IProposableFix extends ICleanUpFix {
+public interface IProposableFix extends ICleanUpFixCore {
 
 	/**
 	 * Returns the string to be displayed in the list of completion proposals.
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/Messages.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/Messages.java
new file mode 100644
index 0000000..95d35a4
--- /dev/null
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/fix/Messages.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - copied to jdt.core.manipulation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+import com.ibm.icu.text.MessageFormat;
+
+/**
+ * Helper class to format message strings.
+ *
+ * @since 3.1
+ */
+public class Messages {
+
+	public static String format(String message, Object object) {
+		return MessageFormat.format(message, new Object[] { object});
+	}
+
+	public static String format(String message, Object[] objects) {
+		return MessageFormat.format(message, objects);
+	}
+
+	private Messages() {
+		// Not for instantiation
+	}
+}
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java
similarity index 99%
rename from org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java
index 9d9fbda..dd6431c 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java
@@ -10,6 +10,7 @@
  *     Benjamin Muskalla <bmuskalla@eclipsesource.com> - [extract method] Extract method and continue https://bugs.eclipse.org/bugs/show_bug.cgi?id=48056
  *     Samrat Dhillon <samrat.dhillon@gmail.com> - [introduce factory] Introduce Factory on an abstract class adds a statement to create an instance of that class - https://bugs.eclipse.org/bugs/show_bug.cgi?id=395016
  *     Yves Joan <yves.joan@oracle.com> - [reorg] Copy action should NOT add 'copy of' prefix - https://bugs.eclipse.org/bugs/show_bug.cgi?id=151668
+ *     Red Hat Inc. - copied to jdt.core.manipulation
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.refactoring;
 
diff --git a/org.eclipse.jdt.ui/internal compatibility/org/eclipse/jdt/internal/corext/refactoring/changes/CompilationUnitChange.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/changes/CompilationUnitChange.java
similarity index 94%
rename from org.eclipse.jdt.ui/internal compatibility/org/eclipse/jdt/internal/corext/refactoring/changes/CompilationUnitChange.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/changes/CompilationUnitChange.java
index 54e8cbe..2f4fee9 100644
--- a/org.eclipse.jdt.ui/internal compatibility/org/eclipse/jdt/internal/corext/refactoring/changes/CompilationUnitChange.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/changes/CompilationUnitChange.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - copied to jdt.core.manipulation
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.refactoring.changes;
 
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties
similarity index 99%
rename from org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties
index b57b832..63182a1 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties
@@ -11,6 +11,7 @@
 #     Benjamin Muskalla <bmuskalla@eclipsesource.com> - [extract method] Name ambiguous return value in error message - https://bugs.eclipse.org/bugs/show_bug.cgi?id=50607
 #	  Samrat Dhillon <samrat.dhillon@gmail.com> - [introduce factory] Introduce Factory on an abstract class adds a statement to create an instance of that class - https://bugs.eclipse.org/bugs/show_bug.cgi?id=395016
 #     Yves Joan <yves.joan@oracle.com> - [reorg] Copy action should NOT add 'copy of' prefix - https://bugs.eclipse.org/bugs/show_bug.cgi?id=151668
+#     Red Hat Inc. - copied to jdt.core.manipulation
 ###############################################################################
 # NLS properties for the Refactoring Core
 
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/CompilationUnitRewrite.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/structure/CompilationUnitRewrite.java
similarity index 94%
rename from org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/CompilationUnitRewrite.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/structure/CompilationUnitRewrite.java
index 8ecfb9b..faf5eb9 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/CompilationUnitRewrite.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/structure/CompilationUnitRewrite.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc, - copied to jdt.core.manipulation
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.refactoring.structure;
 
@@ -34,15 +35,13 @@
 import org.eclipse.jdt.core.dom.CompilationUnit;
 import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
 import org.eclipse.jdt.core.dom.rewrite.ImportRewrite;
+import org.eclipse.jdt.core.manipulation.CodeStyleConfiguration;
 import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
 
-import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
+import org.eclipse.jdt.internal.core.manipulation.JavaManipulationPlugin;
+import org.eclipse.jdt.internal.corext.dom.IASTSharedValues;
 import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
 import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser;
-import org.eclipse.jdt.internal.corext.util.JDTUIHelperClasses;
-
-import org.eclipse.jdt.internal.ui.JavaPlugin;
-import org.eclipse.jdt.internal.corext.dom.IASTSharedValues;
 
 /**
  * A {@link CompilationUnitRewrite} holds all data structures that are typically
@@ -55,7 +54,7 @@
  * Bindings recovery is disabled by default, but can be enabled with <code>setBindingRecovery(true)</code>.
  * </p>
  * 
- * @see JDTUIHelperClasses
+ * see JDTUIHelperClasses
  */
 public class CompilationUnitRewrite {
 	//TODO: add RefactoringStatus fStatus;?
@@ -350,12 +349,12 @@
 				 * ImportRewrite#setUseContextToFilterImplicitImports(boolean) will be set to true
 				 * and ContextSensitiveImportRewriteContext etc. can be used. */
 				if (fRoot == null && ! fResolveBindings) {
-					fImportRewrite= StubUtility.createImportRewrite(fCu, true);
+					fImportRewrite= CodeStyleConfiguration.createImportRewrite(fCu, true);
 				} else {
-					fImportRewrite= StubUtility.createImportRewrite(getRoot(), true);
+					fImportRewrite= createImportRewrite(getRoot(), true);
 				}
 			} catch (CoreException e) {
-				JavaPlugin.log(e);
+				JavaManipulationPlugin.log(e);
 				throw new IllegalStateException(e.getMessage()); // like ASTParser#createAST(..) does
 			}
 		}
@@ -363,6 +362,15 @@
 
 	}
 
+	private ImportRewrite createImportRewrite(CompilationUnit astRoot, boolean restoreExistingImports) {
+		ImportRewrite rewrite= CodeStyleConfiguration.createImportRewrite(astRoot, restoreExistingImports);
+		if (astRoot.getAST().hasResolvedBindings()) {
+			rewrite.setUseContextToFilterImplicitImports(true);
+		}
+		return rewrite;
+	}
+
+
 	public ImportRemover getImportRemover() {
 		if (fImportRemover == null) {
 			fImportRemover= new ImportRemover(fCu.getJavaProject(), getRoot());
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/ImportRemover.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/structure/ImportRemover.java
similarity index 99%
rename from org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/ImportRemover.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/structure/ImportRemover.java
index cddf80c..2e49c0a 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/ImportRemover.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/structure/ImportRemover.java
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - copied to jdt.core.manipulation
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.refactoring.structure;
 
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/util/RefactoringASTParser.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/util/RefactoringASTParser.java
similarity index 95%
rename from org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/util/RefactoringASTParser.java
rename to org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/util/RefactoringASTParser.java
index 0fc5e0d..12685d1 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/util/RefactoringASTParser.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/util/RefactoringASTParser.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - copied to jdt.core.manipulation
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.refactoring.util;
 
@@ -25,12 +26,11 @@
 import org.eclipse.jdt.core.dom.ASTNode;
 import org.eclipse.jdt.core.dom.ASTParser;
 import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.manipulation.CoreASTProvider;
 
 import org.eclipse.jdt.internal.corext.dom.IASTSharedValues;
 import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
 
-import org.eclipse.jdt.ui.SharedASTProvider;
-
 public class RefactoringASTParser {
 
 	private ASTParser fParser;
@@ -115,7 +115,7 @@
 	 * @return the parsed CompilationUnit
 	 */
 	public static CompilationUnit parseWithASTProvider(ITypeRoot typeRoot, boolean resolveBindings, IProgressMonitor pm) {
-		CompilationUnit cuNode= SharedASTProvider.getAST(typeRoot, SharedASTProvider.WAIT_ACTIVE_ONLY, pm);
+		CompilationUnit cuNode= CoreASTProvider.getInstance().getAST(typeRoot, CoreASTProvider.WAIT_ACTIVE_ONLY, pm);
 		if (cuNode != null) {
 			return cuNode;
 		} else {
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstantsOptions.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstantsOptions.java
new file mode 100644
index 0000000..68da113
--- /dev/null
+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstantsOptions.java
@@ -0,0 +1,232 @@
+/*******************************************************************************
+ * Copyright (c) 2018 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Alex Blewitt - https://bugs.eclipse.org/bugs/show_bug.cgi?id=168954
+ *     Red Hat Inc. - split from CleanUpConstants
+ *******************************************************************************/
+package org.eclipse.jdt.internal.corext.fix;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.Assert;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+
+import org.eclipse.jdt.ui.cleanup.CleanUpOptions;
+
+import org.eclipse.jdt.internal.ui.JavaPlugin;
+import org.eclipse.jdt.internal.ui.fix.UnimplementedCodeCleanUp;
+
+public class CleanUpConstantsOptions extends CleanUpConstants {
+
+	private static void setEclipseDefaultSettings(CleanUpOptions options) {
+
+		//Member Accesses
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
+
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
+
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS, CleanUpOptions.TRUE);
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_FIELD, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_METHOD, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS, CleanUpOptions.TRUE);
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS, CleanUpOptions.TRUE);
+
+		//Control Statements
+		options.setOption(CONTROL_STATEMENTS_USE_BLOCKS, CleanUpOptions.FALSE);
+		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_ALWAYS, CleanUpOptions.TRUE);
+		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NO_FOR_RETURN_AND_THROW, CleanUpOptions.FALSE);
+		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NEVER, CleanUpOptions.FALSE);
+
+		options.setOption(CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED, CleanUpOptions.FALSE);
+
+		//Expressions
+		options.setOption(EXPRESSIONS_USE_PARENTHESES, CleanUpOptions.FALSE);
+		options.setOption(EXPRESSIONS_USE_PARENTHESES_NEVER, CleanUpOptions.TRUE);
+		options.setOption(EXPRESSIONS_USE_PARENTHESES_ALWAYS, CleanUpOptions.FALSE);
+
+		//Variable Declarations
+		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL, CleanUpOptions.FALSE);
+		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_LOCAL_VARIABLES, CleanUpOptions.TRUE);
+		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PARAMETERS, CleanUpOptions.FALSE);
+		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PRIVATE_FIELDS, CleanUpOptions.TRUE);
+
+		//Functional Interfaces
+		options.setOption(CONVERT_FUNCTIONAL_INTERFACES, CleanUpOptions.FALSE);
+		options.setOption(USE_LAMBDA, CleanUpOptions.TRUE);
+		options.setOption(USE_ANONYMOUS_CLASS_CREATION, CleanUpOptions.FALSE);
+
+		//Unused Code
+		options.setOption(REMOVE_UNUSED_CODE_IMPORTS, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_MEMBERS, CleanUpOptions.FALSE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_CONSTRUCTORS, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_FELDS, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_METHODS, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_TYPES, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNUSED_CODE_LOCAL_VARIABLES, CleanUpOptions.FALSE);
+
+		//Unnecessary Code
+		options.setOption(REMOVE_UNNECESSARY_CASTS, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNNECESSARY_NLS_TAGS, CleanUpOptions.TRUE);
+		options.setOption(INSERT_INFERRED_TYPE_ARGUMENTS, CleanUpOptions.FALSE);
+		options.setOption(REMOVE_REDUNDANT_TYPE_ARGUMENTS, CleanUpOptions.FALSE);
+		options.setOption(REMOVE_REDUNDANT_MODIFIERS, CleanUpOptions.FALSE);
+
+		//Missing Code
+		options.setOption(ADD_MISSING_ANNOTATIONS, CleanUpOptions.TRUE);
+		options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE, CleanUpOptions.TRUE);
+		options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION, CleanUpOptions.TRUE);
+		options.setOption(ADD_MISSING_ANNOTATIONS_DEPRECATED, CleanUpOptions.TRUE);
+
+		options.setOption(ADD_MISSING_SERIAL_VERSION_ID, CleanUpOptions.FALSE);
+		options.setOption(ADD_MISSING_SERIAL_VERSION_ID_GENERATED, CleanUpOptions.FALSE);
+		options.setOption(ADD_MISSING_SERIAL_VERSION_ID_DEFAULT, CleanUpOptions.TRUE);
+
+		options.setOption(ADD_MISSING_NLS_TAGS, CleanUpOptions.FALSE);
+
+		options.setOption(ADD_MISSING_METHODES, CleanUpOptions.FALSE);
+		options.setOption(UnimplementedCodeCleanUp.MAKE_TYPE_ABSTRACT, CleanUpOptions.FALSE);
+
+		//Code Organizing
+		options.setOption(FORMAT_SOURCE_CODE, CleanUpOptions.FALSE);
+		options.setOption(FORMAT_SOURCE_CODE_CHANGES_ONLY, CleanUpOptions.FALSE);
+
+		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES, CleanUpOptions.FALSE);
+		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_ALL, CleanUpOptions.TRUE);
+		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY, CleanUpOptions.FALSE);
+
+		options.setOption(FORMAT_CORRECT_INDENTATION, CleanUpOptions.FALSE);
+
+		options.setOption(ORGANIZE_IMPORTS, CleanUpOptions.FALSE);
+
+		options.setOption(SORT_MEMBERS, CleanUpOptions.FALSE);
+		options.setOption(SORT_MEMBERS_ALL, CleanUpOptions.FALSE);
+	}
+
+	private static void setSaveParticipantSettings(CleanUpOptions options) {
+
+		//Member Accesses
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
+
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
+
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_FIELD, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_METHOD, CleanUpOptions.FALSE);
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS, CleanUpOptions.TRUE);
+		options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS, CleanUpOptions.TRUE);
+
+		//Control Statements
+		options.setOption(CONTROL_STATEMENTS_USE_BLOCKS, CleanUpOptions.FALSE);
+		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_ALWAYS, CleanUpOptions.TRUE);
+		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NO_FOR_RETURN_AND_THROW, CleanUpOptions.FALSE);
+		options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NEVER, CleanUpOptions.FALSE);
+
+		options.setOption(CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED, CleanUpOptions.FALSE);
+
+		//Expressions
+		options.setOption(EXPRESSIONS_USE_PARENTHESES, CleanUpOptions.FALSE);
+		options.setOption(EXPRESSIONS_USE_PARENTHESES_NEVER, CleanUpOptions.TRUE);
+		options.setOption(EXPRESSIONS_USE_PARENTHESES_ALWAYS, CleanUpOptions.FALSE);
+
+		//Variable Declarations
+		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL, CleanUpOptions.FALSE);
+		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_LOCAL_VARIABLES, CleanUpOptions.TRUE);
+		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PARAMETERS, CleanUpOptions.FALSE);
+		options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PRIVATE_FIELDS, CleanUpOptions.TRUE);
+
+		//Functional Interfaces
+		options.setOption(CONVERT_FUNCTIONAL_INTERFACES, CleanUpOptions.FALSE);
+		options.setOption(USE_LAMBDA, CleanUpOptions.TRUE);
+		options.setOption(USE_ANONYMOUS_CLASS_CREATION, CleanUpOptions.FALSE);
+
+		//Unused Code
+		options.setOption(REMOVE_UNUSED_CODE_IMPORTS, CleanUpOptions.FALSE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_MEMBERS, CleanUpOptions.FALSE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_CONSTRUCTORS, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_FELDS, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_METHODS, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNUSED_CODE_PRIVATE_TYPES, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNUSED_CODE_LOCAL_VARIABLES, CleanUpOptions.FALSE);
+
+		//Unnecessary Code
+		options.setOption(REMOVE_UNNECESSARY_CASTS, CleanUpOptions.TRUE);
+		options.setOption(REMOVE_UNNECESSARY_NLS_TAGS, CleanUpOptions.FALSE);
+		options.setOption(INSERT_INFERRED_TYPE_ARGUMENTS, CleanUpOptions.FALSE);
+		options.setOption(REMOVE_REDUNDANT_TYPE_ARGUMENTS, CleanUpOptions.FALSE);
+		options.setOption(REMOVE_REDUNDANT_MODIFIERS, CleanUpOptions.FALSE);
+
+		//Missing Code
+		options.setOption(ADD_MISSING_ANNOTATIONS, CleanUpOptions.TRUE);
+		options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE, CleanUpOptions.TRUE);
+		options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION, CleanUpOptions.TRUE);
+		options.setOption(ADD_MISSING_ANNOTATIONS_DEPRECATED, CleanUpOptions.TRUE);
+
+		options.setOption(ADD_MISSING_SERIAL_VERSION_ID, CleanUpOptions.FALSE);
+		options.setOption(ADD_MISSING_SERIAL_VERSION_ID_GENERATED, CleanUpOptions.FALSE);
+		options.setOption(ADD_MISSING_SERIAL_VERSION_ID_DEFAULT, CleanUpOptions.TRUE);
+
+		options.setOption(ADD_MISSING_NLS_TAGS, CleanUpOptions.FALSE);
+
+		options.setOption(ADD_MISSING_METHODES, CleanUpOptions.FALSE);
+		options.setOption(UnimplementedCodeCleanUp.MAKE_TYPE_ABSTRACT, CleanUpOptions.FALSE);
+
+		//Code Organizing
+		options.setOption(FORMAT_SOURCE_CODE, CleanUpOptions.FALSE);
+		options.setOption(FORMAT_SOURCE_CODE_CHANGES_ONLY, CleanUpOptions.FALSE);
+
+		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES, CleanUpOptions.FALSE);
+		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_ALL, CleanUpOptions.TRUE);
+		options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY, CleanUpOptions.FALSE);
+
+		options.setOption(FORMAT_CORRECT_INDENTATION, CleanUpOptions.FALSE);
+
+		options.setOption(ORGANIZE_IMPORTS, CleanUpOptions.TRUE);
+
+		options.setOption(SORT_MEMBERS, CleanUpOptions.FALSE);
+		options.setOption(SORT_MEMBERS_ALL, CleanUpOptions.FALSE);
+
+		options.setOption(CLEANUP_ON_SAVE_ADDITIONAL_OPTIONS, CleanUpOptions.FALSE);
+	}
+
+	public static void initDefaults(IPreferenceStore store) {
+		CleanUpOptions settings= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS);
+		for (Iterator<String> iterator= settings.getKeys().iterator(); iterator.hasNext();) {
+			String key= iterator.next();
+			store.setDefault(key, settings.getValue(key));
+		}
+
+		store.setDefault(SHOW_CLEAN_UP_WIZARD, true);
+		store.setDefault(CLEANUP_PROFILE, DEFAULT_PROFILE);
+		store.setDefault(CLEANUP_ON_SAVE_PROFILE, DEFAULT_SAVE_PARTICIPANT_PROFILE);
+	}
+
+	public static void setDefaultOptions(int kind, CleanUpOptions options) {
+		switch (kind) {
+			case CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS:
+				CleanUpConstantsOptions.setEclipseDefaultSettings(options);
+				break;
+			case CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS:
+				CleanUpConstantsOptions.setSaveParticipantSettings(options);
+				break;
+			default:
+				Assert.isTrue(false, "Unknown Clean Up option kind: " + kind); //$NON-NLS-1$
+				break;
+		}
+	}
+
+}
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CompilationUnitRewriteOperationsFix.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CompilationUnitRewriteOperationsFix.java
index 1031f14..7bd1127 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CompilationUnitRewriteOperationsFix.java
+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CompilationUnitRewriteOperationsFix.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2011 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,74 +7,36 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - modified to extend CompilationUnitRewriteOperationsFixCore
  *******************************************************************************/
 package org.eclipse.jdt.internal.corext.fix;
 
 import org.eclipse.core.runtime.Assert;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
 
-import org.eclipse.text.edits.TextEditGroup;
-
-import org.eclipse.ltk.core.refactoring.GroupCategory;
-import org.eclipse.ltk.core.refactoring.GroupCategorySet;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.dom.ASTNode;
 import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.Type;
-import org.eclipse.jdt.core.dom.rewrite.ImportRewrite;
-import org.eclipse.jdt.core.dom.rewrite.ImportRewrite.ImportRewriteContext;
-import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
 
-import org.eclipse.jdt.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext;
 import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite;
-import org.eclipse.jdt.internal.corext.util.Messages;
 
-import org.eclipse.jdt.ui.JavaUI;
-
-public class CompilationUnitRewriteOperationsFix extends AbstractFix {
-
-	public abstract static class CompilationUnitRewriteOperation {
+public class CompilationUnitRewriteOperationsFix extends CompilationUnitRewriteOperationsFixCore implements ILinkedFix {
+	
+	public abstract static class CompilationUnitRewriteOperation extends CompilationUnitRewriteOperationsFixCore.CompilationUnitRewriteOperation {
 
 		public abstract void rewriteAST(CompilationUnitRewrite cuRewrite, LinkedProposalModel linkedModel) throws CoreException;
 
-		protected Type importType(final ITypeBinding toImport, final ASTNode accessor, ImportRewrite imports, final CompilationUnit compilationUnit) {
-			ImportRewriteContext importContext= new ContextSensitiveImportRewriteContext(compilationUnit, accessor.getStartPosition(), imports);
-			return imports.addImport(toImport, compilationUnit.getAST(), importContext);
-		}
-
-		protected TextEditGroup createTextEditGroup(String label, CompilationUnitRewrite rewrite) {
-			if (label.length() > 0) {
-				return rewrite.createCategorizedGroupDescription(label, new GroupCategorySet(new GroupCategory(label, label, label)));
-			} else {
-				return rewrite.createGroupDescription(label);
-			}
-		}
-
-		public String getAdditionalInfo() {
-			return null;
+		@Override
+		public void rewriteAST(CompilationUnitRewrite cuRewrite, LinkedProposalModelCore linkedModel) throws CoreException {
+			rewriteAST(cuRewrite, (LinkedProposalModel)linkedModel);
 		}
 	}
 
-	private final CompilationUnitRewriteOperation[] fOperations;
-	private final CompilationUnit fCompilationUnit;
-	private final LinkedProposalModel fLinkedProposalModel;
-
 	public CompilationUnitRewriteOperationsFix(String name, CompilationUnit compilationUnit, CompilationUnitRewriteOperation operation) {
 		this(name, compilationUnit, new CompilationUnitRewriteOperation[] { operation });
 		Assert.isNotNull(operation);
 	}
 
 	public CompilationUnitRewriteOperationsFix(String name, CompilationUnit compilationUnit, CompilationUnitRewriteOperation[] operations) {
-		super(name);
-		Assert.isNotNull(operations);
-		Assert.isLegal(operations.length > 0);
-		fCompilationUnit= compilationUnit;
-		fOperations= operations;
+		super(name, compilationUnit, operations);
 		fLinkedProposalModel= new LinkedProposalModel();
 	}
 
@@ -83,40 +45,7 @@
 		if (!fLinkedProposalModel.hasLinkedPositions())
 			return null;
 
-		return fLinkedProposalModel;
-	}
-
-	@Override
-	public CompilationUnitChange createChange(IProgressMonitor progressMonitor) throws CoreException {
-		CompilationUnitRewrite cuRewrite= new CompilationUnitRewrite((ICompilationUnit)fCompilationUnit.getJavaElement(), fCompilationUnit);
-
-		fLinkedProposalModel.clear();
-		for (int i= 0; i < fOperations.length; i++) {
-			CompilationUnitRewriteOperation operation= fOperations[i];
-			operation.rewriteAST(cuRewrite, fLinkedProposalModel);
-		}
-
-		CompilationUnitChange result= cuRewrite.createChange(getDisplayString(), true, null);
-		if (result == null)
-			throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, Messages.format(FixMessages.CompilationUnitRewriteOperationsFix_nullChangeError, getDisplayString())));
-
-		return result;
-	}
-
-	@Override
-	public String getAdditionalProposalInfo(){
-		StringBuilder sb= new StringBuilder();
-		for (int i= 0; i < fOperations.length; i++) {
-			CompilationUnitRewriteOperation operation= fOperations[i];
-			String info= operation.getAdditionalInfo();
-			if (info != null)
-				sb.append(info);
-		}
-
-		if (sb.length() == 0)
-			return null;
-
-		return sb.toString();
+		return (LinkedProposalModel)fLinkedProposalModel;
 	}
 
 }
diff --git a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/StringFix.java b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/StringFix.java
index 6422f97..79153f3 100644
--- a/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/StringFix.java
+++ b/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/StringFix.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -49,7 +49,7 @@
  * 		Remove unnecessary $NON-NLS$ tag
  *
  */
-public class StringFix implements IProposableFix {
+public class StringFix implements IProposableFix, ICleanUpFix {
 
 	private final TextEditGroup[] fEditGroups;
 	private final String fName;
@@ -106,7 +106,7 @@
 		ICompilationUnit cu= (ICompilationUnit)compilationUnit.getJavaElement();
 		if (!cu.isStructureKnown())
 			return null; //[clean up] 'Remove unnecessary $NLS-TAGS$' removes necessary ones in case of syntax errors: https://bugs.eclipse.org/bugs/show_bug.cgi?id=285814 : 
-		
+
 		List<CategorizedTextEditGroup> result= new ArrayList<>();
 
 		List<IProblemLocation> missingNLSProblems= new ArrayList<>();
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/DefaultCleanUpOptionsInitializer.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/DefaultCleanUpOptionsInitializer.java
index 093501d..bc6e9b3 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/DefaultCleanUpOptionsInitializer.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/DefaultCleanUpOptionsInitializer.java
@@ -10,6 +10,7 @@
  *******************************************************************************/
 package org.eclipse.jdt.internal.ui.preferences.cleanup;
 
+import org.eclipse.jdt.internal.corext.fix.CleanUpConstantsOptions;
 import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
 
 import org.eclipse.jdt.ui.cleanup.CleanUpOptions;
@@ -29,7 +30,7 @@
 	 */
 	@Override
 	public void setDefaultOptions(CleanUpOptions options) {
-		CleanUpConstants.setDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS, options);
+		CleanUpConstantsOptions.setDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS, options);
 	}
 
 }
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/SaveActionCleanUpOptionsInitializer.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/SaveActionCleanUpOptionsInitializer.java
index da422f4..e5ecbef 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/SaveActionCleanUpOptionsInitializer.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/SaveActionCleanUpOptionsInitializer.java
@@ -10,6 +10,7 @@
  *******************************************************************************/
 package org.eclipse.jdt.internal.ui.preferences.cleanup;
 
+import org.eclipse.jdt.internal.corext.fix.CleanUpConstantsOptions;
 import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
 
 import org.eclipse.jdt.ui.cleanup.CleanUpOptions;
@@ -30,7 +31,7 @@
 	 */
 	@Override
 	public void setDefaultOptions(CleanUpOptions options) {
-		CleanUpConstants.setDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS, options);
+		CleanUpConstantsOptions.setDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS, options);
 	}
 
 }
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/PreferenceConstants.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/PreferenceConstants.java
index 0cce93a..e23725f 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/PreferenceConstants.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/PreferenceConstants.java
@@ -39,7 +39,7 @@
 import org.eclipse.jdt.core.manipulation.JavaManipulation;
 
 import org.eclipse.jdt.internal.core.manipulation.MembersOrderPreferenceCacheCommon;
-import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
+import org.eclipse.jdt.internal.corext.fix.CleanUpConstantsOptions;
 
 import org.eclipse.jdt.ui.text.IJavaColorConstants;
 
@@ -67,7 +67,7 @@
  *
  * @noinstantiate This class is not intended to be instantiated by clients.
  * @noextend This class is not intended to be subclassed by clients.
-  */
+ */
 public class PreferenceConstants {
 
 	private PreferenceConstants() {
@@ -3759,7 +3759,7 @@
 	 */
 	public final static String EDITOR_SOURCE_HOVER_BACKGROUND_COLOR_SYSTEM_DEFAULT= "sourceHoverBackgroundColor.SystemDefault"; //$NON-NLS-1$
 
-	
+
 	/**
 	 * A named preference that tells whether to use different icons
 	 * for source folders marked to contain test code and classpath entries
@@ -4092,7 +4092,7 @@
 
 
 		//Code Clean Up
-		CleanUpConstants.initDefaults(store);
+		CleanUpConstantsOptions.initDefaults(store);
 
 		// Colors that are set by the current theme
 		JavaUIPreferenceInitializer.setThemeBasedPreferences(store, false);
@@ -4128,7 +4128,7 @@
 	 * @param entries an array of classpath entries to be encoded
 	 *
 	 * @return the encoded string.
-	*/
+	 */
 	public static String encodeJRELibrary(String description, IClasspathEntry[] entries) {
 		return NewJavaProjectPreferencePage.encodeJRELibrary(description, entries);
 	}
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpContext.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpContext.java
index 60b92a4..15e1e21 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpContext.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpContext.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2008, 2011 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,11 +7,10 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - modified to use internal class to supply logic
  *******************************************************************************/
 package org.eclipse.jdt.ui.cleanup;
 
-import org.eclipse.core.runtime.Assert;
-
 import org.eclipse.jdt.core.ICompilationUnit;
 import org.eclipse.jdt.core.dom.CompilationUnit;
 
@@ -22,10 +21,9 @@
  * @since 3.5
  */
 public class CleanUpContext {
-
-	private final ICompilationUnit fUnit;
-
-	private final CompilationUnit fAst;
+	
+	// Use internal class to supply logic
+	private final org.eclipse.jdt.internal.corext.fix.CleanUpContext fContext;
 
 	/**
 	 * Creates a new clean up context.
@@ -37,9 +35,7 @@
 	 *            <code>true</code>.
 	 */
 	public CleanUpContext(ICompilationUnit unit, CompilationUnit ast) {
-		Assert.isLegal(unit != null);
-		fUnit= unit;
-		fAst= ast;
+		fContext= new org.eclipse.jdt.internal.corext.fix.CleanUpContext(unit, ast);
 	}
 
 	/**
@@ -48,7 +44,7 @@
 	 * @return the compilation unit to clean up
 	 */
 	public ICompilationUnit getCompilationUnit() {
-		return fUnit;
+		return fContext.getCompilationUnit();
 	}
 
 	/**
@@ -64,6 +60,6 @@
 	 * @return an AST or <code>null</code> if none required
 	 */
 	public CompilationUnit getAST() {
-		return fAst;
+		return fContext.getAST();
 	}
 }
\ No newline at end of file
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpOptions.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpOptions.java
index ae67d65..bf131f2 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpOptions.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpOptions.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2008, 2011 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,16 +7,13 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - modified to supply logic through internal class
  *******************************************************************************/
 package org.eclipse.jdt.ui.cleanup;
 
-import java.util.Collections;
-import java.util.Hashtable;
 import java.util.Map;
 import java.util.Set;
 
-import org.eclipse.core.runtime.Assert;
-
 import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
 
 
@@ -27,8 +24,9 @@
  * @noextend This class is not intended to be subclassed by clients.
  */
 public class CleanUpOptions {
-
-	private final Map<String, String> fOptions;
+	
+	// Use internal class to supply logic
+	private final org.eclipse.jdt.internal.corext.fix.CleanUpOptions fOptions;
 
 	/**
 	 * True value
@@ -47,14 +45,14 @@
 	 *            string value
 	 */
 	protected CleanUpOptions(Map<String, String> options) {
-		fOptions= options;
+		fOptions= new org.eclipse.jdt.internal.corext.fix.CleanUpOptions(options);
 	}
 
 	/**
 	 * Creates a new instance.
 	 */
 	public CleanUpOptions() {
-		fOptions= new Hashtable<>();
+		fOptions= new org.eclipse.jdt.internal.corext.fix.CleanUpOptions();
 	}
 
 	/**
@@ -66,9 +64,7 @@
 	 * @see CleanUpConstants
 	 */
 	public boolean isEnabled(String key) {
-		Assert.isLegal(key != null);
-		Object value= fOptions.get(key);
-		return CleanUpOptions.TRUE == value || CleanUpOptions.TRUE.equals(value);
+		return fOptions.isEnabled(key);
 	}
 
 	/**
@@ -79,10 +75,7 @@
 	 * @throws IllegalArgumentException if the key is null or unknown
 	 */
 	public String getValue(String key) {
-		Assert.isLegal(key != null);
-		String value= fOptions.get(key);
-		Assert.isLegal(value != null);
-		return value;
+		return fOptions.getValue(key);
 	}
 
 	/**
@@ -95,9 +88,7 @@
 	 * @see CleanUpOptions#FALSE
 	 */
 	public void setOption(String key, String value) {
-		Assert.isLegal(key != null);
-		Assert.isLegal(value != null);
-		fOptions.put(key, value);
+		fOptions.setOption(key, value);
 	}
 
 	/**
@@ -106,6 +97,6 @@
 	 * @return an unmodifiable set of all keys
 	 */
 	public Set<String> getKeys() {
-		return Collections.unmodifiableSet(fOptions.keySet());
+		return fOptions.getKeys();
 	}
 }
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpRequirements.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpRequirements.java
index c9ab1e9..6d7ebed 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpRequirements.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/cleanup/CleanUpRequirements.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,13 +7,12 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     Red Hat Inc. - modified to use internal class to perform logic
  *******************************************************************************/
 package org.eclipse.jdt.ui.cleanup;
 
 import java.util.Map;
 
-import org.eclipse.core.runtime.Assert;
-
 import org.eclipse.jdt.core.JavaCore;
 
 
@@ -23,15 +22,9 @@
  * @since 3.5
  */
 public final class CleanUpRequirements {
-
-	private final boolean fRequiresAST;
-
-	private final Map<String, String> fCompilerOptions;
-
-	private final boolean fRequiresFreshAST;
-
-	private final boolean fRequiresChangedRegions;
-
+	
+	// Use internal class which contains logic
+	private final org.eclipse.jdt.internal.corext.fix.CleanUpRequirements fRequirements;
 
 	/**
 	 * Create a new instance
@@ -42,16 +35,7 @@
 	 * @param compilerOptions map of compiler options or <code>null</code> if no requirements
 	 */
 	public CleanUpRequirements(boolean requiresAST, boolean requiresFreshAST, boolean requiresChangedRegions, Map<String, String> compilerOptions) {
-		Assert.isLegal(!requiresFreshAST || requiresAST, "Must not request fresh AST if no AST is required"); //$NON-NLS-1$
-		Assert.isLegal(compilerOptions == null || requiresAST, "Must not provide options if no AST is required"); //$NON-NLS-1$
-		fRequiresAST= requiresAST;
-		fRequiresFreshAST= requiresFreshAST;
-		fRequiresChangedRegions= requiresChangedRegions;
-
-		fCompilerOptions= compilerOptions;
-		// Make sure that compile warnings are not suppressed since some clean ups work on reported warnings
-		if (fCompilerOptions != null)
-			fCompilerOptions.put(JavaCore.COMPILER_PB_SUPPRESS_WARNINGS, JavaCore.DISABLED);
+		this.fRequirements = new org.eclipse.jdt.internal.corext.fix.CleanUpRequirements(requiresAST, requiresFreshAST, requiresChangedRegions, compilerOptions);
 	}
 
 	/**
@@ -64,7 +48,7 @@
 	 * @return <code>true</code> if the {@linkplain CleanUpContext context} must provide an AST
 	 */
 	public boolean requiresAST() {
-		return fRequiresAST;
+		return fRequirements.requiresAST();
 	}
 
 	/**
@@ -74,7 +58,7 @@
 	 * @return <code>true</code> if the caller needs an up to date AST
 	 */
 	public boolean requiresFreshAST() {
-		return fRequiresFreshAST;
+		return fRequirements.requiresFreshAST();
 	}
 
 	/**
@@ -84,7 +68,7 @@
 	 * @see JavaCore
 	 */
 	public Map<String, String> getCompilerOptions() {
-		return fCompilerOptions;
+		return fRequirements.getCompilerOptions();
 	}
 
 	/**
@@ -103,7 +87,7 @@
 	 *         regions
 	 */
 	public boolean requiresChangedRegions() {
-		return fRequiresChangedRegions;
+		return fRequirements.requiresChangedRegions();
 	}
 
 }
\ No newline at end of file