use of org.eclipse.xtend.ide.codebuilder.JavaMethodBuilder in project xtext-xtend by eclipse.
the class CodeBuilderQuickfix method getJavaModification.
protected IModification getJavaModification(final ICodeBuilder.Java builder) {
final IModification _function = (IModificationContext it) -> {
final IType type = builder.getIType();
char _charAt = ".".charAt(0);
final ImportManager importManager = new ImportManager(true, _charAt);
final StringBuilderBasedAppendable content = new StringBuilderBasedAppendable(importManager);
builder.build(content);
final Consumer<String> _function_1 = (String it_1) -> {
try {
ICompilationUnit _compilationUnit = type.getCompilationUnit();
NullProgressMonitor _nullProgressMonitor = new NullProgressMonitor();
_compilationUnit.createImport(it_1, null, _nullProgressMonitor);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
};
importManager.getImports().forEach(_function_1);
Object _switchResult = null;
boolean _matched = false;
if (builder instanceof JavaFieldBuilder) {
_matched = true;
String _string = content.toString();
NullProgressMonitor _nullProgressMonitor = new NullProgressMonitor();
_switchResult = type.createField(_string, null, true, _nullProgressMonitor);
}
if (!_matched) {
if (builder instanceof JavaConstructorBuilder) {
_matched = true;
String _string = content.toString();
NullProgressMonitor _nullProgressMonitor = new NullProgressMonitor();
_switchResult = type.createMethod(_string, null, true, _nullProgressMonitor);
}
}
if (!_matched) {
if (builder instanceof JavaMethodBuilder) {
_matched = true;
String _string = content.toString();
NullProgressMonitor _nullProgressMonitor = new NullProgressMonitor();
_switchResult = type.createMethod(_string, null, true, _nullProgressMonitor);
}
}
if (!_matched) {
_switchResult = null;
}
final Object element = ((Object) _switchResult);
if ((element != null)) {
JdtHyperlink _jdtHyperlink = new JdtHyperlink();
final Procedure1<JdtHyperlink> _function_2 = (JdtHyperlink it_1) -> {
it_1.setJavaElement(((IMember) element));
it_1.open();
};
ObjectExtensions.<JdtHyperlink>operator_doubleArrow(_jdtHyperlink, _function_2);
}
};
return _function;
}
Aggregations