Skip to content

Commit

Permalink
fix XJMF translation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rainer-prosi committed Jun 25, 2024
1 parent be6f8bc commit a23e7e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 34 deletions.
21 changes: 0 additions & 21 deletions src/main/java/org/cip4/tools/jdfeditor/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@
import org.cip4.jdflib.core.JDFElement;
import org.cip4.jdflib.core.JDFParser;
import org.cip4.jdflib.core.KElement;
import org.cip4.jdflib.core.StringArray;
import org.cip4.jdflib.core.VString;
import org.cip4.jdflib.jmf.JDFMessage.EnumFamily;
import org.cip4.jdflib.jmf.JMFBuilder;
import org.cip4.jdflib.jmf.JMFBuilderFactory;
import org.cip4.jdflib.resource.JDFResource;
Expand Down Expand Up @@ -250,27 +247,9 @@ public JSONWriter getJSonWriter()
final InputStream is = ResourceUtil.class.getResourceAsStream(EditorUtils.RES_SCHEMA_20);
final KElement schema = KElement.parseStream(is);
w.fillTypesFromSchema(schema, settingService.getBool(SettingKey.JSON_XJMF_SPLIT));
removeMessages(w);
jsonWriter = w;
}
return jsonWriter;
}

void removeMessages(final JSONWriter w)
{
final StringArray a = new StringArray(w.getArrayNames());
final VString fams = EnumFamily.getFamilies();
for (int i = 0; i < fams.size(); i++)
fams.set(i, fams.get(i).toLowerCase());
for (final String msg : a)
{
for (final String fam : fams)
{
if (msg.startsWith(fam))
w.removeArray(msg);
}
}

}

}
21 changes: 8 additions & 13 deletions src/main/java/org/cip4/tools/jdfeditor/NewFileChooser.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,8 @@
import org.cip4.tools.jdfeditor.util.ResourceUtil;

/**
* @author ThunellE AnderssonA
* Choose format of new file
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
* @author ThunellE AnderssonA Choose format of new file To change this generated comment edit the template variable "typecomment": Window>Preferences>Java>Templates. To enable and
* disable the creation of type comments go to Window>Preferences>Java>Code Generation.
*/
public class NewFileChooser extends JPanel implements ActionListener
{
Expand Down Expand Up @@ -119,14 +115,13 @@ public NewFileChooser()
}

/**
* Method init.
* Create the new file chooser
* Method init. Create the new file chooser
*/
private void init()
{
/*
* Need to add this getString "Golden Ticket" b/c it states right now Do you want to create a new JDF or JMF file?
*/
* Need to add this getString "Golden Ticket" b/c it states right now Do you want to create a new JDF or JMF file?
*/
final JLabel label = new JLabel(ResourceUtil.getMessage("ChooseNewFileKey"));
add(label);
final JPanel p1 = new JPanel();
Expand Down Expand Up @@ -160,7 +155,7 @@ private void init()
vs[i] = ((EnumVersion) enumList.get(i)).getName();
gtVersion = new JComboBox<String>(vs);
gtVersion.addActionListener(this);
gtVersion.setSelectedIndex(8);
gtVersion.setSelectedIndex(9); // 1.8

add(gtVersion);
}
Expand Down Expand Up @@ -192,8 +187,8 @@ else if (src == gtVersion)
}

/**
* Method getSelection.
* get the format of the file to open
* Method getSelection. get the format of the file to open
*
* @return String
*/
public String getSelection()
Expand Down

0 comments on commit a23e7e7

Please sign in to comment.