}
TermiDictProject dictProject = new TermiDictProject();
dictProject.setFile(selectedFile);
TerminologyModel newModel = new TerminologyModelImpl();
try
{
tmdlParser.openTmdl(selectedFile, newModel);
} catch (FileNotFoundException fnfe)
{
System.out.println("not find file: " + selectedFile.getPath());
return;
} catch (IOException e)
{
System.out.println("File not found");
} catch (JDOMException e)
{
System.out.println("JDOM error");
}
if (projectList != null)
{
for (int i = 0; i < projectList.size(); i++)
{
TermiDictProject tempProject = (TermiDictProject) projectList.get(i);
if (tempProject.getName().equals(newModel.getName()))
{
container.setVisible(true);
JOptionPane.showInternalMessageDialog(container, "duplicate terminologyMedel.", "warning", JOptionPane.ERROR_MESSAGE);
container.setVisible(false);
return;
}
}
}
else
{
projectList = new ArrayList();
}
// add into view
addTermiModel(newModel);
// set dictProject.
dictProject.setTerminologyModel(newModel);
dictProject.setName(newModel.getName());
// add into projectList
projectList.add(dictProject);
// show the discription
JLabel desLabel = new JLabel("This terminologyModel is descripted as");
JTextArea descriptionArea = new JTextArea(6, 20);
JScrollPane scrollPane = new JScrollPane();
JPanel showPane = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
descriptionArea.setBackground(background);
descriptionArea.setLineWrap(true);
descriptionArea.setEditable(false);
//descriptionArea.setWrapStyleWord(false);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
scrollPane.setViewportView(descriptionArea);
descriptionArea.setText(newModel.getDescription());
gbc.gridx = 0;
gbc.anchor = GridBagConstraints.NORTHWEST;
showPane.add(desLabel, gbc);
showPane.add(Box.createVerticalStrut(10), gbc);