Merge of changes made in IFS svn between svn export and now.
1.1 --- a/Options/src/org/netbeans/modules/plsqlsupport/options/IfsOptionsUtilities.java Tue Sep 20 20:41:02 2011 +0200
1.2 +++ b/Options/src/org/netbeans/modules/plsqlsupport/options/IfsOptionsUtilities.java Thu Sep 22 15:45:10 2011 +0200
1.3 @@ -45,36 +45,38 @@
1.4
1.5 public class IfsOptionsUtilities {
1.6
1.7 - public static String auto_deploy_all_databases_key ="auto.deploy.all.databases";
1.8 - public static String plsql_annotations_enabled_key = "plsql.annotations.enabled";
1.9 - public static String plsql_expand_folds_key = "plsql.folds.expand";
1.10 - public static String command_window_auto_commit_key = "command.window.auto.commit";
1.11 - public static String plsql_annotations_general_key = "plsql.annotations.general";
1.12 - public static String plsql_annotations_ifs_key = "plsql.annotations.ifs";
1.13 - public static String plsql_annotations_comment_ref_key = "plsql.annotations.comment.ref";
1.14 - public static String plsql_annotations_comments_key = "plsql.annotations.comments";
1.15 - public static String plsql_annotations_cursor_where_key = "plsql.annotations.cursor.where";
1.16 - public static String plsql_annotations_function_return_key = "plsql.annotations.function.return";
1.17 - public static String plsql_annotations_generated_method_key = "plsql.annotations.generated.method";
1.18 - public static String plsql_annotations_global_variable_key = "plsql.annotations.global.variable";
1.19 - public static String plsql_annotations_if_null_key = "plsql.annotations.if.null";
1.20 - public static String plsql_annotations_missing_end_name_key = "plsql.annotations.missing.endname";
1.21 - public static String plsql_annotations_missing_lu_dec_key = "plsql.annotations.missing.ludec";
1.22 - public static String plsql_annotations_missing_method_key = "plsql.annotations.missing.method";
1.23 - public static String plsql_annotations_missing_module_dec_key = "plsql.annotations.missing.moduledec";
1.24 - public static String plsql_annotations_missing_sysinit_key = "plsql.annotations.missing.sysinit";
1.25 - public static String plsql_annotations_same_tag_key = "plsql.annotations.sametag";
1.26 - public static String plsql_annotations_statements_key = "plsql.annotations.statements";
1.27 - public static String plsql_annotations_table_or_view_key = "plsql.annotations.tableorview";
1.28 - public static String plsql_annotations_unique_tag_key = "plsql.annotations.uniquetag";
1.29 - public static String plsql_annotations_unreachable_key = "plsql.annotations.unreachable";
1.30 - public static String plsql_annotations_wrong_end_name_key = "plsql.annotations.wrong.endname";
1.31 - public static String plsql_annotations_wrong_func_param_key = "plsql.annotations.wrong.func.param";
1.32 - public static String plsql_annotations_wrong_init_param_key = "plsql.annotations.wrong.initparam";
1.33 - public static String plsql_annotations_wrong_lu_name_key = "plsql.annotations.wrong.luname";
1.34 - public static String plsql_annotations_wrong_module_key = "plsql.annotations.wrong.module";
1.35 - public static String plsql_annotations_wrong_param_order_key = "plsql.annotations.wrong.param.order";
1.36 -
1.37 + public static final String auto_deploy_all_databases_key = "auto.deploy.all.databases";
1.38 + public static final String plsql_annotations_enabled_key = "plsql.annotations.enabled";
1.39 + public static final String plsql_expand_folds_key = "plsql.folds.expand";
1.40 + public static final String command_window_auto_commit_key = "command.window.auto.commit";
1.41 + public static final String plsql_annotations_general_key = "plsql.annotations.general";
1.42 + public static final String plsql_annotations_ifs_key = "plsql.annotations.ifs";
1.43 + public static final String plsql_annotations_comment_ref_key = "plsql.annotations.comment.ref";
1.44 + public static final String plsql_annotations_comments_key = "plsql.annotations.comments";
1.45 + public static final String plsql_annotations_cursor_where_key = "plsql.annotations.cursor.where";
1.46 + public static final String plsql_annotations_function_return_key = "plsql.annotations.function.return";
1.47 + public static final String plsql_annotations_generated_method_key = "plsql.annotations.generated.method";
1.48 + public static final String plsql_annotations_global_variable_key = "plsql.annotations.global.variable";
1.49 + public static final String plsql_annotations_if_null_key = "plsql.annotations.if.null";
1.50 + public static final String plsql_annotations_missing_end_name_key = "plsql.annotations.missing.endname";
1.51 + public static final String plsql_annotations_missing_lu_dec_key = "plsql.annotations.missing.ludec";
1.52 + public static final String plsql_annotations_missing_method_key = "plsql.annotations.missing.method";
1.53 + public static final String plsql_annotations_missing_module_dec_key = "plsql.annotations.missing.moduledec";
1.54 + public static final String plsql_annotations_missing_sysinit_key = "plsql.annotations.missing.sysinit";
1.55 + public static final String plsql_annotations_same_tag_key = "plsql.annotations.sametag";
1.56 + public static final String plsql_annotations_statements_key = "plsql.annotations.statements";
1.57 + public static final String plsql_annotations_table_or_view_key = "plsql.annotations.tableorview";
1.58 + public static final String plsql_annotations_unique_tag_key = "plsql.annotations.uniquetag";
1.59 + public static final String plsql_annotations_unreachable_key = "plsql.annotations.unreachable";
1.60 + public static final String plsql_annotations_wrong_end_name_key = "plsql.annotations.wrong.endname";
1.61 + public static final String plsql_annotations_wrong_func_param_key = "plsql.annotations.wrong.func.param";
1.62 + public static final String plsql_annotations_wrong_init_param_key = "plsql.annotations.wrong.initparam";
1.63 + public static final String plsql_annotations_wrong_lu_name_key = "plsql.annotations.wrong.luname";
1.64 + public static final String plsql_annotations_wrong_module_key = "plsql.annotations.wrong.module";
1.65 + public static final String plsql_annotations_wrong_param_order_key = "plsql.annotations.wrong.param.order";
1.66 +
1.67 + private IfsOptionsUtilities() {
1.68 + } //singleton
1.69
1.70 public static boolean isDeployNoPromptEnabled() {
1.71 return !NbPreferences.forModule(GeneralPanel.class).getBoolean(auto_deploy_all_databases_key, true);
1.72 @@ -183,5 +185,4 @@
1.73 public static boolean isPlSqlAnnotationWrongParamOrderEnabled() {
1.74 return NbPreferences.forModule(PLSQLAnnotationsPanel.class).getBoolean(plsql_annotations_wrong_param_order_key, true);
1.75 }
1.76 -
1.77 }
2.1 --- a/PLSQL/Annotation/src/org/netbeans/modules/plsql/annotation/Annotation.java Tue Sep 20 20:41:02 2011 +0200
2.2 +++ b/PLSQL/Annotation/src/org/netbeans/modules/plsql/annotation/Annotation.java Thu Sep 22 15:45:10 2011 +0200
2.3 @@ -43,6 +43,7 @@
2.4
2.5 import org.netbeans.modules.plsql.annotation.annotations.PlsqlAnnotation;
2.6 import org.netbeans.modules.plsql.lexer.PlsqlBlock;
2.7 +import java.util.HashMap;
2.8 import java.util.Map;
2.9 import java.util.Set;
2.10
2.11 @@ -53,6 +54,7 @@
2.12 public interface Annotation {
2.13 public final String TOKEN_ERROR_SYS = "ERROR_SYS";
2.14 public final String TOKEN_START_KEYWORD = "START_KEYWORD";
2.15 + public static final Map<String, Set<PlsqlAnnotation>> configuration= new HashMap<String, Set<PlsqlAnnotation>>();
2.16
2.17 public abstract void loadConfiguration();
2.18
3.1 --- a/PLSQL/Annotation/src/org/netbeans/modules/plsql/annotation/GenericPlsqlAnnotations.java Tue Sep 20 20:41:02 2011 +0200
3.2 +++ b/PLSQL/Annotation/src/org/netbeans/modules/plsql/annotation/GenericPlsqlAnnotations.java Thu Sep 22 15:45:10 2011 +0200
3.3 @@ -72,20 +72,15 @@
3.4 public static final String BLOCK_CURSOR = "CURSOR";
3.5 public static final String DEFAULT_ANNOTATIONS = " DEFAULT_ANNOTATIONS";
3.6 public static final String BLOCK_STATEMENT = "STATEMENT";
3.7 -
3.8 - public static Map<String, Set<PlsqlAnnotation>> configuration;
3.9 -
3.10 -
3.11
3.12 @Override
3.13 public void loadConfiguration() {
3.14 +
3.15 final PlsqlWrongFunctionParamAnnotation wrongParamAnnotation = PlsqlWrongFunctionParamAnnotation.getDummyInstance();
3.16 final PlsqlWrongParamOrderAnnotation wrongOrderAnnotation = PlsqlWrongParamOrderAnnotation.getDummyInstance();
3.17 final PlsqlMissingEndNameAnnotation endNameAnnotation = PlsqlMissingEndNameAnnotation.getDummyInstance();
3.18 final PlsqlWrongEndNameAnnotation wrongEndAnnotation = PlsqlWrongEndNameAnnotation.getDummyInstance();
3.19
3.20 - configuration = new HashMap<String, Set<PlsqlAnnotation>>();
3.21 -
3.22 final Set<PlsqlAnnotation> procDefAnnotations = new HashSet<PlsqlAnnotation>();
3.23 configuration.put(BLOCK_PROCEDURE_DEF, procDefAnnotations);
3.24
4.1 --- a/PLSQL/Annotation/src/org/netbeans/modules/plsql/annotation/PlsqlAnnotationManager.java Tue Sep 20 20:41:02 2011 +0200
4.2 +++ b/PLSQL/Annotation/src/org/netbeans/modules/plsql/annotation/PlsqlAnnotationManager.java Thu Sep 22 15:45:10 2011 +0200
4.3 @@ -64,6 +64,7 @@
4.4 import javax.swing.text.Document;
4.5 import javax.swing.text.Position;
4.6 import javax.swing.text.StyledDocument;
4.7 +import org.netbeans.modules.plsqlsupport.options.IfsOptionsUtilities;
4.8 import org.openide.cookies.EditorCookie;
4.9 import org.openide.text.NbDocument;
4.10 import org.openide.util.Exceptions;
4.11 @@ -72,43 +73,42 @@
4.12 import org.openide.util.Task;
4.13 import org.openide.util.lookup.ServiceProvider;
4.14
4.15 -@ServiceProvider(service=PlsqlAnnotationManager.class)
4.16 +@ServiceProvider(service = PlsqlAnnotationManager.class)
4.17 public class PlsqlAnnotationManager implements Observer {
4.18
4.19 public Document doc;
4.20 public final Map<Integer, List<PlsqlAnnotation>> plsqlAnnotations;
4.21 public final Map<Integer, String> errorSysCalls;
4.22 - public static Map<String, Set<PlsqlAnnotation>> configuration;
4.23 public final Map<Integer, Set<String>> allowedTablesOrViews;
4.24 + public static Annotation annotation = new GenericPlsqlAnnotations();
4.25
4.26 - public static Annotation annotation = new GenericPlsqlAnnotations();
4.27 -
4.28 public PlsqlAnnotationManager() {
4.29 - annotation.loadConfiguration();
4.30 -
4.31 + if (IfsOptionsUtilities.isPlSqlAnnotationsEnabled()) {
4.32 + annotation.loadConfiguration();
4.33 + }
4.34 +
4.35 final PreferenceChangeListener listener = new PreferenceChangeListener() {
4.36
4.37 @Override
4.38 public void preferenceChange(final PreferenceChangeEvent evt) {
4.39 if (evt.getKey().startsWith("plsql.annotations.")) {
4.40 - annotation.loadConfiguration();
4.41 - if(doc != null){
4.42 - configuration = null;
4.43 - configuration = annotation.getConfiguration();
4.44 - DataObject dataObj = (DataObject) doc.getProperty(Document.StreamDescriptionProperty);
4.45 - PlsqlBlockFactory apiBlockFac = dataObj.getLookup().lookup(PlsqlBlockFactory.class);
4.46 - initAnnotations(dataObj);
4.47 - update(apiBlockFac,doc);
4.48 + if (IfsOptionsUtilities.isPlSqlAnnotationsEnabled()) {
4.49 + annotation.loadConfiguration();
4.50 + } else {
4.51 + Annotation.configuration.clear();
4.52 + }
4.53 + if (doc != null) {
4.54 + DataObject dataObj = (DataObject) doc.getProperty(Document.StreamDescriptionProperty);
4.55 + initAnnotations(dataObj);
4.56 }
4.57 }
4.58 }
4.59 };
4.60 NbPreferences.forModule(PLSQLAnnotationsPanel.class).addPreferenceChangeListener(listener);
4.61 -
4.62 +
4.63 plsqlAnnotations = new ConcurrentHashMap<Integer, List<PlsqlAnnotation>>();
4.64 errorSysCalls = new ConcurrentHashMap<Integer, String>();
4.65 allowedTablesOrViews = new ConcurrentHashMap<Integer, Set<String>>();
4.66 - configuration = annotation.getConfiguration();
4.67 }
4.68
4.69 @Override
4.70 @@ -125,7 +125,7 @@
4.71
4.72 //Add all annotation types relevant to new blocks which are added
4.73 final Map<Integer, List<PlsqlAnnotation>> annotationsToAdd = new HashMap<Integer, List<PlsqlAnnotation>>();
4.74 -
4.75 +
4.76 updateAllowedTableOrViewOffsets(blockFactory.getStartParse(), blockFactory.getChangedLength());
4.77 PlsqlPackageAnnotationUtil.getPackageAnnotations(this, blockFactory.getBlockHierarchy(), annotationsToAdd, doc); //New blocks wasn't passed since package spec is not reparsed
4.78 PlsqlFileAnnotationUtil.getBlockAnnotations(this, blockFactory.getNewBlocks(), annotationsToAdd, doc);
4.79 @@ -173,7 +173,7 @@
4.80 final int docStartOffset = doc.getStartPosition().getOffset();
4.81 final int docEndOffset = doc.getEndPosition().getOffset();
4.82 PlsqlFileAnnotationUtil.getFileAnnotations(this, annotationsToAdd, doc, docStartOffset, docEndOffset, 0);
4.83 -
4.84 +
4.85 PlsqlPackageAnnotationUtil.getPackageAnnotations(this, blockhierarchy, annotationsToAdd, doc);
4.86 PlsqlFileAnnotationUtil.getBlockAnnotations(this, blockhierarchy, annotationsToAdd, doc);
4.87 attachAnnotations(annotationsToAdd);
4.88 @@ -192,8 +192,8 @@
4.89 }
4.90 };
4.91 try {
4.92 - for (PlsqlAnnotation annotation : lstAnnotations) {
4.93 - attachAnnotation(position, annotation);
4.94 + for (PlsqlAnnotation pa : lstAnnotations) {
4.95 + attachAnnotation(position, pa);
4.96 }
4.97 } catch (BadLocationException ex) {
4.98 Exceptions.printStackTrace(ex);
4.99 @@ -356,9 +356,11 @@
4.100 }
4.101 }
4.102
4.103 - private void removePackageAnnotations(final List<PlsqlBlock> blockHierarchy) {}
4.104 -
4.105 - public void resetAllowedTablesOrViews(final Document doc, final int offset) {}
4.106 + private void removePackageAnnotations(final List<PlsqlBlock> blockHierarchy) {
4.107 + }
4.108 +
4.109 + public void resetAllowedTablesOrViews(final Document doc, final int offset) {
4.110 + }
4.111
4.112 private void removeMethodAnnotations(final List<PlsqlBlock> blockHierarchy) {
4.113 for (PlsqlBlock block : blockHierarchy) {
4.114 @@ -369,7 +371,7 @@
4.115 }
4.116
4.117 public Set<PlsqlAnnotation> getConfiguration(final String type) {
4.118 - return configuration.get(type);
4.119 + return Annotation.configuration.get(type);
4.120 }
4.121
4.122 public Map<Integer, String> getErrorSysCalls() {
5.1 --- a/PLSQL/Annotation/src/org/netbeans/modules/plsql/annotation/PlsqlAnnotationUtil.java Tue Sep 20 20:41:02 2011 +0200
5.2 +++ b/PLSQL/Annotation/src/org/netbeans/modules/plsql/annotation/PlsqlAnnotationUtil.java Thu Sep 22 15:45:10 2011 +0200
5.3 @@ -65,6 +65,9 @@
5.4 */
5.5 public class PlsqlAnnotationUtil {
5.6
5.7 + private PlsqlAnnotationUtil() { //singleton
5.8 + }
5.9 +
5.10 public static Document getDocument() {
5.11 final JTextComponent comp = EditorRegistry.lastFocusedComponent();
5.12 return comp == null ? null : comp.getDocument();
6.1 --- a/PLSQL/Annotation/src/org/netbeans/modules/plsql/annotation/PlsqlFileAnnotationUtil.java Tue Sep 20 20:41:02 2011 +0200
6.2 +++ b/PLSQL/Annotation/src/org/netbeans/modules/plsql/annotation/PlsqlFileAnnotationUtil.java Thu Sep 22 15:45:10 2011 +0200
6.3 @@ -65,8 +65,8 @@
6.4 * Util class for annotations added to the file
6.5 * @author YADHLK
6.6 */
6.7 -public class PlsqlFileAnnotationUtil {
6.8 -
6.9 +public class PlsqlFileAnnotationUtil {
6.10 +
6.11 public static void getFileAnnotations(final PlsqlAnnotationManager manager, final Map<Integer, List<PlsqlAnnotation>> annotationsToAdd, final Document doc, final int startParse, final int endParse, final int change) {
6.12 TokenHierarchy tokenHierarchy = TokenHierarchy.get(doc);
6.13 @SuppressWarnings("unchecked")
6.14 @@ -75,7 +75,7 @@
6.15 final Map<Integer, String> errorMsgs = new HashMap<Integer, String>();
6.16
6.17 //check whether Error_SYS annotations are there in configuration
6.18 - final Set<PlsqlAnnotation> annotations = manager.getConfiguration(manager.annotation.TOKEN_ERROR_SYS);
6.19 + final Set<PlsqlAnnotation> annotations = manager.getConfiguration(Annotation.TOKEN_ERROR_SYS);
6.20 if (annotations != null && annotations.size() > 0) {
6.21 isErrorSys = true;
6.22 }
6.23 @@ -89,7 +89,7 @@
6.24 token = ts.token();
6.25 if (token.id() == PlsqlTokenId.KEYWORD && preText.toString().contains("\n")) {
6.26 //Call token annotations
6.27 - callTokenAnnotation(manager, annotationsToAdd, doc, token, ts.offset(), endParse, null, manager.annotation.TOKEN_START_KEYWORD);
6.28 + callTokenAnnotation(manager, annotationsToAdd, doc, token, ts.offset(), endParse, null, Annotation.TOKEN_START_KEYWORD);
6.29 } else if (token.toString().equalsIgnoreCase("ERROR_SYS") && isErrorSys) {
6.30 int offset = ts.offset();
6.31 boolean isString = false;
6.32 @@ -128,7 +128,7 @@
6.33 manager.resetErrorSysCalls(doc, startParse, endParse, change, errorMsgs);
6.34
6.35 //Process ERROR_SYS tokens
6.36 - callTokenAnnotation(manager, annotationsToAdd, doc, null, startParse, endParse, manager.getErrorSysCalls(), manager.annotation.TOKEN_ERROR_SYS);
6.37 + callTokenAnnotation(manager, annotationsToAdd, doc, null, startParse, endParse, manager.getErrorSysCalls(), Annotation.TOKEN_ERROR_SYS);
6.38 }
6.39 }
6.40
6.41 @@ -170,7 +170,7 @@
6.42 if (block.getType() == PlsqlBlockType.PROCEDURE_DEF || block.getType() == PlsqlBlockType.PROCEDURE_IMPL || block.getType() == PlsqlBlockType.FUNCTION_DEF
6.43 || block.getType() == PlsqlBlockType.FUNCTION_IMPL || block.getType() == PlsqlBlockType.IF || block.getType() == PlsqlBlockType.CURSOR
6.44 || block.getType() == PlsqlBlockType.STATEMENT ) {
6.45 - PlsqlAnnotationUtil.callBlockAnnotations(manager, annotationsToAdd, doc, block, null, null, manager.annotation.getType(block));
6.46 + PlsqlAnnotationUtil.callBlockAnnotations(manager, annotationsToAdd, doc, block, null, null, PlsqlAnnotationManager.annotation.getType(block));
6.47 }
6.48
6.49 //check for child comments
7.1 --- a/PLSQL/Annotation/src/org/netbeans/modules/plsql/annotation/PlsqlMethodAnnotationUtil.java Tue Sep 20 20:41:02 2011 +0200
7.2 +++ b/PLSQL/Annotation/src/org/netbeans/modules/plsql/annotation/PlsqlMethodAnnotationUtil.java Thu Sep 22 15:45:10 2011 +0200
7.3 @@ -150,57 +150,84 @@
7.4 }
7.5 return methodSpec.trim();
7.6 }
7.7 +
7.8 + public static PlsqlBlock findMethod(final List<PlsqlBlock> specBlockHier, final String packageName, final String methodName) {
7.9 + PlsqlBlock match = null;
7.10 + if (!packageName.equals("")) {
7.11 + PlsqlBlock packageBlock = getPackageBody(specBlockHier, PlsqlBlockType.PACKAGE_BODY, packageName);
7.12 + if (packageBlock != null) {
7.13 + for (int i = 0; i < packageBlock.getChildCount(); i++) {
7.14 + final PlsqlBlock temp = packageBlock.getChildBlocks().get(i);
7.15 + if (temp.getName().equals(methodName)) {
7.16 + match = temp;
7.17 + break;
7.18 + }
7.19 + }
7.20 + }
7.21 + }
7.22 + return match;
7.23 + }
7.24 +
7.25 + public static PlsqlBlock getPackageBody(final List<PlsqlBlock> specBlockHier, final PlsqlBlockType blockType, final String packageName){
7.26 + PlsqlBlock packageBlock = null;
7.27 + for (int i = 0; i < specBlockHier.size(); i++) {
7.28 + final PlsqlBlock temp = specBlockHier.get(i);
7.29 + if (temp.getType() == blockType && temp.getName().equalsIgnoreCase(packageName)) {
7.30 + packageBlock = temp;
7.31 + break;
7.32 + }
7.33 + }
7.34 + return packageBlock;
7.35 + }
7.36
7.37 - public static int getOffsetToInsert(final Document doc, final List<PlsqlBlock> specBlockHier, final String packageName, final String searchString) throws BadLocationException {
7.38 - int offset = -1;
7.39 - //Get package block
7.40 - if (!packageName.equals("")) {
7.41 - PlsqlBlock packageBlock = null;
7.42 - for (int i = 0; i < specBlockHier.size(); i++) {
7.43 - final PlsqlBlock temp = specBlockHier.get(i);
7.44 - if (temp.getType() == PlsqlBlockType.PACKAGE && temp.getName().equalsIgnoreCase(packageName)) {
7.45 - packageBlock = temp;
7.46 - break;
7.47 + public static int getOffsetToInsert(final Document doc, final List<PlsqlBlock> specBlockHier, final String packageName, final PlsqlBlock searchBlock, final int searchPlace) throws BadLocationException {
7.48 + int offset = -1;
7.49 + //Get package block
7.50 + if (!packageName.equals("")) {
7.51 + PlsqlBlock packageBlock = getPackageBody(specBlockHier, PlsqlBlockType.PACKAGE, packageName);
7.52 +
7.53 + if (packageBlock != null) {
7.54 + for (int i = 0; i < packageBlock.getChildCount(); i++) {
7.55 + final PlsqlBlock temp = packageBlock.getChildBlocks().get(i);
7.56 + if (!temp.getType().equals(PlsqlBlockType.COMMENT) && (temp.getType().equals(PlsqlBlockType.FUNCTION_DEF) || temp.getType().equals(PlsqlBlockType.PROCEDURE_DEF))) {
7.57 + if (temp.getName().contains(searchBlock.getName())) {
7.58 + if (searchPlace == -1) {
7.59 + offset = temp.getStartOffset();
7.60 + } else {
7.61 + offset = packageBlock.getChildBlocks().get(i + 1).getStartOffset() - 1;
7.62 + }
7.63 + break;
7.64 + }
7.65 + } else if (temp.getType().equals(PlsqlBlockType.COMMENT)&& searchBlock.getType().equals(PlsqlBlockType.COMMENT)) {
7.66 +
7.67 + //Get block content and check; comments can be merged to one comment block
7.68 + final String text = doc.getText(temp.getStartOffset(), temp.getEndOffset() - temp.getStartOffset());
7.69 + int index = text.indexOf(searchBlock.getName());
7.70 + if (index != -1) {
7.71 + index = text.indexOf("\n", index);
7.72 + if (index != -1) {
7.73 + index = text.indexOf("\n", index + 1);
7.74 + if (index != -1) {
7.75 + offset = temp.getStartOffset() + index;
7.76 + } else {
7.77 + offset = temp.getEndOffset();
7.78 + }
7.79 +
7.80 + break;
7.81 + }
7.82 + }
7.83 + }
7.84 + }
7.85 +
7.86 + //If the comment is not found insert some where
7.87 + if (offset == -1) {
7.88 + offset = packageBlock.getChildBlocks().get(0).getEndOffset();
7.89 + }
7.90 }
7.91 - }
7.92 + }
7.93
7.94 - if (packageBlock != null) {
7.95 - for (int i = 0; i < packageBlock.getChildCount(); i++) {
7.96 - final PlsqlBlock temp = packageBlock.getChildBlocks().get(i);
7.97 - if (temp.getType() == PlsqlBlockType.COMMENT) {
7.98 - if (temp.getName().contains(searchString)) {
7.99 - offset = temp.getEndOffset();
7.100 - break;
7.101 - } else {
7.102 - //Get block content and check; comments can be merged to one comment block
7.103 - final String text = doc.getText(temp.getStartOffset(), temp.getEndOffset() - temp.getStartOffset());
7.104 - int index = text.indexOf(searchString);
7.105 - if (index != -1) {
7.106 - index = text.indexOf("\n", index);
7.107 - if (index != -1) {
7.108 - index = text.indexOf("\n", index + 1);
7.109 - if (index != -1) {
7.110 - offset = temp.getStartOffset() + index;
7.111 - } else {
7.112 - offset = temp.getEndOffset();
7.113 - }
7.114 -
7.115 - break;
7.116 - }
7.117 - }
7.118 - }
7.119 - }
7.120 - }
7.121 -
7.122 - //If the comment is not found insert some where
7.123 - if (offset == -1) {
7.124 - offset = packageBlock.getChildBlocks().get(0).getEndOffset();
7.125 - }
7.126 - }
7.127 - }
7.128 -
7.129 - return offset;
7.130 - }
7.131 + return offset;
7.132 + }
7.133
7.134 public static boolean changeParam(final Document doc, final int offset, final String methodName) {
7.135 if (PlsqlAnnotationUtil.isFileReadOnly(doc)) {
8.1 --- a/PLSQL/Annotation/src/org/netbeans/modules/plsql/annotation/PlsqlPackageAnnotationUtil.java Tue Sep 20 20:41:02 2011 +0200
8.2 +++ b/PLSQL/Annotation/src/org/netbeans/modules/plsql/annotation/PlsqlPackageAnnotationUtil.java Thu Sep 22 15:45:10 2011 +0200
8.3 @@ -61,12 +61,12 @@
8.4 * @author YADHLK
8.5 */
8.6 public class PlsqlPackageAnnotationUtil {
8.7 -
8.8 +
8.9 public static void getPackageAnnotations(final PlsqlAnnotationManager manager, final List<PlsqlBlock> blocks, final Map<Integer, List<PlsqlAnnotation>> annotationsToAdd, final Document doc) {
8.10 for (PlsqlBlock temp : blocks) {
8.11 if (temp.getType() == PlsqlBlockType.PACKAGE || temp.getType() == PlsqlBlockType.PACKAGE_BODY) {
8.12 manager.resetAllowedTablesOrViews(doc, temp.getStartOffset());
8.13 - PlsqlAnnotationUtil.callBlockAnnotations(manager, annotationsToAdd, doc, temp, null, null, manager.annotation.getType(temp));
8.14 + PlsqlAnnotationUtil.callBlockAnnotations(manager, annotationsToAdd, doc, temp, null, null, PlsqlAnnotationManager.annotation.getType(temp));
8.15 }
8.16 // else if (temp.getType() == PlsqlBlockType.PACKAGE_BODY) {
8.17 // manager.resetAllowedTablesOrViews(doc, temp.getStartOffset());
9.1 --- a/PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/PlsqlEditorContext.java Tue Sep 20 20:41:02 2011 +0200
9.2 +++ b/PLSQL/Debugging/src/org/netbeans/modules/plsql/debug/PlsqlEditorContext.java Thu Sep 22 15:45:10 2011 +0200
9.3 @@ -462,7 +462,7 @@
9.4 dataObject = (DataObject) result.get(1);
9.5 }
9.6 }
9.7 - if (dataObject == null) {
9.8 + if (dataObject == null || lineNumber < 1) {
9.9 return null;
9.10 }
9.11 LineCookie lc = dataObject.getCookie(LineCookie.class);
10.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/FileExecutionUtil.java Tue Sep 20 20:41:02 2011 +0200
10.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/FileExecutionUtil.java Thu Sep 22 15:45:10 2011 +0200
10.3 @@ -57,8 +57,7 @@
10.4
10.5 public class FileExecutionUtil {
10.6
10.7 - public FileExecutionUtil() {
10.8 - }
10.9 + private FileExecutionUtil() {} //singleton
10.10
10.11 public static List<String> splitStringToVector(String s) {
10.12 List<String> lines = new ArrayList<String>();
11.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PasteAsSqlCommandAction.java Tue Sep 20 20:41:02 2011 +0200
11.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PasteAsSqlCommandAction.java Thu Sep 22 15:45:10 2011 +0200
11.3 @@ -91,10 +91,11 @@
11.4 String[] lines = contents.trim().split("\n");
11.5 int paramCount = 0; //counter for '?' in SQL
11.6 for (int i = 0; i < lines.length; i++) {
11.7 - String line = lines[i].replaceAll("\\s+$", ""); //remove trailing space
11.8 + String line = lines[i].replaceAll("\\s+$", ""); //remove trailing space
11.9 + line = line.replace("\\\"" , "\""); // remove java escape (i.e. \) for double quotes used for column aliases in selects
11.10 line = line.replaceFirst("^\\s*\\+?\\s*\"", ""); // remove lines starting with " or +"
11.11 - line = line.replaceAll("\"\\s*\\+?$", ""); // remove concat lines ending with "+
11.12 - line = line.replaceAll("\"\\s*;?$", ""); // remove lines ending with " or ";
11.13 + line = line.replaceAll("\"\\s*\\+?$", ""); // remove " and "+ from eol
11.14 + line = line.replaceAll("\"\\s*;+$", ""); // remove "; from eol
11.15 //replace ? with code template place holders
11.16 for (;line.indexOf("?")>0;++paramCount){
11.17 line = line.replaceFirst("\\?", "\\${<value_"+paramCount+">}");
12.1 --- a/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlFileExecutor.java Tue Sep 20 20:41:02 2011 +0200
12.2 +++ b/PLSQL/Execution/src/org/netbeans/modules/plsql/execution/PlsqlFileExecutor.java Thu Sep 22 15:45:10 2011 +0200
12.3 @@ -272,6 +272,15 @@
12.4 return false;
12.5 }
12.6 String objectName = tokenizer.nextToken().toUpperCase(Locale.ENGLISH);
12.7 + String objectOwner = null;
12.8 +
12.9 + if (objectName.contains(".")) { //handle schema.object format e.g. ifsapp.customer
12.10 + final String[] result = objectName.split("\\.");
12.11 + if (result != null && result.length == 2) {
12.12 + objectOwner = result[0];
12.13 + objectName = result[1];
12.14 + }
12.15 + }
12.16
12.17 String query = "SELECT t.COLUMN_NAME \"Name\", "
12.18 + "t.data_type||decode(t.data_type,'VARCHAR2','('||t.char_length||')', "
12.19 @@ -285,6 +294,7 @@
12.20 + "WHERE t.TABLE_NAME = c.TABLE_NAME "
12.21 + "AND t.COLUMN_NAME = c.COLUMN_NAME "
12.22 + "AND t.OWNER = c.OWNER "
12.23 + + ((objectOwner!=null && !objectOwner.equals(""))? "AND t.OWNER = '"+ objectOwner +"' " : "") //set owner only if given by user
12.24 + "AND t.TABLE_NAME = '" + objectName + "' ORDER BY t.COLUMN_ID";
12.25 executeSelect(query, con, doc, objectName);
12.26 return true;
13.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PlsqlDataObject.java Tue Sep 20 20:41:02 2011 +0200
13.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PlsqlDataObject.java Thu Sep 22 15:45:10 2011 +0200
13.3 @@ -97,13 +97,11 @@
13.4 annotationManager = plsqlAnnotationManager;
13.5 }
13.6
13.7 - if (IfsOptionsUtilities.isPlSqlAnnotationsEnabled()) {
13.8 - blockFactory.addObserver(annotationManager);
13.9 - isAnnotationsEnabled = true;
13.10 - }
13.11 + blockFactory.addObserver(annotationManager);
13.12
13.13 //Add preference change listener to IFS Options panel
13.14 - addPreferenceListener();
13.15 + //addPreferenceListener();
13.16 + //This will handle by the PlsqlAnnotationManager
13.17 }
13.18 // TODO: if file not in project?!?
13.19 if (project != null) {
13.20 @@ -154,13 +152,13 @@
13.21 if (IfsOptionsUtilities.isPlSqlAnnotationsEnabled() && !isAnnotationsEnabled) {
13.22 blockFactory.addObserver(annotationManager);
13.23 isAnnotationsEnabled = true;
13.24 - createLookup();
13.25 + modifyLookupAnnotationManager(annotationManager);
13.26 annotationManager.initAnnotations(this);
13.27 } else if (!IfsOptionsUtilities.isPlSqlAnnotationsEnabled() && isAnnotationsEnabled) {
13.28 blockFactory.deleteObserver(annotationManager);
13.29 annotationManager.clearAnnotations();
13.30 isAnnotationsEnabled = false;
13.31 - createLookup();
13.32 + modifyLookupAnnotationManager(annotationManager);
13.33 }
13.34 }
13.35
13.36 @@ -168,9 +166,11 @@
13.37 List<Object> objects = new ArrayList<Object>();
13.38 objects.add(blockFactory);
13.39 objects.add(new StatementExecutionHistory());
13.40 - if (isAnnotationsEnabled) {
13.41 - objects.add(annotationManager);
13.42 - }
13.43 +
13.44 + if (annotationManager != null) {
13.45 + objects.add(annotationManager);
13.46 + }
13.47 +
13.48 if (databaseConnection != null) {
13.49 objects.add(databaseConnection);
13.50 }
14.1 --- a/PLSQL/Folding/src/org/netbeans/modules/plsql/fold/PlsqlFoldManager.java Tue Sep 20 20:41:02 2011 +0200
14.2 +++ b/PLSQL/Folding/src/org/netbeans/modules/plsql/fold/PlsqlFoldManager.java Thu Sep 22 15:45:10 2011 +0200
14.3 @@ -129,88 +129,90 @@
14.4 */
14.5 private void addFolds(final List<PlsqlBlock> blockHier, final FoldHierarchyTransaction fhTransaction, final List<FoldInfo> collapsedFolds) throws BadLocationException {
14.6 final int count = blockHier.size();
14.7 -
14.8 + Document doc = getDocument();
14.9 for (int i = 0; i < count; i++) {
14.10 final PlsqlBlock temp = blockHier.get(i);
14.11 FoldType foldType = null;
14.12 final PlsqlBlockType type = temp.getType();
14.13 String description = "";
14.14
14.15 - if (type == PlsqlBlockType.VIEW) {
14.16 - foldType = PlsqlFoldTypes.VIEW;
14.17 - description = temp.getPrefix() + "VIEW " + temp.getName();
14.18 - } else if (type == PlsqlBlockType.TABLE_COMMENT) {
14.19 - foldType = PlsqlFoldTypes.TABLECOMMENT;
14.20 - description = "COMMENT ON TABLE " + temp.getName();
14.21 - } else if (type == PlsqlBlockType.COLUMN_COMMENT) {
14.22 - foldType = PlsqlFoldTypes.COLUMNCOMMENT;
14.23 - description = "COLUMN COMMENTS ON TABLE " + temp.getName();
14.24 - } else if (type == PlsqlBlockType.COMMENT) {
14.25 - foldType = PlsqlFoldTypes.COMMENT;
14.26 - description = temp.getName();
14.27 - } else if (type == PlsqlBlockType.PACKAGE) {
14.28 - foldType = PlsqlFoldTypes.PACKAGE;
14.29 - description = temp.getPrefix() + "PACKAGE " + temp.getName();
14.30 - } else if (type == PlsqlBlockType.PACKAGE_BODY) {
14.31 - foldType = PlsqlFoldTypes.PACKAGEBODY;
14.32 - description = temp.getPrefix() + "PACKAGE BODY " + temp.getName();
14.33 - } else if (type == PlsqlBlockType.PROCEDURE_IMPL) {
14.34 - foldType = PlsqlFoldTypes.PROCEDUREIMPL;
14.35 - description = temp.getPrefix() + "PROCEDURE IMPLEMENTATION " + temp.getName();
14.36 - } else if (type == PlsqlBlockType.FUNCTION_IMPL) {
14.37 - foldType = PlsqlFoldTypes.FUNCTIONIMPL;
14.38 - description = temp.getPrefix() + "FUNCTION IMPLEMENTATION " + temp.getName();
14.39 - } else if (type == PlsqlBlockType.PROCEDURE_DEF) {
14.40 - foldType = PlsqlFoldTypes.PROCEDUREDEF;
14.41 - description = "PROCEDURE DEFINITION " + temp.getName();
14.42 - } else if (type == PlsqlBlockType.FUNCTION_DEF) {
14.43 - foldType = PlsqlFoldTypes.FUNCTIONDEF;
14.44 - description = "FUNCTION DEFINITION " + temp.getName();
14.45 - } else if (type == PlsqlBlockType.DECLARE_END) {
14.46 - foldType = PlsqlFoldTypes.DECLAREEND;
14.47 - description = "DECLARE BLOCK";
14.48 - } else if (type == PlsqlBlockType.BEGIN_END) {
14.49 - foldType = PlsqlFoldTypes.BEGINEND;
14.50 - description = "BEGIN BLOCK";
14.51 - } else if (type == PlsqlBlockType.TRIGGER) {
14.52 - foldType = PlsqlFoldTypes.TRIGGER;
14.53 - description = temp.getPrefix() + "TRIGGER " + temp.getName();
14.54 - } else if (type == PlsqlBlockType.IF) {
14.55 - foldType = PlsqlFoldTypes.IF;
14.56 - description = temp.getName();
14.57 - } else if (type == PlsqlBlockType.CASE) {
14.58 - foldType = PlsqlFoldTypes.CASE;
14.59 - description = temp.getName();
14.60 - } else if (type == PlsqlBlockType.WHILE_LOOP) {
14.61 - foldType = PlsqlFoldTypes.WHILELOOP;
14.62 - description = "WHILE " + temp.getName();
14.63 - } else if (type == PlsqlBlockType.FOR_LOOP) {
14.64 - foldType = PlsqlFoldTypes.FORLOOP;
14.65 - description = "FOR " + temp.getName();
14.66 - } else if (type == PlsqlBlockType.LOOP) {
14.67 - foldType = PlsqlFoldTypes.LOOP;
14.68 - description = "LOOP ";
14.69 - } else if (type == PlsqlBlockType.CUSTOM_FOLD) {
14.70 - foldType = PlsqlFoldTypes.CUSTOM;
14.71 - description = temp.getName();
14.72 - } else if (type == PlsqlBlockType.STATEMENT) {
14.73 - foldType = PlsqlFoldTypes.STATEMENT;
14.74 - description = temp.getPrefix() + temp.getName();
14.75 - } else if (type == PlsqlBlockType.CURSOR) {
14.76 - foldType = PlsqlFoldTypes.CURSOR;
14.77 - description = "CURSOR " + temp.getName();
14.78 - } else if (type == PlsqlBlockType.JAVA_SOURCE) {
14.79 - foldType = PlsqlFoldTypes.JAVASOURCE;
14.80 - description = temp.getPrefix() + "JAVA SOURCE";
14.81 - }
14.82 + if (!(type == PlsqlBlockType.COMMENT && doc.getText(temp.getStartOffset(), temp.getEndOffset() - temp.getStartOffset()).indexOf("\n") == -1)) { // check for single line comments
14.83 + if (type == PlsqlBlockType.VIEW) {
14.84 + foldType = PlsqlFoldTypes.VIEW;
14.85 + description = temp.getPrefix() + "VIEW " + temp.getName();
14.86 + } else if (type == PlsqlBlockType.TABLE_COMMENT) {
14.87 + foldType = PlsqlFoldTypes.TABLECOMMENT;
14.88 + description = "COMMENT ON TABLE " + temp.getName();
14.89 + } else if (type == PlsqlBlockType.COLUMN_COMMENT) {
14.90 + foldType = PlsqlFoldTypes.COLUMNCOMMENT;
14.91 + description = "COLUMN COMMENTS ON TABLE " + temp.getName();
14.92 + } else if (type == PlsqlBlockType.COMMENT) {
14.93 + foldType = PlsqlFoldTypes.COMMENT;
14.94 + description = temp.getName();
14.95 + } else if (type == PlsqlBlockType.PACKAGE) {
14.96 + foldType = PlsqlFoldTypes.PACKAGE;
14.97 + description = temp.getPrefix() + "PACKAGE " + temp.getName();
14.98 + } else if (type == PlsqlBlockType.PACKAGE_BODY) {
14.99 + foldType = PlsqlFoldTypes.PACKAGEBODY;
14.100 + description = temp.getPrefix() + "PACKAGE BODY " + temp.getName();
14.101 + } else if (type == PlsqlBlockType.PROCEDURE_IMPL) {
14.102 + foldType = PlsqlFoldTypes.PROCEDUREIMPL;
14.103 + description = temp.getPrefix() + "PROCEDURE IMPLEMENTATION " + temp.getName();
14.104 + } else if (type == PlsqlBlockType.FUNCTION_IMPL) {
14.105 + foldType = PlsqlFoldTypes.FUNCTIONIMPL;
14.106 + description = temp.getPrefix() + "FUNCTION IMPLEMENTATION " + temp.getName();
14.107 + } else if (type == PlsqlBlockType.PROCEDURE_DEF) {
14.108 + foldType = PlsqlFoldTypes.PROCEDUREDEF;
14.109 + description = "PROCEDURE DEFINITION " + temp.getName();
14.110 + } else if (type == PlsqlBlockType.FUNCTION_DEF) {
14.111 + foldType = PlsqlFoldTypes.FUNCTIONDEF;
14.112 + description = "FUNCTION DEFINITION " + temp.getName();
14.113 + } else if (type == PlsqlBlockType.DECLARE_END) {
14.114 + foldType = PlsqlFoldTypes.DECLAREEND;
14.115 + description = "DECLARE BLOCK";
14.116 + } else if (type == PlsqlBlockType.BEGIN_END) {
14.117 + foldType = PlsqlFoldTypes.BEGINEND;
14.118 + description = "BEGIN BLOCK";
14.119 + } else if (type == PlsqlBlockType.TRIGGER) {
14.120 + foldType = PlsqlFoldTypes.TRIGGER;
14.121 + description = temp.getPrefix() + "TRIGGER " + temp.getName();
14.122 + } else if (type == PlsqlBlockType.IF) {
14.123 + foldType = PlsqlFoldTypes.IF;
14.124 + description = temp.getName();
14.125 + } else if (type == PlsqlBlockType.CASE) {
14.126 + foldType = PlsqlFoldTypes.CASE;
14.127 + description = temp.getName();
14.128 + } else if (type == PlsqlBlockType.WHILE_LOOP) {
14.129 + foldType = PlsqlFoldTypes.WHILELOOP;
14.130 + description = "WHILE " + temp.getName();
14.131 + } else if (type == PlsqlBlockType.FOR_LOOP) {
14.132 + foldType = PlsqlFoldTypes.FORLOOP;
14.133 + description = "FOR " + temp.getName();
14.134 + } else if (type == PlsqlBlockType.LOOP) {
14.135 + foldType = PlsqlFoldTypes.LOOP;
14.136 + description = "LOOP ";
14.137 + } else if (type == PlsqlBlockType.CUSTOM_FOLD) {
14.138 + foldType = PlsqlFoldTypes.CUSTOM;
14.139 + description = temp.getName();
14.140 + } else if (type == PlsqlBlockType.STATEMENT) {
14.141 + foldType = PlsqlFoldTypes.STATEMENT;
14.142 + description = temp.getPrefix() + temp.getName();
14.143 + } else if (type == PlsqlBlockType.CURSOR) {
14.144 + foldType = PlsqlFoldTypes.CURSOR;
14.145 + description = "CURSOR " + temp.getName();
14.146 + } else if (type == PlsqlBlockType.JAVA_SOURCE) {
14.147 + foldType = PlsqlFoldTypes.JAVASOURCE;
14.148 + description = temp.getPrefix() + "JAVA SOURCE";
14.149 + }
14.150
14.151 - if (getDocument().getEndPosition().getOffset() >= temp.getEndOffset()) {
14.152 - operation.addToHierarchy(foldType, description, isCollapsed(temp, foldType, collapsedFolds),
14.153 - temp.getStartOffset(), temp.getEndOffset(), 0, 0, null, fhTransaction);
14.154 + if (getDocument().getEndPosition().getOffset() >= temp.getEndOffset()) {
14.155 + operation.addToHierarchy(foldType, description, isCollapsed(temp, foldType, collapsedFolds),
14.156 + temp.getStartOffset(), temp.getEndOffset(), 0, 0, null, fhTransaction);
14.157
14.158 - //check for any child folds and add them also
14.159 - addFolds(temp.getChildBlocks(), fhTransaction, collapsedFolds);
14.160 - }
14.161 + //check for any child folds and add them also
14.162 + addFolds(temp.getChildBlocks(), fhTransaction, collapsedFolds);
14.163 + }
14.164 + }
14.165 }
14.166 }
14.167
14.168 @@ -276,7 +278,7 @@
14.169 */
14.170 private synchronized void updateFolds(final FoldHierarchyTransaction fhTran) {
14.171 try {
14.172 - final PlsqlBlockFactory blockFactory = getBlockFactory();
14.173 + final PlsqlBlockFactory blockFactory = getBlockFactory();
14.174 if (blockFactory == null) {
14.175 return;
14.176 }
15.1 --- a/PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlFormatter.java Tue Sep 20 20:41:02 2011 +0200
15.2 +++ b/PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlFormatter.java Thu Sep 22 15:45:10 2011 +0200
15.3 @@ -368,6 +368,10 @@
15.4 // Get the first non-whitespace position on the line
15.5 FormatTokenPosition firstNWS = findLineFirstNonWhitespace(pos);
15.6 if (firstNWS != null) { // some non-WS on the line
15.7 + // if the firstNWS is a character literal and contains \n, which means it has multiple lines, so indentation should avoid in such lines
15.8 + if (firstNWS.getToken() != null && firstNWS.getToken().getTokenID().getNumericID() == PlsqlTokenContext.CHAR_LITERAL_ID && firstNWS.getToken().getImage().contains("\n")) {
15.9 + return pos;
15.10 + }
15.11
15.12 indent = findIndent(firstNWS.getToken());
15.13 } else { // whole line is WS
15.14 @@ -415,7 +419,9 @@
15.15 token = token.getNext();
15.16 offset += token.getImage().length();
15.17 }
15.18 - if (offset == caretPos) {
15.19 + // second part of the || condition is to get the correct format if the keyword is immediately followed by serveral whitespaces
15.20 + // as if there are whitespaces next to each other, all of them taken as one token. Hence offset calculation gets wrong.
15.21 + if (offset == caretPos || (token.getImage().trim().length() == 0 && (caretPos == offset - token.getImage().length() + 1))) {
15.22 break;
15.23 }
15.24 }
15.25 @@ -456,7 +462,7 @@
15.26 if (blockFactory != null) {
15.27 blockFactory.beforeCaseChange();
15.28 }
15.29 - if (!image.equals(upperCaseImage)) {
15.30 + if (!image.equals(upperCaseImage) && checkUpperCaseAllowed(token)) {
15.31 if (plsqlFormatSup.canReplaceToken(token)) {
15.32 plsqlFormatSup.replaceToken(token, token.getTokenID(), token.getTokenContextPath(), image.toUpperCase(Locale.ENGLISH));
15.33 } else {
15.34 @@ -525,7 +531,7 @@
15.35 if (blockFactory != null) {
15.36 blockFactory.beforeCaseChange();
15.37 }
15.38 - if (!image.equals(upperCaseImage)) {
15.39 + if (!image.equals(upperCaseImage) && checkUpperCaseAllowed(token)) {
15.40 if (plsqlFormatSup.canReplaceToken(token)) {
15.41 plsqlFormatSup.replaceToken(token, token.getTokenID(), token.getTokenContextPath(), image.toUpperCase(Locale.ENGLISH));
15.42 } else {
15.43 @@ -547,6 +553,15 @@
15.44 }
15.45 }
15.46
15.47 + private boolean checkUpperCaseAllowed(TokenItem token) {
15.48 + TokenItem previousToken = getPreviousNonWhiteSpaceToken(token);
15.49 + if (previousToken != null && (previousToken.getImage().trim().equalsIgnoreCase("PROCEDURE") || previousToken.getImage().trim().equalsIgnoreCase("FUNCTION") || (previousToken.getImage().trim().equalsIgnoreCase("END") && !(token.getImage().trim().equalsIgnoreCase("IF") || token.getImage().trim().equalsIgnoreCase("LOOP") || token.getImage().trim().equalsIgnoreCase("CASE")) ))) {
15.50 + return false;
15.51 + } else {
15.52 + return true;
15.53 + }
15.54 + }
15.55 +
15.56 /** Find the indentation for the first token on the line.
15.57 * The given token is also examined in some cases.
15.58 */
15.59 @@ -558,6 +573,12 @@
15.60 do {
15.61 previousNWS = getPreviousToken(previousNWS);
15.62 if ((previousNWS != null) && (previousNWS.getTokenID() != PlsqlTokenContext.WHITESPACE)) {
15.63 + /*if the previousNWS is a line comment or a block comment, we should get previous non-whitespace token to
15.64 + * indent correctly.
15.65 + */
15.66 + if (previousNWS.getTokenID() == PlsqlTokenContext.LINE_COMMENT || previousNWS.getTokenID() == PlsqlTokenContext.BLOCK_COMMENT) {
15.67 + previousNWS = findLineFirstNonWhitespace(getPosition(previousNWS, 0)).getToken();
15.68 + }
15.69 break;
15.70 }
15.71 } while (previousNWS != null);
15.72 @@ -693,7 +714,7 @@
15.73 }
15.74
15.75 tokenTempPre = tokenTemp;
15.76 - tokenTemp = getPreviousToken(tokenTemp);
15.77 + tokenTemp = getPreviousNonWhiteSpaceToken(tokenTemp);
15.78 }
15.79 }
15.80
15.81 @@ -910,6 +931,22 @@
15.82 /*When a statement is ended by ';' in some statements
15.83 * if the statement is multi-lined we need to go to the beginning to
15.84 * get the indentation for the next*/
15.85 + TokenItem previousToken = getPreviousNonWhiteSpaceToken(previousNWS);
15.86 + /* if the previous Token is a ')' then we should find the begining of the statement */
15.87 + if (previousToken != null && previousToken.getTokenID().getNumericID() == PlsqlTokenContext.RPAREN_ID) {
15.88 + int multiLineIndent = getMethodIndent(previousToken);
15.89 + if (multiLineIndent != -1 && multiLineIndent != 0 && getLineIndent(getPosition(previousNWS, 0), true) != multiLineIndent) {
15.90 + return multiLineIndent - getLineIndent(getPosition(previousNWS, 0), true);
15.91 + }
15.92 + } // if previousToken is a character literal, we need to find the starting line of the string
15.93 + else if (previousToken != null && previousToken.getTokenID().getNumericID() == PlsqlTokenContext.CHAR_LITERAL_ID) {
15.94 + TokenItem preCharToken = getPreviousNonCharLiteralToken(previousToken);
15.95 + FormatTokenPosition tmp1 = getPosition(preCharToken, 0);
15.96 + FormatTokenPosition tmp2 = getPosition(previousNWS, 0);
15.97 + if (!(findLineEnd(tmp1)).equals(findLineEnd(tmp2))) {
15.98 + return (getLineIndent(tmp1, true) - getLineIndent(tmp2, true));
15.99 + }
15.100 + }
15.101 int diff[] = {0};
15.102 String previousBlockKey = getPreviousStmtKey(previousNWS, diff);
15.103
15.104 @@ -975,6 +1012,163 @@
15.105 }
15.106
15.107 /**
15.108 + * Get the previous non-whitespace token
15.109 + * @param token
15.110 + * @return TokenItem.
15.111 + */
15.112 + private TokenItem getPreviousNonWhiteSpaceToken(TokenItem token) {
15.113 + token = token.getPrevious();
15.114 + while (token != null) {
15.115 + if (token.getTokenID().getNumericID() != PlsqlTokenContext.WHITESPACE_ID) {
15.116 + return token;
15.117 + }
15.118 + token = token.getPrevious();
15.119 + }
15.120 + return token;
15.121 + }
15.122 +
15.123 + /**
15.124 + * Get the next non-whitespace token
15.125 + * @param token
15.126 + * @return TokenItem.
15.127 + */
15.128 + private TokenItem getNextNonWhiteSpaceToken(TokenItem token) {
15.129 + token = token.getNext();
15.130 + while (token != null) {
15.131 + if (token.getTokenID().getNumericID() != PlsqlTokenContext.WHITESPACE_ID) {
15.132 + return token;
15.133 + }
15.134 + token = token.getNext();
15.135 + }
15.136 + return token;
15.137 + }
15.138 +
15.139 + /**
15.140 + * Get the previous token Item which is not a character literal
15.141 + * @param token
15.142 + * @return TokenItem which is not a character literal.
15.143 + */
15.144 + private TokenItem getPreviousNonCharLiteralToken(TokenItem token) {
15.145 + token = token.getPrevious();
15.146 + while (token != null) {
15.147 + if (token.getTokenID().getNumericID() != PlsqlTokenContext.WHITESPACE_ID && token.getTokenID().getNumericID() != PlsqlTokenContext.CHAR_LITERAL_ID) {
15.148 + return token;
15.149 + }
15.150 + token = token.getPrevious();
15.151 + }
15.152 + return token;
15.153 + }
15.154 +
15.155 + /**
15.156 + * Get the indentation of a method which has multiple lines, it will simply matches
15.157 + * brace count and return indentation of the method's first line.
15.158 + * @param token, which has image of ')'
15.159 + * @return indentation, indentation of the line that consist the method's starting '(' if a match found else 0.
15.160 + */
15.161 + private int getMethodIndent(TokenItem token) {
15.162 + TokenItem tempToken = getPreviousNonWhiteSpaceToken(token);
15.163 + FormatTokenPosition tmp1 = getPosition(tempToken, 0);
15.164 + FormatTokenPosition tmp2 = null;
15.165 + int brace_count = 1;
15.166 + while (tempToken != null) {
15.167 + if (tempToken.getTokenID().getNumericID() == PlsqlTokenContext.LPAREN_ID) {
15.168 + brace_count--;
15.169 + } else if (tempToken.getTokenID().getNumericID() == PlsqlTokenContext.RPAREN_ID) {
15.170 + brace_count++;
15.171 + }
15.172 + if (brace_count == 0) {
15.173 + tmp2 = getPosition(tempToken, 0);
15.174 + break;
15.175 + }
15.176 + tempToken = getPreviousNonWhiteSpaceToken(tempToken);
15.177 +
15.178 + }
15.179 + if (tmp1 != null && tmp2 != null && !(findLineEnd(tmp1)).equals(findLineEnd(tmp2))) {
15.180 + return getPreviousStmtIndent(tmp2.getToken());
15.181 + } else {
15.182 + return -1;
15.183 + }
15.184 + }
15.185 +
15.186 + /**
15.187 + * Method to get the indentation of the previous statement
15.188 + * @param previousNWS
15.189 + * @param diff
15.190 + * @return
15.191 + */
15.192 + private int getPreviousStmtIndent(TokenItem previousNWS) {
15.193 + int diff = 0;
15.194 + TokenItem tokenTempPre = null;
15.195 + TokenItem tokenTemp = getPreviousToken(previousNWS);
15.196 +
15.197 + while (tokenTemp != null) {
15.198 + String image = tokenTemp.getImage().trim();
15.199 + if ((image.equalsIgnoreCase(";"))
15.200 + || (image.equalsIgnoreCase("BEGIN"))
15.201 + || (image.equalsIgnoreCase("LOOP"))
15.202 + || (image.equalsIgnoreCase("ELSE"))
15.203 + || (image.equalsIgnoreCase("THEN"))
15.204 + || (image.equalsIgnoreCase("CURSOR"))) {
15.205 + //METHOD declarations inside a
15.206 + break;
15.207 + } else {
15.208 + if (tokenTemp.getTokenID().getNumericID() == PlsqlTokenContext.KEYWORD_ID) {
15.209 + tokenTempPre = tokenTemp;
15.210 + }
15.211 + tokenTemp = getPreviousToken(tokenTemp);
15.212 + }
15.213 + }
15.214 +
15.215 + if (tokenTempPre != null) {
15.216 + FormatTokenPosition tmp1 = getPosition(tokenTempPre, 0);
15.217 + FormatTokenPosition tmp2 = getPosition(previousNWS, 0);
15.218 +
15.219 + //if same line ignore
15.220 + if ((findLineEnd(tmp1)).equals(findLineEnd(tmp2))) {
15.221 + return diff;
15.222 + }
15.223 +
15.224 + diff = getLineIndent(tmp1, true);
15.225 + } else {
15.226 + FormatTokenPosition tmp1 = getPosition(getNextNonWhiteSpaceToken(tokenTemp), 0);
15.227 + diff = getLineIndent(tmp1, true);
15.228 + }
15.229 +
15.230 + return diff;
15.231 + }
15.232 +
15.233 + /**
15.234 + * Get the starting line position of a method which has multiple lines, it will simply matches
15.235 + * brace count and return the position of the matching token.
15.236 + * @param token, which has image of ')'
15.237 + * @return format token Position, position of '(' if a match found else null.
15.238 + */
15.239 + private FormatTokenPosition getMethodStartPosition(TokenItem token) {
15.240 + TokenItem tempToken = getPreviousNonWhiteSpaceToken(token);
15.241 + FormatTokenPosition tmp1 = getPosition(tempToken, 0);
15.242 + FormatTokenPosition tmp2 = null;
15.243 + int brace_count = 1;
15.244 + while (tempToken != null) {
15.245 + if (tempToken.getTokenID().getNumericID() == PlsqlTokenContext.LPAREN_ID) {
15.246 + brace_count--;
15.247 + } else if (tempToken.getTokenID().getNumericID() == PlsqlTokenContext.RPAREN_ID) {
15.248 + brace_count++;
15.249 + }
15.250 + if (brace_count == 0) {
15.251 + tmp2 = getPosition(tempToken, 0);
15.252 + break;
15.253 + }
15.254 + tempToken = getPreviousNonWhiteSpaceToken(tempToken);
15.255 +
15.256 + }
15.257 + if (tmp1 != null && tmp2 != null && !(findLineEnd(tmp1)).equals(findLineEnd(tmp2))) {
15.258 + return tmp2;
15.259 + } else {
15.260 + return tmp1;
15.261 + }
15.262 + }
15.263 +
15.264 + /**
15.265 * Get the parent of the IS, can be FUNCTION/ PROCEDURE/PACKAGE/CURSOR
15.266 * @param previous
15.267 * @return
15.268 @@ -1066,7 +1260,11 @@
15.269 || (image.equalsIgnoreCase("BEGIN"))
15.270 || (image.equalsIgnoreCase("LOOP"))
15.271 || (image.equalsIgnoreCase("ELSE"))
15.272 - || (image.equalsIgnoreCase("THEN"))) {
15.273 + || (image.equalsIgnoreCase("THEN"))
15.274 + || (image.equalsIgnoreCase("CURSOR"))) {
15.275 + if (image.equalsIgnoreCase("CURSOR")) {
15.276 + tokenTempPre = tokenTemp;
15.277 + }
15.278 //METHOD declarations inside a
15.279 break;
15.280 } else {
16.1 --- a/PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlSyntax.java Tue Sep 20 20:41:02 2011 +0200
16.2 +++ b/PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlSyntax.java Thu Sep 22 15:45:10 2011 +0200
16.3 @@ -249,9 +249,6 @@
16.4
16.5 case ISI_CHAR:
16.6 switch (actChar) {
16.7 - case '\n':
16.8 - state = INIT;
16.9 - return PlsqlTokenContext.CHAR_LITERAL;
16.10 case '\'': // NOI18N
16.11 offset++;
16.12 state = INIT;
16.13 @@ -293,11 +290,8 @@
16.14 state = ISI_BLOCK_COMMENT;
16.15 break;
16.16 default:
16.17 - if(Character.isWhitespace(actChar) ||
16.18 - actChar == '(') {
16.19 - state = INIT;
16.20 - return PlsqlTokenContext.OPERATOR;
16.21 - }
16.22 + state = INIT;
16.23 + return PlsqlTokenContext.OPERATOR;
16.24 }
16.25 break;
16.26
16.27 @@ -429,6 +423,8 @@
16.28 case ISA_SLASH:
16.29 state = INIT;
16.30 return PlsqlTokenContext.OPERATOR;
16.31 + case ISI_CHAR:
16.32 + return PlsqlTokenContext.CHAR_LITERAL;//sadhlk
16.33 }
16.34 }
16.35
17.1 --- a/PLSQL/FormattingOptions/src/org/netbeans/modules/plsql/format/options/PlsqlFormatOptions.java Tue Sep 20 20:41:02 2011 +0200
17.2 +++ b/PLSQL/FormattingOptions/src/org/netbeans/modules/plsql/format/options/PlsqlFormatOptions.java Thu Sep 22 15:45:10 2011 +0200
17.3 @@ -46,6 +46,10 @@
17.4 import java.awt.Rectangle;
17.5 import java.awt.event.ActionEvent;
17.6 import java.awt.event.ActionListener;
17.7 +import java.io.BufferedReader;
17.8 +import java.io.IOException;
17.9 +import java.io.InputStream;
17.10 +import java.io.InputStreamReader;
17.11 import java.util.HashMap;
17.12 import java.util.LinkedList;
17.13 import java.util.List;
17.14 @@ -61,11 +65,9 @@
17.15 import javax.swing.JTextField;
17.16 import javax.swing.event.DocumentEvent;
17.17 import javax.swing.event.DocumentListener;
17.18 -import org.netbeans.api.editor.mimelookup.MimeLookup;
17.19 import org.netbeans.api.editor.settings.SimpleValueNames;
17.20 import org.netbeans.modules.options.editor.spi.PreferencesCustomizer;
17.21 import org.netbeans.modules.options.editor.spi.PreviewProvider;
17.22 -import org.netbeans.modules.options.indentation.FormattingPanelController;
17.23 import org.openide.text.CloneableEditorSupport;
17.24 import org.openide.util.HelpCtx;
17.25 import org.openide.util.NbBundle;
17.26 @@ -149,24 +151,12 @@
17.27 private final Preferences preferences;
17.28 private final Preferences previewPrefs;
17.29
17.30 - protected CategorySupport(Preferences preferences, String id, JPanel panel, String previewText) {
17.31 - //checkwhether override global options is in preferences already
17.32 - Preferences prefs = MimeLookup.getLookup("text/x-plsql").lookup(Preferences.class);
17.33 - if ((!prefs.getBoolean(FormattingPanelController.OVERRIDE_GLOBAL_FORMATTING_OPTIONS, false)) &&
17.34 - (prefs.getBoolean(FormattingPanelController.OVERRIDE_GLOBAL_FORMATTING_OPTIONS, true))) {
17.35 - prefs.putBoolean(FormattingPanelController.OVERRIDE_GLOBAL_FORMATTING_OPTIONS, true);
17.36 -
17.37 - //Set default values
17.38 - prefs.putBoolean(expandTabToSpaces, getDefaultAsBoolean(expandTabToSpaces));
17.39 - prefs.putInt(tabSize, getDefaultAsInt(tabSize));
17.40 - prefs.putInt(spacesPerTab, getDefaultAsInt(spacesPerTab));
17.41 - prefs.putInt(indentSize, getDefaultAsInt(indentSize));
17.42 - }
17.43 -
17.44 + protected CategorySupport(Preferences preferences, String id, JPanel panel, String previewText) throws IOException {
17.45 +
17.46 this.preferences = preferences;
17.47 this.id = id;
17.48 this.panel = panel;
17.49 - this.previewText = previewText != null ? previewText : NbBundle.getMessage(PlsqlFormatOptions.class, "SAMPLE_Default"); //NOI18N
17.50 + this.previewText =loadPreviewText(getClass().getClassLoader().getResourceAsStream("ifs/dev/nb/plsql/format/options/IndentationExample")); //NOI18N
17.51
17.52 // Scan the panel for its components
17.53 scan(panel, components);
17.54 @@ -211,7 +201,21 @@
17.55 public void changedUpdate(DocumentEvent e) {
17.56 notifyChanged();
17.57 }
17.58 +
17.59 + private static String loadPreviewText(InputStream is) throws IOException {
17.60 + BufferedReader r = new BufferedReader(new InputStreamReader(is));
17.61 + try {
17.62 + StringBuilder sb = new StringBuilder();
17.63 + for (String line = r.readLine(); line != null; line = r.readLine()) {
17.64 + sb.append(line).append('\n');
17.65 + }
17.66 + return sb.toString();
17.67 + } finally {
17.68 + r.close();
17.69 + }
17.70 + }
17.71
17.72 + @Override
17.73 public JComponent getPreviewComponent() {
17.74 if (previewPane == null) {
17.75 previewPane = new JEditorPane();
17.76 @@ -220,6 +224,7 @@
17.77 previewPane.putClientProperty("HighlightsLayerIncludes", "^org\\.netbeans\\.modules\\.editor\\.lib2\\.highlighting\\.SyntaxHighlighting$"); //NOI18N
17.78 previewPane.setEditorKit(CloneableEditorSupport.getEditorKit("text/x-plsql"));
17.79 previewPane.setEditable(false);
17.80 + previewPane.setText(previewText);
17.81 }
17.82 return previewPane;
17.83 }
18.1 --- a/PLSQL/Hyperlink/src/org/netbeans/modules/plsql/hyperlink/PlsqlHyperlinkProvider.java Tue Sep 20 20:41:02 2011 +0200
18.2 +++ b/PLSQL/Hyperlink/src/org/netbeans/modules/plsql/hyperlink/PlsqlHyperlinkProvider.java Thu Sep 22 15:45:10 2011 +0200
18.3 @@ -1222,6 +1222,8 @@
18.4 if ((defBlock.getStartOffset() <= usageBlock.getStartOffset())
18.5 && (defBlock.getEndOffset() >= usageBlock.getEndOffset())) {
18.6 isOffsetOk = true;
18.7 + } else if (defBlock.getType().equals(PlsqlBlockType.CURSOR) && defBlock.getStartOffset() <= offset) {
18.8 + isOffsetOk = true;
18.9 }
18.10 } else if (defBlock == null) {
18.11 isOffsetOk = true;
19.1 --- a/PLSQL/Hyperlink/src/org/netbeans/modules/plsql/hyperlink/actions/ShowDatabaseObjectAction.java Tue Sep 20 20:41:02 2011 +0200
19.2 +++ b/PLSQL/Hyperlink/src/org/netbeans/modules/plsql/hyperlink/actions/ShowDatabaseObjectAction.java Thu Sep 22 15:45:10 2011 +0200
19.3 @@ -107,15 +107,12 @@
19.4 try {
19.5 if (cache.isView(objName, databaseConnection)) {
19.6 try {
19.7 - EditorCookie editorCookie = activatedNodes[0].getLookup().lookup(EditorCookie.class);
19.8 DataObject obj = null;
19.9 String aliasOf = cache.getViewForSynonym(objName);
19.10 if (aliasOf != null) {
19.11 objName = aliasOf;
19.12 }
19.13 - if (editorCookie != null) {
19.14 - obj = PlsqlFileUtil.openExistingFile(editorCookie.getDocument(), objName, VIEW, project);
19.15 - }
19.16 + obj = PlsqlFileUtil.openExistingFile(null, objName, VIEW, project);
19.17 if (obj == null) {
19.18 PlsqlHyperlinkUtil.openAsTempFile(objName, VIEW, databaseConnection, project, null);
19.19 } else {
19.20 @@ -129,7 +126,9 @@
19.21 action.goToPackage(objName, project, "", 1);
19.22 } else if (cache.isTable(objName, databaseConnection)) {
19.23 try {
19.24 - PlsqlHyperlinkUtil.openAsTempFile(objName, TABLE, databaseConnection, project, null);
19.25 + if(PlsqlFileUtil.openExistingFile(null, objName, TABLE, project)==null) {
19.26 + PlsqlHyperlinkUtil.openAsTempFile(objName, TABLE, databaseConnection, project, null);
19.27 + }
19.28 } catch (NotConnectedToDbException ex) {
19.29 Exceptions.printStackTrace(ex);
19.30 }
20.1 --- a/PLSQL/Hyperlink/src/org/netbeans/modules/plsql/hyperlink/target/PlsqlPackageBodyTarget.java Tue Sep 20 20:41:02 2011 +0200
20.2 +++ b/PLSQL/Hyperlink/src/org/netbeans/modules/plsql/hyperlink/target/PlsqlPackageBodyTarget.java Thu Sep 22 15:45:10 2011 +0200
20.3 @@ -63,6 +63,7 @@
20.4 public PlsqlPackageBodyTarget(final String name, final int position, final DataObject sourceDataObject,
20.5 final Project project, final Document sourceDocument) {
20.6 super(name, position, sourceDataObject, project, sourceDocument);
20.7 + this.packageName = name;
20.8 this.type = PlsqlBlockType.PACKAGE_BODY;
20.9 this.synonym = cache.getPackageForSynonym(name);
20.10 }
21.1 --- a/PLSQL/Hyperlink/src/org/netbeans/modules/plsql/hyperlink/target/PlsqlPackageTarget.java Tue Sep 20 20:41:02 2011 +0200
21.2 +++ b/PLSQL/Hyperlink/src/org/netbeans/modules/plsql/hyperlink/target/PlsqlPackageTarget.java Thu Sep 22 15:45:10 2011 +0200
21.3 @@ -63,6 +63,7 @@
21.4 public PlsqlPackageTarget(final String name, final int position, final DataObject sourceDataObject,
21.5 final Project project, final Document sourceDocument) {
21.6 super(name, position, sourceDataObject, project, sourceDocument);
21.7 + this.packageName = name;
21.8 this.type = PlsqlBlockType.PACKAGE;
21.9 this.synonym = cache.getPackageForSynonym(name);
21.10 }
22.1 --- a/PLSQL/Hyperlink/src/org/netbeans/modules/plsql/hyperlink/util/PlsqlHyperlinkUtil.java Tue Sep 20 20:41:02 2011 +0200
22.2 +++ b/PLSQL/Hyperlink/src/org/netbeans/modules/plsql/hyperlink/util/PlsqlHyperlinkUtil.java Thu Sep 22 15:45:10 2011 +0200
22.3 @@ -72,6 +72,8 @@
22.4 */
22.5 public class PlsqlHyperlinkUtil {
22.6
22.7 + private PlsqlHyperlinkUtil() { } //singleton
22.8 +
22.9 /**
22.10 * Get Return next non whitespace token for files
22.11 * @param ts
23.1 --- a/PLSQL/Palette/src/org/netbeans/modules/plsql/palette/PlsqlPaletteUtilities.java Tue Sep 20 20:41:02 2011 +0200
23.2 +++ b/PLSQL/Palette/src/org/netbeans/modules/plsql/palette/PlsqlPaletteUtilities.java Thu Sep 22 15:45:10 2011 +0200
23.3 @@ -63,7 +63,7 @@
23.4 public class PlsqlPaletteUtilities {
23.5
23.6 /** Creates a new instance of PlsqlPaletteUtilities */
23.7 - public PlsqlPaletteUtilities() {
23.8 + private PlsqlPaletteUtilities() {
23.9 }
23.10
23.11 /**
24.1 --- a/PLSQL/Utilities/src/org/netbeans/modules/plsql/utilities/PlsqlFileUtil.java Tue Sep 20 20:41:02 2011 +0200
24.2 +++ b/PLSQL/Utilities/src/org/netbeans/modules/plsql/utilities/PlsqlFileUtil.java Thu Sep 22 15:45:10 2011 +0200
24.3 @@ -77,6 +77,9 @@
24.4 private static final String SOURCE_CACHE_DIRECTORY = "source";
24.5 private static final PlsqlFileLocatorService fileLocator = Lookup.getDefault().lookup(PlsqlFileLocatorService.class);
24.6
24.7 + private PlsqlFileUtil() { //singleton
24.8 + }
24.9 +
24.10 /**
24.11 * Method that will fetch the PACKAGE BODY from database,
24.12 * save it at a tmp directory and open it
25.1 --- a/PLSQL/Utilities/src/org/netbeans/modules/plsql/utilities/PlsqlParserUtil.java Tue Sep 20 20:41:02 2011 +0200
25.2 +++ b/PLSQL/Utilities/src/org/netbeans/modules/plsql/utilities/PlsqlParserUtil.java Thu Sep 22 15:45:10 2011 +0200
25.3 @@ -122,7 +122,7 @@
25.4 if (usageParams.size() > params.size()) {
25.5 return false;
25.6 }
25.7 - if ((usageParams.size() == 0) && (params.size() == 0)) {
25.8 + if ((usageParams.isEmpty()) && (params.isEmpty())) {
25.9 return true;
25.10 }
25.11
26.1 --- a/PLSQL/Utilities/test/unit/src/org/netbeans/modules/plsql/utilities/localization/PlsqlFileLocatorServiceImplTest.java Tue Sep 20 20:41:02 2011 +0200
26.2 +++ b/PLSQL/Utilities/test/unit/src/org/netbeans/modules/plsql/utilities/localization/PlsqlFileLocatorServiceImplTest.java Thu Sep 22 15:45:10 2011 +0200
26.3 @@ -223,9 +223,8 @@
26.4 final FileObject rootFolderA = FileUtil.toFileObject(new File(getDataDir(), WORKSPACE_A));
26.5 instance.registerFolder(PROJECT_A, rootFolderA);
26.6
26.7 -
26.8 PlsqlSearchObject searchObject = new PlsqlSearchObject(PlsqlBlockType.PACKAGE, "FND_SECURITY_PER_USER_RPI");
26.9 - String expResult = PROJECT_A + File.separator + "workspace" + File.separator + "fndbas" + File.separator + "database" + File.separator + "fndbas" + File.separator + "FndSecurityPerUser.rdf";
26.10 + String expResult = PROJECT_A + "/" + "workspace" + "/" + "fndbas" + "/" + "database" + "/" + "fndbas" + "/" + "FndSecurityPerUser.rdf";
26.11 FileObject result = instance.findFile(PROJECT_A, searchObject);
26.12 assertTrue(result.getPath().endsWith(expResult));
26.13 }