From 9c1779d8b11210fce63c0d247a7eca688a66afd0 Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Fri, 5 Apr 2024 18:42:44 +0200 Subject: [PATCH] Re-normalize line-endings in git of all files to Linux style ("\n") Some ASCII-files were checked-in into git having windows style line endings (\r\n). This is in general not wanted because it can cause modified files without any difference in git-staging. This change re-normalizes all such files in this repository except for *.bat files which are only used on Windows. To re-normalize line endings of all files use the following command (including dot): git add --renormalize . --- .../bug410594/mypackage/TortoiseView.xtend | 10 +- .../META-INF/MANIFEST.MF | 34 +- org.eclipse.xtend.m2e/build.properties | 16 +- .../lifecycle-mapping-metadata.xml | 38 +- org.eclipse.xtend.m2e/plugin.xml | 32 +- .../resources/archetype-resources/pom.xml | 134 +- .../src/main/java/HelloXtend.xtend | 20 +- .../resources/it/compile/encoding/pom.xml | 46 +- .../it/compile/multisources-to-link/pom.xml | 130 +- .../resources/it/compile/multisources/pom.xml | 130 +- .../test/resources/it/compile/simple/pom.xml | 40 +- .../suppress_warnings_annotation/pom.xml | 62 +- .../resources/it/compile/symlinks/pom.xml | 140 +- .../it/compile/trace_disabled/pom.xml | 46 +- .../it/compile/trace_enabled/pom.xml | 40 +- .../it/compile/trace_withtestsrc/pom.xml | 70 +- .../resources/it/compile/withtestsrc/pom.xml | 70 +- .../it/compile/xtend-prefs-unused/pom.xml | 64 +- .../resources/it/compile/xtend-prefs/pom.xml | 56 +- .../resources/it/compile/xtenderrors/pom.xml | 40 +- .../it/compile/xtendwarnings/pom.xml | 40 +- .../it/install_debug_info/simple_smap/pom.xml | 62 +- .../smap_multisource/pom.xml | 134 +- .../xtend_as_primary/pom.xml | 62 +- .../pom.xml | 64 +- .../ContentAssistTestLanguageGenerator.java | 106 +- .../ContentAssistTestLanguageGenerator.java | 106 +- .../types/access/impl/URIHelperConstants.java | 50 +- .../generate/bug463946/model/Bug463946.xcore | 24 +- .../xcore/bug463946/Bug463946SuperImpl.java | 10 +- .../xcore/bug463946/Bug463946SuperIntf.java | 10 +- ...FormatterTestLineSeparatorInformation.java | 64 +- .../xtext/ui/editor/IXtextEditorAware.java | 36 +- .../ui/editor/embedded/EmbeddedEditor.java | 220 +-- .../EmbeddedEditorMessages.properties | 242 +-- .../embedded/EmbeddedEditorModelAccess.java | 384 ++--- .../embedded/OperationHistoryListener.java | 86 +- .../ui/editor/embedded/TextViewerAction.java | 290 ++-- .../ui/preferences/IStatusChangeListener.java | 44 +- .../OptionsConfigurationBlock.java | 1394 ++++++++--------- .../preferences/ProjectSelectionDialog.java | 282 ++-- .../PropertyAndPreferencePage.java | 752 ++++----- .../ui/preferences/ScrolledPageContent.java | 122 +- .../xtext/ui/preferences/StatusInfo.java | 274 ++-- .../xtext/web/example/entities/Entities.xtext | 76 +- .../bug462047/Bug462047Lang.xtext | 22 +- .../icons/railroad.svg | 28 +- 47 files changed, 3101 insertions(+), 3101 deletions(-) diff --git a/org.eclipse.xtend.core.tests/batch-compiler-data/bug410594/mypackage/TortoiseView.xtend b/org.eclipse.xtend.core.tests/batch-compiler-data/bug410594/mypackage/TortoiseView.xtend index 722a93a84bb..c771ac95a16 100644 --- a/org.eclipse.xtend.core.tests/batch-compiler-data/bug410594/mypackage/TortoiseView.xtend +++ b/org.eclipse.xtend.core.tests/batch-compiler-data/bug410594/mypackage/TortoiseView.xtend @@ -6,11 +6,11 @@ * * SPDX-License-Identifier: EPL-2.0 ******************************************************************************/ -package mypackage - -import com.google.inject.Singleton -import mypackage.ITortoiseInterpreter - +package mypackage + +import com.google.inject.Singleton +import mypackage.ITortoiseInterpreter + @Singleton class TortoiseView { diff --git a/org.eclipse.xtend.examples/projects/xtend-annotation-examples-client/META-INF/MANIFEST.MF b/org.eclipse.xtend.examples/projects/xtend-annotation-examples-client/META-INF/MANIFEST.MF index 329c6656932..bc8a39821c4 100644 --- a/org.eclipse.xtend.examples/projects/xtend-annotation-examples-client/META-INF/MANIFEST.MF +++ b/org.eclipse.xtend.examples/projects/xtend-annotation-examples-client/META-INF/MANIFEST.MF @@ -1,17 +1,17 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Active Annotations Example Client -Bundle-SymbolicName: xtend-annotation-examples-client -Bundle-Version: 2.35.0.qualifier -Bundle-RequiredExecutionEnvironment: JavaSE-11 -Require-Bundle: org.eclipse.xtend.lib, - com.google.guava;bundle-version="[33.1.0,34.0.0)", - org.eclipse.xtext.xbase.lib;bundle-version="2.35.0", - xtend-annotation-examples;bundle-version="2.4.3" -Bundle-Vendor: Eclipse Xtext -Automatic-Module-Name: xtend-annotation-examples-client -Export-Package: extract;x-internal:=true, - i18n;x-internal:=true, - lazy;x-internal:=true, - observables;x-internal:=true - +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Active Annotations Example Client +Bundle-SymbolicName: xtend-annotation-examples-client +Bundle-Version: 2.35.0.qualifier +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Require-Bundle: org.eclipse.xtend.lib, + com.google.guava;bundle-version="[33.1.0,34.0.0)", + org.eclipse.xtext.xbase.lib;bundle-version="2.35.0", + xtend-annotation-examples;bundle-version="2.4.3" +Bundle-Vendor: Eclipse Xtext +Automatic-Module-Name: xtend-annotation-examples-client +Export-Package: extract;x-internal:=true, + i18n;x-internal:=true, + lazy;x-internal:=true, + observables;x-internal:=true + diff --git a/org.eclipse.xtend.m2e/build.properties b/org.eclipse.xtend.m2e/build.properties index 6789dcdbd6c..cd020c6161b 100644 --- a/org.eclipse.xtend.m2e/build.properties +++ b/org.eclipse.xtend.m2e/build.properties @@ -1,8 +1,8 @@ -source.. = src -bin.includes = META-INF/,\ - .,\ - lifecycle-mapping-metadata.xml,\ - plugin.xml,\ - plugin.properties,\ - about.html, -src.includes = about.html +source.. = src +bin.includes = META-INF/,\ + .,\ + lifecycle-mapping-metadata.xml,\ + plugin.xml,\ + plugin.properties,\ + about.html, +src.includes = about.html diff --git a/org.eclipse.xtend.m2e/lifecycle-mapping-metadata.xml b/org.eclipse.xtend.m2e/lifecycle-mapping-metadata.xml index c9ee9e45b71..5bc185fb95f 100644 --- a/org.eclipse.xtend.m2e/lifecycle-mapping-metadata.xml +++ b/org.eclipse.xtend.m2e/lifecycle-mapping-metadata.xml @@ -1,20 +1,20 @@ - - - - - org.eclipse.xtend - xtend-maven-plugin - [2.2.0,) - - compile - testCompile - - - - - org.eclipse.xtend.m2e.xtendConfigurator - - - - + + + + + org.eclipse.xtend + xtend-maven-plugin + [2.2.0,) + + compile + testCompile + + + + + org.eclipse.xtend.m2e.xtendConfigurator + + + + \ No newline at end of file diff --git a/org.eclipse.xtend.m2e/plugin.xml b/org.eclipse.xtend.m2e/plugin.xml index df08dff3888..fbe42dc34e8 100644 --- a/org.eclipse.xtend.m2e/plugin.xml +++ b/org.eclipse.xtend.m2e/plugin.xml @@ -1,16 +1,16 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/org.eclipse.xtend.maven.archetype/src/main/resources/archetype-resources/pom.xml b/org.eclipse.xtend.maven.archetype/src/main/resources/archetype-resources/pom.xml index 35dac8638b2..06747bfaab0 100644 --- a/org.eclipse.xtend.maven.archetype/src/main/resources/archetype-resources/pom.xml +++ b/org.eclipse.xtend.maven.archetype/src/main/resources/archetype-resources/pom.xml @@ -1,67 +1,67 @@ - - - 4.0.0 - \${groupId} - \${artifactId} - \${version} - xtend-quickstart - - ${project.version} - ${sourceEncoding} - ${javaVersion} - ${javaVersion} - - - - - org.eclipse.xtext - xtext-dev-bom - ${xtend.version} - pom - import - - - - - - - org.eclipse.xtend - xtend-maven-plugin - ${xtend.version} - - - - compile - testCompile - xtend-install-debug-info - xtend-test-install-debug-info - - - - - \${project.build.directory}/xtend-gen/main - \${project.build.directory}/xtend-gen/test - - - - - - - org.eclipse.xtend - org.eclipse.xtend.lib - ${xtend.version} - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - + + + 4.0.0 + \${groupId} + \${artifactId} + \${version} + xtend-quickstart + + ${project.version} + ${sourceEncoding} + ${javaVersion} + ${javaVersion} + + + + + org.eclipse.xtext + xtext-dev-bom + ${xtend.version} + pom + import + + + + + + + org.eclipse.xtend + xtend-maven-plugin + ${xtend.version} + + + + compile + testCompile + xtend-install-debug-info + xtend-test-install-debug-info + + + + + \${project.build.directory}/xtend-gen/main + \${project.build.directory}/xtend-gen/test + + + + + + + org.eclipse.xtend + org.eclipse.xtend.lib + ${xtend.version} + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + diff --git a/org.eclipse.xtend.maven.archetype/src/main/resources/archetype-resources/src/main/java/HelloXtend.xtend b/org.eclipse.xtend.maven.archetype/src/main/resources/archetype-resources/src/main/java/HelloXtend.xtend index 9a5f76a254f..86e4e52f7a4 100644 --- a/org.eclipse.xtend.maven.archetype/src/main/resources/archetype-resources/src/main/java/HelloXtend.xtend +++ b/org.eclipse.xtend.maven.archetype/src/main/resources/archetype-resources/src/main/java/HelloXtend.xtend @@ -1,11 +1,11 @@ -package ${package} - -class HelloXtend { - - def static void main(String[] args) { - println(message) - } - - def static getMessage () '''Hello Xtend!''' - +package ${package} + +class HelloXtend { + + def static void main(String[] args) { + println(message) + } + + def static getMessage () '''Hello Xtend!''' + } \ No newline at end of file diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/encoding/pom.xml b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/encoding/pom.xml index 68a6258b3f5..14302d14641 100755 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/encoding/pom.xml +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/encoding/pom.xml @@ -1,23 +1,23 @@ - - 4.0.0 - - org.eclipse.xtend - it-tests-parent - IT-SNAPSHOT - ../../pom.xml - - simple - - UTF-16 - - - - - org.eclipse.xtend - xtend-maven-plugin - - - - + + 4.0.0 + + org.eclipse.xtend + it-tests-parent + IT-SNAPSHOT + ../../pom.xml + + simple + + UTF-16 + + + + + org.eclipse.xtend + xtend-maven-plugin + + + + diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/multisources-to-link/pom.xml b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/multisources-to-link/pom.xml index 0263fe5135a..bad959cbed5 100755 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/multisources-to-link/pom.xml +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/multisources-to-link/pom.xml @@ -1,65 +1,65 @@ - - 4.0.0 - - org.eclipse.xtend - it-tests-parent - IT-SNAPSHOT - ../../pom.xml - - multisources - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - generate-sources - - add-source - - - - src/main/java2 - - - - - add-test-source - generate-test-sources - - add-test-source - - - - src/test/java2 - - - - - - - org.eclipse.xtend - xtend-maven-plugin - - - - compile - testCompile - - - - - - - - - junit - junit - test - - - + + 4.0.0 + + org.eclipse.xtend + it-tests-parent + IT-SNAPSHOT + ../../pom.xml + + multisources + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-source + generate-sources + + add-source + + + + src/main/java2 + + + + + add-test-source + generate-test-sources + + add-test-source + + + + src/test/java2 + + + + + + + org.eclipse.xtend + xtend-maven-plugin + + + + compile + testCompile + + + + + + + + + junit + junit + test + + + diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/multisources/pom.xml b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/multisources/pom.xml index 0263fe5135a..bad959cbed5 100755 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/multisources/pom.xml +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/multisources/pom.xml @@ -1,65 +1,65 @@ - - 4.0.0 - - org.eclipse.xtend - it-tests-parent - IT-SNAPSHOT - ../../pom.xml - - multisources - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - generate-sources - - add-source - - - - src/main/java2 - - - - - add-test-source - generate-test-sources - - add-test-source - - - - src/test/java2 - - - - - - - org.eclipse.xtend - xtend-maven-plugin - - - - compile - testCompile - - - - - - - - - junit - junit - test - - - + + 4.0.0 + + org.eclipse.xtend + it-tests-parent + IT-SNAPSHOT + ../../pom.xml + + multisources + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-source + generate-sources + + add-source + + + + src/main/java2 + + + + + add-test-source + generate-test-sources + + add-test-source + + + + src/test/java2 + + + + + + + org.eclipse.xtend + xtend-maven-plugin + + + + compile + testCompile + + + + + + + + + junit + junit + test + + + diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/simple/pom.xml b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/simple/pom.xml index 4c7406f5f48..e8625a2f028 100755 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/simple/pom.xml +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/simple/pom.xml @@ -1,20 +1,20 @@ - - 4.0.0 - - org.eclipse.xtend - it-tests-parent - IT-SNAPSHOT - ../../pom.xml - - simple - - - - org.eclipse.xtend - xtend-maven-plugin - - - - + + 4.0.0 + + org.eclipse.xtend + it-tests-parent + IT-SNAPSHOT + ../../pom.xml + + simple + + + + org.eclipse.xtend + xtend-maven-plugin + + + + diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/suppress_warnings_annotation/pom.xml b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/suppress_warnings_annotation/pom.xml index 28d3f6d6f11..4692213cf1f 100755 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/suppress_warnings_annotation/pom.xml +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/suppress_warnings_annotation/pom.xml @@ -1,31 +1,31 @@ - - 4.0.0 - - org.eclipse.xtend - it-tests-parent - IT-SNAPSHOT - ../../pom.xml - - simple - - - - org.eclipse.xtend - xtend-maven-plugin - - false - - - - - compile - testCompile - - - - - - - + + 4.0.0 + + org.eclipse.xtend + it-tests-parent + IT-SNAPSHOT + ../../pom.xml + + simple + + + + org.eclipse.xtend + xtend-maven-plugin + + false + + + + + compile + testCompile + + + + + + + diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/symlinks/pom.xml b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/symlinks/pom.xml index 1d09add3b4c..f6e78c3b413 100755 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/symlinks/pom.xml +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/symlinks/pom.xml @@ -1,70 +1,70 @@ - - 4.0.0 - - org.eclipse.xtend - it-tests-parent - IT-SNAPSHOT - ../../pom.xml - - symlinks - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - generate-sources - - add-source - - - - src/main/java2 - - - - - add-test-source - generate-test-sources - - add-test-source - - - - src/test/java2 - - - - - - - org.eclipse.xtend - xtend-maven-plugin - - - - compile - testCompile - - - - - - - - - org.eclipse.xtend - org.eclipse.xtend.lib - - - junit - junit - 4.13.1 - test - - - + + 4.0.0 + + org.eclipse.xtend + it-tests-parent + IT-SNAPSHOT + ../../pom.xml + + symlinks + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-source + generate-sources + + add-source + + + + src/main/java2 + + + + + add-test-source + generate-test-sources + + add-test-source + + + + src/test/java2 + + + + + + + org.eclipse.xtend + xtend-maven-plugin + + + + compile + testCompile + + + + + + + + + org.eclipse.xtend + org.eclipse.xtend.lib + + + junit + junit + 4.13.1 + test + + + diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/trace_disabled/pom.xml b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/trace_disabled/pom.xml index f13029c9238..e749f684486 100755 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/trace_disabled/pom.xml +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/trace_disabled/pom.xml @@ -1,23 +1,23 @@ - - 4.0.0 - - org.eclipse.xtend - it-tests-parent - IT-SNAPSHOT - ../../pom.xml - - trace_enabled - - - - org.eclipse.xtend - xtend-maven-plugin - - false - - - - - + + 4.0.0 + + org.eclipse.xtend + it-tests-parent + IT-SNAPSHOT + ../../pom.xml + + trace_enabled + + + + org.eclipse.xtend + xtend-maven-plugin + + false + + + + + diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/trace_enabled/pom.xml b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/trace_enabled/pom.xml index 7333c47db7c..44e328f0c47 100755 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/trace_enabled/pom.xml +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/trace_enabled/pom.xml @@ -1,20 +1,20 @@ - - 4.0.0 - - org.eclipse.xtend - it-tests-parent - IT-SNAPSHOT - ../../pom.xml - - trace_enabled - - - - org.eclipse.xtend - xtend-maven-plugin - - - - + + 4.0.0 + + org.eclipse.xtend + it-tests-parent + IT-SNAPSHOT + ../../pom.xml + + trace_enabled + + + + org.eclipse.xtend + xtend-maven-plugin + + + + diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/trace_withtestsrc/pom.xml b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/trace_withtestsrc/pom.xml index 565498a08bd..733e7cda439 100755 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/trace_withtestsrc/pom.xml +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/trace_withtestsrc/pom.xml @@ -1,35 +1,35 @@ - - 4.0.0 - - org.eclipse.xtend - it-tests-parent - IT-SNAPSHOT - ../../pom.xml - - simpletest - - - - org.eclipse.xtend - xtend-maven-plugin - - - - compile - testCompile - - - - - - - - - junit - junit - test - - - + + 4.0.0 + + org.eclipse.xtend + it-tests-parent + IT-SNAPSHOT + ../../pom.xml + + simpletest + + + + org.eclipse.xtend + xtend-maven-plugin + + + + compile + testCompile + + + + + + + + + junit + junit + test + + + diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/withtestsrc/pom.xml b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/withtestsrc/pom.xml index 565498a08bd..733e7cda439 100755 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/withtestsrc/pom.xml +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/withtestsrc/pom.xml @@ -1,35 +1,35 @@ - - 4.0.0 - - org.eclipse.xtend - it-tests-parent - IT-SNAPSHOT - ../../pom.xml - - simpletest - - - - org.eclipse.xtend - xtend-maven-plugin - - - - compile - testCompile - - - - - - - - - junit - junit - test - - - + + 4.0.0 + + org.eclipse.xtend + it-tests-parent + IT-SNAPSHOT + ../../pom.xml + + simpletest + + + + org.eclipse.xtend + xtend-maven-plugin + + + + compile + testCompile + + + + + + + + + junit + junit + test + + + diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/xtend-prefs-unused/pom.xml b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/xtend-prefs-unused/pom.xml index 0073fabba46..67c8aaad5f8 100755 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/xtend-prefs-unused/pom.xml +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/xtend-prefs-unused/pom.xml @@ -1,32 +1,32 @@ - - 4.0.0 - - org.eclipse.xtend - it-tests-parent - IT-SNAPSHOT - ../../pom.xml - - xtend-prefs-unused - - - - org.eclipse.xtend - xtend-maven-plugin - - - - compile - testCompile - - - - - src/main/xtend-dir-from-pom - src/test/xtend-dir-from-pom - - - - - + + 4.0.0 + + org.eclipse.xtend + it-tests-parent + IT-SNAPSHOT + ../../pom.xml + + xtend-prefs-unused + + + + org.eclipse.xtend + xtend-maven-plugin + + + + compile + testCompile + + + + + src/main/xtend-dir-from-pom + src/test/xtend-dir-from-pom + + + + + diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/xtend-prefs/pom.xml b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/xtend-prefs/pom.xml index 99ca82ed307..03f55a4ef00 100755 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/xtend-prefs/pom.xml +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/xtend-prefs/pom.xml @@ -1,28 +1,28 @@ - - 4.0.0 - - org.eclipse.xtend - it-tests-parent - IT-SNAPSHOT - ../../pom.xml - - xtend-prefs - - - - org.eclipse.xtend - xtend-maven-plugin - - - - compile - testCompile - - - - - - - + + 4.0.0 + + org.eclipse.xtend + it-tests-parent + IT-SNAPSHOT + ../../pom.xml + + xtend-prefs + + + + org.eclipse.xtend + xtend-maven-plugin + + + + compile + testCompile + + + + + + + diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/xtenderrors/pom.xml b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/xtenderrors/pom.xml index 4c7406f5f48..e8625a2f028 100755 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/xtenderrors/pom.xml +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/xtenderrors/pom.xml @@ -1,20 +1,20 @@ - - 4.0.0 - - org.eclipse.xtend - it-tests-parent - IT-SNAPSHOT - ../../pom.xml - - simple - - - - org.eclipse.xtend - xtend-maven-plugin - - - - + + 4.0.0 + + org.eclipse.xtend + it-tests-parent + IT-SNAPSHOT + ../../pom.xml + + simple + + + + org.eclipse.xtend + xtend-maven-plugin + + + + diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/xtendwarnings/pom.xml b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/xtendwarnings/pom.xml index 4c7406f5f48..e8625a2f028 100755 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/xtendwarnings/pom.xml +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/compile/xtendwarnings/pom.xml @@ -1,20 +1,20 @@ - - 4.0.0 - - org.eclipse.xtend - it-tests-parent - IT-SNAPSHOT - ../../pom.xml - - simple - - - - org.eclipse.xtend - xtend-maven-plugin - - - - + + 4.0.0 + + org.eclipse.xtend + it-tests-parent + IT-SNAPSHOT + ../../pom.xml + + simple + + + + org.eclipse.xtend + xtend-maven-plugin + + + + diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/install_debug_info/simple_smap/pom.xml b/org.eclipse.xtend.maven.plugin/src/test/resources/it/install_debug_info/simple_smap/pom.xml index 73e974cd071..031efd828be 100755 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/install_debug_info/simple_smap/pom.xml +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/install_debug_info/simple_smap/pom.xml @@ -1,31 +1,31 @@ - - 4.0.0 - - org.eclipse.xtend - it-tests-parent - IT-SNAPSHOT - ../../pom.xml - - simple - - - - org.eclipse.xtend - xtend-maven-plugin - - 11 - - - - - compile - xtend-install-debug-info - - - - - - - + + 4.0.0 + + org.eclipse.xtend + it-tests-parent + IT-SNAPSHOT + ../../pom.xml + + simple + + + + org.eclipse.xtend + xtend-maven-plugin + + 11 + + + + + compile + xtend-install-debug-info + + + + + + + diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/install_debug_info/smap_multisource/pom.xml b/org.eclipse.xtend.maven.plugin/src/test/resources/it/install_debug_info/smap_multisource/pom.xml index e98d9aaac37..671383512e5 100755 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/install_debug_info/smap_multisource/pom.xml +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/install_debug_info/smap_multisource/pom.xml @@ -1,67 +1,67 @@ - - 4.0.0 - - org.eclipse.xtend - it-tests-parent - IT-SNAPSHOT - ../../pom.xml - - smap_multisources - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - generate-sources - - add-source - - - - src/main/java2 - - - - - add-test-source - generate-test-sources - - add-test-source - - - - src/test/java2 - - - - - - - org.eclipse.xtend - xtend-maven-plugin - - - - compile - testCompile - xtend-install-debug-info - xtend-test-install-debug-info - - - - - - - - - junit - junit - test - - - + + 4.0.0 + + org.eclipse.xtend + it-tests-parent + IT-SNAPSHOT + ../../pom.xml + + smap_multisources + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-source + generate-sources + + add-source + + + + src/main/java2 + + + + + add-test-source + generate-test-sources + + add-test-source + + + + src/test/java2 + + + + + + + org.eclipse.xtend + xtend-maven-plugin + + + + compile + testCompile + xtend-install-debug-info + xtend-test-install-debug-info + + + + + + + + + junit + junit + test + + + diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/install_debug_info/xtend_as_primary/pom.xml b/org.eclipse.xtend.maven.plugin/src/test/resources/it/install_debug_info/xtend_as_primary/pom.xml index 2ebe5e053af..433816d10fe 100755 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/install_debug_info/xtend_as_primary/pom.xml +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/install_debug_info/xtend_as_primary/pom.xml @@ -1,31 +1,31 @@ - - 4.0.0 - simple - - org.eclipse.xtend - it-tests-parent - IT-SNAPSHOT - ../../pom.xml - - - - - org.eclipse.xtend - xtend-maven-plugin - - true - - - - - compile - xtend-install-debug-info - - - - - - - + + 4.0.0 + simple + + org.eclipse.xtend + it-tests-parent + IT-SNAPSHOT + ../../pom.xml + + + + + org.eclipse.xtend + xtend-maven-plugin + + true + + + + + compile + xtend-install-debug-info + + + + + + + diff --git a/org.eclipse.xtend.maven.plugin/src/test/resources/it/install_debug_info/xtend_as_primary_with_synthetic_vars/pom.xml b/org.eclipse.xtend.maven.plugin/src/test/resources/it/install_debug_info/xtend_as_primary_with_synthetic_vars/pom.xml index 2d92c105b3e..c0f05cf885d 100755 --- a/org.eclipse.xtend.maven.plugin/src/test/resources/it/install_debug_info/xtend_as_primary_with_synthetic_vars/pom.xml +++ b/org.eclipse.xtend.maven.plugin/src/test/resources/it/install_debug_info/xtend_as_primary_with_synthetic_vars/pom.xml @@ -1,32 +1,32 @@ - - 4.0.0 - simple - - org.eclipse.xtend - it-tests-parent - IT-SNAPSHOT - ../../pom.xml - - - - - org.eclipse.xtend - xtend-maven-plugin - - true - false - - - - - compile - xtend-install-debug-info - - - - - - - + + 4.0.0 + simple + + org.eclipse.xtend + it-tests-parent + IT-SNAPSHOT + ../../pom.xml + + + + + org.eclipse.xtend + xtend-maven-plugin + + true + false + + + + + compile + xtend-install-debug-info + + + + + + + diff --git a/org.eclipse.xtext.common.types.eclipse.tests/src/org/eclipse/xtext/common/types/xtext/ui/generator/ContentAssistTestLanguageGenerator.java b/org.eclipse.xtext.common.types.eclipse.tests/src/org/eclipse/xtext/common/types/xtext/ui/generator/ContentAssistTestLanguageGenerator.java index 3ad39522a19..76571ada550 100644 --- a/org.eclipse.xtext.common.types.eclipse.tests/src/org/eclipse/xtext/common/types/xtext/ui/generator/ContentAssistTestLanguageGenerator.java +++ b/org.eclipse.xtext.common.types.eclipse.tests/src/org/eclipse/xtext/common/types/xtext/ui/generator/ContentAssistTestLanguageGenerator.java @@ -1,53 +1,53 @@ -/******************************************************************************* - * Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.common.types.xtext.ui.generator; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.xtext.common.types.xtext.ui.contentAssistTestLanguage.GenerateDirective; -import org.eclipse.xtext.common.types.xtext.ui.contentAssistTestLanguage.Model; -import org.eclipse.xtext.generator.IFileSystemAccess; -import org.eclipse.xtext.generator.IGenerator; - -/** - * @author Vladimir Piskarev - Initial contribution and API - */ -public class ContentAssistTestLanguageGenerator implements IGenerator { - - @Override - public void doGenerate(Resource input, IFileSystemAccess fsa) { - if (input.getContents().isEmpty()) - return; - EObject root = input.getContents().get(0); - if (!(root instanceof Model)) - return; - GenerateDirective generateDirective = ((Model) root).getGenerateDirective(); - if (generateDirective != null) { - fsa.generateFile(generateFileName(generateDirective), generateFileContents(generateDirective)); - } - } - - private String generateFileName(GenerateDirective generateDirective) { - return generateDirective.getTypeName().replace('.', '/') + ".java"; - } - - private String generateFileContents(GenerateDirective generateDirective) { - String typeName = generateDirective.getTypeName(); - int lastDot = typeName.lastIndexOf('.'); - String packageName = (lastDot < 0) ? null : typeName.substring(0, lastDot); - String simpleTypeName = (lastDot < 0) ? typeName : typeName.substring(lastDot + 1); - StringBuilder result = new StringBuilder(); - if (packageName != null && packageName.length() > 0) - result.append("package " + packageName + "; "); - if (simpleTypeName.length() > 0) - result.append("public class " + simpleTypeName + " {}"); - return result.toString(); - } - -} +/******************************************************************************* + * Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.xtext.common.types.xtext.ui.generator; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.xtext.common.types.xtext.ui.contentAssistTestLanguage.GenerateDirective; +import org.eclipse.xtext.common.types.xtext.ui.contentAssistTestLanguage.Model; +import org.eclipse.xtext.generator.IFileSystemAccess; +import org.eclipse.xtext.generator.IGenerator; + +/** + * @author Vladimir Piskarev - Initial contribution and API + */ +public class ContentAssistTestLanguageGenerator implements IGenerator { + + @Override + public void doGenerate(Resource input, IFileSystemAccess fsa) { + if (input.getContents().isEmpty()) + return; + EObject root = input.getContents().get(0); + if (!(root instanceof Model)) + return; + GenerateDirective generateDirective = ((Model) root).getGenerateDirective(); + if (generateDirective != null) { + fsa.generateFile(generateFileName(generateDirective), generateFileContents(generateDirective)); + } + } + + private String generateFileName(GenerateDirective generateDirective) { + return generateDirective.getTypeName().replace('.', '/') + ".java"; + } + + private String generateFileContents(GenerateDirective generateDirective) { + String typeName = generateDirective.getTypeName(); + int lastDot = typeName.lastIndexOf('.'); + String packageName = (lastDot < 0) ? null : typeName.substring(0, lastDot); + String simpleTypeName = (lastDot < 0) ? typeName : typeName.substring(lastDot + 1); + StringBuilder result = new StringBuilder(); + if (packageName != null && packageName.length() > 0) + result.append("package " + packageName + "; "); + if (simpleTypeName.length() > 0) + result.append("public class " + simpleTypeName + " {}"); + return result.toString(); + } + +} diff --git a/org.eclipse.xtext.common.types.tests/src/org/eclipse/xtext/common/types/xtext/ui/generator/ContentAssistTestLanguageGenerator.java b/org.eclipse.xtext.common.types.tests/src/org/eclipse/xtext/common/types/xtext/ui/generator/ContentAssistTestLanguageGenerator.java index 098f3b69ac3..f2367b644b2 100644 --- a/org.eclipse.xtext.common.types.tests/src/org/eclipse/xtext/common/types/xtext/ui/generator/ContentAssistTestLanguageGenerator.java +++ b/org.eclipse.xtext.common.types.tests/src/org/eclipse/xtext/common/types/xtext/ui/generator/ContentAssistTestLanguageGenerator.java @@ -1,53 +1,53 @@ -/******************************************************************************* - * Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.common.types.xtext.ui.generator; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.xtext.common.types.xtext.ui.contentAssistTestLanguage.GenerateDirective; -import org.eclipse.xtext.common.types.xtext.ui.contentAssistTestLanguage.Model; -import org.eclipse.xtext.generator.IFileSystemAccess; -import org.eclipse.xtext.generator.IGenerator; - -/** - * @author Vladimir Piskarev - Initial contribution and API - */ -public class ContentAssistTestLanguageGenerator implements IGenerator { - - @Override - public void doGenerate(Resource input, IFileSystemAccess fsa) { - if (input.getContents().isEmpty()) - return; - EObject root = input.getContents().get(0); - if (!(root instanceof Model)) - return; - GenerateDirective generateDirective = ((Model) root).getGenerateDirective(); - if (generateDirective != null) { - fsa.generateFile(generateFileName(generateDirective), generateFileContents(generateDirective)); - } - } - - private String generateFileName(GenerateDirective generateDirective) { - return generateDirective.getTypeName().replace('.', '/') + ".java"; - } - - private String generateFileContents(GenerateDirective generateDirective) { - String typeName = generateDirective.getTypeName(); - int lastDot = typeName.lastIndexOf('.'); - String packageName = (lastDot < 0) ? null : typeName.substring(0, lastDot); - String simpleTypeName = (lastDot < 0) ? typeName : typeName.substring(lastDot + 1); - StringBuilder result = new StringBuilder(); - if (packageName != null && packageName.length() > 0) - result.append("package " + packageName + "; "); - if (simpleTypeName.length() > 0) - result.append("public class " + simpleTypeName + " {}"); - return result.toString(); - } - -} +/******************************************************************************* + * Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.xtext.common.types.xtext.ui.generator; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.xtext.common.types.xtext.ui.contentAssistTestLanguage.GenerateDirective; +import org.eclipse.xtext.common.types.xtext.ui.contentAssistTestLanguage.Model; +import org.eclipse.xtext.generator.IFileSystemAccess; +import org.eclipse.xtext.generator.IGenerator; + +/** + * @author Vladimir Piskarev - Initial contribution and API + */ +public class ContentAssistTestLanguageGenerator implements IGenerator { + + @Override + public void doGenerate(Resource input, IFileSystemAccess fsa) { + if (input.getContents().isEmpty()) + return; + EObject root = input.getContents().get(0); + if (!(root instanceof Model)) + return; + GenerateDirective generateDirective = ((Model) root).getGenerateDirective(); + if (generateDirective != null) { + fsa.generateFile(generateFileName(generateDirective), generateFileContents(generateDirective)); + } + } + + private String generateFileName(GenerateDirective generateDirective) { + return generateDirective.getTypeName().replace('.', '/') + ".java"; + } + + private String generateFileContents(GenerateDirective generateDirective) { + String typeName = generateDirective.getTypeName(); + int lastDot = typeName.lastIndexOf('.'); + String packageName = (lastDot < 0) ? null : typeName.substring(0, lastDot); + String simpleTypeName = (lastDot < 0) ? typeName : typeName.substring(lastDot + 1); + StringBuilder result = new StringBuilder(); + if (packageName != null && packageName.length() > 0) + result.append("package " + packageName + "; "); + if (simpleTypeName.length() > 0) + result.append("public class " + simpleTypeName + " {}"); + return result.toString(); + } + +} diff --git a/org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/impl/URIHelperConstants.java b/org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/impl/URIHelperConstants.java index c6d9b0ceee3..5e0c2a7b689 100644 --- a/org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/impl/URIHelperConstants.java +++ b/org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/impl/URIHelperConstants.java @@ -1,25 +1,25 @@ -/******************************************************************************* - * Copyright (c) 2010 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.common.types.access.impl; - -import org.eclipse.emf.common.util.URI; - -/** - * @author Sebastian Zarnekow - Initial contribution and API - */ -public interface URIHelperConstants { - - URI PRIMITIVES_URI = URI.createURI("java:/Primitives"); - URI OBJECTS_URI = URI.createURI("java:/Objects"); - - String PRIMITIVES = "/Primitives"; //$NON-NLS-1$ - String OBJECTS = "/Objects/"; //$NON-NLS-1$ - String PROTOCOL = "java"; //$NON-NLS-1$ - -} +/******************************************************************************* + * Copyright (c) 2010 itemis AG (http://www.itemis.eu) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.xtext.common.types.access.impl; + +import org.eclipse.emf.common.util.URI; + +/** + * @author Sebastian Zarnekow - Initial contribution and API + */ +public interface URIHelperConstants { + + URI PRIMITIVES_URI = URI.createURI("java:/Primitives"); + URI OBJECTS_URI = URI.createURI("java:/Objects"); + + String PRIMITIVES = "/Primitives"; //$NON-NLS-1$ + String OBJECTS = "/Objects/"; //$NON-NLS-1$ + String PROTOCOL = "java"; //$NON-NLS-1$ + +} diff --git a/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/bug463946/model/Bug463946.xcore b/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/bug463946/model/Bug463946.xcore index 49b75dedac1..c8b4419b35e 100644 --- a/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/bug463946/model/Bug463946.xcore +++ b/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/bug463946/model/Bug463946.xcore @@ -1,13 +1,13 @@ -@GenModel(modelDirectory="bug463946/src-gen", rootExtendsInterface="xcore.bug463946.Bug463946SuperIntf", rootExtendsClass="xcore.bug463946.Bug463946SuperImpl") -package xcore.bug463946.pack - -import org.eclipse.emf.common.notify.Notification - -type Bug463946Notification wraps Notification - -abstract class MyModel { - op void eNotify(Bug463946Notification notification) - { - super.eNotify(notification) - } +@GenModel(modelDirectory="bug463946/src-gen", rootExtendsInterface="xcore.bug463946.Bug463946SuperIntf", rootExtendsClass="xcore.bug463946.Bug463946SuperImpl") +package xcore.bug463946.pack + +import org.eclipse.emf.common.notify.Notification + +type Bug463946Notification wraps Notification + +abstract class MyModel { + op void eNotify(Bug463946Notification notification) + { + super.eNotify(notification) + } } \ No newline at end of file diff --git a/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/bug463946/src/main/java/xcore/bug463946/Bug463946SuperImpl.java b/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/bug463946/src/main/java/xcore/bug463946/Bug463946SuperImpl.java index be960b36ac2..42af28ce876 100644 --- a/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/bug463946/src/main/java/xcore/bug463946/Bug463946SuperImpl.java +++ b/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/bug463946/src/main/java/xcore/bug463946/Bug463946SuperImpl.java @@ -1,6 +1,6 @@ -package xcore.bug463946; - -import org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container; - -public class Bug463946SuperImpl extends Container implements Bug463946SuperIntf { +package xcore.bug463946; + +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container; + +public class Bug463946SuperImpl extends Container implements Bug463946SuperIntf { } \ No newline at end of file diff --git a/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/bug463946/src/main/java/xcore/bug463946/Bug463946SuperIntf.java b/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/bug463946/src/main/java/xcore/bug463946/Bug463946SuperIntf.java index aaa152c14e4..185a94788a3 100644 --- a/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/bug463946/src/main/java/xcore/bug463946/Bug463946SuperIntf.java +++ b/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/bug463946/src/main/java/xcore/bug463946/Bug463946SuperIntf.java @@ -1,6 +1,6 @@ -package xcore.bug463946; - -import org.eclipse.emf.ecore.EObject; - -public interface Bug463946SuperIntf extends EObject { +package xcore.bug463946; + +import org.eclipse.emf.ecore.EObject; + +public interface Bug463946SuperIntf extends EObject { } \ No newline at end of file diff --git a/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/formatter/FormatterTestLineSeparatorInformation.java b/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/formatter/FormatterTestLineSeparatorInformation.java index fda383b66fa..69d06fcdb99 100644 --- a/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/formatter/FormatterTestLineSeparatorInformation.java +++ b/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/formatter/FormatterTestLineSeparatorInformation.java @@ -1,32 +1,32 @@ -/******************************************************************************* - * Copyright (c) 2012 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.parsetree.formatter; - -import org.eclipse.xtext.formatting.ILineSeparatorInformation; - -import com.google.inject.Singleton; - -/** - * @author Jan Koehnlein - Initial contribution and API - */ -@Singleton -public class FormatterTestLineSeparatorInformation implements ILineSeparatorInformation { - - private String lineSeparator; - - public void setLineSeparator(String lineSeparator) { - this.lineSeparator = lineSeparator; - } - - @Override - public String getLineSeparator() { - return lineSeparator; - } - -} +/******************************************************************************* + * Copyright (c) 2012 itemis AG (http://www.itemis.eu) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.xtext.parsetree.formatter; + +import org.eclipse.xtext.formatting.ILineSeparatorInformation; + +import com.google.inject.Singleton; + +/** + * @author Jan Koehnlein - Initial contribution and API + */ +@Singleton +public class FormatterTestLineSeparatorInformation implements ILineSeparatorInformation { + + private String lineSeparator; + + public void setLineSeparator(String lineSeparator) { + this.lineSeparator = lineSeparator; + } + + @Override + public String getLineSeparator() { + return lineSeparator; + } + +} diff --git a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/IXtextEditorAware.java b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/IXtextEditorAware.java index d8e63e8f693..aaa08a98d28 100644 --- a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/IXtextEditorAware.java +++ b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/IXtextEditorAware.java @@ -1,18 +1,18 @@ -/******************************************************************************* - * Copyright (c) 2009 Dan Stefanescu and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ui.editor; - -/** - * @author Dan Stefanescu - Initial contribution and API - */ -public interface IXtextEditorAware { - - void setEditor(XtextEditor editor); - -} +/******************************************************************************* + * Copyright (c) 2009 Dan Stefanescu and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.xtext.ui.editor; + +/** + * @author Dan Stefanescu - Initial contribution and API + */ +public interface IXtextEditorAware { + + void setEditor(XtextEditor editor); + +} diff --git a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/EmbeddedEditor.java b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/EmbeddedEditor.java index 23a152eeb87..dc21bd804f8 100644 --- a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/EmbeddedEditor.java +++ b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/EmbeddedEditor.java @@ -1,111 +1,111 @@ -/******************************************************************************* - * Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ui.editor.embedded; - -import org.eclipse.xtext.ui.editor.XtextSourceViewer; -import org.eclipse.xtext.ui.editor.XtextSourceViewerConfiguration; -import org.eclipse.xtext.ui.editor.model.XtextDocument; -import org.eclipse.xtext.ui.editor.model.XtextDocumentUtil; - -/** - * Handle for an embedded Xtext editor. It allows to initialize the edited model - * and provides accessors for the {@link #getDocument() document}, - * the {@link #getConfiguration() source viewer configuration}, and the {@link #getViewer() viewer}. - * - * @since 2.2 - * @author Sebastian Zarnekow - Initial contribution and API - * @noinstantiate This class is not intended to be instantiated by clients. - */ -public class EmbeddedEditor { - private final XtextSourceViewer viewer; - - private final IEditedResourceProvider resourceProvider; - - private final XtextDocument document; - - private final XtextSourceViewerConfiguration configuration; - - private final Runnable afterSetDocument; - - /** - * @since 2.19 - */ - private XtextDocumentUtil xtextDocumentUtil = new XtextDocumentUtil(); - - public EmbeddedEditor(XtextDocument document, XtextSourceViewer viewer, XtextSourceViewerConfiguration configuration, IEditedResourceProvider resourceProvider, Runnable afterSetDocumet) { - this.document = document; - this.viewer = viewer; - this.configuration = configuration; - this.resourceProvider = resourceProvider; - this.afterSetDocument = afterSetDocumet; - } - - public XtextSourceViewer getViewer() { - return this.viewer; - } - - public XtextDocument getDocument() { - return this.document; - } - - public XtextSourceViewerConfiguration getConfiguration() { - return this.configuration; - } - - /** - * @since 2.19 - */ - public void setXtextDocumentUtil(XtextDocumentUtil xtextDocumentUtil) { - this.xtextDocumentUtil = xtextDocumentUtil; - } - - /** - * @since 2.19 - */ - public XtextDocumentUtil getXtextDocumentUtil() { - return xtextDocumentUtil; - } - - /** - * Obtain the {@link EmbeddedEditorModelAccess model access} for this editor instance. - * It can be used to query the currently edited text or update it externally. - * The prefix and the suffix will not be visible in the editor. It is possible to - * insert artificial line-breaks between the three parts (prefix, editablePart, suffix). - * @return the model access. Never null. - */ - public EmbeddedEditorModelAccess createPartialEditor(String prefix, String editablePart, String suffix, boolean insertLineBreaks) { - EmbeddedEditorModelAccess result = new EmbeddedEditorModelAccess(this.viewer, this.resourceProvider, insertLineBreaks); - result.setXtextDocumentUtil(xtextDocumentUtil); - result.setModel(getDocument(), prefix, editablePart, suffix); - afterSetDocument.run(); - return result; - } - - /** - * Obtain the {@link EmbeddedEditorModelAccess model access} for this editor instance. - * It can be used to query the currently edited text or update it externally. - * This is a shortcut for - * {@link #createPartialEditor(String, String, String, boolean) createPartialEditor("", "", "", insertLinebreaks)}. - * @return the model access. Never null. - */ - public EmbeddedEditorModelAccess createPartialEditor(boolean insertLinebreaks) { - return createPartialEditor("", "", "", insertLinebreaks); - } - - /** - * Obtain the {@link EmbeddedEditorModelAccess model access} for this editor instance. - * It can be used to query the currently edited text or update it externally. - * This is a shortcut for - * {@link #createPartialEditor(String, String, String, boolean) createPartialEditor("", "", "", false)}. - * @return the model access. Never null. - */ - public EmbeddedEditorModelAccess createPartialEditor() { - return createPartialEditor("", "", "", false); - } +/******************************************************************************* + * Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.xtext.ui.editor.embedded; + +import org.eclipse.xtext.ui.editor.XtextSourceViewer; +import org.eclipse.xtext.ui.editor.XtextSourceViewerConfiguration; +import org.eclipse.xtext.ui.editor.model.XtextDocument; +import org.eclipse.xtext.ui.editor.model.XtextDocumentUtil; + +/** + * Handle for an embedded Xtext editor. It allows to initialize the edited model + * and provides accessors for the {@link #getDocument() document}, + * the {@link #getConfiguration() source viewer configuration}, and the {@link #getViewer() viewer}. + * + * @since 2.2 + * @author Sebastian Zarnekow - Initial contribution and API + * @noinstantiate This class is not intended to be instantiated by clients. + */ +public class EmbeddedEditor { + private final XtextSourceViewer viewer; + + private final IEditedResourceProvider resourceProvider; + + private final XtextDocument document; + + private final XtextSourceViewerConfiguration configuration; + + private final Runnable afterSetDocument; + + /** + * @since 2.19 + */ + private XtextDocumentUtil xtextDocumentUtil = new XtextDocumentUtil(); + + public EmbeddedEditor(XtextDocument document, XtextSourceViewer viewer, XtextSourceViewerConfiguration configuration, IEditedResourceProvider resourceProvider, Runnable afterSetDocumet) { + this.document = document; + this.viewer = viewer; + this.configuration = configuration; + this.resourceProvider = resourceProvider; + this.afterSetDocument = afterSetDocumet; + } + + public XtextSourceViewer getViewer() { + return this.viewer; + } + + public XtextDocument getDocument() { + return this.document; + } + + public XtextSourceViewerConfiguration getConfiguration() { + return this.configuration; + } + + /** + * @since 2.19 + */ + public void setXtextDocumentUtil(XtextDocumentUtil xtextDocumentUtil) { + this.xtextDocumentUtil = xtextDocumentUtil; + } + + /** + * @since 2.19 + */ + public XtextDocumentUtil getXtextDocumentUtil() { + return xtextDocumentUtil; + } + + /** + * Obtain the {@link EmbeddedEditorModelAccess model access} for this editor instance. + * It can be used to query the currently edited text or update it externally. + * The prefix and the suffix will not be visible in the editor. It is possible to + * insert artificial line-breaks between the three parts (prefix, editablePart, suffix). + * @return the model access. Never null. + */ + public EmbeddedEditorModelAccess createPartialEditor(String prefix, String editablePart, String suffix, boolean insertLineBreaks) { + EmbeddedEditorModelAccess result = new EmbeddedEditorModelAccess(this.viewer, this.resourceProvider, insertLineBreaks); + result.setXtextDocumentUtil(xtextDocumentUtil); + result.setModel(getDocument(), prefix, editablePart, suffix); + afterSetDocument.run(); + return result; + } + + /** + * Obtain the {@link EmbeddedEditorModelAccess model access} for this editor instance. + * It can be used to query the currently edited text or update it externally. + * This is a shortcut for + * {@link #createPartialEditor(String, String, String, boolean) createPartialEditor("", "", "", insertLinebreaks)}. + * @return the model access. Never null. + */ + public EmbeddedEditorModelAccess createPartialEditor(boolean insertLinebreaks) { + return createPartialEditor("", "", "", insertLinebreaks); + } + + /** + * Obtain the {@link EmbeddedEditorModelAccess model access} for this editor instance. + * It can be used to query the currently edited text or update it externally. + * This is a shortcut for + * {@link #createPartialEditor(String, String, String, boolean) createPartialEditor("", "", "", false)}. + * @return the model access. Never null. + */ + public EmbeddedEditorModelAccess createPartialEditor() { + return createPartialEditor("", "", "", false); + } } \ No newline at end of file diff --git a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/EmbeddedEditorMessages.properties b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/EmbeddedEditorMessages.properties index 1c15560e11d..0341d69050c 100644 --- a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/EmbeddedEditorMessages.properties +++ b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/EmbeddedEditorMessages.properties @@ -1,121 +1,121 @@ -############################################################################### -# Copyright (c) 2000, 2009 IBM Corporation and others. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License 2.0 which is available at -# http://www.eclipse.org/legal/epl-2.0. -# -# SPDX-License-Identifier: EPL-2.0 -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### - - -## Errors ## - -Editor_error_no_provider=Text editor does not have a document provider - -Editor_error_save_title=Save Problems -Editor_error_save_message=Save could not be completed. - -Editor_error_save_deleted_title=Cannot Save -Editor_error_save_deleted_message=The file has been deleted or is not accessible. - -Editor_error_init= Editor could not be initialized. - -Editor_error_save_outofsync_title=Update conflict -Editor_error_save_outofsync_message=The file ''{0}'' has been changed on the file system. Do you want to overwrite the changes made on the file system? - -Editor_error_activated_outofsync_title=File Changed -Editor_error_activated_outofsync_message=The file ''{0}'' has been changed on the file system. Do you want to replace the editor contents with these changes? - -Editor_error_activated_deleted_save_title=File Not Accessible -Editor_error_activated_deleted_save_message=The file ''{0}'' has been deleted or is not accessible. Do you want to save your changes or close the editor without saving? -Editor_error_activated_deleted_save_button_save=Save -Editor_error_activated_deleted_save_button_close=Close -Editor_error_activated_deleted_close_title=File Not Accessible -Editor_error_activated_deleted_close_message=The file ''{0}'' has been deleted or is not accessible. This editor will be closed. - -Editor_error_refresh_outofsync_title=Problems loading File -Editor_error_refresh_outofsync_message=The file ''{0}'' could not be loaded from the file system. - -Editor_error_revert_title=Problems while reverting to saved state -Editor_error_revert_message=Could not revert to saved state. -Editor_error_setinput_title=Problem opening -Editor_error_setinput_message=Cannot open input element: - -Editor_error_validateEdit_title= Problems editing file -Editor_error_validateEdit_message= The file cannot be edited. - -Editor_error_HyperlinkDetector_couldNotCreate_message= The ''{0}'' extension from plug-in ''{1}'' to the ''org.eclipse.ui.workbench.texteditor.hyperlinkDetectors'' extension point failed to load the hyperlink detector. -Editor_error_HyperlinkDetector_invalidElementName_message= An extension from plug-in ''{0}'' to the ''org.eclipse.ui.workbench.texteditor.hyperlinkDetectors'' extension point was ignored because it contains the following invalid element: ''{1}''. -Editor_error_HyperlinkDetector_invalidExtension_message= The ''{0}'' extension from plug-in ''{1}'' to the ''org.eclipse.ui.workbench.texteditor.hyperlinkDetectors'' extension point will be ignored because it contains invalid attributes. -Editor_error_HyperlinkDetectorTarget_invalidElementName_message= An extension from plug-in ''{0}'' to the ''org.eclipse.ui.workbench.texteditor.hyperlinkDetectorTargets'' extension point was ignored because it contains the following invalid element: ''{1}''. -Editor_error_HyperlinkDetectorTarget_invalidExtension_message= The ''{0}'' extension from plug-in ''{1}'' to the ''org.eclipse.ui.workbench.texteditor.hyperlinkDetectorTargets'' extension point will be ignored because it contains invalid attributes. - -AbstractDocumentProvider_error_save_inuse=File is either open in another editor or in use by another operation. - -Editor_mark_status_message_mark_set=Mark set -Editor_mark_status_message_mark_cleared=Mark cleared -Editor_mark_status_message_mark_swapped=Mark swapped -MarkRegionTarget_markNotSet=mark not set -MarkRegionTarget_markNotVisible=mark not in visible region - -# Incremental Find Status field -Editor_FindIncremental_name= Incremental Find -Editor_FindIncremental_reverse_name= Reverse Incremental Find -Editor_FindIncremental_not_found_pattern={0}{1} {2} not found -Editor_FindIncremental_found_pattern={0}{1}: {2} -Editor_FindIncremental_render_tab= - -# The following two properties must end in a space -Editor_FindIncremental_wrapped=Wrapped -Editor_FindIncremental_reverse=Reverse - -Editor_ConvertLineDelimiter_title=Converting line delimiters... - -## Status line ## -Editor_statusline_state_readonly_label=Read-Only -Editor_statusline_state_writable_label=Writable -Editor_statusline_mode_insert_label=Insert -Editor_statusline_mode_overwrite_label=Overwrite -Editor_statusline_mode_smartinsert_label=Smart Insert -Editor_statusline_position_pattern={0} : {1} -Editor_statusline_error_label=? - -## Others ## -WorkbenchChainedTextFontFieldEditor_defaultWorkbenchTextFont= - -FindReplace_title= Find/Replace -FindReplace_Find_label=&Find: -FindReplace_Replace_label=R&eplace with: -FindReplace_Direction=Direction -FindReplace_ForwardRadioButton_label=F&orward -FindReplace_BackwardRadioButton_label=&Backward -FindReplace_Scope=Scope -FindReplace_GlobalRadioButton_label=A&ll -FindReplace_SelectedRangeRadioButton_label=Selec&ted lines -FindReplace_Options=Options -FindReplace_CaseCheckBox_label=&Case sensitive -FindReplace_WrapCheckBox_label=Wra&p search -FindReplace_WholeWordCheckBox_label=&Whole word -FindReplace_IncrementalCheckBox_label=&Incremental -FindReplace_RegExCheckbox_label= Regular e&xpressions -FindReplace_FindNextButton_label=Fi&nd -FindReplace_ReplaceFindButton_label=Replace/Fin&d -FindReplace_ReplaceSelectionButton_label=&Replace -FindReplace_ReplaceAllButton_label=Replace &All -FindReplace_CloseButton_label=Close -FindReplace_Status_noMatch_label=String Not Found -FindReplace_Status_replacement_label=1 Match replaced -FindReplace_Status_replacements_label={0} matches replaced - -FindNext_Status_noMatch_label=String Not Found - -AbstractDocumentProvider_ok=OK -AbstractDocumentProvider_error=ERROR -FindReplaceDialog_read_only=Cannot replace. File is read-only. - -Editor_MoveLines_IllegalMove_status= Move not possible - Uncheck "Show Source of Selected Element Only" to see the entire document - -Editor_error_clipboard_copy_failed_message= Copy to clipboard failed. +############################################################################### +# Copyright (c) 2000, 2009 IBM Corporation and others. +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License 2.0 which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### + + +## Errors ## + +Editor_error_no_provider=Text editor does not have a document provider + +Editor_error_save_title=Save Problems +Editor_error_save_message=Save could not be completed. + +Editor_error_save_deleted_title=Cannot Save +Editor_error_save_deleted_message=The file has been deleted or is not accessible. + +Editor_error_init= Editor could not be initialized. + +Editor_error_save_outofsync_title=Update conflict +Editor_error_save_outofsync_message=The file ''{0}'' has been changed on the file system. Do you want to overwrite the changes made on the file system? + +Editor_error_activated_outofsync_title=File Changed +Editor_error_activated_outofsync_message=The file ''{0}'' has been changed on the file system. Do you want to replace the editor contents with these changes? + +Editor_error_activated_deleted_save_title=File Not Accessible +Editor_error_activated_deleted_save_message=The file ''{0}'' has been deleted or is not accessible. Do you want to save your changes or close the editor without saving? +Editor_error_activated_deleted_save_button_save=Save +Editor_error_activated_deleted_save_button_close=Close +Editor_error_activated_deleted_close_title=File Not Accessible +Editor_error_activated_deleted_close_message=The file ''{0}'' has been deleted or is not accessible. This editor will be closed. + +Editor_error_refresh_outofsync_title=Problems loading File +Editor_error_refresh_outofsync_message=The file ''{0}'' could not be loaded from the file system. + +Editor_error_revert_title=Problems while reverting to saved state +Editor_error_revert_message=Could not revert to saved state. +Editor_error_setinput_title=Problem opening +Editor_error_setinput_message=Cannot open input element: + +Editor_error_validateEdit_title= Problems editing file +Editor_error_validateEdit_message= The file cannot be edited. + +Editor_error_HyperlinkDetector_couldNotCreate_message= The ''{0}'' extension from plug-in ''{1}'' to the ''org.eclipse.ui.workbench.texteditor.hyperlinkDetectors'' extension point failed to load the hyperlink detector. +Editor_error_HyperlinkDetector_invalidElementName_message= An extension from plug-in ''{0}'' to the ''org.eclipse.ui.workbench.texteditor.hyperlinkDetectors'' extension point was ignored because it contains the following invalid element: ''{1}''. +Editor_error_HyperlinkDetector_invalidExtension_message= The ''{0}'' extension from plug-in ''{1}'' to the ''org.eclipse.ui.workbench.texteditor.hyperlinkDetectors'' extension point will be ignored because it contains invalid attributes. +Editor_error_HyperlinkDetectorTarget_invalidElementName_message= An extension from plug-in ''{0}'' to the ''org.eclipse.ui.workbench.texteditor.hyperlinkDetectorTargets'' extension point was ignored because it contains the following invalid element: ''{1}''. +Editor_error_HyperlinkDetectorTarget_invalidExtension_message= The ''{0}'' extension from plug-in ''{1}'' to the ''org.eclipse.ui.workbench.texteditor.hyperlinkDetectorTargets'' extension point will be ignored because it contains invalid attributes. + +AbstractDocumentProvider_error_save_inuse=File is either open in another editor or in use by another operation. + +Editor_mark_status_message_mark_set=Mark set +Editor_mark_status_message_mark_cleared=Mark cleared +Editor_mark_status_message_mark_swapped=Mark swapped +MarkRegionTarget_markNotSet=mark not set +MarkRegionTarget_markNotVisible=mark not in visible region + +# Incremental Find Status field +Editor_FindIncremental_name= Incremental Find +Editor_FindIncremental_reverse_name= Reverse Incremental Find +Editor_FindIncremental_not_found_pattern={0}{1} {2} not found +Editor_FindIncremental_found_pattern={0}{1}: {2} +Editor_FindIncremental_render_tab= + +# The following two properties must end in a space +Editor_FindIncremental_wrapped=Wrapped +Editor_FindIncremental_reverse=Reverse + +Editor_ConvertLineDelimiter_title=Converting line delimiters... + +## Status line ## +Editor_statusline_state_readonly_label=Read-Only +Editor_statusline_state_writable_label=Writable +Editor_statusline_mode_insert_label=Insert +Editor_statusline_mode_overwrite_label=Overwrite +Editor_statusline_mode_smartinsert_label=Smart Insert +Editor_statusline_position_pattern={0} : {1} +Editor_statusline_error_label=? + +## Others ## +WorkbenchChainedTextFontFieldEditor_defaultWorkbenchTextFont= + +FindReplace_title= Find/Replace +FindReplace_Find_label=&Find: +FindReplace_Replace_label=R&eplace with: +FindReplace_Direction=Direction +FindReplace_ForwardRadioButton_label=F&orward +FindReplace_BackwardRadioButton_label=&Backward +FindReplace_Scope=Scope +FindReplace_GlobalRadioButton_label=A&ll +FindReplace_SelectedRangeRadioButton_label=Selec&ted lines +FindReplace_Options=Options +FindReplace_CaseCheckBox_label=&Case sensitive +FindReplace_WrapCheckBox_label=Wra&p search +FindReplace_WholeWordCheckBox_label=&Whole word +FindReplace_IncrementalCheckBox_label=&Incremental +FindReplace_RegExCheckbox_label= Regular e&xpressions +FindReplace_FindNextButton_label=Fi&nd +FindReplace_ReplaceFindButton_label=Replace/Fin&d +FindReplace_ReplaceSelectionButton_label=&Replace +FindReplace_ReplaceAllButton_label=Replace &All +FindReplace_CloseButton_label=Close +FindReplace_Status_noMatch_label=String Not Found +FindReplace_Status_replacement_label=1 Match replaced +FindReplace_Status_replacements_label={0} matches replaced + +FindNext_Status_noMatch_label=String Not Found + +AbstractDocumentProvider_ok=OK +AbstractDocumentProvider_error=ERROR +FindReplaceDialog_read_only=Cannot replace. File is read-only. + +Editor_MoveLines_IllegalMove_status= Move not possible - Uncheck "Show Source of Selected Element Only" to see the entire document + +Editor_error_clipboard_copy_failed_message= Copy to clipboard failed. diff --git a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/EmbeddedEditorModelAccess.java b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/EmbeddedEditorModelAccess.java index 42f8b1a8f97..b77e27fce06 100644 --- a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/EmbeddedEditorModelAccess.java +++ b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/EmbeddedEditorModelAccess.java @@ -1,192 +1,192 @@ -/******************************************************************************* - * Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ui.editor.embedded; - -import java.util.Collections; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IDocumentExtension4; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.ISynchronizable; -import org.eclipse.jface.text.source.AnnotationModel; -import org.eclipse.jface.text.source.SourceViewer; -import org.eclipse.xtext.nodemodel.ICompositeNode; -import org.eclipse.xtext.nodemodel.util.NodeModelUtils; -import org.eclipse.xtext.resource.XtextResource; -import org.eclipse.xtext.ui.editor.model.IXtextDocument; -import org.eclipse.xtext.ui.editor.model.XtextDocument; -import org.eclipse.xtext.ui.editor.model.XtextDocumentUtil; -import org.eclipse.xtext.util.ITextRegion; -import org.eclipse.xtext.util.LazyStringInputStream; -import org.eclipse.xtext.util.TextRegion; -import org.eclipse.xtext.util.concurrent.IUnitOfWork; - -/** - * The model access allows to obtain or manipulate the edited text. - * - * @since 2.2 - * @noinstantiate This class is not intended to be instantiated by clients. - * @author Sebastian Zarnekow - Initial contribution and API - */ -public class EmbeddedEditorModelAccess { - - private final SourceViewer viewer; - - private final boolean insertLineBreaks; - - private final IEditedResourceProvider resourceProvider; - - /** - * @since 2.19 - */ - private XtextDocumentUtil xtextDocumentUtil = new XtextDocumentUtil(); - - public EmbeddedEditorModelAccess(SourceViewer viewer, IEditedResourceProvider resourceProvider, - boolean insertLineBreaks) { - this.viewer = viewer; - this.resourceProvider = resourceProvider; - this.insertLineBreaks = insertLineBreaks; - } - - protected void setModel(XtextDocument document, String prefix, String editablePart, String suffix) { - if (this.insertLineBreaks) { - String delimiter = document.getDefaultLineDelimiter(); - prefix = prefix + delimiter; - suffix = delimiter + suffix; - } - String model = prefix + editablePart + suffix; - document.set(model); - XtextResource resource = createResource(model); - document.setInput(resource); - AnnotationModel annotationModel = new AnnotationModel(); - if (document instanceof ISynchronizable) { - Object lock = ((ISynchronizable) document).getLockObject(); - if (lock == null) { - lock = new Object(); - ((ISynchronizable) document).setLockObject(lock); - } - ((ISynchronizable) annotationModel).setLockObject(lock); - } - this.viewer.setDocument(document, annotationModel, prefix.length(), editablePart.length()); - } - - protected XtextResource createResource(String content) { - XtextResource result = this.resourceProvider.createResource(); - try { - result.load(new LazyStringInputStream(content, result.getEncoding()), Collections.emptyMap()); - } catch (Exception e) { - throw new RuntimeException(e); - } - return result; - } - - public void updateModel(String model) { - IDocument document = this.viewer.getDocument(); - this.viewer.setRedraw(false); - this.viewer.getUndoManager().disconnect(); - document.set(model); - this.viewer.resetVisibleRegion(); - this.viewer.getUndoManager().connect(this.viewer); - this.viewer.setRedraw(true); - } - - public void updateModel(String prefix, String editablePart, String suffix) { - IDocument document = this.viewer.getDocument(); - if (this.insertLineBreaks) { - String delimiter = document.getLegalLineDelimiters()[0]; - if (document instanceof IDocumentExtension4) { - delimiter = ((IDocumentExtension4) document).getDefaultLineDelimiter(); - } - prefix = prefix + delimiter; - suffix = delimiter + suffix; - } - String model = prefix + editablePart + suffix; - this.viewer.setRedraw(false); - this.viewer.getUndoManager().disconnect(); - document.set(model); - this.viewer.setVisibleRegion(prefix.length(), editablePart.length()); - this.viewer.getUndoManager().connect(this.viewer); - this.viewer.setRedraw(true); - } - - public void updateModel(final String model, final String editablePartUriFragment) { - updateModel(model, new IUnitOfWork() { - @Override - public ITextRegion exec(XtextResource state) throws Exception { - EObject editablePart = state.getEObject(editablePartUriFragment); - ICompositeNode node = NodeModelUtils.findActualNodeFor(editablePart); - if (node != null) - return new TextRegion(node.getOffset(), node.getLength()); - return null; - } - }); - } - - public void updateModel(String model, final IUnitOfWork editablePartSelector) { - IXtextDocument document = xtextDocumentUtil.getXtextDocument(this.viewer); - this.viewer.setRedraw(false); - this.viewer.getUndoManager().disconnect(); - document.set(model); - - ITextRegion textRegion = document.readOnly(editablePartSelector); - if (textRegion == null) { - this.viewer.resetVisibleRegion(); - } else { - this.viewer.setVisibleRegion(textRegion.getOffset(), textRegion.getLength()); - } - this.viewer.getUndoManager().connect(this.viewer); - this.viewer.setRedraw(true); - } - - public void updatePrefix(String prefix) { - try { - IDocument document = this.viewer.getDocument(); - IRegion visibleRegion = this.viewer.getVisibleRegion(); - String editablePart = document.get(visibleRegion.getOffset(), visibleRegion.getLength()); - int suffixOffset = visibleRegion.getOffset() + visibleRegion.getLength(); - String suffix = ""; - if (document.getLength() - suffixOffset > 0) { - suffix = document.get(suffixOffset, document.getLength() - suffixOffset); - if (this.insertLineBreaks) { - String delimiter = document.getLegalLineDelimiters()[0]; - if (document instanceof IDocumentExtension4) { - delimiter = ((IDocumentExtension4) document).getDefaultLineDelimiter(); - } - suffix = suffix.substring(delimiter.length()); - } - } - updateModel(prefix, editablePart, suffix); - } catch (BadLocationException e) { - throw new RuntimeException(e); - } - } - - public String getEditablePart() { - IDocument doc = this.viewer.getDocument(); - IRegion visible = this.viewer.getVisibleRegion(); - try { - return doc.get(visible.getOffset(), visible.getLength()); - } catch (BadLocationException e) { - return ""; //$NON-NLS-1$ - } - } - - public String getSerializedModel() { - return this.viewer.getDocument().get(); - } - - /** - * @since 2.19 - */ - protected void setXtextDocumentUtil(XtextDocumentUtil xtextDocumentUtil) { - this.xtextDocumentUtil = xtextDocumentUtil; - } -} +/******************************************************************************* + * Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.xtext.ui.editor.embedded; + +import java.util.Collections; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.IDocumentExtension4; +import org.eclipse.jface.text.IRegion; +import org.eclipse.jface.text.ISynchronizable; +import org.eclipse.jface.text.source.AnnotationModel; +import org.eclipse.jface.text.source.SourceViewer; +import org.eclipse.xtext.nodemodel.ICompositeNode; +import org.eclipse.xtext.nodemodel.util.NodeModelUtils; +import org.eclipse.xtext.resource.XtextResource; +import org.eclipse.xtext.ui.editor.model.IXtextDocument; +import org.eclipse.xtext.ui.editor.model.XtextDocument; +import org.eclipse.xtext.ui.editor.model.XtextDocumentUtil; +import org.eclipse.xtext.util.ITextRegion; +import org.eclipse.xtext.util.LazyStringInputStream; +import org.eclipse.xtext.util.TextRegion; +import org.eclipse.xtext.util.concurrent.IUnitOfWork; + +/** + * The model access allows to obtain or manipulate the edited text. + * + * @since 2.2 + * @noinstantiate This class is not intended to be instantiated by clients. + * @author Sebastian Zarnekow - Initial contribution and API + */ +public class EmbeddedEditorModelAccess { + + private final SourceViewer viewer; + + private final boolean insertLineBreaks; + + private final IEditedResourceProvider resourceProvider; + + /** + * @since 2.19 + */ + private XtextDocumentUtil xtextDocumentUtil = new XtextDocumentUtil(); + + public EmbeddedEditorModelAccess(SourceViewer viewer, IEditedResourceProvider resourceProvider, + boolean insertLineBreaks) { + this.viewer = viewer; + this.resourceProvider = resourceProvider; + this.insertLineBreaks = insertLineBreaks; + } + + protected void setModel(XtextDocument document, String prefix, String editablePart, String suffix) { + if (this.insertLineBreaks) { + String delimiter = document.getDefaultLineDelimiter(); + prefix = prefix + delimiter; + suffix = delimiter + suffix; + } + String model = prefix + editablePart + suffix; + document.set(model); + XtextResource resource = createResource(model); + document.setInput(resource); + AnnotationModel annotationModel = new AnnotationModel(); + if (document instanceof ISynchronizable) { + Object lock = ((ISynchronizable) document).getLockObject(); + if (lock == null) { + lock = new Object(); + ((ISynchronizable) document).setLockObject(lock); + } + ((ISynchronizable) annotationModel).setLockObject(lock); + } + this.viewer.setDocument(document, annotationModel, prefix.length(), editablePart.length()); + } + + protected XtextResource createResource(String content) { + XtextResource result = this.resourceProvider.createResource(); + try { + result.load(new LazyStringInputStream(content, result.getEncoding()), Collections.emptyMap()); + } catch (Exception e) { + throw new RuntimeException(e); + } + return result; + } + + public void updateModel(String model) { + IDocument document = this.viewer.getDocument(); + this.viewer.setRedraw(false); + this.viewer.getUndoManager().disconnect(); + document.set(model); + this.viewer.resetVisibleRegion(); + this.viewer.getUndoManager().connect(this.viewer); + this.viewer.setRedraw(true); + } + + public void updateModel(String prefix, String editablePart, String suffix) { + IDocument document = this.viewer.getDocument(); + if (this.insertLineBreaks) { + String delimiter = document.getLegalLineDelimiters()[0]; + if (document instanceof IDocumentExtension4) { + delimiter = ((IDocumentExtension4) document).getDefaultLineDelimiter(); + } + prefix = prefix + delimiter; + suffix = delimiter + suffix; + } + String model = prefix + editablePart + suffix; + this.viewer.setRedraw(false); + this.viewer.getUndoManager().disconnect(); + document.set(model); + this.viewer.setVisibleRegion(prefix.length(), editablePart.length()); + this.viewer.getUndoManager().connect(this.viewer); + this.viewer.setRedraw(true); + } + + public void updateModel(final String model, final String editablePartUriFragment) { + updateModel(model, new IUnitOfWork() { + @Override + public ITextRegion exec(XtextResource state) throws Exception { + EObject editablePart = state.getEObject(editablePartUriFragment); + ICompositeNode node = NodeModelUtils.findActualNodeFor(editablePart); + if (node != null) + return new TextRegion(node.getOffset(), node.getLength()); + return null; + } + }); + } + + public void updateModel(String model, final IUnitOfWork editablePartSelector) { + IXtextDocument document = xtextDocumentUtil.getXtextDocument(this.viewer); + this.viewer.setRedraw(false); + this.viewer.getUndoManager().disconnect(); + document.set(model); + + ITextRegion textRegion = document.readOnly(editablePartSelector); + if (textRegion == null) { + this.viewer.resetVisibleRegion(); + } else { + this.viewer.setVisibleRegion(textRegion.getOffset(), textRegion.getLength()); + } + this.viewer.getUndoManager().connect(this.viewer); + this.viewer.setRedraw(true); + } + + public void updatePrefix(String prefix) { + try { + IDocument document = this.viewer.getDocument(); + IRegion visibleRegion = this.viewer.getVisibleRegion(); + String editablePart = document.get(visibleRegion.getOffset(), visibleRegion.getLength()); + int suffixOffset = visibleRegion.getOffset() + visibleRegion.getLength(); + String suffix = ""; + if (document.getLength() - suffixOffset > 0) { + suffix = document.get(suffixOffset, document.getLength() - suffixOffset); + if (this.insertLineBreaks) { + String delimiter = document.getLegalLineDelimiters()[0]; + if (document instanceof IDocumentExtension4) { + delimiter = ((IDocumentExtension4) document).getDefaultLineDelimiter(); + } + suffix = suffix.substring(delimiter.length()); + } + } + updateModel(prefix, editablePart, suffix); + } catch (BadLocationException e) { + throw new RuntimeException(e); + } + } + + public String getEditablePart() { + IDocument doc = this.viewer.getDocument(); + IRegion visible = this.viewer.getVisibleRegion(); + try { + return doc.get(visible.getOffset(), visible.getLength()); + } catch (BadLocationException e) { + return ""; //$NON-NLS-1$ + } + } + + public String getSerializedModel() { + return this.viewer.getDocument().get(); + } + + /** + * @since 2.19 + */ + protected void setXtextDocumentUtil(XtextDocumentUtil xtextDocumentUtil) { + this.xtextDocumentUtil = xtextDocumentUtil; + } +} diff --git a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/OperationHistoryListener.java b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/OperationHistoryListener.java index 5ecc1447349..5f135ce9585 100644 --- a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/OperationHistoryListener.java +++ b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/OperationHistoryListener.java @@ -1,44 +1,44 @@ -/******************************************************************************* - * Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ui.editor.embedded; - -import org.eclipse.core.commands.operations.IOperationHistoryListener; -import org.eclipse.core.commands.operations.IUndoContext; -import org.eclipse.core.commands.operations.OperationHistoryEvent; -import org.eclipse.ui.texteditor.IUpdate; - -/** - * @author Sebastian Zarnekow - Initial contribution and API - */ -public class OperationHistoryListener implements IOperationHistoryListener { - private final IUndoContext context; - - private final IUpdate update; - - public OperationHistoryListener(IUndoContext context, IUpdate update) { - this.context = context; - this.update = update; - } - - @Override - public void historyNotification(OperationHistoryEvent event) { - final int type = event.getEventType(); - switch (type) { - case OperationHistoryEvent.UNDONE: - case OperationHistoryEvent.REDONE: - case OperationHistoryEvent.OPERATION_ADDED: - case OperationHistoryEvent.OPERATION_REMOVED: - case OperationHistoryEvent.OPERATION_NOT_OK: - // if this is one of our operations - if (event.getOperation().hasContext(this.context)) { - this.update.update(); - } - } - } +/******************************************************************************* + * Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.xtext.ui.editor.embedded; + +import org.eclipse.core.commands.operations.IOperationHistoryListener; +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.commands.operations.OperationHistoryEvent; +import org.eclipse.ui.texteditor.IUpdate; + +/** + * @author Sebastian Zarnekow - Initial contribution and API + */ +public class OperationHistoryListener implements IOperationHistoryListener { + private final IUndoContext context; + + private final IUpdate update; + + public OperationHistoryListener(IUndoContext context, IUpdate update) { + this.context = context; + this.update = update; + } + + @Override + public void historyNotification(OperationHistoryEvent event) { + final int type = event.getEventType(); + switch (type) { + case OperationHistoryEvent.UNDONE: + case OperationHistoryEvent.REDONE: + case OperationHistoryEvent.OPERATION_ADDED: + case OperationHistoryEvent.OPERATION_REMOVED: + case OperationHistoryEvent.OPERATION_NOT_OK: + // if this is one of our operations + if (event.getOperation().hasContext(this.context)) { + this.update.update(); + } + } + } } \ No newline at end of file diff --git a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/TextViewerAction.java b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/TextViewerAction.java index 969fcc8a306..e4cca60c3c5 100644 --- a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/TextViewerAction.java +++ b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/embedded/TextViewerAction.java @@ -1,145 +1,145 @@ -/******************************************************************************* - * Copyright (c) 2010 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ui.editor.embedded; - -import java.util.ResourceBundle; - -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.ui.texteditor.IUpdate; -import org.eclipse.ui.texteditor.ResourceAction; - -/** - * Skeleton of a standard text viewer action. The action is initially associated with a text viewer via the constructor, - * but can subsequently be changed using {@link #setViewer(ITextViewer)} Subclasses must implement the run - * method and if required override the update method. - *

- * Subclasses that may modify the editor content should use {@link #canModifyViewer()} in their update code - * to check whether updating the viewer is possible. - *

- * - * @since 2.3 - * @author Sebastian Zarnekow - Initial contribution and API - */ -public abstract class TextViewerAction extends ResourceAction implements IUpdate { - - /** The action's viewer */ - private ITextViewer viewer; - - /** - * Creates and initializes the action for the given text editor. The action configures its visual representation - * from the given resource bundle. - * - * @param bundle - * the resource bundle - * @param prefix - * a prefix to be prepended to the various resource keys (described in ResourceAction - * constructor), or null if none - * @param viewer - * the text viewer - * @see ResourceAction#ResourceAction(ResourceBundle, String) - */ - protected TextViewerAction(ResourceBundle bundle, String prefix, ITextViewer viewer) { - this(bundle, prefix); - setViewer(viewer); - update(); - } - - /** - * Make sure the Viewer in set after calling this constructor and before calling {@link #update()} - */ - protected TextViewerAction(ResourceBundle bundle, String prefix) { - super(bundle, prefix); - } - - /** - * Creates and initializes the action for the given text editor. The action configures its visual representation - * from the given resource bundle. - * - * @param bundle - * the resource bundle - * @param prefix - * a prefix to be prepended to the various resource keys (described in ResourceAction - * constructor), or null if none - * @param viewer - * the text editor - * @param style - * the style of this action - * @see ResourceAction#ResourceAction(ResourceBundle, String, int) - */ - protected TextViewerAction(ResourceBundle bundle, String prefix, ITextViewer viewer, int style) { - super(bundle, prefix, style); - setViewer(viewer); - update(); - } - - /** - * Returns the action's text editor. - * - * @return the action's text editor - */ - protected ITextViewer getTextViewer() { - return viewer; - } - - /** - * Retargets this action to the given editor. - * - * @param viewer - * the new viewer, or null if none - */ - public void setViewer(ITextViewer viewer) { - this.viewer = viewer; - } - - /** - * Always enables this action if it is connected to a text editor. If the associated editor is null, - * the action is disabled. Subclasses may override. - */ - @Override - public void update() { - setEnabled(getTextViewer() != null); - } - - /** - * Checks the viewer's modifiable state. Returns true if the viewer can be modified - * - * @return true if a modifying action should be enabled, false otherwise - */ - protected boolean canModifyViewer() { - ITextViewer viewer = getTextViewer(); - if (viewer != null) - return viewer.isEditable(); - else - return false; - } - - /** - * Returns the viewer's selection. - * - * @param viewer - * the viewer - * @return the viewer's selection - */ - protected ITextSelection getSelection(ITextViewer viewer) { - - ISelectionProvider selectionProvider = viewer.getSelectionProvider(); - if (selectionProvider == null) - return null; - - ISelection selection = selectionProvider.getSelection(); - if (!(selection instanceof ITextSelection)) - return null; - - return (ITextSelection) selection; - } - -} +/******************************************************************************* + * Copyright (c) 2010 itemis AG (http://www.itemis.eu) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.xtext.ui.editor.embedded; + +import java.util.ResourceBundle; + +import org.eclipse.jface.text.ITextSelection; +import org.eclipse.jface.text.ITextViewer; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.ui.texteditor.IUpdate; +import org.eclipse.ui.texteditor.ResourceAction; + +/** + * Skeleton of a standard text viewer action. The action is initially associated with a text viewer via the constructor, + * but can subsequently be changed using {@link #setViewer(ITextViewer)} Subclasses must implement the run + * method and if required override the update method. + *

+ * Subclasses that may modify the editor content should use {@link #canModifyViewer()} in their update code + * to check whether updating the viewer is possible. + *

+ * + * @since 2.3 + * @author Sebastian Zarnekow - Initial contribution and API + */ +public abstract class TextViewerAction extends ResourceAction implements IUpdate { + + /** The action's viewer */ + private ITextViewer viewer; + + /** + * Creates and initializes the action for the given text editor. The action configures its visual representation + * from the given resource bundle. + * + * @param bundle + * the resource bundle + * @param prefix + * a prefix to be prepended to the various resource keys (described in ResourceAction + * constructor), or null if none + * @param viewer + * the text viewer + * @see ResourceAction#ResourceAction(ResourceBundle, String) + */ + protected TextViewerAction(ResourceBundle bundle, String prefix, ITextViewer viewer) { + this(bundle, prefix); + setViewer(viewer); + update(); + } + + /** + * Make sure the Viewer in set after calling this constructor and before calling {@link #update()} + */ + protected TextViewerAction(ResourceBundle bundle, String prefix) { + super(bundle, prefix); + } + + /** + * Creates and initializes the action for the given text editor. The action configures its visual representation + * from the given resource bundle. + * + * @param bundle + * the resource bundle + * @param prefix + * a prefix to be prepended to the various resource keys (described in ResourceAction + * constructor), or null if none + * @param viewer + * the text editor + * @param style + * the style of this action + * @see ResourceAction#ResourceAction(ResourceBundle, String, int) + */ + protected TextViewerAction(ResourceBundle bundle, String prefix, ITextViewer viewer, int style) { + super(bundle, prefix, style); + setViewer(viewer); + update(); + } + + /** + * Returns the action's text editor. + * + * @return the action's text editor + */ + protected ITextViewer getTextViewer() { + return viewer; + } + + /** + * Retargets this action to the given editor. + * + * @param viewer + * the new viewer, or null if none + */ + public void setViewer(ITextViewer viewer) { + this.viewer = viewer; + } + + /** + * Always enables this action if it is connected to a text editor. If the associated editor is null, + * the action is disabled. Subclasses may override. + */ + @Override + public void update() { + setEnabled(getTextViewer() != null); + } + + /** + * Checks the viewer's modifiable state. Returns true if the viewer can be modified + * + * @return true if a modifying action should be enabled, false otherwise + */ + protected boolean canModifyViewer() { + ITextViewer viewer = getTextViewer(); + if (viewer != null) + return viewer.isEditable(); + else + return false; + } + + /** + * Returns the viewer's selection. + * + * @param viewer + * the viewer + * @return the viewer's selection + */ + protected ITextSelection getSelection(ITextViewer viewer) { + + ISelectionProvider selectionProvider = viewer.getSelectionProvider(); + if (selectionProvider == null) + return null; + + ISelection selection = selectionProvider.getSelection(); + if (!(selection instanceof ITextSelection)) + return null; + + return (ITextSelection) selection; + } + +} diff --git a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/preferences/IStatusChangeListener.java b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/preferences/IStatusChangeListener.java index 6102dd495b0..c3d4d26c251 100755 --- a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/preferences/IStatusChangeListener.java +++ b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/preferences/IStatusChangeListener.java @@ -1,23 +1,23 @@ -/******************************************************************************* - * Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ui.preferences; - -import org.eclipse.core.runtime.IStatus; - -/** - * - * Initially copied from Jdt. - * - * @author Michael Clay - * @since 2.1 - */ -public interface IStatusChangeListener { - - void statusChanged(IStatus status); +/******************************************************************************* + * Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.xtext.ui.preferences; + +import org.eclipse.core.runtime.IStatus; + +/** + * + * Initially copied from Jdt. + * + * @author Michael Clay + * @since 2.1 + */ +public interface IStatusChangeListener { + + void statusChanged(IStatus status); } \ No newline at end of file diff --git a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/preferences/OptionsConfigurationBlock.java b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/preferences/OptionsConfigurationBlock.java index 21b7f3ac13b..ab5f1f702c1 100755 --- a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/preferences/OptionsConfigurationBlock.java +++ b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/preferences/OptionsConfigurationBlock.java @@ -1,697 +1,697 @@ -/******************************************************************************* - * Copyright (c) 2011, 2017 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ui.preferences; - -import java.io.IOException; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.preference.IPersistentPreferenceStore; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.osgi.util.TextProcessor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Widget; -import org.eclipse.ui.forms.events.ExpansionAdapter; -import org.eclipse.ui.forms.events.ExpansionEvent; -import org.eclipse.ui.forms.widgets.ExpandableComposite; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; -import org.eclipse.xtext.ui.editor.preferences.PreferenceStoreAccessImpl; - -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import com.google.common.collect.MapDifference; -import com.google.common.collect.MapDifference.ValueDifference; -import com.google.common.collect.Maps; -import com.google.inject.Inject; - -/** - * Initially copied from jdt's OptionsConfigurationBlock - * - * @author Michael Clay - * @since 2.1 - */ -public abstract class OptionsConfigurationBlock { - @Inject - AbstractUIPlugin uiPlugin; - - @Inject - protected PreferenceStoreAccessImpl preferenceStoreAccessImpl; - - @Inject - private IBuildPreferenceEvaluator buildPreferenceEvaluator; - - private static final String IS_PROJECT_SPECIFIC = "is_project_specific"; //$NON-NLS-1$ - private static final String SETTINGS_EXPANDED = "expanded"; //$NON-NLS-1$ - private static final String REBUILD_COUNT_KEY = "preferences_build_requested"; //$NON-NLS-1$ - - protected static class ControlData { - private String key; - private String[] values; - - public ControlData(String key, String[] values) { - this.key = key; - this.values = values; - } - - public String getKey() { - return key; - } - - public String getValue(boolean selection) { - int index = selection ? 0 : 1; - return values[index]; - } - - public String getValue(int index) { - return values[index]; - } - - public int getSelection(String value) { - if (value != null) { - for (int i = 0; i < values.length; i++) { - if (value.equals(values[i])) { - return i; - } - } - } - return values.length - 1; // assume the last option is the least severe - } - } - - public static final class BuildJob extends Job { - private final IProject project; - - public BuildJob(String name, IProject project) { - super(name); - this.project = project; - } - - public boolean isCoveredBy(BuildJob other) { - if (other.project == null) { - return true; - } - return project != null && project.equals(other.project); - } - - @Override - protected IStatus run(IProgressMonitor monitor) { - synchronized (getClass()) { - if (monitor.isCanceled()) { - return Status.CANCEL_STATUS; - } - Job[] buildJobs = Job.getJobManager().find(ResourcesPlugin.FAMILY_MANUAL_BUILD); - for (int i = 0; i < buildJobs.length; i++) { - if (buildJobs[i] != this && buildJobs[i] instanceof BuildJob) { - BuildJob job = (BuildJob) buildJobs[i]; - if (job.isCoveredBy(this)) { - buildJobs[i].cancel(); - } - } - } - } - try { - if (project != null) { - monitor.beginTask(String.format( - Messages.BuilderConfigurationBlock_BuildJob_TitleBuildProject_TaskName, - TextProcessor.process(project.getName(), ":.")), //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-1$ - 2); - project.build(IncrementalProjectBuilder.FULL_BUILD, SubMonitor.convert(monitor, 1)); - ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, - SubMonitor.convert(monitor, 1)); - } else { - monitor.beginTask(Messages.BuilderConfigurationBlock_BuildJob_TitleBuildAll_TaskName, 2); - ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, - SubMonitor.convert(monitor, 2)); - } - } catch (CoreException e) { - return e.getStatus(); - } catch (OperationCanceledException e) { - return Status.CANCEL_STATUS; - } finally { - monitor.done(); - } - return Status.OK_STATUS; - } - - @Override - public boolean belongsTo(Object family) { - return ResourcesPlugin.FAMILY_MANUAL_BUILD == family; - } - } - - protected final List