tabbedPane.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent e)
{
JigenDocument document;
try
{
if (tabbedPane.getSelectedComponent() == visualEditorPanel)
document = xmlEditorPanel.getJigenDocument();
else if (tabbedPane.getSelectedComponent() == xmlEditorPanel)
document = visualEditorPanel.getJigenDocument();
else
throw new AssertionError();
}
catch(InvalidJigenException ex)
{
tabbedPane.removeChangeListener(this);
if (tabbedPane.getSelectedComponent() == visualEditorPanel)
tabbedPane.setSelectedComponent(xmlEditorPanel);
else if (tabbedPane.getSelectedComponent() == xmlEditorPanel)
tabbedPane.setSelectedComponent(visualEditorPanel);
else
throw new AssertionError();
tabbedPane.addChangeListener(this);
new ErrorDetailsDialog(ex).openDialog();
return;
}
if (tabbedPane.getSelectedComponent() == visualEditorPanel)
visualEditorPanel.setJigenDocument(document);
else if (tabbedPane.getSelectedComponent() == xmlEditorPanel)
xmlEditorPanel.setJigenDocument(document);
else
throw new AssertionError();
}
});
createInstallerButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
final JigenDocument document;
try
{
if (tabbedPane.getSelectedComponent() == xmlEditorPanel)
document = xmlEditorPanel.getJigenDocument();