Skip to content

Commit d74794d

Browse files
ensure connection is not opened when shown context menu
1 parent 01d4d0d commit d74794d

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

sqldev/src/main/java/org/utplsql/sqldev/menu/UtplsqlController.xtend

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,21 @@ class UtplsqlController implements Controller {
7373
} else if (view instanceof DBNavigatorWindow) {
7474
if (context.selection.length == 1) {
7575
val element = context.selection.get(0)
76-
val dao = new UtplsqlDao(Connections.instance.getConnection(context.URL.connectionName))
77-
if (dao.utAnnotationManagerInstalled) {
78-
if (element instanceof DatabaseConnection) {
79-
action.enabled = dao.containsUtplsqlTest(element.connection.schema)
80-
} else if (element instanceof ObjectFolder) {
81-
action.enabled = dao.containsUtplsqlTest(element.URL.schema)
82-
} else if (element instanceof PlSqlNode) {
83-
action.enabled = dao.containsUtplsqlTest(element.owner, element.objectName)
84-
} else if (element instanceof ChildObjectElement) {
85-
action.enabled = dao.containsUtplsqlTest(element.URL.schema, element.URL.memberObject, element.shortLabel)
76+
if (Connections.instance.isConnectionOpen(context.URL.connectionName)) {
77+
val dao = new UtplsqlDao(Connections.instance.getConnection(context.URL.connectionName))
78+
if (dao.utAnnotationManagerInstalled) {
79+
if (element instanceof DatabaseConnection) {
80+
action.enabled = dao.containsUtplsqlTest(element.connection.schema)
81+
} else if (element instanceof ObjectFolder) {
82+
action.enabled = dao.containsUtplsqlTest(element.URL.schema)
83+
} else if (element instanceof PlSqlNode) {
84+
action.enabled = dao.containsUtplsqlTest(element.owner, element.objectName)
85+
} else if (element instanceof ChildObjectElement) {
86+
action.enabled = dao.containsUtplsqlTest(element.URL.schema, element.URL.memberObject, element.shortLabel)
87+
}
88+
} else {
89+
action.enabled = true
8690
}
87-
} else {
88-
action.enabled = true
8991
}
9092
}
9193
}

0 commit comments

Comments
 (0)