use of org.eclipse.ui.texteditor.ITextEditor in project xtext-xtend by eclipse.
the class SeveralEditorsQueuedBuildTest method undoEditorChangesAndClose.
@Test
public void undoEditorChangesAndClose() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package mypackage;");
_builder.newLine();
_builder.newLine();
_builder.append("public class Foo {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("public void foo() {");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
this.testHelper.createFile("/mypackage/Foo.java", _builder.toString());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("package mypackage;");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("public class Bar {");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("public void bar() {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
this.testHelper.createFile("/mypackage/Bar.java", _builder_1.toString());
this.reset();
final ITextEditor fooEditor = this._javaEditorExtension.reconcile("/mypackage/Foo.java", "foo", "foo2");
this.assertThereAreNotDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas());
this.assertThereAreNotDeltas(this.queuedBuildData.getAndRemovePendingDeltas());
final ITextEditor barEditor = this._javaEditorExtension.reconcile("/mypackage/Bar.java", "bar", "bar2");
this.assertThereAreNotDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas());
this.assertThereAreNotDeltas(this.queuedBuildData.getAndRemovePendingDeltas());
this._javaEditorExtension.reconcile(fooEditor, "foo2", "foo");
this.assertThereAreNotDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas());
this.assertThereAreNotDeltas(this.queuedBuildData.getAndRemovePendingDeltas());
this._javaEditorExtension.close(fooEditor);
this.assertThereAreNotDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas());
this.assertThereAreNotDeltas(this.queuedBuildData.getAndRemovePendingDeltas());
this._javaEditorExtension.save(barEditor);
this.assertThereAreDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas(), "mypackage.Bar");
this.assertThereAreNotDeltas(this.queuedBuildData.getAndRemovePendingDeltas());
this.confirmDeltas();
this.assertThereAreNotDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas());
this.assertThereAreDeltas(this.queuedBuildData.getAndRemovePendingDeltas(), "mypackage.Bar");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.ui.texteditor.ITextEditor in project xtext-xtend by eclipse.
the class SeveralEditorsQueuedBuildTest method undoEditorChangesAndSave.
@Test
public void undoEditorChangesAndSave() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package mypackage;");
_builder.newLine();
_builder.newLine();
_builder.append("public class Foo {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("public void foo() {");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
this.testHelper.createFile("/mypackage/Foo.java", _builder.toString());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("package mypackage;");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("public class Bar {");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("public void bar() {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
this.testHelper.createFile("/mypackage/Bar.java", _builder_1.toString());
this.reset();
final ITextEditor fooEditor = this._javaEditorExtension.reconcile("/mypackage/Foo.java", "foo", "foo2");
this.assertThereAreNotDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas());
this.assertThereAreNotDeltas(this.queuedBuildData.getAndRemovePendingDeltas());
final ITextEditor barEditor = this._javaEditorExtension.reconcile("/mypackage/Bar.java", "bar", "bar2");
this.assertThereAreNotDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas());
this.assertThereAreNotDeltas(this.queuedBuildData.getAndRemovePendingDeltas());
this._javaEditorExtension.reconcile(fooEditor, "foo2", "foo");
this.assertThereAreNotDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas());
this.assertThereAreNotDeltas(this.queuedBuildData.getAndRemovePendingDeltas());
this._javaEditorExtension.save(fooEditor);
this.assertThereAreDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas(), "mypackage.Foo");
this.assertThereAreNotDeltas(this.queuedBuildData.getAndRemovePendingDeltas());
this.confirmDeltas();
this.assertThereAreNotDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas());
this.assertThereAreNotDeltas(this.queuedBuildData.getAndRemovePendingDeltas());
this._javaEditorExtension.save(barEditor);
this.assertThereAreDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas(), "mypackage.Bar");
this.assertThereAreNotDeltas(this.queuedBuildData.getAndRemovePendingDeltas());
this.confirmDeltas();
this.assertThereAreNotDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas());
this.assertThereAreDeltas(this.queuedBuildData.getAndRemovePendingDeltas(), "mypackage.Bar");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.ui.texteditor.ITextEditor in project xtext-xtend by eclipse.
the class SeveralEditorsQueuedBuildTest method saveSeveralEditorsOneByOne.
@Test
public void saveSeveralEditorsOneByOne() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package mypackage;");
_builder.newLine();
_builder.newLine();
_builder.append("public class Foo {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("public void foo() {");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
this.testHelper.createFile("/mypackage/Foo.java", _builder.toString());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("package mypackage;");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("public class Bar {");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("public void bar() {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
this.testHelper.createFile("/mypackage/Bar.java", _builder_1.toString());
this.reset();
final ITextEditor fooEditor = this._javaEditorExtension.reconcile("/mypackage/Foo.java", "foo", "foo2");
this.assertThereAreNotDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas());
this.assertThereAreNotDeltas(this.queuedBuildData.getAndRemovePendingDeltas());
final ITextEditor barEditor = this._javaEditorExtension.reconcile("/mypackage/Bar.java", "bar", "bar2");
this.assertThereAreNotDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas());
this.assertThereAreNotDeltas(this.queuedBuildData.getAndRemovePendingDeltas());
this._javaEditorExtension.save(barEditor);
this.assertThereAreDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas(), "mypackage.Bar");
this.assertThereAreNotDeltas(this.queuedBuildData.getAndRemovePendingDeltas());
this.confirmDeltas();
this.assertThereAreNotDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas());
this.assertThereAreDeltas(this.queuedBuildData.getAndRemovePendingDeltas(), "mypackage.Bar");
this._javaEditorExtension.save(fooEditor);
this.assertThereAreDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas(), "mypackage.Foo");
this.assertThereAreNotDeltas(this.queuedBuildData.getAndRemovePendingDeltas());
this.confirmDeltas();
this.assertThereAreNotDeltas(this.queuedBuildDataContribution.getUnconfirmedDeltas());
this.assertThereAreDeltas(this.queuedBuildData.getAndRemovePendingDeltas(), "mypackage.Foo");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.ui.texteditor.ITextEditor in project xtext-xtend by eclipse.
the class AbstractSingleEditorQueuedBuildTest method renameNestedTypesWithinDefaultPackage.
@Test
public void renameNestedTypesWithinDefaultPackage() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("public class Bar {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("public class Foo { public class Foo3 {} }");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("public static class Foo2 {}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
this.testHelper.createFile("Bar.java", _builder.toString());
final Procedure0 _function = () -> {
final Function1<ITextEditor, ITextEditor> _function_1 = (ITextEditor it) -> {
ITextEditor _xblockexpression = null;
{
this._javaEditorExtension.changeContent(it, " Foo ", " NewFoo ");
this._javaEditorExtension.changeContent(it, " Foo2 ", " NewFoo2 ");
_xblockexpression = this._javaEditorExtension.changeContent(it, " Foo3 ", " NewFoo3 ");
}
return _xblockexpression;
};
this.save("Bar.java", _function_1);
};
this.assertThereAreDeltas(_function, "Bar", "Bar$Foo", "Bar$Foo2", "Bar$NewFoo", "Bar$NewFoo2", "Bar$NewFoo$NewFoo3", "Bar$Foo$Foo3");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.ui.texteditor.ITextEditor in project xtext-xtend by eclipse.
the class AbstractSingleEditorQueuedBuildTest method removeNestedTypesWithinDefaultPackage.
@Test
public void removeNestedTypesWithinDefaultPackage() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("public class Bar {");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("public class Foo { public class Foo3 {} }");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("public static class Foo2 {}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
this.testHelper.createFile("Bar.java", _builder.toString());
final Procedure0 _function = () -> {
final Function1<ITextEditor, ITextEditor> _function_1 = (ITextEditor it) -> {
ITextEditor _xblockexpression = null;
{
this._javaEditorExtension.changeContent(it, "public class Foo { public class Foo3 {} }", "");
_xblockexpression = this._javaEditorExtension.changeContent(it, "public static class Foo2 {}", "");
}
return _xblockexpression;
};
this.save("Bar.java", _function_1);
};
this.assertThereAreDeltas(_function, "Bar", "Bar$Foo", "Bar$Foo2", "Bar$Foo$Foo3");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations