use of com.noser.neo4j.android.dbinspector.base.DBInspectorException in project neo4j-mobile-android by neo4j-contrib.
the class MainActivity method askCreationOfNeo4jDatabase.
private void askCreationOfNeo4jDatabase() {
AlertDialog dialog = new AlertDialog.Builder(this).create();
dialog.setTitle(R.string.main_create_database_title);
View mainCreateDatabaseView = inflater.inflate(R.layout.main_activity_createdatabase, null);
final EditText mainCreateDatabaseEdit = (EditText) mainCreateDatabaseView.findViewById(R.id.mainCreateDatabaseEdit);
dialog.setView(mainCreateDatabaseView);
dialog.setButton(getResources().getString(android.R.string.yes), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String databaseName = mainCreateDatabaseEdit.getText().toString();
if (!databaseName.isEmpty()) {
try {
if (dbManager.neo4jDatabaseExists(databaseName)) {
showDatabaseAlreadyExistsDialog(databaseName);
} else {
if (dbManager.isCurrentNeo4jDatabaseOpen()) {
shutdownNeo4jDatabase(dbManager.getCurrentNeo4jDatabaseName());
}
openOrCreateNeo4jDatabase(databaseName);
}
} catch (DBInspectorException e) {
Ln.e(e, "failed to check for existing database '" + databaseName + "'.");
showErrorDialog();
}
}
}
});
dialog.setButton2(getResources().getString(android.R.string.no), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
dialog.show();
}
use of com.noser.neo4j.android.dbinspector.base.DBInspectorException in project neo4j-mobile-android by neo4j-contrib.
the class DBManager method openOrCreateNeo4jDatabase.
@Override
public void openOrCreateNeo4jDatabase(String databaseName) throws DBInspectorException {
try {
doShutdownNeo4jDatabase(databaseName);
this.database = neo4jService.openOrCreateDatabase(databaseName);
this.databaseName = databaseName;
} catch (Neo4jServiceException e) {
throw new DBInspectorException(e);
} catch (RemoteException e) {
throw new DBInspectorException(e);
}
}
Aggregations