Skip to content

Commit

Permalink
Fixed 465 Genconf resource not suppporting UTF-8 encoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
ylussaud committed Sep 6, 2023
1 parent 6fe9c37 commit c7b5c8c
Show file tree
Hide file tree
Showing 9 changed files with 1,686 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.obeonetwork.m2doc.genconf.editor.wizard;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -90,7 +91,8 @@ public class NewGenerationWizard extends Wizard implements INewWizard {
*/
public NewGenerationWizard() {
generation = GenconfPackage.eINSTANCE.getGenconfFactory().createGeneration();
final Resource resource = new XMIResourceImpl();
final XMIResourceImpl resource = new XMIResourceImpl();
resource.setEncoding(StandardCharsets.UTF_8.name());
final ResourceSet rs = new ResourceSetImpl();
rs.getResources().add(resource);
resource.getContents().add(generation);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--- RCPTT testcase ---
Format-Version: 1.0
Context-Type: org.eclipse.rcptt.ctx.workspace
Element-Name: Edit Generation Configurations UTF-8
Element-Type: context
Element-Version: 2.0
Id: _MXO2EEzBEe6RxPWQEeDEcQ
Runtime-Version: 2.5.4.202210020716
Save-Time: 9/6/23, 4:26 PM

------=_.q7.content-3d2e0690-ce48-3609-83e0-c704d49f1eaf
Content-Type: q7/binary
Entry-Name: .q7.content

UEsDBBQACAgIAAAAIQAAAAAAAAAAAAAAAAAIAAkALmNvbnRlbnRVVAUAAQAAAACVkUFPwzAMhe/9FVHu
JNADQlXTSUBASEwwBNpuqKReF7YmVeLSil9P0q29Ajc7/uz3npIvhuZAvsB5bY2gF+ycEjDKVtrUgna4
PbuiiyLJrasZqINuPTCnWkSmcGC9dXvflgqy9VTdWIMwIBkanc1n03g2CBmfhXdBd4htxnnf98w2NQvH
+Wb5MCG/aM3rExPXR44Hjs8cJaZsAi0rjeQeDLgSgxsSHG513R07T95e70JGoitB35ebp1TK72sJly/D
83ol4VaqFS0SQnIVgxmMdehaZz9B4aM2e3/SQfBIyWkgaExhP8AawGiJNWll1TFPoErcCerA284p8Pwv
HvkowEczfHaT8/9+TZH8AFBLBwiwcmryDQEAAPUBAABQSwECFAAUAAgICAAAACEAsHJq8g0BAAD1AQAA
CAAJAAAAAAAAAAAAAAAAAAAALmNvbnRlbnRVVAUAAQAAAABQSwUGAAAAAAEAAQA/AAAATAEAAAAA
------=_.q7.content-3d2e0690-ce48-3609-83e0-c704d49f1eaf--
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
--- RCPTT testcase ---
Format-Version: 1.0
Contexts: _nPYeUHgzEeeKcP-oL2U8_A,_MXO2EEzBEe6RxPWQEeDEcQ
Element-Name: UTF-8 model
Element-Type: testcase
Element-Version: 3.0
External-Reference:
Id: _hosBgEzBEe6RxPWQEeDEcQ
Runtime-Version: 2.5.4.202210020716
Save-Time: 9/6/23, 4:31 PM
Testcase-Type: ecl

------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac
Content-Type: text/ecl
Entry-Name: .content

get-view "Project Explorer" | get-tree | select "test/asImageByRepresentationDescriptionName.genconf" | double-click
with [get-window "Generation configuration"] {
get-button "Next >" | click -metaKeys ""
get-button "Load resource" | click -metaKeys ""
with [get-window "Load Resource"] {
get-button "Browse Workspace..." | click -metaKeys ""
get-window "File Selection" | get-tree | select "test/中文.ecore" | double-click
get-button OK | click -metaKeys ""
}
get-table | select self
get-button Edit | click -metaKeys ""
with [get-window "Select value for self"] {
get-tree | select "platform:\\/resource\\/test\\/中文.ecore/anydsl"
get-button OK | click -metaKeys ""
}
get-button Finish | click -metaKeys ""
}
get-view "Project Explorer" | get-tree | select "test/asImageByRepresentationDescriptionName.genconf" | get-menu
-path "Open With/Text Editor" | click -metaKeys ""
get-editor "asImageByRepresentationDescriptionName.genconf" | get-text-viewer | get-property text
| equals "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<genconf:Generation xmi:version=\"2.0\" xmlns:xmi=\"http://www.omg.org/XMI\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:genconf=\"http://www.obeonetwork.org/m2doc/genconf/1.0\" name=\"nominal\" templateFileName=\"asImageByRepresentationDescriptionName-template.docx\" resultFileName=\"asImageByRepresentationDescriptionName-generated.docx\" validationFileName=\"asImageByRepresentationDescriptionName-validation.docx\">\n"
+ " <definitions xsi:type=\"genconf:ModelDefinition\" key=\"self\">\n"
+ " <value href=\"中文.ecore#/\"/>\n"
+ " </definitions>\n"
+ " <options name=\"SiriusSession\" value=\"asImageByRepresentationDescriptionName.aird\"/>\n"
+ " <options name=\"UpdateFields\" value=\"false\"/>\n"
+ "</genconf:Generation>" | verify-true
------=_.content-0a7243a0-75d3-3d5f-9791-539de0e5b7ac--
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
<nature>org.eclipse.sirius.nature.modelingproject</nature>
</natures>
</projectDescription>
Binary file not shown.
Loading

0 comments on commit c7b5c8c

Please sign in to comment.