1515 */
1616package org.utplsql.sqldev
1717
18- import java.util.ArrayList
19- import java.util.HashSet
2018import java.util.List
2119import java.util.logging.Logger
22- import java.util.regex.Pattern
2320import javax.swing.JSplitPane
2421import oracle.dbtools.raptor.utils.Connections
2522import oracle.dbtools.worksheet.editor.OpenWorksheetWizard
@@ -44,44 +41,13 @@ class UtplsqlWorksheet {
4441 setConnection(connectionName)
4542 }
4643
47- new (String path, String connectionName) {
48- this . pathList = new ArrayList<String > ()
49- this . pathList. add(path)
50- this . preferences = PreferenceModel . getInstance(Preferences . preferences);
51- setConnection(connectionName)
52- }
53-
5444 private def setConnection (String connectionName ) {
5545 if (connectionName !== null && preferences. unsharedWorksheet) {
5646 this . connectionName = Connections . instance. createPrivateConnection(connectionName)
5747 } else {
5848 this . connectionName = connectionName;
5949 }
6050 }
61-
62- private def dedupPathList () {
63- val set = new HashSet<String >
64- for (path : pathList) {
65- set. add(path)
66- }
67- val ret = new ArrayList<String >
68- val p = Pattern . compile(" ((((\\ w+)\\ .)?\\ w+)\\ .)?\\ w+" )
69- for (path : set) {
70- val m = p. matcher(path)
71- if (m. matches()) {
72- val parent1 = m. group(4 ) // user
73- val parent2 = m. group(2 ) // user.package
74- if (parent1 == = null || ! set. contains(parent1)) {
75- if (parent2 == = null || ! set. contains(parent2)) {
76- ret. add(path)
77- }
78- }
79- } else {
80- logger. severe(' ' ' path: «path» did not pattern «p.toString», this is unexected!' ' ' )
81- }
82- }
83- return ret
84- }
8551
8652 private def getCode () '''
8753 «IF preferences.resetPackage»
@@ -91,7 +57,7 @@ class UtplsqlWorksheet {
9157 «IF preferences. clearScreen»
9258 CLEAR SCREEN
9359 «ENDIF »
94- «val paths = dedupPathList »
60+ «val paths = pathList »
9561 «IF paths. size == 1 »
9662 EXECUTE ut. run(' «paths.get(0)»' );
9763 «ELSE »
0 commit comments