use of org.hortonmachine.style.MainController in project hortonmachine by TheHortonMachine.
the class SqlTemplatesAndActions method getOpenInSldEditorAction.
public Action getOpenInSldEditorAction(TableLevel table, DatabaseViewer spatialiteViewer) {
if (isNosql) {
return null;
}
if (spatialiteViewer.currentConnectedSqlDatabase.getType() == EDb.GEOPACKAGE || spatialiteViewer.currentConnectedSqlDatabase.getType() == EDb.POSTGRES || spatialiteViewer.currentConnectedSqlDatabase.getType() == EDb.POSTGIS) {
return new AbstractAction("Open in SLD editor") {
@Override
public void actionPerformed(ActionEvent e) {
try {
DefaultGuiBridgeImpl gBridge = new DefaultGuiBridgeImpl();
String databasePath = spatialiteViewer.currentConnectedSqlDatabase.getDatabasePath();
final MainController controller = new MainController(new File(databasePath), table.tableName);
final JFrame frame = gBridge.showWindow(controller.asJComponent(), "HortonMachine SLD Editor");
Class<DatabaseViewer> class1 = DatabaseViewer.class;
ImageIcon icon = new ImageIcon(class1.getResource("/org/hortonmachine/images/hm150.png"));
frame.setIconImage(icon.getImage());
} catch (Exception ex) {
ex.printStackTrace();
}
}
};
} else {
return null;
}
}
Aggregations