Bug 61273 RTF-styles no longer copied in java editor
I20040506-0200 Copying text from the java editor used to copy the selected source range also in RTF format. This no longer works - the only type in the clipboard is text.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClipboardOperationAction.java
target.beginCompoundChange();		
			}
			try {
				fOperationTarget.doOperation(fOperationCode);
				addImports((ICompilationUnit) inputElement, importsData);
			} catch (CoreException e) {
				JavaPlugin.log(e);
			} finally {
				if (target != null) {
					target.endCompoundChange();		
				}
			}
		} else {
			fOperationTarget.doOperation(fOperationCode);
		}
	}
	
	
	private void addImports(ICompilationUnit unit, ClipboardData data) throws CoreException {
		CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings();
		ImportsStructure importsStructure= new ImportsStructure(unit, settings.importOrder, settings.importThreshold, true);
		importsStructure.setFindAmbiguousImports(false);
		String[] imports= data.getImports();
		for (int i= 0; i < imports.length; i++) {
			importsStructure.addImport(imports[i]);
		}
		importsStructure.create(false, null);
	}
}