private void okButtonActionPerformed(ActionEvent evt) { // SQL file selected? String sqlFilePath = sqlSourceTextField.getText(); if ((null == sqlFilePath) || (0 == sqlFilePath.length())) { JOptionPane.showMessageDialog( this, "Please select a source SQL file!", "Invalid Input", JOptionPane.ERROR_MESSAGE); return; } // destination XML file selected String xmlFilePath = xmlDestinationTextField.getText(); if ((null == xmlFilePath) || (0 == xmlFilePath.length())) { JOptionPane.showMessageDialog( this, "Please select a destination XML file!", "Invalid Input", JOptionPane.ERROR_MESSAGE); return; } // do the conversion boolean errorOccured = convert(sqlFilePath, xmlFilePath); if (errorOccured) { JOptionPane.showMessageDialog( this, "Conversion failed!", "Conversion Failure", JOptionPane.ERROR_MESSAGE); return; } boolean importIntoWorkspace = importCheckBox.isSelected(); if (importIntoWorkspace) { XMLDocument xmlDocument = null; try { xmlDocument = new XMLDocument(xmlFilePath); } catch (JDOMException e) { log.error(e.getMessage(), e); ErrorManager.getInstance().errorOccured(e.getMessage(), e); errorOccured = true; } catch (IOException e) { log.error(e.getMessage(), e); ErrorManager.getInstance().errorOccured(e.getMessage(), e); errorOccured = true; } Workspace.getInstance().addXMLDocument(xmlDocument); EventManager.getInstance().fireXMLDocumentAdded(xmlDocument); } if (errorOccured) { JOptionPane.showMessageDialog( this, "Import into workspace failed!", "Import Failure", JOptionPane.ERROR_MESSAGE); return; } // if (!errorOccured) { // dispose(); // } dispose(); }
public void changePerspective(ItemEvent evt) { // if a perspective is deselected, remove it´s menu entries // from the menubar Perspective perspective = (Perspective) evt.getItem(); if (evt.getStateChange() == java.awt.event.ItemEvent.DESELECTED) { editor.unsetPerspective(perspective); } else if (evt.getStateChange() == java.awt.event.ItemEvent.SELECTED) { editor.setPerspective(perspective); } EventManager.getInstance().firePerspectiveChangedEvent(evt); }