From 20480f3d34e76a10fc1309f499aa85cb64398722 Mon Sep 17 00:00:00 2001 From: khartlage Date: Fri, 5 Mar 2004 17:09:38 +0000 Subject: [PATCH 01/16] misc parser changes --- .../phpdt/internal/compiler/parser/Parser.java | 56 ++++++++++++++++++- .../phpdt/internal/compiler/parser/Scanner.java | 2 +- 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java index 271c3d6..7369a24 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java @@ -1410,10 +1410,10 @@ public class Parser //extends PHPParserSuperclass typeDecl.declarationSourceEnd = scanner.getCurrentTokenEndPosition(); getNextToken(); } else { - throwSyntaxError("'}' expected at end of interface body."); + throwSyntaxError("'}' expected at end of class body."); } } else { - throwSyntaxError("'{' expected at start of interface body."); + throwSyntaxError("'{' expected at start of class body."); } } private void class_entry_type() { @@ -1492,7 +1492,14 @@ public class Parser //extends PHPParserSuperclass private void class_statement_list() { do { class_statement(); - } while (token == TokenNamefunction || token == TokenNamevar); + } while (token == TokenNamepublic || + token == TokenNameprotected || + token == TokenNameprivate || + token == TokenNamestatic || + token == TokenNameabstract || + token == TokenNamefinal || + token == TokenNamefunction || + token == TokenNamevar); } private void class_statement() { // class_statement: @@ -2185,6 +2192,26 @@ public class Parser //extends PHPParserSuperclass getNextToken(); } break; + case TokenNamearray : + // T_ARRAY '(' array_pair_list ')' + getNextToken(); + if (token == TokenNameLPAREN) { + getNextToken(); + if (token == TokenNameRPAREN) { + getNextToken(); + break; + } + array_pair_list(); + if (token != TokenNameRPAREN) { + throwSyntaxError("')' expected after keyword 'array'" + + "(Found token: " + scanner.toStringAction(token) + ")"); + } + getNextToken(); + } else { + throwSyntaxError("'(' expected after keyword 'array'" + + "(Found token: " + scanner.toStringAction(token) + ")"); + } + break; case TokenNameprint : getNextToken(); expr(); @@ -2358,6 +2385,29 @@ public class Parser //extends PHPParserSuperclass } } while (while_flag); } + private void array_pair_list() { +// array_pair_list: +// /* empty */ +//| non_empty_array_pair_list possible_comma + non_empty_array_pair_list(); + if (token == TokenNameCOMMA) { + getNextToken(); + } + } + + + private void non_empty_array_pair_list() { +//non_empty_array_pair_list: +// non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr +//| non_empty_array_pair_list ',' expr +//| expr T_DOUBLE_ARROW expr +//| expr +//| non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_variable +//| non_empty_array_pair_list ',' '&' w_variable +//| expr T_DOUBLE_ARROW '&' w_variable +//| '&' w_variable + } + private void unaryExpression() { switch (token) { case TokenNamePLUS_PLUS : diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java index 83ca372..a9520dd 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java @@ -160,7 +160,7 @@ public class Scanner implements IScanner, ITerminalSymbols { public char[][] taskTags = null; public char[][] taskPriorities = null; - public static final boolean DEBUG = false; + public static final boolean DEBUG = true; public Scanner() { this(false, false); -- 1.7.1 From 7a53c30e2ecce051aec50b1bab3fd5bca5f71b5b Mon Sep 17 00:00:00 2001 From: khartlage Date: Fri, 5 Mar 2004 17:14:44 +0000 Subject: [PATCH 02/16] misc parser changes --- net.sourceforge.phpeclipse.tests/plugin.xml | 6 + .../php/test/DualParseSyntaxErrorTest.java | 25 +- .../phpeclipse/tests/parser/PHPManualTestCase.java | 345 +++++++------------- .../phpeclipse/tests/parser/PHPParserTestCase.java | 101 ++---- 4 files changed, 175 insertions(+), 302 deletions(-) diff --git a/net.sourceforge.phpeclipse.tests/plugin.xml b/net.sourceforge.phpeclipse.tests/plugin.xml index 7cbb00e..1a70b25 100644 --- a/net.sourceforge.phpeclipse.tests/plugin.xml +++ b/net.sourceforge.phpeclipse.tests/plugin.xml @@ -1,4 +1,5 @@ + + + + + + diff --git a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/phpeditor/php/test/DualParseSyntaxErrorTest.java b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/phpeditor/php/test/DualParseSyntaxErrorTest.java index 088c75a..09830f3 100644 --- a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/phpeditor/php/test/DualParseSyntaxErrorTest.java +++ b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/phpeditor/php/test/DualParseSyntaxErrorTest.java @@ -95,7 +95,16 @@ public class DualParseSyntaxErrorTest extends AbstractCompilerTest { } public void test01() { String s = - " "; + "final class test {\n" + + "\n" + + "private function f1() {\n" + + "\n" + + "}\n" + + "public function f2() {\n" + + "\n" + + " \n" + + "} \n" + + "}"; String expectedSyntaxErrorDiagnosis = ""; @@ -126,24 +135,14 @@ public class DualParseSyntaxErrorTest extends AbstractCompilerTest { public void test97() { String s = - "class class { \n"+ + "class momo { \n"+ " function &fetchRow($result, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum=null) \n"+ " { \n"+ " } \n"+ "} \n"; String expectedSyntaxErrorDiagnosis = - "----------\n" + - "1. ERROR in (at line 1)\n" + - " class class { \n" + - " ^^^^^\n" + - "Parse error \"Don\'t use keyword for class declaration [class].\"\n" + - "----------\n" + - "2. ERROR in (at line 1)\n" + - " class class { \n" + - " ^\n" + - "Parse error \"Class name expected after keyword \'class\'.\"\n" + - "----------\n"; + ""; checkParse( s.toCharArray(), diff --git a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPManualTestCase.java b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPManualTestCase.java index 6ab02e7..56d3697 100644 --- a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPManualTestCase.java +++ b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPManualTestCase.java @@ -1,215 +1,158 @@ package net.sourceforge.phpeclipse.tests.parser; -/********************************************************************** -Copyright (c) 2002 Klaus Hartlage - www.eclipseproject.de -All rights reserved. This program and the accompanying materials -are made available under the terms of the Common Public License v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/cpl-v10.html -**********************************************************************/ - +/******************************************************************************* + * Copyright (c) 2002 Klaus Hartlage - www.eclipseproject.de All rights + * reserved. This program and the accompanying materials are made available + * under the terms of the Common Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html + ******************************************************************************/ +import junit.framework.TestCase; import net.sourceforge.phpdt.internal.compiler.parser.Parser; import net.sourceforge.phpdt.internal.compiler.parser.Scanner; - -import org.eclipse.core.runtime.CoreException; -import junit.framework.TestCase; - /** - * Tests the php parser + * Tests the php parser */ public class PHPManualTestCase extends TestCase { - Parser parser; - public PHPManualTestCase(String name) { super(name); } - /** - * Test the PHP Parser with different PHP snippets + * Test the PHP Parser with different PHP snippets */ public void testPHPParser() { - checkPHP("function foo()" + "{" + " echo \"In foo()
\\n\";" + "}" + "" + "function bar($arg = '')" + "{" + " echo \"In bar(); argument was '$arg'.
\\n\";" + "}" + "" + "// This is a wrapper function around echo" + "function echoit($string)" + "{" + " echo $string;" + "}" + "" + "$func = 'foo';" + "$func(); // This calls foo()" + "" + "$func = 'bar';" + "$func('test'); // This calls bar()" + "" + "$func = 'echoit';" + "$func('test'); // This calls echoit()" + ""); - checkPHP("class Foo" + "{" + " function Vari()" + " {" + " $name = 'Bar';" + " $this->$name(); // This calls the Bar() method\n" + " }" + " " + " function Bar()" + " {" + " echo \"This is Bar\";" + " }" + "}" + "" + "$foo = new Foo();" + "$funcname = \"Var\";" + "$foo->$varname(); // This calls $foo->Var()\n" + ""); - checkPHP("function square ($num)" + "{" + " return $num * $num;" + "}" + "echo square (4); // outputs '16'." + ""); - checkPHP("function small_numbers()" + "{" + " return array (0, 1, 2);" + "}" + "list ($zero, $one, $two) = small_numbers();" + ""); - checkPHP("function &returns_reference()" + "{" + " return $someref;" + "}" + "" + "$newref =& returns_reference();" + " " + ""); - checkPHP("function add_some_extra(&$string)" + "{" + " $string .= 'and something extra.';" + "}" + "$str = 'This is a string, ';" + "add_some_extra($str);" + "echo $str; "); - checkPHP("function makecoffee ($type = \"cappuccino\")\n" + "{\n" + " return \"Making a cup of $type.\\n\";\n" + "}" + "echo makecoffee ();" + "echo makecoffee (\"espresso\");" + ""); - checkPHP("$makefoo = true;" + "" + "/* We can't call foo() from here " + " since it doesn't exist yet," + " but we can call bar() */" + "" + "bar();" + "" + "if ($makefoo) {" + " function foo ()" + " {" + " echo \"I don't exist until program execution reaches me.\\n\";" + " }" + "}" + "" + "/* Now we can safely call foo()" + " since $makefoo evaluated to true */" + "" + "if ($makefoo) foo();" + "" + "function bar() " + "{" + " echo \"I exist immediately upon program start.\\n\";" + "}" + "" + ""); - checkPHP( - "function foo() " + "{" + " function bar() " + " {" + " echo \"I don't exist until foo() is called.\\n\";" + " }" + "}" + "" + "/* We can't call bar() yet" + " since it doesn't exist. */" + "" + "foo();\n" + "" + "/* Now we can call bar()," + " foo()'s processesing has" + " made it accessable. */" + "" + "bar();" + ""); + checkPHP("function foo()" + "{" + " echo \"In foo()
\\n\";" + "}" + + "" + "function bar($arg = '')" + "{" + + " echo \"In bar(); argument was '$arg'.
\\n\";" + "}" + "" + + "// This is a wrapper function around echo" + + "function echoit($string)" + "{" + " echo $string;" + "}" + "" + + "$func = 'foo';" + "$func(); // This calls foo()" + "" + + "$func = 'bar';" + "$func('test'); // This calls bar()" + "" + + "$func = 'echoit';" + "$func('test'); // This calls echoit()" + ""); + checkPHP("class Foo" + "{" + " function Vari()" + " {" + + " $name = 'Bar';" + + " $this->$name(); // This calls the Bar() method\n" + " }" + + " " + " function Bar()" + " {" + + " echo \"This is Bar\";" + " }" + "}" + "" + + "$foo = new Foo();" + "$funcname = \"Var\";" + + "$foo->$varname(); // This calls $foo->Var()\n" + ""); + checkPHP("function square ($num)" + "{" + " return $num * $num;" + "}" + + "echo square (4); // outputs '16'." + ""); + checkPHP("function small_numbers()" + "{" + " return array (0, 1, 2);" + + "}" + "list ($zero, $one, $two) = small_numbers();" + ""); + checkPHP("function &returns_reference()" + "{" + " return $someref;" + + "}" + "" + "$newref =& returns_reference();" + " " + ""); + checkPHP("function add_some_extra(&$string)" + "{" + + " $string .= 'and something extra.';" + "}" + + "$str = 'This is a string, ';" + "add_some_extra($str);" + + "echo $str; "); + checkPHP("function makecoffee ($type = \"cappuccino\")\n" + "{\n" + + " return \"Making a cup of $type.\\n\";\n" + "}" + + "echo makecoffee ();" + "echo makecoffee (\"espresso\");" + ""); + checkPHP("$makefoo = true;" + "" + "/* We can't call foo() from here " + + " since it doesn't exist yet," + " but we can call bar() */" + "" + + "bar();" + "" + "if ($makefoo) {" + " function foo ()" + " {" + + " echo \"I don't exist until program execution reaches me.\\n\";" + + " }" + "}" + "" + "/* Now we can safely call foo()" + + " since $makefoo evaluated to true */" + "" + + "if ($makefoo) foo();" + "" + "function bar() " + "{" + + " echo \"I exist immediately upon program start.\\n\";" + "}" + "" + + ""); + checkPHP("function foo() " + "{" + " function bar() " + " {" + + " echo \"I don't exist until foo() is called.\\n\";" + " }" + "}" + + "" + "/* We can't call bar() yet" + " since it doesn't exist. */" + + "" + "foo();\n" + "" + "/* Now we can call bar()," + + " foo()'s processesing has" + " made it accessable. */" + "" + + "bar();" + ""); // Bugs item #690938 - checkPHP( - " echo \"This is a test\"; // This is a one-line c++ style comment\n" + checkPHP(" echo \"This is a test\"; // This is a one-line c++ style comment\n" + " /* This is a multi line comment\n" + " yet another line of comment */\n" + " echo \"This is yet another test\";\n" + " echo \"One Final Test\"; # This is shell-style style comment \n"); - checkPHP( - "$bool = TRUE; // a boolean\n" - + "$str = \"foo\"; // a string\n" - + "$int = 12; // an integer\n" - + "\n" - + "echo gettype($bool); // prints out \"boolean\"\n" - + "echo gettype($str); // prints out \"string\"\n" - + "" + checkPHP("$bool = TRUE; // a boolean\n" + + "$str = \"foo\"; // a string\n" + "$int = 12; // an integer\n" + + "\n" + "echo gettype($bool); // prints out \"boolean\"\n" + + "echo gettype($str); // prints out \"string\"\n" + "" + "// If this is an integer, increment it by four\n" - + "if (is_int($int)) {\n" - + " $int += 4;\n" - + "}\n" - + "\n" + + "if (is_int($int)) {\n" + " $int += 4;\n" + "}\n" + "\n" + "// If $bool is a string, print it out\n" - + "// (does not print out anything)\n" - + "if (is_string($bool)) {\n" - + " echo \"String: $bool\";\n" - + "}\n"); - + + "// (does not print out anything)\n" + "if (is_string($bool)) {\n" + + " echo \"String: $bool\";\n" + "}\n"); checkPHP("$foo = True; // assign the value TRUE to $foo"); - - checkPHP( - "// == is an operator which test\n" + checkPHP("// == is an operator which test\n" + "// equality and returns a boolean\n" + "if ($action == \"show_version\") {\n" - + " echo \"The version is 1.23\";\n" - + "}\n" - + "\n" - + "// this is not necessary...\n" - + "if ($show_separators == TRUE) {\n" - + " echo \"
\\n\";\n" - + "}\n" - + "\n" - + "// ...because you can simply type\n" - + "if ($show_separators) {\n" - + " echo \"
\\n\";\n" - + "}"); - - checkPHP( - "echo gettype((bool) \"\"); // bool(false)\n" + + " echo \"The version is 1.23\";\n" + "}\n" + "\n" + + "// this is not necessary...\n" + "if ($show_separators == TRUE) {\n" + + " echo \"
\\n\";\n" + "}\n" + "\n" + + "// ...because you can simply type\n" + "if ($show_separators) {\n" + + " echo \"
\\n\";\n" + "}"); + checkPHP("echo gettype((bool) \"\"); // bool(false)\n" + "echo gettype((bool) 1); // bool(true)\n" + "echo gettype((bool) -2); // bool(true)\n" + "echo gettype((bool) \"foo\"); // bool(true)\n" + "echo gettype((bool) 2.3e5); // bool(true)\n" + "echo gettype((bool) array(12)); // bool(true)\n" + "echo gettype((bool) array()); // bool(false)\n"); - - checkPHP( - "$a = 1234; # decimal number\n" + checkPHP("$a = 1234; # decimal number\n" + "$a = -123; # a negative number\n" + "$a = 0123; # octal number (equivalent to 83 decimal)\n" + "$a = 0x1A; # hexadecimal number (equivalent to 26 decimal)\n"); - - checkPHP( - "$large_number = 2147483647;\n" - + "var_dump($large_number);\n" - + "// output: int(2147483647)\n" - + "\n" - + "$large_number = 2147483648;\n" - + "var_dump($large_number);\n" - + "// output: float(2147483648)\n" - + "" + checkPHP("$large_number = 2147483647;\n" + "var_dump($large_number);\n" + + "// output: int(2147483647)\n" + "\n" + + "$large_number = 2147483648;\n" + "var_dump($large_number);\n" + + "// output: float(2147483648)\n" + "" + "// this goes also for hexadecimal specified integers:\n" - + "var_dump( 0x80000000 );\n" - + "// output: float(2147483648)\n" - + "\n" - + "$million = 1000000;\n" - + "$large_number = 50000 * $million;\n" - + "var_dump($large_number);\n" - + "// output: float(50000000000)\n"); - - checkPHP( - "var_dump(25/7); // float(3.5714285714286)\n" + + "var_dump( 0x80000000 );\n" + "// output: float(2147483648)\n" + "\n" + + "$million = 1000000;\n" + "$large_number = 50000 * $million;\n" + + "var_dump($large_number);\n" + "// output: float(50000000000)\n"); + checkPHP("var_dump(25/7); // float(3.5714285714286)\n" + "var_dump((int) (25/7)); // int(3)\n" + "var_dump(round(25/7)); // float(4)"); - checkPHP("echo (int) ( (0.1+0.7) * 10 ); // echoes 7!"); - checkPHP("$a = 1.234; " + "$b = 1.2e3; " + "$c = 7E-10;"); - - checkPHP( - "echo 'this is a simple string';\n" - + "\n" + checkPHP("echo 'this is a simple string';\n" + "\n" + "echo 'You can also have embedded newlines in \n" - + "strings this way as it is\n" - + "okay to do';\n" - + "\n" + + "strings this way as it is\n" + "okay to do';\n" + "\n" + "// Outputs: \"I'll be back\"\n" - + "echo 'Arnold once said: \"I\\'ll be back\"';\n" - + "\n" + + "echo 'Arnold once said: \"I\\'ll be back\"';\n" + "\n" + "// Outputs: You deleted C:\\*.*?\n" - + "echo 'You deleted C:\\\\*.*?';\n" - + "\n" + + "echo 'You deleted C:\\\\*.*?';\n" + "\n" + "// Outputs: You deleted C:\\*.*?\n" - + "echo 'You deleted C:\\\\*.*?';\n" - + "\n" + + "echo 'You deleted C:\\\\*.*?';\n" + "\n" + "// Outputs: This will not expand: \\n a newline\n" - + "echo 'This will not expand: \\n a newline';\n" - + "\n" + + "echo 'This will not expand: \\n a newline';\n" + "\n" + "// Outputs: Variables do not $expand $either\n" + "echo 'Variables do not $expand $either';\n"); - - checkPHP( - "$str = <<foo = 'Foo';\n" - + " $this->bar = array('Bar1', 'Bar2', 'Bar3');\n" - + " }\n" - + "}\n" - + "\n" - + "$foo = new foo();\n" - + "$name = 'MyName';\n" - + "\n" + checkPHP("$str = <<foo = 'Foo';\n" + + " $this->bar = array('Bar1', 'Bar2', 'Bar3');\n" + " }\n" + + "}\n" + "\n" + "$foo = new foo();\n" + "$name = 'MyName';\n" + "\n" + "echo <<foo.\n" + "Now, I am printing some {$foo->bar[1]}.\n" - + "This should print a capital 'A': \\x41\n" - + "EOT;\n"); - + + "This should print a capital 'A': \\x41\n" + "EOT;\n"); checkPHP("echo \"This works: \" . $arr['foo'][3];"); - checkPHP("echo \"\\$foo==$foo; type is \" . gettype ($foo) . \"
\\n\";"); - - checkPHP( - "$arr = array(\"foo\" => \"bar\", 12 => true);\n" - + "\n" - + "echo $arr[\"foo\"]; // bar\n" - + "echo $arr[12]; // 1\n"); - - checkPHP( - "// This array is the same as ...\n" - + "array(5 => 43, 32, 56, \"b\" => 12);\n" - + "\n" + checkPHP("$arr = array(\"foo\" => \"bar\", 12 => true);\n" + "\n" + + "echo $arr[\"foo\"]; // bar\n" + "echo $arr[12]; // 1\n"); + checkPHP("// This array is the same as ...\n" + + "array(5 => 43, 32, 56, \"b\" => 12);\n" + "\n" + "// ...this array\n" + "array(5 => 43, 6 => 32, 7 => 56, \"b\" => 12);\n"); - - checkPHP( - "$arr = array(5 => 1, 12 => 2);\n" - + "\n" + checkPHP("$arr = array(5 => 1, 12 => 2);\n" + "\n" + "$arr[] = 56; // This is the same as $arr[13] = 56;\n" - + " // at this point of the script\n" - + "\n" + + " // at this point of the script\n" + "\n" + "$arr[\"x\"] = 42; // This adds a new element to\n" + " // the array with key \"x\"\n" + " \n" - + "unset($arr[5]); // This removes the element from the array\n" - + "\n" + + "unset($arr[5]); // This removes the element from the array\n" + "\n" + "unset($arr); // This deletes the whole array\n"); - checkPHP("$foo[bar] = 'enemy';\n" + "echo $foo[bar];"); - - checkPHP( - "$a = array( 'color' => 'red',\n" + checkPHP("$a = array( 'color' => 'red',\n" + " 'taste' => 'sweet',\n" + " 'shape' => 'round',\n" + " 'name' => 'apple',\n" @@ -228,19 +171,11 @@ public class PHPManualTestCase extends TestCase { + "$b[] = 'c';\n" + "// will result in the array array(0 => 'a' , 1 => 'b' , 2 => 'c'),\n" + "// or simply array('a', 'b', 'c')\n"); - - checkPHP( - "foreach ($colors as $key => $color) {\n" - + " // won't work:\n" - + " //$color = strtoupper($color);\n" - + " \n" - + " // works:\n" - + " $colors[$key] = strtoupper($color);\n" - + "}\n" + checkPHP("foreach ($colors as $key => $color) {\n" + " // won't work:\n" + + " //$color = strtoupper($color);\n" + " \n" + " // works:\n" + + " $colors[$key] = strtoupper($color);\n" + "}\n" + "print_r($colors);\n"); - - checkPHP( - "$fruits = array ( \"fruits\" => array ( \"a\" => \"orange\",\n" + checkPHP("$fruits = array ( \"fruits\" => array ( \"a\" => \"orange\",\n" + " \"b\" => \"banana\",\n" + " \"c\" => \"apple\"\n" + " ),\n" @@ -254,79 +189,47 @@ public class PHPManualTestCase extends TestCase { + " \"holes\" => array ( \"first\",\n" + " 5 => \"second\",\n" + " \"third\"\n" - + " )\n" - + " );\n" - + "\n" - + "// Some examples to address values in the array above \n" + + " )\n" + " );\n" + + "\n" + "// Some examples to address values in the array above \n" + "echo $fruits[\"holes\"][5]; // prints \"second\"\n" + "echo $fruits[\"fruits\"][\"a\"]; // prints \"orange\"\n" - + "unset($fruits[\"holes\"][0]); // remove \"first\"\n" - + "\n" + + "unset($fruits[\"holes\"][0]); // remove \"first\"\n" + "\n" + "// Create a new multi-dimensional array\n" + "$juices[\"apple\"][\"green\"] = \"good\"; \n"); - checkPHP("$arr3 = &$arr1;"); - - checkPHP( - "class foo\n" - + "{\n" - + " function do_foo()\n" - + " {\n" - + " echo \"Doing foo.\"; \n" - + " }\n" - + "}\n" - + "\n" - + "$bar = new foo;\n" - + "$bar->do_foo();\n"); - - checkPHP( - "$obj = (object) 'ciao';\n" + - "echo $obj->scalar; // outputs 'ciao'"); - + checkPHP("class foo\n" + "{\n" + " function do_foo()\n" + " {\n" + + " echo \"Doing foo.\"; \n" + " }\n" + "}\n" + "\n" + + "$bar = new foo;\n" + "$bar->do_foo();\n"); + checkPHP("$obj = (object) 'ciao';\n" + + "echo $obj->scalar; // outputs 'ciao'"); checkPHP("$var = NULL;"); - - checkPHP("$var = \"Bob\";\n" + - "$Var = \"Joe\";\n" + - "echo \"$var, $Var\"; // outputs \"Bob, Joe\"\n" + - "\n" + - // "$4site = 'not yet'; // invalid; starts with a number\n" + - "$_4site = 'not yet'; // valid; starts with an underscore\n" + - "$täyte = 'mansikka'; \n"); - + checkPHP("$var = \"Bob\";\n" + "$Var = \"Joe\";\n" + + "echo \"$var, $Var\"; // outputs \"Bob, Joe\"\n" + "\n" + + // "$4site = 'not yet'; // invalid; starts with a number\n" + + "$_4site = 'not yet'; // valid; starts with an underscore\n" + + "$täyte = 'mansikka'; \n"); checkPHP(""); - checkPHP(""); - checkPHP(""); } - private void checkPHP(String strEval) { - try { - if (Scanner.DEBUG) { - System.out.println("\n------------------------------------"); - System.out.println(strEval); - } - parser.phpParserTester(strEval, 1); - } catch (CoreException e) { + if (Scanner.DEBUG) { + System.out.println("\n------------------------------------"); + System.out.println(strEval); } + parser.phpParserTester(strEval, 1); } - private void checkHTML(String strEval) { - try { - if (Scanner.DEBUG) { - System.out.println("\n------------------------------------"); - System.out.println(strEval); - } - parser.parse(strEval); - } catch (CoreException e) { + if (Scanner.DEBUG) { + System.out.println("\n------------------------------------"); + System.out.println(strEval); } + parser.parse(strEval); } - /** - * The JUnit setup method + * The JUnit setup method */ protected void setUp() { parser = new Parser(null); } - } diff --git a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPParserTestCase.java b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPParserTestCase.java index 1122579..f0c034a 100644 --- a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPParserTestCase.java +++ b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPParserTestCase.java @@ -1,47 +1,34 @@ package net.sourceforge.phpeclipse.tests.parser; -/********************************************************************** -Copyright (c) 2002 Klaus Hartlage - www.eclipseproject.de -All rights reserved. This program and the accompanying materials -are made available under the terms of the Common Public License v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/cpl-v10.html -**********************************************************************/ - -import junit.framework.*; -import net.sourceforge.phpdt.internal.compiler.parser.*; - -import org.eclipse.core.runtime.*; - +/******************************************************************************* + * Copyright (c) 2002 Klaus Hartlage - www.eclipseproject.de All rights + * reserved. This program and the accompanying materials are made available + * under the terms of the Common Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html + ******************************************************************************/ +import junit.framework.TestCase; +import net.sourceforge.phpdt.internal.compiler.parser.Parser; +import net.sourceforge.phpdt.internal.compiler.parser.Scanner; /** - * Tests the php parser + * Tests the php parser */ public class PHPParserTestCase extends TestCase { - Parser parser; - public PHPParserTestCase(String name) { super(name); } - /** - * Test the PHP Parser with different PHP snippets + * Test the PHP Parser with different PHP snippets */ public void testPHPParser() { - // checkPHP("if(!$result = mysql_query($sql)) return(array());"); + // checkPHP("if(!$result = mysql_query($sql)) return(array());"); checkPHP("class test { function &fetchRow($result, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum=null) \n{ \n } \n }"); - // Bugs item #690938 - checkPHP( - "$ebus_sql['sel_url_list'] = <<>\n" - + "and appl_sect_deftn_sk = <>\n" - + "order by url_ord\n" + + "and appl_sect_deftn_sk = <>\n" + "order by url_ord\n" + "EOS;\n"); - checkPHP("foreach ($HTTP_GET_VARS as $secvalue) { }"); checkPHP("\"\\\"\";"); checkPHP("\"\\[addsig]\""); @@ -79,21 +66,12 @@ public class PHPParserTestCase extends TestCase { checkPHP("class Cmd extends PEAR { var $arrSetting = array(), $i=10; }"); checkPHP("if (isset($test)) { } elseif (isset($lang)) { }"); checkPHP("require_once(\"mainfile.php\"); "); - checkPHP( - "if (eregi(\"footer.php\",$PHP_SELF)) {\n" - + "Header(\"Location: index.php\");\n" - + "die();\n" - + "}\n"); - checkPHP( - "while (eregi(\"footer.php\",$PHP_SELF)) {\n" - + "Header(\"Location: index.php\");\n" - + "die();\n" - + "}\n"); - checkPHP( - "while (eregi(\"footer.php\",$PHP_SELF)) :\n" - + "Header(\"Location: index.php\");\n" - + "die();\n" - + "endwhile;\n"); + checkPHP("if (eregi(\"footer.php\",$PHP_SELF)) {\n" + + "Header(\"Location: index.php\");\n" + "die();\n" + "}\n"); + checkPHP("while (eregi(\"footer.php\",$PHP_SELF)) {\n" + + "Header(\"Location: index.php\");\n" + "die();\n" + "}\n"); + checkPHP("while (eregi(\"footer.php\",$PHP_SELF)) :\n" + + "Header(\"Location: index.php\");\n" + "die();\n" + "endwhile;\n"); checkPHP("$tipath = \"images/topics/\";"); checkPHP("$reasons = array(\"1\", \"2\",\"test\");"); checkPHP("if ($home == 1) { message_box(); blocks(Center);}"); @@ -107,16 +85,14 @@ public class PHPParserTestCase extends TestCase { checkPHP("if (!empty($pass) AND $pass==$passwd) { }"); checkPHP("$AllowableHTML = array(\"b\"=>1,\n \"i\"=>1);"); checkPHP("if ($term{0}!=$firstChar) {}"); - checkPHP( - "echo \"
\"._NOADMINYET.\"


\"\n" + checkPHP("echo \"
\"._NOADMINYET.\"


\"\n" + ".\"
\"\n" + ".\"\"._NICKNAME.\":\"\n" + ";"); checkPHP("/* \n overLib is from Eric Bosrup (http://www.bosrup.com/web/overlib/) \n */"); checkPHP("if ($arrAtchCookie[1]==0 && $IdAtchPostId!=null){ } "); checkPHP("$arrAtchCookie[1] -= filesize(realpath($AtchTempDir).\"/\".$xattachlist)/ 1024; "); - checkPHP( - "if (!isset($message)){ \n" + checkPHP("if (!isset($message)){ \n" + "$message = $myrow[post_text];\n" + "$message = eregi_replace(\"\\[addsig]\", \"\\n-----------------\\n\" . $myrow[user_sig], $message); \n" + "$message = str_replace(\"
\", \"\\n\", $message); \n" @@ -124,7 +100,6 @@ public class PHPParserTestCase extends TestCase { checkPHP("do {$array[] = array(\"$myrow[uid]\" => \"$myrow[uname]\"); } while($myrow = mysql_fetch_array($result));"); checkPHP("$ol = new Overlib();"); checkPHP("$risultato = mysql_query($sql) or\n die(mysql_error());"); - checkHTML("\n\n\n\n "); checkHTML(""); checkHTML(""); @@ -132,34 +107,24 @@ public class PHPParserTestCase extends TestCase { checkHTML(" "); checkHTML(""); } - private void checkPHP(String strEval) { - try { - if (Scanner.DEBUG) { - System.out.println("\n------------------------------------"); - System.out.println(strEval); - } - parser.phpParserTester(strEval, 1); - } catch (CoreException e) { + if (Scanner.DEBUG) { + System.out.println("\n------------------------------------"); + System.out.println(strEval); } + parser.phpParserTester(strEval, 1); } - private void checkHTML(String strEval) { - try { - if (Scanner.DEBUG) { - System.out.println("\n------------------------------------"); - System.out.println(strEval); - } - parser.parse(strEval); - } catch (CoreException e) { + if (Scanner.DEBUG) { + System.out.println("\n------------------------------------"); + System.out.println(strEval); } + parser.parse(strEval); } - /** - * The JUnit setup method + * The JUnit setup method */ protected void setUp() { parser = new Parser(null); } - } -- 1.7.1 From 8dea0852fb960db1f239c6ea439b134addbb846c Mon Sep 17 00:00:00 2001 From: khartlage Date: Fri, 5 Mar 2004 21:11:46 +0000 Subject: [PATCH 03/16] misc parser changes --- .../sourceforge/phpdt/core/compiler/IProblem.java | 2 + .../phpdt/core/compiler/ITerminalSymbols.java | 14 +- .../phpdt/internal/compiler/parser/Parser.java | 355 +- .../phpdt/internal/compiler/parser/Scanner.java | 1425 +++--- .../internal/compiler/problem/ProblemHandler.java | 5 +- .../internal/compiler/problem/ProblemReporter.java | 5476 ++++++++++---------- .../internal/compiler/problem/messages.properties | 5 +- .../phpdt/internal/formatter/CodeFormatter.java | 2 +- 8 files changed, 3574 insertions(+), 3710 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IProblem.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IProblem.java index b6241ef..5674266 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IProblem.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/IProblem.java @@ -365,6 +365,8 @@ public interface IProblem { int ParsingErrorOnKeyword = Syntax + Internal + 209; int ParsingErrorOnKeywordNoSuggestion = Syntax + Internal + 210; int PHPParsingError = Syntax + Internal + 211; + int PHPParsingWarning = Syntax + Internal + 212; + int PHPVarDeprecatedWarning = Syntax + Internal + 213; int UnmatchedBracket = Syntax + Internal + 220; int NoFieldOnBaseType = FieldRelated + 221; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java index d9e97af..cc27c47 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java @@ -77,7 +77,7 @@ public interface ITerminalSymbols { final static int TokenNameAND_EQUAL = 60; final static int TokenNameOR_EQUAL = 61; final static int TokenNameQUESTION = 62; - final static int TokenNameCOLON_COLON = 63; + final static int TokenNamePAAMAYIM_NEKUDOTAYIM = 63; final static int TokenNameAT = 64; final static int TokenNameDOLLAR_LBRACE = 127; @@ -155,9 +155,9 @@ public interface ITerminalSymbols { // public final static int TokenNameor = 1041; // public final static int TokenNamexor = 1042; public final static int TokenNamelist = 1043; - public final static int TokenNamenull = 1044; - public final static int TokenNamefalse = 1045; - public final static int TokenNametrue = 1046; +// public final static int TokenNamenull = 1044; +// public final static int TokenNamefalse = 1045; +// public final static int TokenNametrue = 1046; public final static int TokenNamethis = 1047; // public final static int TokenNameabstract = 1050; @@ -180,4 +180,10 @@ public interface ITerminalSymbols { public final static int TokenNameuse = 1066; public final static int TokenNameisset = 1066; public final static int TokenNamefinal = 1067; + + public final static int TokenNameLINE = 1070; + public final static int TokenNameFILE = 1071; + public final static int TokenNameCLASS_C = 1072; + public final static int TokenNameMETHOD_C = 1073; + public final static int TokenNameFUNC_C = 1074; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java index 7369a24..f389faa 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java @@ -165,6 +165,12 @@ public class Parser //extends PHPParserSuperclass problemEndPosition, referenceContext, compilationUnit.compilationResult); } + private void reportSyntaxWarning(String error, int problemStartPosition, + int problemEndPosition) { + problemReporter.phpParsingWarning(new String[]{error}, + problemStartPosition, problemEndPosition, referenceContext, + compilationUnit.compilationResult); + } /** * Method Declaration. * @@ -1222,38 +1228,38 @@ public class Parser //extends PHPParserSuperclass // getNextToken(); // } // return; -// } else if (token == TokenNamedefine) { -// getNextToken(); -// if (token == TokenNameLPAREN) { -// getNextToken(); -// } else { -// throwSyntaxError("'(' expected after 'define' keyword."); -// } -// expr(); -// if (token == TokenNameCOMMA) { -// getNextToken(); -// } else { -// throwSyntaxError("',' expected after first 'define' constant."); -// } -// expr(); -// if (token == TokenNameCOMMA) { -// getNextToken(); -// expr(); -// } -// if (token == TokenNameRPAREN) { -// getNextToken(); -// } else { -// throwSyntaxError("')' expected after 'define' statement."); -// } -// if (token == TokenNameSEMICOLON) { -// getNextToken(); -// } else { -// if (token != TokenNameStopPHP) { -// throwSyntaxError("';' expected after 'define' statement."); -// } -// getNextToken(); -// } -// return; + // } else if (token == TokenNamedefine) { + // getNextToken(); + // if (token == TokenNameLPAREN) { + // getNextToken(); + // } else { + // throwSyntaxError("'(' expected after 'define' keyword."); + // } + // expr(); + // if (token == TokenNameCOMMA) { + // getNextToken(); + // } else { + // throwSyntaxError("',' expected after first 'define' constant."); + // } + // expr(); + // if (token == TokenNameCOMMA) { + // getNextToken(); + // expr(); + // } + // if (token == TokenNameRPAREN) { + // getNextToken(); + // } else { + // throwSyntaxError("')' expected after 'define' statement."); + // } + // if (token == TokenNameSEMICOLON) { + // getNextToken(); + // } else { + // if (token != TokenNameStopPHP) { + // throwSyntaxError("';' expected after 'define' statement."); + // } + // getNextToken(); + // } + // return; } else if (token == TokenNamefunction) { MethodDeclaration methodDecl = new MethodDeclaration( this.compilationUnit.compilationResult); @@ -1437,7 +1443,7 @@ public class Parser //extends PHPParserSuperclass } getNextToken(); } else { - throwSyntaxError("Keyword 'class' 'final' or 'abstract' expected"); + throwSyntaxError("Keyword 'class' 'final' or 'abstract' expected"); } } private void interface_extends_list() { @@ -1492,14 +1498,10 @@ public class Parser //extends PHPParserSuperclass private void class_statement_list() { do { class_statement(); - } while (token == TokenNamepublic || - token == TokenNameprotected || - token == TokenNameprivate || - token == TokenNamestatic || - token == TokenNameabstract || - token == TokenNamefinal || - token == TokenNamefunction || - token == TokenNamevar); + } while (token == TokenNamepublic || token == TokenNameprotected + || token == TokenNameprivate || token == TokenNamestatic + || token == TokenNameabstract || token == TokenNamefinal + || token == TokenNamefunction || token == TokenNamevar); } private void class_statement() { // class_statement: @@ -1510,12 +1512,12 @@ public class Parser //extends PHPParserSuperclass initializeModifiers(); if (token == TokenNamevar) { checkAndSetModifiers(AccPublic); - reportSyntaxError( - "Keyword 'var' is deprecated. Please use 'public' 'private' or 'protected' modifier for field declarations.", - scanner.getCurrentTokenStartPosition(), scanner - .getCurrentTokenEndPosition()); + problemReporter.phpVarDeprecatedWarning(scanner + .getCurrentTokenStartPosition(), + scanner.getCurrentTokenEndPosition(), referenceContext, + compilationUnit.compilationResult); getNextToken(); - classProperty(); + class_variable_declaration(); } else { boolean hasModifiers = member_modifiers(); if (token == TokenNamefunction) { @@ -1533,7 +1535,7 @@ public class Parser //extends PHPParserSuperclass if (!hasModifiers) { throwSyntaxError("'public' 'private' or 'protected' modifier expected for field declarations."); } - classProperty(); + class_variable_declaration(); } } // if (token == TokenNamefunction) { @@ -1618,32 +1620,34 @@ public class Parser //extends PHPParserSuperclass } return foundToken; } - private void classProperty() { - //'var' variable ';' - //'var' variable '=' constant ';' + private void class_variable_declaration() { + // class_variable_declaration: + // class_variable_declaration ',' T_VARIABLE + // | class_variable_declaration ',' T_VARIABLE '=' static_scalar + // | T_VARIABLE + // | T_VARIABLE '=' static_scalar do { if (token == TokenNameVariable) { getNextToken(); if (token == TokenNameEQUAL) { getNextToken(); - constant(); + static_scalar(); } } else { if (token == TokenNamethis) { - throwSyntaxError("Reserved word '$this' not allowed after keyword 'var'."); + throwSyntaxError("'$this' not allowed after keyword 'public' 'protected' 'private' 'var'."); } - throwSyntaxError("Variable expected after keyword 'var'."); + throwSyntaxError("Variable expected keyword 'public' 'protected' 'private' 'var'."); } if (token != TokenNameCOMMA) { break; } getNextToken(); } while (true); - if (token == TokenNameSEMICOLON) { - getNextToken(); - } else { - throwSyntaxError("';' expected after variable declaration."); + if (token != TokenNameSEMICOLON) { + throwSyntaxError("';' expected after field declaration."); } + getNextToken(); } private void functionDefinition(MethodDeclaration methodDecl) { if (astPtr == 0) { @@ -1730,7 +1734,7 @@ public class Parser //extends PHPParserSuperclass getNextToken(); if (token == TokenNameEQUAL) { getNextToken(); - constant(); + static_scalar(); } return; } @@ -2077,15 +2081,16 @@ public class Parser //extends PHPParserSuperclass getNextToken(); expr(); break; - case TokenNamenull : - getNextToken(); - break; - case TokenNamefalse : - getNextToken(); - break; - case TokenNametrue : - getNextToken(); - break; + // + // case TokenNamenull : + // getNextToken(); + // break; + // case TokenNamefalse : + // getNextToken(); + // break; + // case TokenNametrue : + // getNextToken(); + // break; case TokenNameStringConstant : getNextToken(); break; @@ -2193,7 +2198,7 @@ public class Parser //extends PHPParserSuperclass } break; case TokenNamearray : - // T_ARRAY '(' array_pair_list ')' + // T_ARRAY '(' array_pair_list ')' getNextToken(); if (token == TokenNameLPAREN) { getNextToken(); @@ -2299,7 +2304,7 @@ public class Parser //extends PHPParserSuperclass } getNextToken(); break; - case TokenNameCOLON_COLON : + case TokenNamePAAMAYIM_NEKUDOTAYIM : // :: case TokenNameMINUS_GREATER : // -> @@ -2386,28 +2391,48 @@ public class Parser //extends PHPParserSuperclass } while (while_flag); } private void array_pair_list() { -// array_pair_list: -// /* empty */ -//| non_empty_array_pair_list possible_comma + // array_pair_list: + // /* empty */ + //| non_empty_array_pair_list possible_comma non_empty_array_pair_list(); if (token == TokenNameCOMMA) { getNextToken(); } } - - private void non_empty_array_pair_list() { -//non_empty_array_pair_list: -// non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr -//| non_empty_array_pair_list ',' expr -//| expr T_DOUBLE_ARROW expr -//| expr -//| non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_variable -//| non_empty_array_pair_list ',' '&' w_variable -//| expr T_DOUBLE_ARROW '&' w_variable -//| '&' w_variable - } - + //non_empty_array_pair_list: + // non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr + //| non_empty_array_pair_list ',' expr + //| expr T_DOUBLE_ARROW expr + //| expr + //| non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_variable + //| non_empty_array_pair_list ',' '&' w_variable + //| expr T_DOUBLE_ARROW '&' w_variable + //| '&' w_variable + while (true) { + expr(); + if (token == TokenNameAND) { + getNextToken(); + variable(); + return; + } else if (token == TokenNameEQUAL_GREATER) { + getNextToken(); + if (token == TokenNameAND) { + getNextToken(); + variable(); + } else { + expr(); + } + } + if (token != TokenNameCOMMA) { + return; + } + getNextToken(); + if (token == TokenNameRPAREN) { + return; + } + } + } private void unaryExpression() { switch (token) { case TokenNamePLUS_PLUS : @@ -2706,7 +2731,7 @@ public class Parser //extends PHPParserSuperclass getNextToken(); } else if (token == TokenNameEQUAL) { getNextToken(); - constant(); + static_scalar(); } } else { throwSyntaxError("$-variable expected in variable-list."); @@ -2809,80 +2834,132 @@ public class Parser //extends PHPParserSuperclass } } } - /** - * It will look for a value (after a '=' for example) @ - */ - private void constant() { - // String ident; + private boolean common_scalar() { + // common_scalar: + // T_LNUMBER + // | T_DNUMBER + // | T_CONSTANT_ENCAPSED_STRING + // | T_LINE + // | T_FILE + // | T_CLASS_C + // | T_METHOD_C + // | T_FUNC_C switch (token) { - case TokenNamePLUS : + case TokenNameIntegerLiteral : getNextToken(); - switch (token) { - case TokenNameDoubleLiteral : - getNextToken(); - break; - case TokenNameIntegerLiteral : - getNextToken(); - break; - default : - throwSyntaxError("Constant expected after '+' presign."); - } - break; - case TokenNameMINUS : + return true; + case TokenNameDoubleLiteral : getNextToken(); - switch (token) { - case TokenNameDoubleLiteral : - getNextToken(); - break; - case TokenNameIntegerLiteral : - getNextToken(); - break; - default : - throwSyntaxError("Constant expected after '-' presign."); - } - break; - case TokenNamenull : + return true; + case TokenNameStringLiteral : getNextToken(); - break; - case TokenNamefalse : + return true; + case TokenNameStringConstant : getNextToken(); - break; - case TokenNametrue : + return true; + case TokenNameStringInterpolated : getNextToken(); - break; + return true; + case TokenNameFILE : + getNextToken(); + return true; + case TokenNameLINE : + getNextToken(); + return true; + case TokenNameCLASS_C : + getNextToken(); + return true; + case TokenNameMETHOD_C : + getNextToken(); + return true; + case TokenNameFUNC_C : + getNextToken(); + return true; + } + return false; + } + private void static_scalar() { + // static_scalar: /* compile-time evaluated scalars */ + // common_scalar + // | T_STRING + // | '+' static_scalar + // | '-' static_scalar + // | T_ARRAY '(' static_array_pair_list ')' + // | static_class_constant + if (common_scalar()) { + return; + } + switch (token) { case TokenNameIdentifier : - // ident = identifier; - char[] ident = scanner.getCurrentIdentifierSource(); getNextToken(); - if (token == TokenNameLPAREN) { + // static_class_constant: + // T_STRING T_PAAMAYIM_NEKUDOTAYIM T_STRING + if (token == TokenNamePAAMAYIM_NEKUDOTAYIM) { getNextToken(); - if (token != TokenNameRPAREN) { - expressionList(); - if (token != TokenNameRPAREN) { - throwSyntaxError("')' expected after identifier '" - + new String(ident) + "' in postfix-expression."); - } + if (token == TokenNameIdentifier) { + getNextToken(); + } else { + throwSyntaxError("Identifier expected after '::' operator."); } - getNextToken(); } break; - case TokenNameStringLiteral : + case TokenNamePLUS : getNextToken(); + static_scalar(); break; - case TokenNameStringConstant : + case TokenNameMINUS : getNextToken(); + static_scalar(); break; - case TokenNameStringInterpolated : + case TokenNamearray : getNextToken(); - break; - case TokenNameDoubleLiteral : + if (token != TokenNameLPAREN) { + throwSyntaxError("'(' expected after keyword 'array'"); + } getNextToken(); - break; - case TokenNameIntegerLiteral : + if (token == TokenNameRPAREN) { + getNextToken(); + break; + } + non_empty_static_array_pair_list(); + if (token != TokenNameRPAREN) { + throwSyntaxError("')' expected after keyword 'array'"); + } getNextToken(); break; + // case TokenNamenull : + // getNextToken(); + // break; + // case TokenNamefalse : + // getNextToken(); + // break; + // case TokenNametrue : + // getNextToken(); + // break; default : - throwSyntaxError("Constant expected."); + throwSyntaxError("Static scalar/constant expected."); + } + } + private void non_empty_static_array_pair_list() { + // non_empty_static_array_pair_list: + // non_empty_static_array_pair_list ',' static_scalar T_DOUBLE_ARROW + // static_scalar + //| non_empty_static_array_pair_list ',' static_scalar + //| static_scalar T_DOUBLE_ARROW static_scalar + //| static_scalar + while (true) { + static_scalar(); + if (token == TokenNameEQUAL_GREATER) { + getNextToken(); + static_scalar(); + } + if (token != TokenNameCOMMA) { + break; + } + getNextToken(); + if (token != TokenNameRPAREN) { + break; + } } } public void reportSyntaxError() { //int act, int currentKind, int diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java index a9520dd..bef873a 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java @@ -9,72 +9,59 @@ * IBM Corporation - initial API and implementation ******************************************************************************/ package net.sourceforge.phpdt.internal.compiler.parser; - import java.util.ArrayList; import java.util.Iterator; import java.util.List; - import net.sourceforge.phpdt.core.compiler.CharOperation; import net.sourceforge.phpdt.core.compiler.IScanner; import net.sourceforge.phpdt.core.compiler.ITerminalSymbols; import net.sourceforge.phpdt.core.compiler.InvalidInputException; import net.sourceforge.phpdt.internal.compiler.ast.StringLiteral; - public class Scanner implements IScanner, ITerminalSymbols { - /* - * APIs ares - getNextToken() which return the current type of the token (this value is not memorized by the scanner) - - * getCurrentTokenSource() which provides with the token "REAL" source (aka all unicode have been transformed into a correct - * char) - sourceStart gives the position into the stream - currentPosition-1 gives the sourceEnd position into the stream + * APIs ares - getNextToken() which return the current type of the token + * (this value is not memorized by the scanner) - getCurrentTokenSource() + * which provides with the token "REAL" source (aka all unicode have been + * transformed into a correct char) - sourceStart gives the position into the + * stream - currentPosition-1 gives the sourceEnd position into the stream */ - // 1.4 feature private boolean assertMode; public boolean useAssertAsAnIndentifier = false; //flag indicating if processed source contains occurrences of keyword assert public boolean containsAssertKeyword = false; - public boolean recordLineSeparator; public boolean phpMode = false; - public char currentCharacter; public int startPosition; public int currentPosition; public int initialPosition, eofPosition; - // after this position eof are generated instead of real token from the source - + // after this position eof are generated instead of real token from the + // source public boolean tokenizeComments; public boolean tokenizeWhiteSpace; - //source should be viewed as a window (aka a part) //of a entire very large stream public char source[]; - //unicode support public char[] withoutUnicodeBuffer; public int withoutUnicodePtr; //when == 0 ==> no unicode in the current token public boolean unicodeAsBackSlash = false; - public boolean scanningFloatLiteral = false; - //support for /** comments //public char[][] comments = new char[10][]; public int[] commentStops = new int[10]; public int[] commentStarts = new int[10]; public int commentPtr = -1; // no comment test with commentPtr value -1 - //diet parsing support - jump over some method body when requested public boolean diet = false; - //support for the poor-line-debuggers .... //remember the position of the cr/lf public int[] lineEnds = new int[250]; public int linePtr = -1; public boolean wasAcr = false; - public static final String END_OF_SOURCE = "End_Of_Source"; //$NON-NLS-1$ - public static final String INVALID_HEXA = "Invalid_Hexa_Literal"; //$NON-NLS-1$ public static final String INVALID_OCTAL = "Invalid_Octal_Literal"; //$NON-NLS-1$ public static final String INVALID_CHARACTER_CONSTANT = "Invalid_Character_Constant"; //$NON-NLS-1$ @@ -82,45 +69,31 @@ public class Scanner implements IScanner, ITerminalSymbols { public static final String INVALID_INPUT = "Invalid_Input"; //$NON-NLS-1$ public static final String INVALID_UNICODE_ESCAPE = "Invalid_Unicode_Escape"; //$NON-NLS-1$ public static final String INVALID_FLOAT = "Invalid_Float_Literal"; //$NON-NLS-1$ - public static final String NULL_SOURCE_STRING = "Null_Source_String"; //$NON-NLS-1$ public static final String UNTERMINATED_STRING = "Unterminated_String"; //$NON-NLS-1$ public static final String UNTERMINATED_COMMENT = "Unterminated_Comment"; //$NON-NLS-1$ public static final String INVALID_CHAR_IN_STRING = "Invalid_Char_In_String"; //$NON-NLS-1$ - //----------------optimized identifier managment------------------ - static final char[] charArray_a = new char[] { 'a' }, - charArray_b = new char[] { 'b' }, - charArray_c = new char[] { 'c' }, - charArray_d = new char[] { 'd' }, - charArray_e = new char[] { 'e' }, - charArray_f = new char[] { 'f' }, - charArray_g = new char[] { 'g' }, - charArray_h = new char[] { 'h' }, - charArray_i = new char[] { 'i' }, - charArray_j = new char[] { 'j' }, - charArray_k = new char[] { 'k' }, - charArray_l = new char[] { 'l' }, - charArray_m = new char[] { 'm' }, - charArray_n = new char[] { 'n' }, - charArray_o = new char[] { 'o' }, - charArray_p = new char[] { 'p' }, - charArray_q = new char[] { 'q' }, - charArray_r = new char[] { 'r' }, - charArray_s = new char[] { 's' }, - charArray_t = new char[] { 't' }, - charArray_u = new char[] { 'u' }, - charArray_v = new char[] { 'v' }, - charArray_w = new char[] { 'w' }, - charArray_x = new char[] { 'x' }, - charArray_y = new char[] { 'y' }, - charArray_z = new char[] { 'z' }; - - static final char[] initCharArray = new char[] { '\u0000', '\u0000', '\u0000', '\u0000', '\u0000', '\u0000' }; + static final char[] charArray_a = new char[]{'a'}, + charArray_b = new char[]{'b'}, charArray_c = new char[]{'c'}, + charArray_d = new char[]{'d'}, charArray_e = new char[]{'e'}, + charArray_f = new char[]{'f'}, charArray_g = new char[]{'g'}, + charArray_h = new char[]{'h'}, charArray_i = new char[]{'i'}, + charArray_j = new char[]{'j'}, charArray_k = new char[]{'k'}, + charArray_l = new char[]{'l'}, charArray_m = new char[]{'m'}, + charArray_n = new char[]{'n'}, charArray_o = new char[]{'o'}, + charArray_p = new char[]{'p'}, charArray_q = new char[]{'q'}, + charArray_r = new char[]{'r'}, charArray_s = new char[]{'s'}, + charArray_t = new char[]{'t'}, charArray_u = new char[]{'u'}, + charArray_v = new char[]{'v'}, charArray_w = new char[]{'w'}, + charArray_x = new char[]{'x'}, charArray_y = new char[]{'y'}, + charArray_z = new char[]{'z'}; + static final char[] initCharArray = new char[]{'\u0000', '\u0000', '\u0000', + '\u0000', '\u0000', '\u0000'}; static final int TableSize = 30, InternalTableSize = 6; //30*6 = 180 entries public static final int OptimizedLength = 6; - public /* static */ + public/* static */ final char[][][][] charArray_length = new char[OptimizedLength][TableSize][InternalTableSize][]; // support for detecting non-externalized string literals int currentLineNr = -1; @@ -134,8 +107,7 @@ public class Scanner implements IScanner, ITerminalSymbols { public StringLiteral[] nonNLSStrings = null; public boolean checkNonExternalizedStringLiterals = true; public boolean wasNonExternalizedStringLiteral = false; - - /* static */ { + /* static */{ for (int i = 0; i < 6; i++) { for (int j = 0; j < TableSize; j++) { for (int k = 0; k < InternalTableSize; k++) { @@ -144,13 +116,12 @@ public class Scanner implements IScanner, ITerminalSymbols { } } } - static int newEntry2 = 0, newEntry3 = 0, newEntry4 = 0, newEntry5 = 0, newEntry6 = 0; - + static int newEntry2 = 0, newEntry3 = 0, newEntry4 = 0, newEntry5 = 0, + newEntry6 = 0; public static final int RoundBracket = 0; public static final int SquareBracket = 1; public static final int CurlyBracket = 2; public static final int BracketKinds = 3; - // task tag support public char[][] foundTaskTags = null; public char[][] foundTaskMessages; @@ -159,39 +130,35 @@ public class Scanner implements IScanner, ITerminalSymbols { public int foundTaskCount = 0; public char[][] taskTags = null; public char[][] taskPriorities = null; - - public static final boolean DEBUG = true; - + public static final boolean DEBUG = false; public Scanner() { this(false, false); } public Scanner(boolean tokenizeComments, boolean tokenizeWhiteSpace) { this(tokenizeComments, tokenizeWhiteSpace, false); } - /** - * Determines if the specified character is permissible as the first character in a PHP identifier + * Determines if the specified character is permissible as the first + * character in a PHP identifier */ public static boolean isPHPIdentifierStart(char ch) { return Character.isLetter(ch) || (ch == '_') || (0x7F <= ch && ch <= 0xFF); } - /** - * Determines if the specified character may be part of a PHP identifier as other than the first character + * Determines if the specified character may be part of a PHP identifier as + * other than the first character */ public static boolean isPHPIdentifierPart(char ch) { - return Character.isLetterOrDigit(ch) || (ch == '_') || (0x7F <= ch && ch <= 0xFF); + return Character.isLetterOrDigit(ch) || (ch == '_') + || (0x7F <= ch && ch <= 0xFF); } - public final boolean atEnd() { // This code is not relevant if source is // Only a part of the real stream input - return source.length == currentPosition; } public char[] getCurrentIdentifierSource() { //return the token REAL source (aka unicodes are precomputed) - char[] result; // if (withoutUnicodePtr != 0) // //0 is used as a fast test flag so the real first char is in position 1 @@ -218,17 +185,16 @@ public class Scanner implements IScanner, ITerminalSymbols { return optimizedCurrentTokenSource6(); } //no optimization - System.arraycopy(source, startPosition, result = new char[length], 0, length); + System.arraycopy(source, startPosition, result = new char[length], 0, + length); // } return result; } public int getCurrentTokenEndPosition() { return this.currentPosition - 1; } - public final char[] getCurrentTokenSource() { // Return the token REAL source (aka unicodes are precomputed) - char[] result; // if (withoutUnicodePtr != 0) // // 0 is used as a fast test flag so the real first char is in position 1 @@ -240,14 +206,13 @@ public class Scanner implements IScanner, ITerminalSymbols { // withoutUnicodePtr); // else { int length; - System.arraycopy(source, startPosition, result = new char[length = currentPosition - startPosition], 0, length); + System.arraycopy(source, startPosition, + result = new char[length = currentPosition - startPosition], 0, length); // } return result; } - public final char[] getCurrentTokenSource(int startPos) { // Return the token REAL source (aka unicodes are precomputed) - char[] result; // if (withoutUnicodePtr != 0) // // 0 is used as a fast test flag so the real first char is in position 1 @@ -259,81 +224,79 @@ public class Scanner implements IScanner, ITerminalSymbols { // withoutUnicodePtr); // else { int length; - System.arraycopy(source, startPos, result = new char[length = currentPosition - startPos], 0, length); + System.arraycopy(source, startPos, + result = new char[length = currentPosition - startPos], 0, length); // } return result; } - public final char[] getCurrentTokenSourceString() { //return the token REAL source (aka unicodes are precomputed). //REMOVE the two " that are at the beginning and the end. - char[] result; if (withoutUnicodePtr != 0) //0 is used as a fast test flag so the real first char is in position 1 - System.arraycopy(withoutUnicodeBuffer, 2, + System.arraycopy(withoutUnicodeBuffer, 2, //2 is 1 (real start) + 1 (to jump over the ") - result = new char[withoutUnicodePtr - 2], 0, withoutUnicodePtr - 2); + result = new char[withoutUnicodePtr - 2], 0, withoutUnicodePtr - 2); else { int length; - System.arraycopy(source, startPosition + 1, result = new char[length = currentPosition - startPosition - 2], 0, length); + System.arraycopy(source, startPosition + 1, + result = new char[length = currentPosition - startPosition - 2], 0, + length); } return result; } public int getCurrentTokenStartPosition() { return this.startPosition; } - public final char[] getCurrentStringLiteralSource() { // Return the token REAL source (aka unicodes are precomputed) - char[] result; - int length; - System.arraycopy(source, startPosition + 1, result = new char[length = currentPosition - startPosition - 2], 0, length); + System.arraycopy(source, startPosition + 1, + result = new char[length = currentPosition - startPosition - 2], 0, + length); // } return result; } - /* * Search the source position corresponding to the end of a given line number * - * Line numbers are 1-based, and relative to the scanner initialPosition. Character positions are 0-based. + * Line numbers are 1-based, and relative to the scanner initialPosition. + * Character positions are 0-based. * * In case the given line number is inconsistent, answers -1. */ public final int getLineEnd(int lineNumber) { - if (lineEnds == null) return -1; if (lineNumber >= lineEnds.length) return -1; if (lineNumber <= 0) return -1; - if (lineNumber == lineEnds.length - 1) return eofPosition; return lineEnds[lineNumber - 1]; // next line start one character behind the lineEnd of the previous line } /** - * Search the source position corresponding to the beginning of a given line number + * Search the source position corresponding to the beginning of a given line + * number * - * Line numbers are 1-based, and relative to the scanner initialPosition. Character positions are 0-based. + * Line numbers are 1-based, and relative to the scanner initialPosition. + * Character positions are 0-based. * * e.g. getLineStart(1) --> 0 i.e. first line starts at character 0. * * In case the given line number is inconsistent, answers -1. */ public final int getLineStart(int lineNumber) { - if (lineEnds == null) return -1; if (lineNumber >= lineEnds.length) return -1; if (lineNumber <= 0) return -1; - if (lineNumber == 1) return initialPosition; return lineEnds[lineNumber - 2] + 1; @@ -342,14 +305,14 @@ public class Scanner implements IScanner, ITerminalSymbols { public final boolean getNextChar(char testedChar) { //BOOLEAN //handle the case of unicode. - //when a unicode appears then we must use a buffer that holds char internal values + //when a unicode appears then we must use a buffer that holds char + // internal values //At the end of this method currentCharacter holds the new visited char //and currentPosition points right next after it - //Both previous lines are true if the currentCharacter is == to the testedChar + //Both previous lines are true if the currentCharacter is == to the + // testedChar //On false, no side effect has occured. - //ALL getNextChar.... ARE OPTIMIZED COPIES - int temp = currentPosition; try { currentCharacter = source[currentPosition++]; @@ -419,14 +382,14 @@ public class Scanner implements IScanner, ITerminalSymbols { //INT 0 : testChar1 \\\\///\\\\ 1 : testedChar2 \\\\///\\\\ -1 : others //test can be done with (x==0) for the first and (x>0) for the second //handle the case of unicode. - //when a unicode appears then we must use a buffer that holds char internal values + //when a unicode appears then we must use a buffer that holds char + // internal values //At the end of this method currentCharacter holds the new visited char //and currentPosition points right next after it - //Both previous lines are true if the currentCharacter is == to the testedChar1/2 + //Both previous lines are true if the currentCharacter is == to the + // testedChar1/2 //On false, no side effect has occured. - //ALL getNextChar.... ARE OPTIMIZED COPIES - int temp = currentPosition; try { int result; @@ -488,7 +451,6 @@ public class Scanner implements IScanner, ITerminalSymbols { currentPosition = temp; return -1; } - // if (withoutUnicodePtr != 0) // withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter; return result; @@ -501,14 +463,13 @@ public class Scanner implements IScanner, ITerminalSymbols { public final boolean getNextCharAsDigit() { //BOOLEAN //handle the case of unicode. - //when a unicode appears then we must use a buffer that holds char internal values + //when a unicode appears then we must use a buffer that holds char + // internal values //At the end of this method currentCharacter holds the new visited char //and currentPosition points right next after it //Both previous lines are true if the currentCharacter is a digit //On false, no side effect has occured. - //ALL getNextChar.... ARE OPTIMIZED COPIES - int temp = currentPosition; try { currentCharacter = source[currentPosition++]; @@ -573,14 +534,14 @@ public class Scanner implements IScanner, ITerminalSymbols { public final boolean getNextCharAsDigit(int radix) { //BOOLEAN //handle the case of unicode. - //when a unicode appears then we must use a buffer that holds char internal values + //when a unicode appears then we must use a buffer that holds char + // internal values //At the end of this method currentCharacter holds the new visited char //and currentPosition points right next after it - //Both previous lines are true if the currentCharacter is a digit base on radix + //Both previous lines are true if the currentCharacter is a digit base on + // radix //On false, no side effect has occured. - //ALL getNextChar.... ARE OPTIMIZED COPIES - int temp = currentPosition; try { currentCharacter = source[currentPosition++]; @@ -645,14 +606,14 @@ public class Scanner implements IScanner, ITerminalSymbols { public boolean getNextCharAsJavaIdentifierPart() { //BOOLEAN //handle the case of unicode. - //when a unicode appears then we must use a buffer that holds char internal values + //when a unicode appears then we must use a buffer that holds char + // internal values //At the end of this method currentCharacter holds the new visited char //and currentPosition points right next after it - //Both previous lines are true if the currentCharacter is a JavaIdentifierPart + //Both previous lines are true if the currentCharacter is a + // JavaIdentifierPart //On false, no side effect has occured. - //ALL getNextChar.... ARE OPTIMIZED COPIES - int temp = currentPosition; try { currentCharacter = source[currentPosition++]; @@ -705,7 +666,6 @@ public class Scanner implements IScanner, ITerminalSymbols { currentPosition = temp; return false; } - // if (withoutUnicodePtr != 0) // withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter; return true; @@ -715,7 +675,6 @@ public class Scanner implements IScanner, ITerminalSymbols { return false; } } - public int getNextToken() throws InvalidInputException { int htmlPosition = currentPosition; try { @@ -724,18 +683,21 @@ public class Scanner implements IScanner, ITerminalSymbols { if (currentCharacter == '<') { if (getNextChar('?')) { currentCharacter = source[currentPosition++]; - if ((currentCharacter == ' ') || Character.isWhitespace(currentCharacter)) { + if ((currentCharacter == ' ') + || Character.isWhitespace(currentCharacter)) { // = 0) { @@ -744,10 +706,10 @@ public class Scanner implements IScanner, ITerminalSymbols { // eofPosition) return TokenNameEOF; - // ---------Identify the next token------------- - switch (currentCharacter) { case '(' : return TokenNameLPAREN; @@ -838,7 +796,6 @@ public class Scanner implements IScanner, ITerminalSymbols { return TokenNameSEMICOLON; case ',' : return TokenNameCOMMA; - case '.' : if (getNextCharAsDigit()) return scanNumber(true); @@ -861,7 +818,6 @@ public class Scanner implements IScanner, ITerminalSymbols { return TokenNameMINUS_EQUAL; if (getNextChar('>')) return TokenNameMINUS_GREATER; - return TokenNameMINUS; } case '~' : @@ -904,9 +860,7 @@ public class Scanner implements IScanner, ITerminalSymbols { while (isPHPIdentifierPart(currentCharacter)) { currentCharacter = source[currentPosition++]; } - heredocLength = currentPosition - heredocStart - 1; - // heredoc end-tag determination boolean endTag = true; char ch; @@ -919,7 +873,8 @@ public class Scanner implements IScanner, ITerminalSymbols { currentLine = null; } for (int i = 0; i < heredocLength; i++) { - if (source[currentPosition + i] != source[heredocStart + i]) { + if (source[currentPosition + i] != source[heredocStart + + i]) { endTag = false; break; } @@ -932,9 +887,7 @@ public class Scanner implements IScanner, ITerminalSymbols { endTag = true; } } - } while (true); - return TokenNameHEREDOC; } return TokenNameLEFT_SHIFT; @@ -993,84 +946,87 @@ public class Scanner implements IScanner, ITerminalSymbols { return TokenNameQUESTION; case ':' : if (getNextChar(':')) - return TokenNameCOLON_COLON; + return TokenNamePAAMAYIM_NEKUDOTAYIM; return TokenNameCOLON; case '@' : return TokenNameAT; - // case '\'' : - // { - // int test; - // if ((test = getNextChar('\n', '\r')) == 0) { - // throw new InvalidInputException(INVALID_CHARACTER_CONSTANT); - // } - // if (test > 0) { - // // relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed - // for (int lookAhead = 0; - // lookAhead < 3; - // lookAhead++) { - // if (currentPosition + lookAhead - // == source.length) - // break; - // if (source[currentPosition + lookAhead] - // == '\n') - // break; - // if (source[currentPosition + lookAhead] - // == '\'') { - // currentPosition += lookAhead + 1; - // break; - // } - // } - // throw new InvalidInputException(INVALID_CHARACTER_CONSTANT); - // } - // } - // if (getNextChar('\'')) { - // // relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed - // for (int lookAhead = 0; - // lookAhead < 3; - // lookAhead++) { - // if (currentPosition + lookAhead - // == source.length) - // break; - // if (source[currentPosition + lookAhead] - // == '\n') - // break; - // if (source[currentPosition + lookAhead] - // == '\'') { - // currentPosition += lookAhead + 1; - // break; - // } - // } - // throw new InvalidInputException(INVALID_CHARACTER_CONSTANT); - // } - // if (getNextChar('\\')) - // scanEscapeCharacter(); - // else { // consume next character - // unicodeAsBackSlash = false; - // if (((currentCharacter = source[currentPosition++]) - // == '\\') - // && (source[currentPosition] == 'u')) { - // getNextUnicodeChar(); - // } else { - // if (withoutUnicodePtr != 0) { - // withoutUnicodeBuffer[++withoutUnicodePtr] = - // currentCharacter; - // } - // } - // } - // // if (getNextChar('\'')) - // // return TokenNameCharacterLiteral; - // // relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed - // for (int lookAhead = 0; lookAhead < 20; lookAhead++) { - // if (currentPosition + lookAhead == source.length) - // break; - // if (source[currentPosition + lookAhead] == '\n') - // break; - // if (source[currentPosition + lookAhead] == '\'') { - // currentPosition += lookAhead + 1; - // break; - // } - // } - // throw new InvalidInputException(INVALID_CHARACTER_CONSTANT); + // case '\'' : + // { + // int test; + // if ((test = getNextChar('\n', '\r')) == 0) { + // throw new InvalidInputException(INVALID_CHARACTER_CONSTANT); + // } + // if (test > 0) { + // // relocate if finding another quote fairly close: thus unicode + // '/u000D' will be fully consumed + // for (int lookAhead = 0; + // lookAhead < 3; + // lookAhead++) { + // if (currentPosition + lookAhead + // == source.length) + // break; + // if (source[currentPosition + lookAhead] + // == '\n') + // break; + // if (source[currentPosition + lookAhead] + // == '\'') { + // currentPosition += lookAhead + 1; + // break; + // } + // } + // throw new InvalidInputException(INVALID_CHARACTER_CONSTANT); + // } + // } + // if (getNextChar('\'')) { + // // relocate if finding another quote fairly close: thus unicode + // '/u000D' will be fully consumed + // for (int lookAhead = 0; + // lookAhead < 3; + // lookAhead++) { + // if (currentPosition + lookAhead + // == source.length) + // break; + // if (source[currentPosition + lookAhead] + // == '\n') + // break; + // if (source[currentPosition + lookAhead] + // == '\'') { + // currentPosition += lookAhead + 1; + // break; + // } + // } + // throw new InvalidInputException(INVALID_CHARACTER_CONSTANT); + // } + // if (getNextChar('\\')) + // scanEscapeCharacter(); + // else { // consume next character + // unicodeAsBackSlash = false; + // if (((currentCharacter = source[currentPosition++]) + // == '\\') + // && (source[currentPosition] == 'u')) { + // getNextUnicodeChar(); + // } else { + // if (withoutUnicodePtr != 0) { + // withoutUnicodeBuffer[++withoutUnicodePtr] = + // currentCharacter; + // } + // } + // } + // // if (getNextChar('\'')) + // // return TokenNameCharacterLiteral; + // // relocate if finding another quote fairly close: thus unicode + // '/u000D' will be fully consumed + // for (int lookAhead = 0; lookAhead < 20; lookAhead++) { + // if (currentPosition + lookAhead == source.length) + // break; + // if (source[currentPosition + lookAhead] == '\n') + // break; + // if (source[currentPosition + lookAhead] == '\'') { + // currentPosition += lookAhead + 1; + // break; + // } + // } + // throw new InvalidInputException(INVALID_CHARACTER_CONSTANT); case '\'' : try { // consume next character @@ -1085,13 +1041,12 @@ public class Scanner implements IScanner, ITerminalSymbols { // currentCharacter; // } // } - while (currentCharacter != '\'') { - /** ** in PHP \r and \n are valid in string literals *** */ // if ((currentCharacter == '\n') // || (currentCharacter == '\r')) { - // // relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed + // // relocate if finding another quote fairly close: thus + // unicode '/u000D' will be fully consumed // for (int lookAhead = 0; lookAhead < 50; lookAhead++) { // if (currentPosition + lookAhead == source.length) // break; @@ -1107,17 +1062,22 @@ public class Scanner implements IScanner, ITerminalSymbols { if (currentCharacter == '\\') { int escapeSize = currentPosition; boolean backSlashAsUnicodeInString = unicodeAsBackSlash; - //scanEscapeCharacter make a side effect on this value and we need the previous value few lines down this one + //scanEscapeCharacter make a side effect on this value and + // we need the previous value few lines down this one scanSingleQuotedEscapeCharacter(); escapeSize = currentPosition - escapeSize; if (withoutUnicodePtr == 0) { //buffer all the entries that have been left aside.... - withoutUnicodePtr = currentPosition - escapeSize - 1 - startPosition; - System.arraycopy(source, startPosition, withoutUnicodeBuffer, 1, withoutUnicodePtr); + withoutUnicodePtr = currentPosition - escapeSize - 1 + - startPosition; + System.arraycopy(source, startPosition, + withoutUnicodeBuffer, 1, withoutUnicodePtr); withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter; } else { //overwrite the / in the buffer withoutUnicodeBuffer[withoutUnicodePtr] = currentCharacter; - if (backSlashAsUnicodeInString) { //there are TWO \ in the stream where only one is correct + if (backSlashAsUnicodeInString) { //there are TWO \ in + // the stream where + // only one is correct withoutUnicodePtr--; } } @@ -1125,7 +1085,8 @@ public class Scanner implements IScanner, ITerminalSymbols { // consume next character unicodeAsBackSlash = false; currentCharacter = source[currentPosition++]; - // if (((currentCharacter = source[currentPosition++]) == '\\') + // if (((currentCharacter = source[currentPosition++]) == + // '\\') // && (source[currentPosition] == 'u')) { // getNextUnicodeChar(); // } else { @@ -1133,13 +1094,13 @@ public class Scanner implements IScanner, ITerminalSymbols { withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter; } // } - } } catch (IndexOutOfBoundsException e) { throw new InvalidInputException(UNTERMINATED_STRING); } catch (InvalidInputException e) { if (e.getMessage().equals(INVALID_ESCAPE)) { - // relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed + // relocate if finding another quote fairly close: thus + // unicode '/u000D' will be fully consumed for (int lookAhead = 0; lookAhead < 50; lookAhead++) { if (currentPosition + lookAhead == source.length) break; @@ -1150,16 +1111,20 @@ public class Scanner implements IScanner, ITerminalSymbols { break; } } - } throw e; // rethrow } - if (checkNonExternalizedStringLiterals) { // check for presence of NLS tags //$NON-NLS-?$ where ? is an int. + if (checkNonExternalizedStringLiterals) { // check for presence + // of NLS tags + // //$NON-NLS-?$ where + // ? is an int. if (currentLine == null) { currentLine = new NLSLine(); lines.add(currentLine); } - currentLine.add(new StringLiteral(getCurrentTokenSourceString(), startPosition, currentPosition - 1)); + currentLine.add(new StringLiteral( + getCurrentTokenSourceString(), startPosition, + currentPosition - 1)); } return TokenNameStringConstant; case '"' : @@ -1176,13 +1141,12 @@ public class Scanner implements IScanner, ITerminalSymbols { // currentCharacter; // } // } - while (currentCharacter != '"') { - /** ** in PHP \r and \n are valid in string literals *** */ // if ((currentCharacter == '\n') // || (currentCharacter == '\r')) { - // // relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed + // // relocate if finding another quote fairly close: thus + // unicode '/u000D' will be fully consumed // for (int lookAhead = 0; lookAhead < 50; lookAhead++) { // if (currentPosition + lookAhead == source.length) // break; @@ -1198,17 +1162,22 @@ public class Scanner implements IScanner, ITerminalSymbols { if (currentCharacter == '\\') { int escapeSize = currentPosition; boolean backSlashAsUnicodeInString = unicodeAsBackSlash; - //scanEscapeCharacter make a side effect on this value and we need the previous value few lines down this one + //scanEscapeCharacter make a side effect on this value and + // we need the previous value few lines down this one scanDoubleQuotedEscapeCharacter(); escapeSize = currentPosition - escapeSize; if (withoutUnicodePtr == 0) { //buffer all the entries that have been left aside.... - withoutUnicodePtr = currentPosition - escapeSize - 1 - startPosition; - System.arraycopy(source, startPosition, withoutUnicodeBuffer, 1, withoutUnicodePtr); + withoutUnicodePtr = currentPosition - escapeSize - 1 + - startPosition; + System.arraycopy(source, startPosition, + withoutUnicodeBuffer, 1, withoutUnicodePtr); withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter; } else { //overwrite the / in the buffer withoutUnicodeBuffer[withoutUnicodePtr] = currentCharacter; - if (backSlashAsUnicodeInString) { //there are TWO \ in the stream where only one is correct + if (backSlashAsUnicodeInString) { //there are TWO \ in + // the stream where + // only one is correct withoutUnicodePtr--; } } @@ -1216,7 +1185,8 @@ public class Scanner implements IScanner, ITerminalSymbols { // consume next character unicodeAsBackSlash = false; currentCharacter = source[currentPosition++]; - // if (((currentCharacter = source[currentPosition++]) == '\\') + // if (((currentCharacter = source[currentPosition++]) == + // '\\') // && (source[currentPosition] == 'u')) { // getNextUnicodeChar(); // } else { @@ -1224,13 +1194,13 @@ public class Scanner implements IScanner, ITerminalSymbols { withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter; } // } - } } catch (IndexOutOfBoundsException e) { throw new InvalidInputException(UNTERMINATED_STRING); } catch (InvalidInputException e) { if (e.getMessage().equals(INVALID_ESCAPE)) { - // relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed + // relocate if finding another quote fairly close: thus + // unicode '/u000D' will be fully consumed for (int lookAhead = 0; lookAhead < 50; lookAhead++) { if (currentPosition + lookAhead == source.length) break; @@ -1241,16 +1211,20 @@ public class Scanner implements IScanner, ITerminalSymbols { break; } } - } throw e; // rethrow } - if (checkNonExternalizedStringLiterals) { // check for presence of NLS tags //$NON-NLS-?$ where ? is an int. + if (checkNonExternalizedStringLiterals) { // check for presence + // of NLS tags + // //$NON-NLS-?$ where + // ? is an int. if (currentLine == null) { currentLine = new NLSLine(); lines.add(currentLine); } - currentLine.add(new StringLiteral(getCurrentTokenSourceString(), startPosition, currentPosition - 1)); + currentLine.add(new StringLiteral( + getCurrentTokenSourceString(), startPosition, + currentPosition - 1)); } return TokenNameStringLiteral; case '`' : @@ -1267,13 +1241,12 @@ public class Scanner implements IScanner, ITerminalSymbols { // currentCharacter; // } // } - while (currentCharacter != '`') { - /** ** in PHP \r and \n are valid in string literals *** */ // if ((currentCharacter == '\n') // || (currentCharacter == '\r')) { - // // relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed + // // relocate if finding another quote fairly close: thus + // unicode '/u000D' will be fully consumed // for (int lookAhead = 0; lookAhead < 50; lookAhead++) { // if (currentPosition + lookAhead == source.length) // break; @@ -1289,17 +1262,22 @@ public class Scanner implements IScanner, ITerminalSymbols { if (currentCharacter == '\\') { int escapeSize = currentPosition; boolean backSlashAsUnicodeInString = unicodeAsBackSlash; - //scanEscapeCharacter make a side effect on this value and we need the previous value few lines down this one + //scanEscapeCharacter make a side effect on this value and + // we need the previous value few lines down this one scanDoubleQuotedEscapeCharacter(); escapeSize = currentPosition - escapeSize; if (withoutUnicodePtr == 0) { //buffer all the entries that have been left aside.... - withoutUnicodePtr = currentPosition - escapeSize - 1 - startPosition; - System.arraycopy(source, startPosition, withoutUnicodeBuffer, 1, withoutUnicodePtr); + withoutUnicodePtr = currentPosition - escapeSize - 1 + - startPosition; + System.arraycopy(source, startPosition, + withoutUnicodeBuffer, 1, withoutUnicodePtr); withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter; } else { //overwrite the / in the buffer withoutUnicodeBuffer[withoutUnicodePtr] = currentCharacter; - if (backSlashAsUnicodeInString) { //there are TWO \ in the stream where only one is correct + if (backSlashAsUnicodeInString) { //there are TWO \ in + // the stream where + // only one is correct withoutUnicodePtr--; } } @@ -1307,7 +1285,8 @@ public class Scanner implements IScanner, ITerminalSymbols { // consume next character unicodeAsBackSlash = false; currentCharacter = source[currentPosition++]; - // if (((currentCharacter = source[currentPosition++]) == '\\') + // if (((currentCharacter = source[currentPosition++]) == + // '\\') // && (source[currentPosition] == 'u')) { // getNextUnicodeChar(); // } else { @@ -1315,13 +1294,13 @@ public class Scanner implements IScanner, ITerminalSymbols { withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter; } // } - } } catch (IndexOutOfBoundsException e) { throw new InvalidInputException(UNTERMINATED_STRING); } catch (InvalidInputException e) { if (e.getMessage().equals(INVALID_ESCAPE)) { - // relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed + // relocate if finding another quote fairly close: thus + // unicode '/u000D' will be fully consumed for (int lookAhead = 0; lookAhead < 50; lookAhead++) { if (currentPosition + lookAhead == source.length) break; @@ -1332,23 +1311,28 @@ public class Scanner implements IScanner, ITerminalSymbols { break; } } - } throw e; // rethrow } - if (checkNonExternalizedStringLiterals) { // check for presence of NLS tags //$NON-NLS-?$ where ? is an int. + if (checkNonExternalizedStringLiterals) { // check for presence + // of NLS tags + // //$NON-NLS-?$ where + // ? is an int. if (currentLine == null) { currentLine = new NLSLine(); lines.add(currentLine); } - currentLine.add(new StringLiteral(getCurrentTokenSourceString(), startPosition, currentPosition - 1)); + currentLine.add(new StringLiteral( + getCurrentTokenSourceString(), startPosition, + currentPosition - 1)); } return TokenNameStringInterpolated; case '#' : case '/' : { int test; - if ((currentCharacter == '#') || (test = getNextChar('/', '*')) == 0) { + if ((currentCharacter == '#') + || (test = getNextChar('/', '*')) == 0) { //line comment int endPositionForLineComment = 0; try { //get the next char @@ -1384,7 +1368,6 @@ public class Scanner implements IScanner, ITerminalSymbols { // (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4); // } // } - //handle the \\u case manually into comment // if (currentCharacter == '\\') { // if (source[currentPosition] == '\\') @@ -1399,7 +1382,6 @@ public class Scanner implements IScanner, ITerminalSymbols { return TokenNameStopPHP; } } - //get the next char isUnicode = false; currentCharacter = source[currentPosition++]; @@ -1432,7 +1414,8 @@ public class Scanner implements IScanner, ITerminalSymbols { // source[currentPosition++])) // > 15 // || c4 < 0) { - // throw new InvalidInputException(INVALID_UNICODE_ESCAPE); + // throw new + // InvalidInputException(INVALID_UNICODE_ESCAPE); // } else { // currentCharacter = // (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4); @@ -1450,7 +1433,8 @@ public class Scanner implements IScanner, ITerminalSymbols { endPositionForLineComment = currentPosition - 1; } recordComment(false); - if ((currentCharacter == '\r') || (currentCharacter == '\n')) { + if ((currentCharacter == '\r') + || (currentCharacter == '\n')) { checkNonExternalizeString(); if (recordLineSeparator) { if (isUnicode) { @@ -1469,7 +1453,8 @@ public class Scanner implements IScanner, ITerminalSymbols { } return TokenNameCOMMENT_LINE; } - } catch (IndexOutOfBoundsException e) { //an eof will them be generated + } catch (IndexOutOfBoundsException e) { //an eof will them + // be generated if (tokenizeComments) { currentPosition--; // reset one character behind @@ -1484,7 +1469,8 @@ public class Scanner implements IScanner, ITerminalSymbols { // consume next character unicodeAsBackSlash = false; currentCharacter = source[currentPosition++]; - // if (((currentCharacter = source[currentPosition++]) == '\\') + // if (((currentCharacter = source[currentPosition++]) == + // '\\') // && (source[currentPosition] == 'u')) { // getNextUnicodeChar(); // } else { @@ -1493,7 +1479,6 @@ public class Scanner implements IScanner, ITerminalSymbols { // currentCharacter; // } // } - if (currentCharacter == '*') { isJavadoc = true; star = true; @@ -1526,7 +1511,8 @@ public class Scanner implements IScanner, ITerminalSymbols { } //loop until end of comment */ while ((currentCharacter != '/') || (!star)) { - if ((currentCharacter == '\r') || (currentCharacter == '\n')) { + if ((currentCharacter == '\r') + || (currentCharacter == '\n')) { checkNonExternalizeString(); if (recordLineSeparator) { pushLineSeparator(); @@ -1567,9 +1553,9 @@ public class Scanner implements IScanner, ITerminalSymbols { case '\u001a' : if (atEnd()) return TokenNameEOF; - //the atEnd may not be if source is only some part of a real (external) stream + //the atEnd may not be if + // source is only some part of a real (external) stream throw new InvalidInputException("Ctrl-Z"); //$NON-NLS-1$ - default : if (currentCharacter == '$') { while ((currentCharacter = source[currentPosition++]) == '$') { @@ -1593,12 +1579,12 @@ public class Scanner implements IScanner, ITerminalSymbols { } return TokenNameEOF; } - // public final void getNextUnicodeChar() // throws IndexOutOfBoundsException, InvalidInputException { // //VOID // //handle the case of unicode. - // //when a unicode appears then we must use a buffer that holds char internal values + // //when a unicode appears then we must use a buffer that holds char + // internal values // //At the end of this method currentCharacter holds the new visited char // //and currentPosition points right next after it // @@ -1639,10 +1625,10 @@ public class Scanner implements IScanner, ITerminalSymbols { // unicodeAsBackSlash = currentCharacter == '\\'; // } /* - * Tokenize a method body, assuming that curly brackets are properly balanced. + * Tokenize a method body, assuming that curly brackets are properly + * balanced. */ public final void jumpOverMethodBody() { - this.wasAcr = false; int found = 1; try { @@ -1656,12 +1642,12 @@ public class Scanner implements IScanner, ITerminalSymbols { // && (source[currentPosition] == 'u')) { // isWhiteSpace = jumpOverUnicodeWhiteSpace(); // } else { - if (recordLineSeparator && ((currentCharacter == '\r') || (currentCharacter == '\n'))) + if (recordLineSeparator + && ((currentCharacter == '\r') || (currentCharacter == '\n'))) pushLineSeparator(); isWhiteSpace = Character.isWhitespace(currentCharacter); // } } while (isWhiteSpace); - // -------consume token until } is found--------- switch (currentCharacter) { case '{' : @@ -1757,7 +1743,8 @@ public class Scanner implements IScanner, ITerminalSymbols { try { //get the next char currentCharacter = source[currentPosition++]; - // if (((currentCharacter = source[currentPosition++]) == '\\') + // if (((currentCharacter = source[currentPosition++]) == + // '\\') // && (source[currentPosition] == 'u')) { // //-------------unicode traitement ------------ // int c1 = 0, c2 = 0, c3 = 0, c4 = 0; @@ -1789,7 +1776,6 @@ public class Scanner implements IScanner, ITerminalSymbols { // (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4); // } // } - while (currentCharacter != '\r' && currentCharacter != '\n') { //get the next char currentCharacter = source[currentPosition++]; @@ -1827,7 +1813,8 @@ public class Scanner implements IScanner, ITerminalSymbols { // } // } } - if (recordLineSeparator && ((currentCharacter == '\r') || (currentCharacter == '\n'))) + if (recordLineSeparator + && ((currentCharacter == '\r') || (currentCharacter == '\n'))) pushLineSeparator(); } catch (IndexOutOfBoundsException e) { } //an eof will them be generated @@ -1852,11 +1839,13 @@ public class Scanner implements IScanner, ITerminalSymbols { if (currentCharacter == '*') { star = true; } - if (recordLineSeparator && ((currentCharacter == '\r') || (currentCharacter == '\n'))) + if (recordLineSeparator + && ((currentCharacter == '\r') || (currentCharacter == '\n'))) pushLineSeparator(); try { //get the next char currentCharacter = source[currentPosition++]; - // if (((currentCharacter = source[currentPosition++]) == '\\') + // if (((currentCharacter = source[currentPosition++]) == + // '\\') // && (source[currentPosition] == 'u')) { // //-------------unicode traitement ------------ // int c1 = 0, c2 = 0, c3 = 0, c4 = 0; @@ -1890,7 +1879,8 @@ public class Scanner implements IScanner, ITerminalSymbols { // } //loop until end of comment */ while ((currentCharacter != '/') || (!star)) { - if (recordLineSeparator && ((currentCharacter == '\r') || (currentCharacter == '\n'))) + if (recordLineSeparator + && ((currentCharacter == '\r') || (currentCharacter == '\n'))) pushLineSeparator(); star = currentCharacter == '*'; //get next char @@ -1936,9 +1926,9 @@ public class Scanner implements IScanner, ITerminalSymbols { } break; } - default : - if (isPHPIdentifierStart(currentCharacter) || currentCharacter == '$') { + if (isPHPIdentifierStart(currentCharacter) + || currentCharacter == '$') { try { scanIdentifierOrKeyword((currentCharacter == '$')); } catch (InvalidInputException ex) { @@ -2006,18 +1996,15 @@ public class Scanner implements IScanner, ITerminalSymbols { // } public final int[] getLineEnds() { //return a bounded copy of this.lineEnds - int[] copy; System.arraycopy(lineEnds, 0, copy = new int[linePtr + 1], 0, linePtr + 1); return copy; } - public char[] getSource() { return this.source; } final char[] optimizedCurrentTokenSource1() { //return always the same char[] build only once - //optimization at no speed cost of 99.5 % of the singleCharIdentifier char charOne = source[startPosition]; switch (charOne) { @@ -2074,15 +2061,14 @@ public class Scanner implements IScanner, ITerminalSymbols { case 'z' : return charArray_z; default : - return new char[] { charOne }; + return new char[]{charOne}; } } - final char[] optimizedCurrentTokenSource2() { //try to return the same char[] build only once - char c0, c1; - int hash = (((c0 = source[startPosition]) << 6) + (c1 = source[startPosition + 1])) % TableSize; + int hash = (((c0 = source[startPosition]) << 6) + (c1 = source[startPosition + 1])) + % TableSize; char[][] table = charArray_length[0][hash]; int i = newEntry2; while (++i < InternalTableSize) { @@ -2102,17 +2088,15 @@ public class Scanner implements IScanner, ITerminalSymbols { if (++max >= InternalTableSize) max = 0; char[] r; - table[max] = (r = new char[] { c0, c1 }); + table[max] = (r = new char[]{c0, c1}); newEntry2 = max; return r; } - final char[] optimizedCurrentTokenSource3() { //try to return the same char[] build only once - char c0, c1, c2; - int hash = - (((c0 = source[startPosition]) << 12) + ((c1 = source[startPosition + 1]) << 6) + (c2 = source[startPosition + 2])) + int hash = (((c0 = source[startPosition]) << 12) + + ((c1 = source[startPosition + 1]) << 6) + (c2 = source[startPosition + 2])) % TableSize; char[][] table = charArray_length[1][hash]; int i = newEntry3; @@ -2133,26 +2117,23 @@ public class Scanner implements IScanner, ITerminalSymbols { if (++max >= InternalTableSize) max = 0; char[] r; - table[max] = (r = new char[] { c0, c1, c2 }); + table[max] = (r = new char[]{c0, c1, c2}); newEntry3 = max; return r; } - final char[] optimizedCurrentTokenSource4() { //try to return the same char[] build only once - char c0, c1, c2, c3; - long hash = - ((((long) (c0 = source[startPosition])) << 18) + long hash = ((((long) (c0 = source[startPosition])) << 18) + ((c1 = source[startPosition + 1]) << 12) - + ((c2 = source[startPosition + 2]) << 6) - + (c3 = source[startPosition + 3])) + + ((c2 = source[startPosition + 2]) << 6) + (c3 = source[startPosition + 3])) % TableSize; char[][] table = charArray_length[2][(int) hash]; int i = newEntry4; while (++i < InternalTableSize) { char[] charArray = table[i]; - if ((c0 == charArray[0]) && (c1 == charArray[1]) && (c2 == charArray[2]) && (c3 == charArray[3])) + if ((c0 == charArray[0]) && (c1 == charArray[1]) && (c2 == charArray[2]) + && (c3 == charArray[3])) return charArray; } //---------other side--------- @@ -2160,35 +2141,32 @@ public class Scanner implements IScanner, ITerminalSymbols { int max = newEntry4; while (++i <= max) { char[] charArray = table[i]; - if ((c0 == charArray[0]) && (c1 == charArray[1]) && (c2 == charArray[2]) && (c3 == charArray[3])) + if ((c0 == charArray[0]) && (c1 == charArray[1]) && (c2 == charArray[2]) + && (c3 == charArray[3])) return charArray; } //--------add the entry------- if (++max >= InternalTableSize) max = 0; char[] r; - table[max] = (r = new char[] { c0, c1, c2, c3 }); + table[max] = (r = new char[]{c0, c1, c2, c3}); newEntry4 = max; return r; - } - final char[] optimizedCurrentTokenSource5() { //try to return the same char[] build only once - char c0, c1, c2, c3, c4; - long hash = - ((((long) (c0 = source[startPosition])) << 24) + long hash = ((((long) (c0 = source[startPosition])) << 24) + (((long) (c1 = source[startPosition + 1])) << 18) + ((c2 = source[startPosition + 2]) << 12) - + ((c3 = source[startPosition + 3]) << 6) - + (c4 = source[startPosition + 4])) + + ((c3 = source[startPosition + 3]) << 6) + (c4 = source[startPosition + 4])) % TableSize; char[][] table = charArray_length[3][(int) hash]; int i = newEntry5; while (++i < InternalTableSize) { char[] charArray = table[i]; - if ((c0 == charArray[0]) && (c1 == charArray[1]) && (c2 == charArray[2]) && (c3 == charArray[3]) && (c4 == charArray[4])) + if ((c0 == charArray[0]) && (c1 == charArray[1]) && (c2 == charArray[2]) + && (c3 == charArray[3]) && (c4 == charArray[4])) return charArray; } //---------other side--------- @@ -2196,41 +2174,34 @@ public class Scanner implements IScanner, ITerminalSymbols { int max = newEntry5; while (++i <= max) { char[] charArray = table[i]; - if ((c0 == charArray[0]) && (c1 == charArray[1]) && (c2 == charArray[2]) && (c3 == charArray[3]) && (c4 == charArray[4])) + if ((c0 == charArray[0]) && (c1 == charArray[1]) && (c2 == charArray[2]) + && (c3 == charArray[3]) && (c4 == charArray[4])) return charArray; } //--------add the entry------- if (++max >= InternalTableSize) max = 0; char[] r; - table[max] = (r = new char[] { c0, c1, c2, c3, c4 }); + table[max] = (r = new char[]{c0, c1, c2, c3, c4}); newEntry5 = max; return r; - } - final char[] optimizedCurrentTokenSource6() { //try to return the same char[] build only once - char c0, c1, c2, c3, c4, c5; - long hash = - ((((long) (c0 = source[startPosition])) << 32) + long hash = ((((long) (c0 = source[startPosition])) << 32) + (((long) (c1 = source[startPosition + 1])) << 24) + (((long) (c2 = source[startPosition + 2])) << 18) + ((c3 = source[startPosition + 3]) << 12) - + ((c4 = source[startPosition + 4]) << 6) - + (c5 = source[startPosition + 5])) + + ((c4 = source[startPosition + 4]) << 6) + (c5 = source[startPosition + 5])) % TableSize; char[][] table = charArray_length[4][(int) hash]; int i = newEntry6; while (++i < InternalTableSize) { char[] charArray = table[i]; - if ((c0 == charArray[0]) - && (c1 == charArray[1]) - && (c2 == charArray[2]) - && (c3 == charArray[3]) - && (c4 == charArray[4]) - && (c5 == charArray[5])) + if ((c0 == charArray[0]) && (c1 == charArray[1]) && (c2 == charArray[2]) + && (c3 == charArray[3]) && (c4 == charArray[4]) + && (c5 == charArray[5])) return charArray; } //---------other side--------- @@ -2238,33 +2209,27 @@ public class Scanner implements IScanner, ITerminalSymbols { int max = newEntry6; while (++i <= max) { char[] charArray = table[i]; - if ((c0 == charArray[0]) - && (c1 == charArray[1]) - && (c2 == charArray[2]) - && (c3 == charArray[3]) - && (c4 == charArray[4]) - && (c5 == charArray[5])) + if ((c0 == charArray[0]) && (c1 == charArray[1]) && (c2 == charArray[2]) + && (c3 == charArray[3]) && (c4 == charArray[4]) + && (c5 == charArray[5])) return charArray; } //--------add the entry------- if (++max >= InternalTableSize) max = 0; char[] r; - table[max] = (r = new char[] { c0, c1, c2, c3, c4, c5 }); + table[max] = (r = new char[]{c0, c1, c2, c3, c4, c5}); newEntry6 = max; return r; } - public final void pushLineSeparator() throws InvalidInputException { //see comment on isLineDelimiter(char) for the use of '\n' and '\r' final int INCREMENT = 250; - if (this.checkNonExternalizedStringLiterals) { // reinitialize the current line for non externalize strings purpose currentLine = null; } //currentCharacter is at position currentPosition-1 - // cr 000D if (currentCharacter == '\r') { int separatorPos = currentPosition - 1; @@ -2323,17 +2288,13 @@ public class Scanner implements IScanner, ITerminalSymbols { } public final void pushUnicodeLineSeparator() { // isUnicode means that the \r or \n has been read as a unicode character - //see comment on isLineDelimiter(char) for the use of '\n' and '\r' - final int INCREMENT = 250; //currentCharacter is at position currentPosition-1 - if (this.checkNonExternalizedStringLiterals) { // reinitialize the current line for non externalize strings purpose currentLine = null; } - // cr 000D if (currentCharacter == '\r') { int separatorPos = currentPosition - 6; @@ -2387,10 +2348,11 @@ public class Scanner implements IScanner, ITerminalSymbols { } } public final void recordComment(boolean isJavadoc) { - // a new annotation comment is recorded try { - commentStops[++commentPtr] = isJavadoc ? currentPosition : -currentPosition; + commentStops[++commentPtr] = isJavadoc + ? currentPosition + : -currentPosition; } catch (IndexOutOfBoundsException e) { int oldStackLength = commentStops.length; int[] oldStack = commentStops; @@ -2402,23 +2364,20 @@ public class Scanner implements IScanner, ITerminalSymbols { commentStarts = new int[oldStackLength + 30]; System.arraycopy(old, 0, commentStarts, 0, oldStackLength); } - //the buffer is of a correct size here commentStarts[commentPtr] = startPosition; } public void resetTo(int begin, int end) { //reset the scanner to a given position where it may rescan again - diet = false; initialPosition = startPosition = currentPosition = begin; eofPosition = end < Integer.MAX_VALUE ? end + 1 : end; commentPtr = -1; // reset comment stack } - - public final void scanSingleQuotedEscapeCharacter() throws InvalidInputException { + public final void scanSingleQuotedEscapeCharacter() + throws InvalidInputException { // the string with "\\u" is a legal string of two chars \ and u //thus we use a direct access to the source (for regular cases). - // if (unicodeAsBackSlash) { // // consume next character // unicodeAsBackSlash = false; @@ -2444,11 +2403,10 @@ public class Scanner implements IScanner, ITerminalSymbols { currentPosition--; } } - - public final void scanDoubleQuotedEscapeCharacter() throws InvalidInputException { + public final void scanDoubleQuotedEscapeCharacter() + throws InvalidInputException { // the string with "\\u" is a legal string of two chars \ and u //thus we use a direct access to the source (for regular cases). - // if (unicodeAsBackSlash) { // // consume next character // unicodeAsBackSlash = false; @@ -2472,9 +2430,9 @@ public class Scanner implements IScanner, ITerminalSymbols { case 'n' : currentCharacter = '\n'; break; - // case 'f' : - // currentCharacter = '\f'; - // break; + // case 'f' : + // currentCharacter = '\f'; + // break; case 'r' : currentCharacter = '\r'; break; @@ -2495,7 +2453,6 @@ public class Scanner implements IScanner, ITerminalSymbols { // OctalDigit // OctalDigit OctalDigit // ZeroToThree OctalDigit OctalDigit - int number = Character.getNumericValue(currentCharacter); if (number >= 0 && number <= 7) { boolean zeroToThreeNot = number > 3; @@ -2503,22 +2460,27 @@ public class Scanner implements IScanner, ITerminalSymbols { int digit = Character.getNumericValue(currentCharacter); if (digit >= 0 && digit <= 7) { number = (number * 8) + digit; - if (Character.isDigit(currentCharacter = source[currentPosition++])) { - if (zeroToThreeNot) { // has read \NotZeroToThree OctalDigit Digit --> ignore last character + if (Character + .isDigit(currentCharacter = source[currentPosition++])) { + if (zeroToThreeNot) { // has read \NotZeroToThree OctalDigit + // Digit --> ignore last character currentPosition--; } else { digit = Character.getNumericValue(currentCharacter); if (digit >= 0 && digit <= 7) { // has read \ZeroToThree OctalDigit OctalDigit number = (number * 8) + digit; - } else { // has read \ZeroToThree OctalDigit NonOctalDigit --> ignore last character + } else { // has read \ZeroToThree OctalDigit NonOctalDigit + // --> ignore last character currentPosition--; } } - } else { // has read \OctalDigit NonDigit--> ignore last character + } else { // has read \OctalDigit NonDigit--> ignore last + // character currentPosition--; } - } else { // has read \OctalDigit NonOctalDigit--> ignore last character + } else { // has read \OctalDigit NonOctalDigit--> ignore last + // character currentPosition--; } } else { // has read \OctalDigit --> ignore last character @@ -2528,28 +2490,23 @@ public class Scanner implements IScanner, ITerminalSymbols { throw new InvalidInputException(INVALID_ESCAPE); currentCharacter = (char) number; } - //else - // throw new InvalidInputException(INVALID_ESCAPE); + //else + // throw new InvalidInputException(INVALID_ESCAPE); } } - // public int scanIdentifierOrKeyword() throws InvalidInputException { // return scanIdentifierOrKeyword( false ); // } - - public int scanIdentifierOrKeyword(boolean isVariable) throws InvalidInputException { + public int scanIdentifierOrKeyword(boolean isVariable) + throws InvalidInputException { //test keywords - //first dispatch on the first char. //then the length. If there are several //keywors with the same length AND the same first char, then do another //disptach on the second char :-)...cool....but fast ! - useAssertAsAnIndentifier = false; - while (getNextCharAsJavaIdentifierPart()) { }; - if (isVariable) { if (new String(getCurrentTokenSource()).equals("$this")) { return TokenNamethis; @@ -2560,11 +2517,9 @@ public class Scanner implements IScanner, ITerminalSymbols { char[] data; char firstLetter; // if (withoutUnicodePtr == 0) - //quick test on length == 1 but not on length > 12 while most identifier //have a length which is <= 12...but there are lots of identifier with //only one char.... - // { if ((length = currentPosition - startPosition) == 1) return TokenNameIdentifier; @@ -2585,86 +2540,134 @@ public class Scanner implements IScanner, ITerminalSymbols { // } // index = 1; // } - firstLetter = data[index]; switch (firstLetter) { - - case 'a' : // as and array abstract + case '_' : + switch (length) { + case 8 : + //__FILE__ + if ((data[++index] == '_') && (data[++index] == 'f') + && (data[++index] == 'i') && (data[++index] == 'l') + && (data[++index] == 'e') && (data[++index] == '_') + && (data[++index] == '_')) + return TokenNameFILE; + index = 0; //__LINE__ + if ((data[++index] == '_') && (data[++index] == 'l') + && (data[++index] == 'i') && (data[++index] == 'n') + && (data[++index] == 'e') && (data[++index] == '_') + && (data[++index] == '_')) + return TokenNameLINE; + break; + case 9 : + //__CLASS__ + if ((data[++index] == '_') && (data[++index] == 'c') + && (data[++index] == 'l') && (data[++index] == 'a') + && (data[++index] == 's') && (data[++index] == 's') + && (data[++index] == '_') && (data[++index] == '_')) + return TokenNameCLASS_C; + break; + case 11 : + //__METHOD__ + if ((data[++index] == '_') && (data[++index] == 'm') + && (data[++index] == 'e') && (data[++index] == 't') + && (data[++index] == 'h') && (data[++index] == 'o') + && (data[++index] == 'd') && (data[++index] == '_') + && (data[++index] == '_')) + return TokenNameMETHOD_C; + break; + case 12 : + //__FUNCTION__ + if ((data[++index] == '_') && (data[++index] == 'f') + && (data[++index] == 'u') && (data[++index] == 'n') + && (data[++index] == 'c') && (data[++index] == 't') + && (data[++index] == 'i') && (data[++index] == 'o') + && (data[++index] == 'n') && (data[++index] == '_') + && (data[++index] == '_')) + return TokenNameFUNC_C; + break; + } + return TokenNameIdentifier; + case 'a' : + // as and array abstract switch (length) { - case 2 : //as + case 2 : + //as if ((data[++index] == 's')) { return TokenNameas; } else { return TokenNameIdentifier; } - case 3 : //and + case 3 : + //and if ((data[++index] == 'n') && (data[++index] == 'd')) { return TokenNameAND; } else { return TokenNameIdentifier; } - case 5 : // array - if ((data[++index] == 'r') && (data[++index] == 'r') && (data[++index] == 'a') && (data[++index] == 'y')) + case 5 : + // array + if ((data[++index] == 'r') && (data[++index] == 'r') + && (data[++index] == 'a') && (data[++index] == 'y')) return TokenNamearray; else return TokenNameIdentifier; case 8 : - if ((data[++index] == 'b') - && (data[++index] == 's') - && (data[++index] == 't') - && (data[++index] == 'r') - && (data[++index] == 'a') - && (data[++index] == 'c') - && (data[++index] == 't')) + if ((data[++index] == 'b') && (data[++index] == 's') + && (data[++index] == 't') && (data[++index] == 'r') + && (data[++index] == 'a') && (data[++index] == 'c') + && (data[++index] == 't')) return TokenNameabstract; else return TokenNameIdentifier; default : return TokenNameIdentifier; } - case 'b' : //break + case 'b' : + //break switch (length) { case 5 : - if ((data[++index] == 'r') && (data[++index] == 'e') && (data[++index] == 'a') && (data[++index] == 'k')) + if ((data[++index] == 'r') && (data[++index] == 'e') + && (data[++index] == 'a') && (data[++index] == 'k')) return TokenNamebreak; else return TokenNameIdentifier; default : return TokenNameIdentifier; } - - case 'c' : //case catch class const continue + case 'c' : + //case catch class const continue switch (length) { case 4 : - if ((data[++index] == 'a') && (data[++index] == 's') && (data[++index] == 'e')) + if ((data[++index] == 'a') && (data[++index] == 's') + && (data[++index] == 'e')) return TokenNamecase; else return TokenNameIdentifier; case 5 : - if ((data[++index] == 'a') && (data[++index] == 't') && (data[++index] == 'c') && (data[++index] == 'h')) + if ((data[++index] == 'a') && (data[++index] == 't') + && (data[++index] == 'c') && (data[++index] == 'h')) return TokenNamecatch; - if ((data[index] == 'l') && (data[++index] == 'a') && (data[++index] == 's') && (data[++index] == 's')) + if ((data[index] == 'l') && (data[++index] == 'a') + && (data[++index] == 's') && (data[++index] == 's')) return TokenNameclass; - if ((data[index] == 'o') && (data[++index] == 'n') && (data[++index] == 's') && (data[++index] == 't')) + if ((data[index] == 'o') && (data[++index] == 'n') + && (data[++index] == 's') && (data[++index] == 't')) return TokenNameconst; else return TokenNameIdentifier; case 8 : - if ((data[++index] == 'o') - && (data[++index] == 'n') - && (data[++index] == 't') - && (data[++index] == 'i') - && (data[++index] == 'n') - && (data[++index] == 'u') - && (data[++index] == 'e')) + if ((data[++index] == 'o') && (data[++index] == 'n') + && (data[++index] == 't') && (data[++index] == 'i') + && (data[++index] == 'n') && (data[++index] == 'u') + && (data[++index] == 'e')) return TokenNamecontinue; else return TokenNameIdentifier; default : return TokenNameIdentifier; } - - case 'd' : // declare default do die + case 'd' : + // declare default do die // TODO delete define ==> no keyword ! switch (length) { case 2 : @@ -2672,135 +2675,117 @@ public class Scanner implements IScanner, ITerminalSymbols { return TokenNamedo; else return TokenNameIdentifier; -// case 6 : -// if ((data[++index] == 'e') -// && (data[++index] == 'f') -// && (data[++index] == 'i') -// && (data[++index] == 'n') -// && (data[++index] == 'e')) -// return TokenNamedefine; -// else -// return TokenNameIdentifier; + // case 6 : + // if ((data[++index] == 'e') + // && (data[++index] == 'f') + // && (data[++index] == 'i') + // && (data[++index] == 'n') + // && (data[++index] == 'e')) + // return TokenNamedefine; + // else + // return TokenNameIdentifier; case 7 : - if ((data[++index] == 'e') - && (data[++index] == 'c') - && (data[++index] == 'l') - && (data[++index] == 'a') - && (data[++index] == 'r') - && (data[++index] == 'e')) + if ((data[++index] == 'e') && (data[++index] == 'c') + && (data[++index] == 'l') && (data[++index] == 'a') + && (data[++index] == 'r') && (data[++index] == 'e')) return TokenNamedeclare; index = 0; - if ((data[++index] == 'e') - && (data[++index] == 'f') - && (data[++index] == 'a') - && (data[++index] == 'u') - && (data[++index] == 'l') - && (data[++index] == 't')) + if ((data[++index] == 'e') && (data[++index] == 'f') + && (data[++index] == 'a') && (data[++index] == 'u') + && (data[++index] == 'l') && (data[++index] == 't')) return TokenNamedefault; else return TokenNameIdentifier; default : return TokenNameIdentifier; } - case 'e' : //echo else exit elseif extends eval + case 'e' : + //echo else exit elseif extends eval switch (length) { case 4 : - if ((data[++index] == 'c') && (data[++index] == 'h') && (data[++index] == 'o')) + if ((data[++index] == 'c') && (data[++index] == 'h') + && (data[++index] == 'o')) return TokenNameecho; - else if ((data[index] == 'l') && (data[++index] == 's') && (data[++index] == 'e')) + else if ((data[index] == 'l') && (data[++index] == 's') + && (data[++index] == 'e')) return TokenNameelse; - else if ((data[index] == 'x') && (data[++index] == 'i') && (data[++index] == 't')) + else if ((data[index] == 'x') && (data[++index] == 'i') + && (data[++index] == 't')) return TokenNameexit; - else if ((data[index] == 'v') && (data[++index] == 'a') && (data[++index] == 'l')) + else if ((data[index] == 'v') && (data[++index] == 'a') + && (data[++index] == 'l')) return TokenNameeval; else return TokenNameIdentifier; - case 5 : // endif empty - if ((data[++index] == 'n') && (data[++index] == 'd') && (data[++index] == 'i') && (data[++index] == 'f')) + case 5 : + // endif empty + if ((data[++index] == 'n') && (data[++index] == 'd') + && (data[++index] == 'i') && (data[++index] == 'f')) return TokenNameendif; - if ((data[index] == 'm') && (data[++index] == 'p') && (data[++index] == 't') && (data[++index] == 'y')) + if ((data[index] == 'm') && (data[++index] == 'p') + && (data[++index] == 't') && (data[++index] == 'y')) return TokenNameempty; else return TokenNameIdentifier; - case 6 : // endfor - if ((data[++index] == 'n') - && (data[++index] == 'd') - && (data[++index] == 'f') - && (data[++index] == 'o') - && (data[++index] == 'r')) + case 6 : + // endfor + if ((data[++index] == 'n') && (data[++index] == 'd') + && (data[++index] == 'f') && (data[++index] == 'o') + && (data[++index] == 'r')) return TokenNameendfor; - else if ( - (data[index] == 'l') - && (data[++index] == 's') - && (data[++index] == 'e') - && (data[++index] == 'i') + else if ((data[index] == 'l') && (data[++index] == 's') + && (data[++index] == 'e') && (data[++index] == 'i') && (data[++index] == 'f')) return TokenNameelseif; else return TokenNameIdentifier; case 7 : - if ((data[++index] == 'x') - && (data[++index] == 't') - && (data[++index] == 'e') - && (data[++index] == 'n') - && (data[++index] == 'd') - && (data[++index] == 's')) + if ((data[++index] == 'x') && (data[++index] == 't') + && (data[++index] == 'e') && (data[++index] == 'n') + && (data[++index] == 'd') && (data[++index] == 's')) return TokenNameextends; else return TokenNameIdentifier; - case 8 : // endwhile - if ((data[++index] == 'n') - && (data[++index] == 'd') - && (data[++index] == 'w') - && (data[++index] == 'h') - && (data[++index] == 'i') - && (data[++index] == 'l') - && (data[++index] == 'e')) + case 8 : + // endwhile + if ((data[++index] == 'n') && (data[++index] == 'd') + && (data[++index] == 'w') && (data[++index] == 'h') + && (data[++index] == 'i') && (data[++index] == 'l') + && (data[++index] == 'e')) return TokenNameendwhile; else return TokenNameIdentifier; - case 9 : // endswitch - if ((data[++index] == 'n') - && (data[++index] == 'd') - && (data[++index] == 's') - && (data[++index] == 'w') - && (data[++index] == 'i') - && (data[++index] == 't') - && (data[++index] == 'c') - && (data[++index] == 'h')) + case 9 : + // endswitch + if ((data[++index] == 'n') && (data[++index] == 'd') + && (data[++index] == 's') && (data[++index] == 'w') + && (data[++index] == 'i') && (data[++index] == 't') + && (data[++index] == 'c') && (data[++index] == 'h')) return TokenNameendswitch; else return TokenNameIdentifier; - case 10 : // enddeclare - if ((data[++index] == 'n') - && (data[++index] == 'd') - && (data[++index] == 'd') - && (data[++index] == 'e') - && (data[++index] == 'c') - && (data[++index] == 'l') - && (data[++index] == 'a') - && (data[++index] == 'r') - && (data[++index] == 'e')) + case 10 : + // enddeclare + if ((data[++index] == 'n') && (data[++index] == 'd') + && (data[++index] == 'd') && (data[++index] == 'e') + && (data[++index] == 'c') && (data[++index] == 'l') + && (data[++index] == 'a') && (data[++index] == 'r') + && (data[++index] == 'e')) return TokenNameendforeach; index = 0; if ((data[++index] == 'n') // endforeach - && (data[++index] == 'd') - && (data[++index] == 'f') - && (data[++index] == 'o') - && (data[++index] == 'r') - && (data[++index] == 'e') - && (data[++index] == 'a') - && (data[++index] == 'c') - && (data[++index] == 'h')) + && (data[++index] == 'd') && (data[++index] == 'f') + && (data[++index] == 'o') && (data[++index] == 'r') + && (data[++index] == 'e') && (data[++index] == 'a') + && (data[++index] == 'c') && (data[++index] == 'h')) return TokenNameendforeach; else return TokenNameIdentifier; - default : return TokenNameIdentifier; } - - case 'f' : //for false final function + case 'f' : + //for false final function switch (length) { case 3 : if ((data[++index] == 'o') && (data[++index] == 'r')) @@ -2808,154 +2793,136 @@ public class Scanner implements IScanner, ITerminalSymbols { else return TokenNameIdentifier; case 5 : - if ((data[++index] == 'a') && (data[++index] == 'l') && (data[++index] == 's') && (data[++index] == 'e')) - return TokenNamefalse; - if ((data[index] == 'i') && (data[++index] == 'n') && (data[++index] == 'a') && (data[++index] == 'l')) +// if ((data[++index] == 'a') && (data[++index] == 'l') +// && (data[++index] == 's') && (data[++index] == 'e')) +// return TokenNamefalse; + if ((data[++index] == 'i') && (data[++index] == 'n') + && (data[++index] == 'a') && (data[++index] == 'l')) return TokenNamefinal; else return TokenNameIdentifier; - case 7 : // foreach - if ((data[++index] == 'o') - && (data[++index] == 'r') - && (data[++index] == 'e') - && (data[++index] == 'a') - && (data[++index] == 'c') - && (data[++index] == 'h')) + case 7 : + // foreach + if ((data[++index] == 'o') && (data[++index] == 'r') + && (data[++index] == 'e') && (data[++index] == 'a') + && (data[++index] == 'c') && (data[++index] == 'h')) return TokenNameforeach; else return TokenNameIdentifier; - case 8 : // function - if ((data[++index] == 'u') - && (data[++index] == 'n') - && (data[++index] == 'c') - && (data[++index] == 't') - && (data[++index] == 'i') - && (data[++index] == 'o') - && (data[++index] == 'n')) + case 8 : + // function + if ((data[++index] == 'u') && (data[++index] == 'n') + && (data[++index] == 'c') && (data[++index] == 't') + && (data[++index] == 'i') && (data[++index] == 'o') + && (data[++index] == 'n')) return TokenNamefunction; else return TokenNameIdentifier; default : return TokenNameIdentifier; } - case 'g' : //global + case 'g' : + //global if (length == 6) { - if ((data[++index] == 'l') - && (data[++index] == 'o') - && (data[++index] == 'b') - && (data[++index] == 'a') - && (data[++index] == 'l')) { + if ((data[++index] == 'l') && (data[++index] == 'o') + && (data[++index] == 'b') && (data[++index] == 'a') + && (data[++index] == 'l')) { return TokenNameglobal; } } return TokenNameIdentifier; - - case 'i' : //if int isset include include_once instanceof interface implements + case 'i' : + //if int isset include include_once instanceof interface implements switch (length) { case 2 : if (data[++index] == 'f') return TokenNameif; else return TokenNameIdentifier; - // case 3 : - // if ((data[++index] == 'n') && (data[++index] == 't')) - // return TokenNameint; - // else - // return TokenNameIdentifier; + // case 3 : + // if ((data[++index] == 'n') && (data[++index] == 't')) + // return TokenNameint; + // else + // return TokenNameIdentifier; case 5 : - if ((data[++index] == 's') && (data[++index] == 's') && (data[++index] == 'e') && (data[++index] == 't')) + if ((data[++index] == 's') && (data[++index] == 's') + && (data[++index] == 'e') && (data[++index] == 't')) return TokenNameisset; else return TokenNameIdentifier; case 7 : - if ((data[++index] == 'n') - && (data[++index] == 'c') - && (data[++index] == 'l') - && (data[++index] == 'u') - && (data[++index] == 'd') - && (data[++index] == 'e')) + if ((data[++index] == 'n') && (data[++index] == 'c') + && (data[++index] == 'l') && (data[++index] == 'u') + && (data[++index] == 'd') && (data[++index] == 'e')) return TokenNameinclude; else return TokenNameIdentifier; - case 9 : // interface - if ((data[++index] == 'n') - && (data[++index] == 't') - && (data[++index] == 'e') - && (data[++index] == 'r') - && (data[++index] == 'f') - && (data[++index] == 'a') - && (data[++index] == 'c') - && (data[++index] == 'e')) + case 9 : + // interface + if ((data[++index] == 'n') && (data[++index] == 't') + && (data[++index] == 'e') && (data[++index] == 'r') + && (data[++index] == 'f') && (data[++index] == 'a') + && (data[++index] == 'c') && (data[++index] == 'e')) return TokenNameinterface; else return TokenNameIdentifier; - case 10 : // instanceof - if ((data[++index] == 'n') - && (data[++index] == 's') - && (data[++index] == 't') - && (data[++index] == 'a') - && (data[++index] == 'n') - && (data[++index] == 'c') - && (data[++index] == 'e') - && (data[++index] == 'o') - && (data[++index] == 'f')) + case 10 : + // instanceof + if ((data[++index] == 'n') && (data[++index] == 's') + && (data[++index] == 't') && (data[++index] == 'a') + && (data[++index] == 'n') && (data[++index] == 'c') + && (data[++index] == 'e') && (data[++index] == 'o') + && (data[++index] == 'f')) return TokenNameinstanceof; - if ((data[index] == 'm') - && (data[++index] == 'p') - && (data[++index] == 'l') - && (data[++index] == 'e') - && (data[++index] == 'm') - && (data[++index] == 'e') - && (data[++index] == 'n') - && (data[++index] == 't') - && (data[++index] == 's')) + if ((data[index] == 'm') && (data[++index] == 'p') + && (data[++index] == 'l') && (data[++index] == 'e') + && (data[++index] == 'm') && (data[++index] == 'e') + && (data[++index] == 'n') && (data[++index] == 't') + && (data[++index] == 's')) return TokenNameimplements; else return TokenNameIdentifier; case 12 : - if ((data[++index] == 'n') - && (data[++index] == 'c') - && (data[++index] == 'l') - && (data[++index] == 'u') - && (data[++index] == 'd') - && (data[++index] == 'e') - && (data[++index] == '_') - && (data[++index] == 'o') - && (data[++index] == 'n') - && (data[++index] == 'c') - && (data[++index] == 'e')) + if ((data[++index] == 'n') && (data[++index] == 'c') + && (data[++index] == 'l') && (data[++index] == 'u') + && (data[++index] == 'd') && (data[++index] == 'e') + && (data[++index] == '_') && (data[++index] == 'o') + && (data[++index] == 'n') && (data[++index] == 'c') + && (data[++index] == 'e')) return TokenNameinclude_once; else return TokenNameIdentifier; default : return TokenNameIdentifier; } - - case 'l' : //list + case 'l' : + //list if (length == 4) { - if ((data[++index] == 'i') && (data[++index] == 's') && (data[++index] == 't')) { + if ((data[++index] == 'i') && (data[++index] == 's') + && (data[++index] == 't')) { return TokenNamelist; } } return TokenNameIdentifier; - - case 'n' : // new null + case 'n' : + // new null switch (length) { case 3 : if ((data[++index] == 'e') && (data[++index] == 'w')) return TokenNamenew; else return TokenNameIdentifier; - case 4 : - if ((data[++index] == 'u') && (data[++index] == 'l') && (data[++index] == 'l')) - return TokenNamenull; - else - return TokenNameIdentifier; - +// case 4 : +// if ((data[++index] == 'u') && (data[++index] == 'l') +// && (data[++index] == 'l')) +// return TokenNamenull; +// else +// return TokenNameIdentifier; default : return TokenNameIdentifier; } - case 'o' : // or old_function + case 'o' : + // or old_function if (length == 2) { if (data[++index] == 'r') { return TokenNameOR; @@ -2977,95 +2944,76 @@ public class Scanner implements IScanner, ITerminalSymbols { // } // } return TokenNameIdentifier; - - case 'p' : // print public private protected + case 'p' : + // print public private protected switch (length) { case 5 : - if ((data[++index] == 'r') && (data[++index] == 'i') && (data[++index] == 'n') && (data[++index] == 't')) { + if ((data[++index] == 'r') && (data[++index] == 'i') + && (data[++index] == 'n') && (data[++index] == 't')) { return TokenNameprint; } else return TokenNameIdentifier; case 6 : - if ((data[++index] == 'u') - && (data[++index] == 'b') - && (data[++index] == 'l') - && (data[++index] == 'i') - && (data[++index] == 'c')) { + if ((data[++index] == 'u') && (data[++index] == 'b') + && (data[++index] == 'l') && (data[++index] == 'i') + && (data[++index] == 'c')) { return TokenNamepublic; } else return TokenNameIdentifier; case 7 : - if ((data[++index] == 'r') - && (data[++index] == 'i') - && (data[++index] == 'v') - && (data[++index] == 'a') - && (data[++index] == 't') - && (data[++index] == 'e')) { + if ((data[++index] == 'r') && (data[++index] == 'i') + && (data[++index] == 'v') && (data[++index] == 'a') + && (data[++index] == 't') && (data[++index] == 'e')) { return TokenNameprivate; } else return TokenNameIdentifier; case 9 : - if ((data[++index] == 'r') - && (data[++index] == 'o') - && (data[++index] == 't') - && (data[++index] == 'e') - && (data[++index] == 'c') - && (data[++index] == 't') - && (data[++index] == 'e') - && (data[++index] == 'd')) { + if ((data[++index] == 'r') && (data[++index] == 'o') + && (data[++index] == 't') && (data[++index] == 'e') + && (data[++index] == 'c') && (data[++index] == 't') + && (data[++index] == 'e') && (data[++index] == 'd')) { return TokenNameprotected; } else return TokenNameIdentifier; } return TokenNameIdentifier; - case 'r' : //return require require_once + case 'r' : + //return require require_once if (length == 6) { - if ((data[++index] == 'e') - && (data[++index] == 't') - && (data[++index] == 'u') - && (data[++index] == 'r') - && (data[++index] == 'n')) { + if ((data[++index] == 'e') && (data[++index] == 't') + && (data[++index] == 'u') && (data[++index] == 'r') + && (data[++index] == 'n')) { return TokenNamereturn; } } else if (length == 7) { - if ((data[++index] == 'e') - && (data[++index] == 'q') - && (data[++index] == 'u') - && (data[++index] == 'i') - && (data[++index] == 'r') - && (data[++index] == 'e')) { + if ((data[++index] == 'e') && (data[++index] == 'q') + && (data[++index] == 'u') && (data[++index] == 'i') + && (data[++index] == 'r') && (data[++index] == 'e')) { return TokenNamerequire; } } else if (length == 12) { - if ((data[++index] == 'e') - && (data[++index] == 'q') - && (data[++index] == 'u') - && (data[++index] == 'i') - && (data[++index] == 'r') - && (data[++index] == 'e') - && (data[++index] == '_') - && (data[++index] == 'o') - && (data[++index] == 'n') - && (data[++index] == 'c') - && (data[++index] == 'e')) { + if ((data[++index] == 'e') && (data[++index] == 'q') + && (data[++index] == 'u') && (data[++index] == 'i') + && (data[++index] == 'r') && (data[++index] == 'e') + && (data[++index] == '_') && (data[++index] == 'o') + && (data[++index] == 'n') && (data[++index] == 'c') + && (data[++index] == 'e')) { return TokenNamerequire_once; } } else return TokenNameIdentifier; - - case 's' : //static switch + case 's' : + //static switch switch (length) { case 6 : if (data[++index] == 't') - if ((data[++index] == 'a') && (data[++index] == 't') && (data[++index] == 'i') && (data[++index] == 'c')) { + if ((data[++index] == 'a') && (data[++index] == 't') + && (data[++index] == 'i') && (data[++index] == 'c')) { return TokenNamestatic; } else return TokenNameIdentifier; - else if ( - (data[index] == 'w') - && (data[++index] == 'i') - && (data[++index] == 't') - && (data[++index] == 'c') + else if ((data[index] == 'w') && (data[++index] == 'i') + && (data[++index] == 't') && (data[++index] == 'c') && (data[++index] == 'h')) return TokenNameswitch; else @@ -3073,29 +3021,31 @@ public class Scanner implements IScanner, ITerminalSymbols { default : return TokenNameIdentifier; } - - case 't' : // try true throw + case 't' : + // try true throw switch (length) { case 3 : if ((data[++index] == 'r') && (data[++index] == 'y')) return TokenNametry; else return TokenNameIdentifier; - case 4 : - if ((data[++index] == 'r') && (data[++index] == 'u') && (data[++index] == 'e')) - return TokenNametrue; - else - return TokenNameIdentifier; +// case 4 : +// if ((data[++index] == 'r') && (data[++index] == 'u') +// && (data[++index] == 'e')) +// return TokenNametrue; +// else +// return TokenNameIdentifier; case 5 : - if ((data[++index] == 'h') && (data[++index] == 'r') && (data[++index] == 'o') && (data[++index] == 'w')) + if ((data[++index] == 'h') && (data[++index] == 'r') + && (data[++index] == 'o') && (data[++index] == 'w')) return TokenNamethrow; else return TokenNameIdentifier; - default : return TokenNameIdentifier; } - case 'u' : //use unset + case 'u' : + //use unset switch (length) { case 3 : if ((data[++index] == 's') && (data[++index] == 'e')) @@ -3103,49 +3053,51 @@ public class Scanner implements IScanner, ITerminalSymbols { else return TokenNameIdentifier; case 5 : - if ((data[++index] == 'n') && (data[++index] == 's') && (data[++index] == 'e') && (data[++index] == 't')) + if ((data[++index] == 'n') && (data[++index] == 's') + && (data[++index] == 'e') && (data[++index] == 't')) return TokenNameunset; else return TokenNameIdentifier; default : return TokenNameIdentifier; } - case 'v' : //var + case 'v' : + //var switch (length) { case 3 : if ((data[++index] == 'a') && (data[++index] == 'r')) return TokenNamevar; else return TokenNameIdentifier; - default : return TokenNameIdentifier; } - - case 'w' : //while + case 'w' : + //while switch (length) { case 5 : - if ((data[++index] == 'h') && (data[++index] == 'i') && (data[++index] == 'l') && (data[++index] == 'e')) + if ((data[++index] == 'h') && (data[++index] == 'i') + && (data[++index] == 'l') && (data[++index] == 'e')) return TokenNamewhile; else return TokenNameIdentifier; - //case 6:if ( (data[++index] =='i') && (data[++index]=='d') && (data[++index]=='e') && (data[++index]=='f')&& - // (data[++index]=='p')) - //return TokenNamewidefp ; - //else - //return TokenNameIdentifier; + //case 6:if ( (data[++index] =='i') && (data[++index]=='d') && + // (data[++index]=='e') && (data[++index]=='f')&& + // (data[++index]=='p')) + //return TokenNamewidefp ; + //else + //return TokenNameIdentifier; default : return TokenNameIdentifier; } - - case 'x' : //xor + case 'x' : + //xor switch (length) { case 3 : if ((data[++index] == 'o') && (data[++index] == 'r')) return TokenNameXOR; else return TokenNameIdentifier; - default : return TokenNameIdentifier; } @@ -3154,11 +3106,9 @@ public class Scanner implements IScanner, ITerminalSymbols { } } public int scanNumber(boolean dotPrefix) throws InvalidInputException { - //when entering this method the currentCharacter is the firt //digit of the number , i.e. it may be preceeded by a . when //dotPrefix is true - boolean floating = dotPrefix; if ((!dotPrefix) && (currentCharacter == '0')) { if (getNextChar('x', 'X') >= 0) { //----------hexa----------------- @@ -3184,14 +3134,13 @@ public class Scanner implements IScanner, ITerminalSymbols { // else return TokenNameIntegerLiteral; } - //there is x or X in the number - //potential octal ! ... some one may write 000099.0 ! thus 00100 < 00078.0 is true !!!!! crazy language + //potential octal ! ... some one may write 000099.0 ! thus 00100 < + // 00078.0 is true !!!!! crazy language if (getNextCharAsDigit()) { //-------------potential octal----------------- while (getNextCharAsDigit()) { }; - // if (getNextChar('l', 'L') >= 0) { // return TokenNameLongLiteral; // } @@ -3199,7 +3148,6 @@ public class Scanner implements IScanner, ITerminalSymbols { // if (getNextChar('f', 'F') >= 0) { // return TokenNameFloatingPointLiteral; // } - if (getNextChar('d', 'D') >= 0) { return TokenNameDoubleLiteral; } else { //make the distinction between octal and float .... @@ -3218,7 +3166,6 @@ public class Scanner implements IScanner, ITerminalSymbols { // withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter; // } // } - if ((currentCharacter == '-') || (currentCharacter == '+')) { // consume next character unicodeAsBackSlash = false; @@ -3250,21 +3197,16 @@ public class Scanner implements IScanner, ITerminalSymbols { /* carry on */ } } - while (getNextCharAsDigit()) { }; - // if ((!dotPrefix) && (getNextChar('l', 'L') >= 0)) // return TokenNameLongLiteral; - if ((!dotPrefix) && (getNextChar('.'))) { //decimal part that can be empty while (getNextCharAsDigit()) { }; floating = true; } - //if floating is true both exponant and suffix may be optional - if (getNextChar('e', 'E') >= 0) { floating = true; // consume next character @@ -3278,8 +3220,9 @@ public class Scanner implements IScanner, ITerminalSymbols { // withoutUnicodeBuffer[++withoutUnicodePtr] = currentCharacter; // } // } - - if ((currentCharacter == '-') || (currentCharacter == '+')) { // consume next character + if ((currentCharacter == '-') || (currentCharacter == '+')) { // consume + // next + // character unicodeAsBackSlash = false; currentCharacter = source[currentPosition++]; // if (((currentCharacter = source[currentPosition++]) == '\\') @@ -3296,14 +3239,11 @@ public class Scanner implements IScanner, ITerminalSymbols { while (getNextCharAsDigit()) { }; } - if (getNextChar('d', 'D') >= 0) return TokenNameDoubleLiteral; // if (getNextChar('f', 'F') >= 0) // return TokenNameFloatingPointLiteral; - //the long flag has been tested before - return floating ? TokenNameDoubleLiteral : TokenNameIntegerLiteral; } /** @@ -3311,7 +3251,6 @@ public class Scanner implements IScanner, ITerminalSymbols { * */ public final int getLineNumber(int position) { - if (lineEnds == null) return 1; int length = linePtr + 1; @@ -3334,14 +3273,11 @@ public class Scanner implements IScanner, ITerminalSymbols { } return m + 2; } - public void setPHPMode(boolean mode) { phpMode = mode; } - public final void setSource(char[] source) { //the source-buffer is set to sourceString - if (source == null) { this.source = new char[0]; } else { @@ -3351,18 +3287,14 @@ public class Scanner implements IScanner, ITerminalSymbols { initialPosition = currentPosition = 0; containsAssertKeyword = false; withoutUnicodeBuffer = new char[this.source.length]; - } - public String toString() { if (startPosition == source.length) return "EOF\n\n" + new String(source); //$NON-NLS-1$ if (currentPosition > source.length) return "behind the EOF :-( ....\n\n" + new String(source); //$NON-NLS-1$ - char front[] = new char[startPosition]; System.arraycopy(source, 0, front, 0, startPosition); - int middleLength = (currentPosition - 1) - startPosition + 1; char middle[]; if (middleLength > -1) { @@ -3371,19 +3303,20 @@ public class Scanner implements IScanner, ITerminalSymbols { } else { middle = new char[0]; } - char end[] = new char[source.length - (currentPosition - 1)]; - System.arraycopy(source, (currentPosition - 1) + 1, end, 0, source.length - (currentPosition - 1) - 1); - - return new String(front) + "\n===============================\nStarts here -->" //$NON-NLS-1$ - + new String(middle) + "<-- Ends here\n===============================\n" //$NON-NLS-1$ - + new String(end); + System.arraycopy(source, (currentPosition - 1) + 1, end, 0, source.length + - (currentPosition - 1) - 1); + return new String(front) + + "\n===============================\nStarts here -->" //$NON-NLS-1$ + + new String(middle) + + "<-- Ends here\n===============================\n" //$NON-NLS-1$ + + new String(end); } public final String toStringAction(int act) { - switch (act) { case TokenNameERROR : - return "ScannerError"; // + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ + return "ScannerError"; // + new String(getCurrentTokenSource()) + ")"; + // //$NON-NLS-1$ case TokenNameStopPHP : return "StopPHP(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ case TokenNameIdentifier : @@ -3406,8 +3339,8 @@ public class Scanner implements IScanner, ITerminalSymbols { return "continue"; //$NON-NLS-1$ case TokenNamedefault : return "default"; //$NON-NLS-1$ -// case TokenNamedefine : -// return "define"; //$NON-NLS-1$ + // case TokenNamedefine : + // return "define"; //$NON-NLS-1$ case TokenNamedo : return "do"; //$NON-NLS-1$ case TokenNameecho : @@ -3428,8 +3361,8 @@ public class Scanner implements IScanner, ITerminalSymbols { return "endwhile"; //$NON-NLS-1$ case TokenNameextends : return "extends"; //$NON-NLS-1$ - case TokenNamefalse : - return "false"; //$NON-NLS-1$ +// case TokenNamefalse : +// return "false"; //$NON-NLS-1$ case TokenNamefinal : return "final"; //$NON-NLS-1$ case TokenNamefor : @@ -3454,8 +3387,8 @@ public class Scanner implements IScanner, ITerminalSymbols { return "list"; //$NON-NLS-1$ case TokenNamenew : return "new"; //$NON-NLS-1$ - case TokenNamenull : - return "null"; //$NON-NLS-1$ +// case TokenNamenull : +// return "null"; //$NON-NLS-1$ case TokenNameprint : return "print"; //$NON-NLS-1$ case TokenNameprivate : @@ -3474,8 +3407,8 @@ public class Scanner implements IScanner, ITerminalSymbols { return "static"; //$NON-NLS-1$ case TokenNameswitch : return "switch"; //$NON-NLS-1$ - case TokenNametrue : - return "true"; //$NON-NLS-1$ +// case TokenNametrue : +// return "true"; //$NON-NLS-1$ case TokenNameunset : return "unset"; //$NON-NLS-1$ case TokenNamevar : @@ -3493,10 +3426,10 @@ public class Scanner implements IScanner, ITerminalSymbols { case TokenNameStringConstant : return "StringConstant(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ case TokenNameStringInterpolated : - return "StringInterpolated(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ + return "StringInterpolated(" + new String(getCurrentTokenSource()) + + ")"; //$NON-NLS-1$ //$NON-NLS-2$ case TokenNameHEREDOC : return "HEREDOC(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ - case TokenNamePLUS_PLUS : return "++"; //$NON-NLS-1$ case TokenNameMINUS_MINUS : @@ -3611,33 +3544,39 @@ public class Scanner implements IScanner, ITerminalSymbols { return "COMMENT_PHPDOC(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ case TokenNameHTML : return "HTML(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ + case TokenNameFILE : + return "__FILE__"; //$NON-NLS-1$ + case TokenNameLINE : + return "__LINE__"; //$NON-NLS-1$ + case TokenNameCLASS_C : + return "__CLASS__"; //$NON-NLS-1$ + case TokenNameMETHOD_C : + return "__METHOD__"; //$NON-NLS-1$ + case TokenNameFUNC_C : + return "__FUNCTION__"; //$NON-NLS-1$ default : - return "not-a-token(" + (new Integer(act)) + ") " + new String(getCurrentTokenSource()); //$NON-NLS-1$ + return "not-a-token(" + (new Integer(act)) + ") " + + new String(getCurrentTokenSource()); //$NON-NLS-1$ } } - - public Scanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean checkNonExternalizedStringLiterals) { - this(tokenizeComments, tokenizeWhiteSpace, checkNonExternalizedStringLiterals, false); + public Scanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, + boolean checkNonExternalizedStringLiterals) { + this(tokenizeComments, tokenizeWhiteSpace, + checkNonExternalizedStringLiterals, false); } - - public Scanner( - boolean tokenizeComments, - boolean tokenizeWhiteSpace, - boolean checkNonExternalizedStringLiterals, - boolean assertMode) { + public Scanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, + boolean checkNonExternalizedStringLiterals, boolean assertMode) { this.eofPosition = Integer.MAX_VALUE; this.tokenizeComments = tokenizeComments; this.tokenizeWhiteSpace = tokenizeWhiteSpace; this.checkNonExternalizedStringLiterals = checkNonExternalizedStringLiterals; this.assertMode = assertMode; } - private void checkNonExternalizeString() throws InvalidInputException { if (currentLine == null) return; parseTags(currentLine); } - private void parseTags(NLSLine line) throws InvalidInputException { String s = new String(getCurrentTokenSource()); int pos = s.indexOf(TAG_PREFIX); @@ -3658,7 +3597,6 @@ public class Scanner implements IScanner, ITerminalSymbols { } pos = s.indexOf(TAG_PREFIX, start); } - this.nonNLSStrings = new StringLiteral[lineLength]; int nonNLSCounter = 0; for (Iterator iterator = line.iterator(); iterator.hasNext();) { @@ -3674,19 +3612,20 @@ public class Scanner implements IScanner, ITerminalSymbols { } this.wasNonExternalizedStringLiteral = true; if (nonNLSCounter != lineLength) { - System.arraycopy(this.nonNLSStrings, 0, (this.nonNLSStrings = new StringLiteral[nonNLSCounter]), 0, nonNLSCounter); + System.arraycopy(this.nonNLSStrings, 0, + (this.nonNLSStrings = new StringLiteral[nonNLSCounter]), 0, + nonNLSCounter); } currentLine = null; } - public final void scanEscapeCharacter() throws InvalidInputException { // the string with "\\u" is a legal string of two chars \ and u //thus we use a direct access to the source (for regular cases). - if (unicodeAsBackSlash) { // consume next character unicodeAsBackSlash = false; - // if (((currentCharacter = source[currentPosition++]) == '\\') && (source[currentPosition] == 'u')) { + // if (((currentCharacter = source[currentPosition++]) == '\\') && + // (source[currentPosition] == 'u')) { // getNextUnicodeChar(); // } else { if (withoutUnicodePtr != 0) { @@ -3725,7 +3664,6 @@ public class Scanner implements IScanner, ITerminalSymbols { // OctalDigit // OctalDigit OctalDigit // ZeroToThree OctalDigit OctalDigit - int number = Character.getNumericValue(currentCharacter); if (number >= 0 && number <= 7) { boolean zeroToThreeNot = number > 3; @@ -3733,21 +3671,27 @@ public class Scanner implements IScanner, ITerminalSymbols { int digit = Character.getNumericValue(currentCharacter); if (digit >= 0 && digit <= 7) { number = (number * 8) + digit; - if (Character.isDigit(currentCharacter = source[currentPosition++])) { - if (zeroToThreeNot) { // has read \NotZeroToThree OctalDigit Digit --> ignore last character + if (Character + .isDigit(currentCharacter = source[currentPosition++])) { + if (zeroToThreeNot) { // has read \NotZeroToThree OctalDigit + // Digit --> ignore last character currentPosition--; } else { digit = Character.getNumericValue(currentCharacter); - if (digit >= 0 && digit <= 7) { // has read \ZeroToThree OctalDigit OctalDigit + if (digit >= 0 && digit <= 7) { // has read \ZeroToThree + // OctalDigit OctalDigit number = (number * 8) + digit; - } else { // has read \ZeroToThree OctalDigit NonOctalDigit --> ignore last character + } else { // has read \ZeroToThree OctalDigit NonOctalDigit + // --> ignore last character currentPosition--; } } - } else { // has read \OctalDigit NonDigit--> ignore last character + } else { // has read \OctalDigit NonDigit--> ignore last + // character currentPosition--; } - } else { // has read \OctalDigit NonOctalDigit--> ignore last character + } else { // has read \OctalDigit NonOctalDigit--> ignore last + // character currentPosition--; } } else { // has read \OctalDigit --> ignore last character @@ -3760,83 +3704,76 @@ public class Scanner implements IScanner, ITerminalSymbols { throw new InvalidInputException(INVALID_ESCAPE); } } - // chech presence of task: tags public void checkTaskTag(int commentStart, int commentEnd) { - // only look for newer task: tags - if (this.foundTaskCount > 0 && this.foundTaskPositions[this.foundTaskCount - 1][0] >= commentStart) { + if (this.foundTaskCount > 0 + && this.foundTaskPositions[this.foundTaskCount - 1][0] >= commentStart) { return; } int foundTaskIndex = this.foundTaskCount; - nextChar : for (int i = commentStart; i < commentEnd && i < this.eofPosition; i++) { - + nextChar : for (int i = commentStart; i < commentEnd + && i < this.eofPosition; i++) { char[] tag = null; char[] priority = null; - // check for tag occurrence nextTag : for (int itag = 0; itag < this.taskTags.length; itag++) { tag = this.taskTags[itag]; - priority = this.taskPriorities != null && itag < this.taskPriorities.length ? this.taskPriorities[itag] : null; + priority = this.taskPriorities != null + && itag < this.taskPriorities.length + ? this.taskPriorities[itag] + : null; int tagLength = tag.length; for (int t = 0; t < tagLength; t++) { if (this.source[i + t] != tag[t]) continue nextTag; } - if (this.foundTaskTags == null) { this.foundTaskTags = new char[5][]; this.foundTaskMessages = new char[5][]; this.foundTaskPriorities = new char[5][]; this.foundTaskPositions = new int[5][]; } else if (this.foundTaskCount == this.foundTaskTags.length) { - System.arraycopy(this.foundTaskTags, 0, this.foundTaskTags = new char[this.foundTaskCount * 2][], 0, this.foundTaskCount); - System.arraycopy( - this.foundTaskMessages, - 0, - this.foundTaskMessages = new char[this.foundTaskCount * 2][], - 0, - this.foundTaskCount); - System.arraycopy( - this.foundTaskPriorities, - 0, - this.foundTaskPriorities = new char[this.foundTaskCount * 2][], - 0, - this.foundTaskCount); - System.arraycopy( - this.foundTaskPositions, - 0, - this.foundTaskPositions = new int[this.foundTaskCount * 2][], - 0, - this.foundTaskCount); + System.arraycopy(this.foundTaskTags, 0, + this.foundTaskTags = new char[this.foundTaskCount * 2][], 0, + this.foundTaskCount); + System.arraycopy(this.foundTaskMessages, 0, + this.foundTaskMessages = new char[this.foundTaskCount * 2][], 0, + this.foundTaskCount); + System.arraycopy(this.foundTaskPriorities, 0, + this.foundTaskPriorities = new char[this.foundTaskCount * 2][], + 0, this.foundTaskCount); + System.arraycopy(this.foundTaskPositions, 0, + this.foundTaskPositions = new int[this.foundTaskCount * 2][], 0, + this.foundTaskCount); } this.foundTaskTags[this.foundTaskCount] = tag; this.foundTaskPriorities[this.foundTaskCount] = priority; - this.foundTaskPositions[this.foundTaskCount] = new int[] { i, i + tagLength - 1 }; + this.foundTaskPositions[this.foundTaskCount] = new int[]{i, + i + tagLength - 1}; this.foundTaskMessages[this.foundTaskCount] = CharOperation.NO_CHAR; this.foundTaskCount++; - i += tagLength - 1; // will be incremented when looping } } - for (int i = foundTaskIndex; i < this.foundTaskCount; i++) { // retrieve message start and end positions - int msgStart = this.foundTaskPositions[i][0] + this.foundTaskTags[i].length; - int max_value = i + 1 < this.foundTaskCount ? this.foundTaskPositions[i + 1][0] - 1 : commentEnd - 1; + int msgStart = this.foundTaskPositions[i][0] + + this.foundTaskTags[i].length; + int max_value = i + 1 < this.foundTaskCount + ? this.foundTaskPositions[i + 1][0] - 1 + : commentEnd - 1; // at most beginning of next task if (max_value < msgStart) max_value = msgStart; // would only occur if tag is before EOF. int end = -1; char c; - for (int j = msgStart; j < max_value; j++) { if ((c = this.source[j]) == '\n' || c == '\r') { end = j - 1; break; } } - if (end == -1) { for (int j = max_value; j > msgStart; j--) { if ((c = this.source[j]) == '*') { @@ -3847,26 +3784,20 @@ public class Scanner implements IScanner, ITerminalSymbols { if (end == -1) end = max_value; } - if (msgStart == end) continue; // empty - // trim the message while (CharOperation.isWhitespace(source[end]) && msgStart <= end) end--; while (CharOperation.isWhitespace(source[msgStart]) && msgStart <= end) msgStart++; - // update the end position of the task this.foundTaskPositions[i][1] = end; - // get the message source final int messageLength = end - msgStart + 1; char[] message = new char[messageLength]; - System.arraycopy(source, msgStart, message, 0, messageLength); this.foundTaskMessages[i] = message; } } - } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemHandler.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemHandler.java index e96bead..6e52747 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemHandler.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemHandler.java @@ -51,7 +51,10 @@ public ProblemHandler(IErrorHandlingPolicy policy, IProblemFactory problemFactor * Error | Warning | Ignore */ public int computeSeverity(int problemId){ - + if (problemId==IProblem.PHPParsingWarning || + problemId==IProblem.PHPVarDeprecatedWarning) { + return Warning; + } return Error; // by default all problems are errors } public IProblem createProblem( diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java index 7e72de4..7e1acce 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java @@ -76,2821 +76,2663 @@ import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration; import net.sourceforge.phpeclipse.internal.compiler.ast.TypeReference; import net.sourceforge.phpeclipse.internal.compiler.ast.UnaryExpression; public class ProblemReporter extends ProblemHandler implements ProblemReasons { - public ReferenceContext referenceContext; - public ProblemReporter(IErrorHandlingPolicy policy, - IProblemFactory problemFactory) { - //CompilerOptions options, IProblemFactory problemFactory) { - super(policy, problemFactory);//options, problemFactory); - } - public void abortDueToInternalError(String errorMessage) { - String[] arguments = new String[]{errorMessage}; - this.handle(IProblem.Unclassified, arguments, arguments, Error | Abort, - 0, 0); - } - public void abortDueToInternalError(String errorMessage, AstNode location) { - String[] arguments = new String[]{errorMessage}; - this.handle(IProblem.Unclassified, arguments, arguments, Error | Abort, - location.sourceStart, location.sourceEnd); - } - public void abstractMethodCannotBeOverridden(SourceTypeBinding type, - MethodBinding concreteMethod) { - this.handle( - // %1 must be abstract since it cannot override the inherited - // package-private abstract method %2 - IProblem.AbstractMethodCannotBeOverridden, new String[]{ - new String(type.sourceName()), - new String(CharOperation.concat( - concreteMethod.declaringClass.readableName(), - concreteMethod.readableName(), '.'))}, - new String[]{ - new String(type.sourceName()), - new String(CharOperation.concat( - concreteMethod.declaringClass - .shortReadableName(), concreteMethod - .shortReadableName(), '.'))}, type - .sourceStart(), type.sourceEnd()); - } - public void abstractMethodInAbstractClass(SourceTypeBinding type, - AbstractMethodDeclaration methodDecl) { - String[] arguments = new String[]{new String(type.sourceName()), - new String(methodDecl.selector)}; - this.handle(IProblem.AbstractMethodInAbstractClass, arguments, - arguments, methodDecl.sourceStart, methodDecl.sourceEnd); - } - public void abstractMethodMustBeImplemented(SourceTypeBinding type, - MethodBinding abstractMethod) { - this.handle( - // Must implement the inherited abstract method %1 - // 8.4.3 - Every non-abstract subclass of an abstract type, A, - // must provide a concrete implementation of all of A's - // methods. - IProblem.AbstractMethodMustBeImplemented, - new String[]{new String(CharOperation.concat( - abstractMethod.declaringClass.readableName(), - abstractMethod.readableName(), '.'))}, - new String[]{new String(CharOperation.concat( - abstractMethod.declaringClass.shortReadableName(), - abstractMethod.shortReadableName(), '.'))}, type - .sourceStart(), type.sourceEnd()); - } - public void abstractMethodNeedingNoBody(AbstractMethodDeclaration method) { - this.handle(IProblem.BodyForAbstractMethod, NoArgument, NoArgument, - method.sourceStart, method.sourceEnd, method, method - .compilationResult()); - } - public void alreadyDefinedLabel(char[] labelName, AstNode location) { - String[] arguments = new String[]{new String(labelName)}; - this.handle(IProblem.DuplicateLabel, arguments, arguments, - location.sourceStart, location.sourceEnd); - } - public void anonymousClassCannotExtendFinalClass(Expression expression, - TypeBinding type) { - this.handle(IProblem.AnonymousClassCannotExtendFinalClass, - new String[]{new String(type.readableName())}, - new String[]{new String(type.shortReadableName())}, - expression.sourceStart, expression.sourceEnd); - } - public void argumentTypeCannotBeVoid(SourceTypeBinding type, - AbstractMethodDeclaration methodDecl, Argument arg) { - String[] arguments = new String[]{new String(methodDecl.selector), - new String(arg.name)}; - this.handle(IProblem.ArgumentTypeCannotBeVoid, arguments, arguments, - methodDecl.sourceStart, methodDecl.sourceEnd); - } - public void argumentTypeCannotBeVoidArray(SourceTypeBinding type, - AbstractMethodDeclaration methodDecl, Argument arg) { - String[] arguments = new String[]{new String(methodDecl.selector), - new String(arg.name)}; - this.handle(IProblem.ArgumentTypeCannotBeVoidArray, arguments, - arguments, methodDecl.sourceStart, methodDecl.sourceEnd); - } - public void argumentTypeProblem(SourceTypeBinding type, - AbstractMethodDeclaration methodDecl, Argument arg, - TypeBinding expectedType) { - int problemId = expectedType.problemId(); - int id; - switch (problemId) { - case NotFound : - // 1 - id = IProblem.ArgumentTypeNotFound; - break; - case NotVisible : - // 2 - id = IProblem.ArgumentTypeNotVisible; - break; - case Ambiguous : - // 3 - id = IProblem.ArgumentTypeAmbiguous; - break; - case InternalNameProvided : - // 4 - id = IProblem.ArgumentTypeInternalNameProvided; - break; - case InheritedNameHidesEnclosingName : - // 5 - id = IProblem.ArgumentTypeInheritedNameHidesEnclosingName; - break; - case NoError : - // 0 - default : - needImplementation(); // want to fail to see why we were - // here... - return; - } - this.handle(id, new String[]{new String(methodDecl.selector), - arg.name(), new String(expectedType.readableName())}, - new String[]{new String(methodDecl.selector), arg.name(), - new String(expectedType.shortReadableName())}, - arg.type.sourceStart, arg.type.sourceEnd); - } - public void arrayConstantsOnlyInArrayInitializers(int sourceStart, - int sourceEnd) { - this.handle(IProblem.ArrayConstantsOnlyInArrayInitializers, NoArgument, - NoArgument, sourceStart, sourceEnd); - } - public void assignmentHasNoEffect(Assignment assignment, char[] name) { - String[] arguments = new String[]{new String(name)}; - this.handle(IProblem.AssignmentHasNoEffect, arguments, arguments, - assignment.sourceStart, assignment.sourceEnd); - } - public void attemptToReturnNonVoidExpression( - ReturnStatement returnStatement, TypeBinding expectedType) { - this.handle(IProblem.VoidMethodReturnsValue, new String[]{new String( - expectedType.readableName())}, new String[]{new String( - expectedType.shortReadableName())}, - returnStatement.sourceStart, returnStatement.sourceEnd); - } - public void attemptToReturnVoidValue(ReturnStatement returnStatement) { - this.handle(IProblem.MethodReturnsVoid, NoArgument, NoArgument, - returnStatement.sourceStart, returnStatement.sourceEnd); - } - //public void bytecodeExceeds64KLimit(AbstractMethodDeclaration location) - // { - // String[] arguments = new String[] {new String(location.selector), - // parametersAsString(location.binding)}; - // if (location.isConstructor()) { - // this.handle( - // IProblem.BytecodeExceeds64KLimitForConstructor, - // arguments, - // arguments, - // Error | Abort, - // location.sourceStart, - // location.sourceEnd); - // } else { - // this.handle( - // IProblem.BytecodeExceeds64KLimit, - // arguments, - // arguments, - // Error | Abort, - // location.sourceStart, - // location.sourceEnd); - // } - //} - public void bytecodeExceeds64KLimit(TypeDeclaration location) { - this.handle(IProblem.BytecodeExceeds64KLimitForClinit, NoArgument, - NoArgument, Error | Abort, location.sourceStart, - location.sourceEnd); - } - public void cannotAllocateVoidArray(Expression expression) { - this.handle(IProblem.CannotAllocateVoidArray, NoArgument, NoArgument, - expression.sourceStart, expression.sourceEnd); - } - public void cannotAssignToFinalField(FieldBinding field, AstNode location) { - this.handle(IProblem.FinalFieldAssignment, new String[]{ - (field.declaringClass == null ? "array" : new String( - field.declaringClass.readableName())), //$NON-NLS-1$ - new String(field.readableName())}, new String[]{ - (field.declaringClass == null ? "array" : new String( - field.declaringClass.shortReadableName())), //$NON-NLS-1$ - new String(field.shortReadableName())}, location.sourceStart, - location.sourceEnd); - } - public void cannotAssignToFinalLocal(LocalVariableBinding local, - AstNode location) { - String[] arguments = new String[]{new String(local.readableName())}; - this.handle(IProblem.NonBlankFinalLocalAssignment, arguments, - arguments, location.sourceStart, location.sourceEnd); - } - public void cannotAssignToFinalOuterLocal(LocalVariableBinding local, - AstNode location) { - String[] arguments = new String[]{new String(local.readableName())}; - this.handle(IProblem.FinalOuterLocalAssignment, arguments, arguments, - location.sourceStart, location.sourceEnd); - } - public void cannotDeclareLocalInterface(char[] interfaceName, - int sourceStart, int sourceEnd) { - String[] arguments = new String[]{new String(interfaceName)}; - this.handle(IProblem.CannotDefineInterfaceInLocalType, arguments, - arguments, sourceStart, sourceEnd); - } - public void cannotDefineDimensionsAndInitializer( - ArrayAllocationExpression expresssion) { - this.handle(IProblem.CannotDefineDimensionExpressionsWithInit, - NoArgument, NoArgument, expresssion.sourceStart, - expresssion.sourceEnd); - } - public void cannotDireclyInvokeAbstractMethod(MessageSend messageSend, - MethodBinding method) { - this.handle(IProblem.DirectInvocationOfAbstractMethod, new String[]{ - new String(method.declaringClass.readableName()), - new String(method.selector), parametersAsString(method)}, - new String[]{ - new String(method.declaringClass.shortReadableName()), - new String(method.selector), - parametersAsShortString(method)}, - messageSend.sourceStart, messageSend.sourceEnd); - } - public void cannotImportPackage(ImportReference importRef) { - String[] arguments = new String[]{CharOperation - .toString(importRef.tokens)}; - this.handle(IProblem.CannotImportPackage, arguments, arguments, - importRef.sourceStart, importRef.sourceEnd); - } - public void cannotInstantiate(TypeReference typeRef, TypeBinding type) { - this.handle(IProblem.InvalidClassInstantiation, - new String[]{new String(type.readableName())}, - new String[]{new String(type.shortReadableName())}, - typeRef.sourceStart, typeRef.sourceEnd); - } - public void cannotReferToNonFinalOuterLocal(LocalVariableBinding local, - AstNode location) { - String[] arguments = new String[]{new String(local.readableName())}; - this.handle(IProblem.OuterLocalMustBeFinal, arguments, arguments, - location.sourceStart, location.sourceEnd); - } - public void cannotReturnInInitializer(AstNode location) { - this.handle(IProblem.CannotReturnInInitializer, NoArgument, NoArgument, - location.sourceStart, location.sourceEnd); - } - public void cannotThrowNull(ThrowStatement statement) { - this.handle(IProblem.CannotThrowNull, NoArgument, NoArgument, - statement.sourceStart, statement.sourceEnd); - } - public void cannotThrowType(SourceTypeBinding type, - AbstractMethodDeclaration methodDecl, TypeReference exceptionType, - TypeBinding expectedType) { - this.handle(IProblem.CannotThrowType, new String[]{new String( - expectedType.readableName())}, new String[]{new String( - expectedType.shortReadableName())}, exceptionType.sourceStart, - exceptionType.sourceEnd); - } - public void cannotUseSuperInJavaLangObject(AstNode reference) { - this.handle(IProblem.ObjectHasNoSuperclass, NoArgument, NoArgument, - reference.sourceStart, reference.sourceEnd); - } - public void cannotUseSuperInCodeSnippet(int start, int end) { - this.handle(IProblem.CannotUseSuperInCodeSnippet, NoArgument, - NoArgument, Error | Abort, start, end); - } - public void caseExpressionMustBeConstant(Expression expression) { - this.handle(IProblem.NonConstantExpression, NoArgument, NoArgument, - expression.sourceStart, expression.sourceEnd); - } - public void classExtendFinalClass(SourceTypeBinding type, - TypeReference superclass, TypeBinding expectedType) { - String name = new String(type.sourceName()); - String expectedFullName = new String(expectedType.readableName()); - String expectedShortName = new String(expectedType.shortReadableName()); - if (expectedShortName.equals(name)) - expectedShortName = expectedFullName; - this.handle(IProblem.ClassExtendFinalClass, new String[]{ - expectedFullName, name}, new String[]{expectedShortName, name}, - superclass.sourceStart, superclass.sourceEnd); - } - public void codeSnippetMissingClass(String missing, int start, int end) { - String[] arguments = new String[]{missing}; - this.handle(IProblem.CodeSnippetMissingClass, arguments, arguments, - Error | Abort, start, end); - } - public void codeSnippetMissingMethod(String className, - String missingMethod, String argumentTypes, int start, int end) { - String[] arguments = new String[]{className, missingMethod, - argumentTypes}; - this.handle(IProblem.CodeSnippetMissingMethod, arguments, arguments, - Error | Abort, start, end); - } - /* - * Given the current configuration, answers which category the problem - * falls into: Error | Warning | Ignore - */ - //public int computeSeverity(int problemId){ - // - // // severity can have been preset on the problem - //// if ((problem.severity & Fatal) != 0){ - //// return Error; - //// } - // - // // if not then check whether it is a configurable problem - // int errorThreshold = options.errorThreshold; - // int warningThreshold = options.warningThreshold; - // - // switch(problemId){ - // - // case IProblem.UnreachableCatch : - // case IProblem.CodeCannotBeReached : - // if ((errorThreshold & CompilerOptions.UnreachableCode) != 0){ - // return Error; - // } - // if ((warningThreshold & CompilerOptions.UnreachableCode) != 0){ - // return Warning; - // } - // return Ignore; - // - // case IProblem.MaskedCatch : - // if ((errorThreshold & CompilerOptions.MaskedCatchBlock) != 0){ - // return Error; - // } - // if ((warningThreshold & CompilerOptions.MaskedCatchBlock) != 0){ - // return Warning; - // } - // return Ignore; - // - ///* - // case Never Used : - // if ((errorThreshold & ParsingOptionalError) != 0){ - // return Error; - // } - // if ((warningThreshold & ParsingOptionalError) != 0){ - // return Warning; - // } - // return Ignore; - //*/ - // case IProblem.ImportNotFound : - // case IProblem.ImportNotVisible : - // case IProblem.ImportAmbiguous : - // case IProblem.ImportInternalNameProvided : - // case IProblem.ImportInheritedNameHidesEnclosingName : - // case IProblem.DuplicateImport : - // case IProblem.ConflictingImport : - // case IProblem.CannotImportPackage : - // if ((errorThreshold & CompilerOptions.ImportProblem) != 0){ - // return Error; - // } - // if ((warningThreshold & CompilerOptions.ImportProblem) != 0){ - // return Warning; - // } - // return Ignore; - // - // case IProblem.UnusedImport : - // // if import problem are disabled, then ignore - // if ((errorThreshold & CompilerOptions.ImportProblem) == 0 - // && (warningThreshold & CompilerOptions.ImportProblem) == 0){ - // return Ignore; - // } - // if ((errorThreshold & CompilerOptions.UnusedImport) != 0){ - // return Error; - // } - // if ((warningThreshold & CompilerOptions.UnusedImport) != 0){ - // return Warning; - // } - // return Ignore; - // - // case IProblem.MethodButWithConstructorName : - // if ((errorThreshold & CompilerOptions.MethodWithConstructorName) != 0){ - // return Error; - // } - // if ((warningThreshold & CompilerOptions.MethodWithConstructorName) != - // 0){ - // return Warning; - // } - // return Ignore; - // - // case IProblem.OverridingNonVisibleMethod : - // if ((errorThreshold & CompilerOptions.OverriddenPackageDefaultMethod) != - // 0){ - // return Error; - // } - // if ((warningThreshold & CompilerOptions.OverriddenPackageDefaultMethod) - // != 0){ - // return Warning; - // } - // return Ignore; - // - // case IProblem.IncompatibleReturnTypeForNonInheritedInterfaceMethod : - // case - // IProblem.IncompatibleExceptionInThrowsClauseForNonInheritedInterfaceMethod - // : - // if ((errorThreshold & - // CompilerOptions.IncompatibleNonInheritedInterfaceMethod) != 0){ - // return Error; - // } - // if ((warningThreshold & - // CompilerOptions.IncompatibleNonInheritedInterfaceMethod) != 0){ - // return Warning; - // } - // return Ignore; - // - // case IProblem.OverridingDeprecatedMethod : - // case IProblem.UsingDeprecatedType : - // case IProblem.UsingDeprecatedMethod : - // case IProblem.UsingDeprecatedConstructor : - // case IProblem.UsingDeprecatedField : - // if ((errorThreshold & CompilerOptions.UsingDeprecatedAPI) != 0){ - // return Error; - // } - // if ((warningThreshold & CompilerOptions.UsingDeprecatedAPI) != 0){ - // return Warning; - // } - // return Ignore; - // - // case IProblem.LocalVariableIsNeverUsed : - // if ((errorThreshold & CompilerOptions.UnusedLocalVariable) != 0){ - // return Error; - // } - // if ((warningThreshold & CompilerOptions.UnusedLocalVariable) != 0){ - // return Warning; - // } - // return Ignore; - // - // case IProblem.ArgumentIsNeverUsed : - // if ((errorThreshold & CompilerOptions.UnusedArgument) != 0){ - // return Error; - // } - // if ((warningThreshold & CompilerOptions.UnusedArgument) != 0){ - // return Warning; - // } - // return Ignore; - // - // case IProblem.NoImplicitStringConversionForCharArrayExpression : - // if ((errorThreshold & CompilerOptions.NoImplicitStringConversion) != 0){ - // return Error; - // } - // if ((warningThreshold & CompilerOptions.NoImplicitStringConversion) != - // 0){ - // return Warning; - // } - // return Ignore; - // - // case IProblem.NeedToEmulateFieldReadAccess : - // case IProblem.NeedToEmulateFieldWriteAccess : - // case IProblem.NeedToEmulateMethodAccess : - // case IProblem.NeedToEmulateConstructorAccess : - // if ((errorThreshold & CompilerOptions.AccessEmulation) != 0){ - // return Error; - // } - // if ((warningThreshold & CompilerOptions.AccessEmulation) != 0){ - // return Warning; - // } - // return Ignore; - // case IProblem.NonExternalizedStringLiteral : - // if ((errorThreshold & CompilerOptions.NonExternalizedString) != 0){ - // return Error; - // } - // if ((warningThreshold & CompilerOptions.NonExternalizedString) != 0){ - // return Warning; - // } - // return Ignore; - // case IProblem.UseAssertAsAnIdentifier : - // if ((errorThreshold & CompilerOptions.AssertUsedAsAnIdentifier) != 0){ - // return Error; - // } - // if ((warningThreshold & CompilerOptions.AssertUsedAsAnIdentifier) != 0){ - // return Warning; - // } - // return Ignore; - // case IProblem.NonStaticAccessToStaticMethod : - // case IProblem.NonStaticAccessToStaticField : - // if ((errorThreshold & CompilerOptions.StaticAccessReceiver) != 0){ - // return Error; - // } - // if ((warningThreshold & CompilerOptions.StaticAccessReceiver) != 0){ - // return Warning; - // } - // return Ignore; - // case IProblem.AssignmentHasNoEffect: - // if ((errorThreshold & CompilerOptions.NoEffectAssignment) != 0){ - // return Error; - // } - // if ((warningThreshold & CompilerOptions.NoEffectAssignment) != 0){ - // return Warning; - // } - // return Ignore; - // case IProblem.UnusedPrivateConstructor: - // case IProblem.UnusedPrivateMethod: - // case IProblem.UnusedPrivateField: - // case IProblem.UnusedPrivateType: - // if ((errorThreshold & CompilerOptions.UnusedPrivateMember) != 0){ - // return Error; - // } - // if ((warningThreshold & CompilerOptions.UnusedPrivateMember) != 0){ - // return Warning; - // } - // return Ignore; - // - // case IProblem.Task : - // return Warning; - // default: - // return Error; - // } - //} - //public void conditionalArgumentsIncompatibleTypes(ConditionalExpression - // expression, TypeBinding trueType, TypeBinding falseType) { - // this.handle( - // IProblem.IncompatibleTypesInConditionalOperator, - // new String[] {new String(trueType.readableName()), new - // String(falseType.readableName())}, - // new String[] {new String(trueType.sourceName()), new - // String(falseType.sourceName())}, - // expression.sourceStart, - // expression.sourceEnd); - //} - public void conflictingImport(ImportReference importRef) { - String[] arguments = new String[]{CharOperation - .toString(importRef.tokens)}; - this.handle(IProblem.ConflictingImport, arguments, arguments, - importRef.sourceStart, importRef.sourceEnd); - } - public void constantOutOfFormat(NumberLiteral lit) { - // the literal is not in a correct format - // this code is called on IntLiteral and LongLiteral - // example 000811 ...the 8 is uncorrect. - if ((lit instanceof LongLiteral) || (lit instanceof IntLiteral)) { - char[] source = lit.source(); - try { - final String Radix; - final int radix; - if ((source[1] == 'x') || (source[1] == 'X')) { - radix = 16; - Radix = "Hexa"; //$NON-NLS-1$ - } else { - radix = 8; - Radix = "Octal"; //$NON-NLS-1$ - } - //look for the first digit that is incorrect - int place = -1; - label : for (int i = radix == 8 ? 1 : 2; i < source.length; i++) { - if (Character.digit(source[i], radix) == -1) { - place = i; - break label; - } - } - String[] arguments = new String[]{Radix + " " - + new String(source) + " (digit " - + new String(new char[]{source[place]}) + ")"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - this.handle(IProblem.NumericValueOutOfRange, arguments, - arguments, lit.sourceStart, lit.sourceEnd); - return; - } catch (IndexOutOfBoundsException ex) { - } - // just in case .... use a predefined error.. - // we should never come here...(except if the code changes !) - this.constantOutOfRange(lit); - } - } - public void constantOutOfRange(Literal lit) { - // lit is some how out of range of it declared type - // example - // 9999999999999999999999999999999999999999999999999999999999999999999 - String[] arguments = new String[]{new String(lit.source())}; - this.handle(IProblem.NumericValueOutOfRange, arguments, arguments, - lit.sourceStart, lit.sourceEnd); - } - public void deprecatedField(FieldBinding field, AstNode location) { - this.handle(IProblem.UsingDeprecatedField, new String[]{ - new String(field.declaringClass.readableName()), - new String(field.name)}, new String[]{ - new String(field.declaringClass.shortReadableName()), - new String(field.name)}, location.sourceStart, - location.sourceEnd); - } - public void deprecatedMethod(MethodBinding method, AstNode location) { - if (method.isConstructor()) - this.handle(IProblem.UsingDeprecatedConstructor, new String[]{ - new String(method.declaringClass.readableName()), - parametersAsString(method)}, new String[]{ - new String(method.declaringClass.shortReadableName()), - parametersAsShortString(method)}, location.sourceStart, - location.sourceEnd); - else - this.handle(IProblem.UsingDeprecatedMethod, new String[]{ - new String(method.declaringClass.readableName()), - new String(method.selector), parametersAsString(method)}, - new String[]{ - new String(method.declaringClass - .shortReadableName()), - new String(method.selector), - parametersAsShortString(method)}, - location.sourceStart, location.sourceEnd); - } - public void deprecatedType(TypeBinding type, AstNode location) { - if (location == null) - return; // 1G828DN - no type ref for synthetic arguments - this.handle(IProblem.UsingDeprecatedType, new String[]{new String(type - .readableName())}, new String[]{new String(type - .shortReadableName())}, location.sourceStart, - location.sourceEnd); - } - public void duplicateCase(Case statement, Constant constant) { - String[] arguments = new String[]{String.valueOf(constant.intValue())}; - this.handle(IProblem.DuplicateCase, arguments, arguments, - statement.sourceStart, statement.sourceEnd); - } - public void duplicateDefaultCase(DefaultCase statement) { - this.handle(IProblem.DuplicateDefaultCase, NoArgument, NoArgument, - statement.sourceStart, statement.sourceEnd); - } - public void duplicateFieldInType(SourceTypeBinding type, - FieldDeclaration fieldDecl) { - this.handle(IProblem.DuplicateField, new String[]{ - new String(type.sourceName()), fieldDecl.name()}, new String[]{ - new String(type.shortReadableName()), fieldDecl.name()}, - fieldDecl.sourceStart, fieldDecl.sourceEnd); - } - public void duplicateImport(ImportReference importRef) { - String[] arguments = new String[]{CharOperation - .toString(importRef.tokens)}; - this.handle(IProblem.DuplicateImport, arguments, arguments, - importRef.sourceStart, importRef.sourceEnd); - } - public void duplicateInitializationOfBlankFinalField(FieldBinding field, - Reference reference) { - String[] arguments = new String[]{new String(field.readableName())}; - this.handle(IProblem.DuplicateBlankFinalFieldInitialization, arguments, - arguments, reference.sourceStart, reference.sourceEnd); - } - public void duplicateInitializationOfFinalLocal(LocalVariableBinding local, - AstNode location) { - String[] arguments = new String[]{new String(local.readableName())}; - this.handle(IProblem.DuplicateFinalLocalInitialization, arguments, - arguments, location.sourceStart, location.sourceEnd); - } - public void duplicateMethodInType(SourceTypeBinding type, - AbstractMethodDeclaration methodDecl) { - String[] arguments = new String[]{new String(methodDecl.selector), - new String(type.sourceName())}; - this.handle(IProblem.DuplicateMethod, arguments, arguments, - methodDecl.sourceStart, methodDecl.sourceEnd); - } - public void duplicateModifierForField(ReferenceBinding type, - FieldDeclaration fieldDecl) { - /* - * to highlight modifiers use: this.handle( new Problem( - * DuplicateModifierForField, new String[] {fieldDecl.name()}, - * fieldDecl.modifiers.sourceStart, fieldDecl.modifiers.sourceEnd)); - */ - String[] arguments = new String[]{fieldDecl.name()}; - this.handle(IProblem.DuplicateModifierForField, arguments, arguments, - fieldDecl.sourceStart, fieldDecl.sourceEnd); - } - public void duplicateModifierForMethod(ReferenceBinding type, - AbstractMethodDeclaration methodDecl) { - this.handle(IProblem.DuplicateModifierForMethod, - new String[]{new String(type.sourceName()), - new String(methodDecl.selector)}, new String[]{ - new String(type.shortReadableName()), - new String(methodDecl.selector)}, - methodDecl.sourceStart, methodDecl.sourceEnd); - } - public void duplicateModifierForType(SourceTypeBinding type) { - String[] arguments = new String[]{new String(type.sourceName())}; - this.handle(IProblem.DuplicateModifierForType, arguments, arguments, - type.sourceStart(), type.sourceEnd()); - } - public void duplicateModifierForVariable(LocalDeclaration localDecl, - boolean complainForArgument) { - String[] arguments = new String[]{localDecl.name()}; - this.handle(complainForArgument - ? IProblem.DuplicateModifierForArgument - : IProblem.DuplicateModifierForVariable, arguments, arguments, - localDecl.sourceStart, localDecl.sourceEnd); - } - public void duplicateNestedType(TypeDeclaration typeDecl) { - String[] arguments = new String[]{new String(typeDecl.name)}; - this.handle(IProblem.DuplicateNestedType, arguments, arguments, - typeDecl.sourceStart, typeDecl.sourceEnd); - } - public void duplicateSuperinterface(SourceTypeBinding type, - TypeDeclaration typeDecl, ReferenceBinding superType) { - this.handle(IProblem.DuplicateSuperInterface, new String[]{ - new String(superType.readableName()), - new String(type.sourceName())}, new String[]{ - new String(superType.shortReadableName()), - new String(type.sourceName())}, typeDecl.sourceStart, - typeDecl.sourceEnd); - } - public void duplicateTypes(CompilationUnitDeclaration compUnitDecl, - TypeDeclaration typeDecl) { - String[] arguments = new String[]{ - new String(compUnitDecl.getFileName()), - new String(typeDecl.name)}; - this.referenceContext = typeDecl; // report the problem against the - // type not the entire compilation - // unit - this.handle(IProblem.DuplicateTypes, arguments, arguments, - typeDecl.sourceStart, typeDecl.sourceEnd, - compUnitDecl.compilationResult); - } - public void errorNoMethodFor(MessageSend messageSend, TypeBinding recType, - TypeBinding[] params) { - StringBuffer buffer = new StringBuffer(); - StringBuffer shortBuffer = new StringBuffer(); - for (int i = 0, length = params.length; i < length; i++) { - if (i != 0) { - buffer.append(", "); //$NON-NLS-1$ - shortBuffer.append(", "); //$NON-NLS-1$ - } - buffer.append(new String(params[i].readableName())); - shortBuffer.append(new String(params[i].shortReadableName())); - } - this.handle(recType.isArrayType() - ? IProblem.NoMessageSendOnArrayType - : IProblem.NoMessageSendOnBaseType, new String[]{ - new String(recType.readableName()), - new String(messageSend.selector), buffer.toString()}, - new String[]{new String(recType.shortReadableName()), - new String(messageSend.selector), - shortBuffer.toString()}, messageSend.sourceStart, - messageSend.sourceEnd); - } - public void errorThisSuperInStatic(AstNode reference) { - String[] arguments = new String[]{reference.isSuper() - ? "super" - : "this"}; //$NON-NLS-2$ //$NON-NLS-1$ - this.handle(IProblem.ThisInStaticContext, arguments, arguments, - reference.sourceStart, reference.sourceEnd); - } - public void exceptionTypeProblem(SourceTypeBinding type, - AbstractMethodDeclaration methodDecl, TypeReference exceptionType, - TypeBinding expectedType) { - int problemId = expectedType.problemId(); - int id; - switch (problemId) { - case NotFound : - // 1 - id = IProblem.ExceptionTypeNotFound; - break; - case NotVisible : - // 2 - id = IProblem.ExceptionTypeNotVisible; - break; - case Ambiguous : - // 3 - id = IProblem.ExceptionTypeAmbiguous; - break; - case InternalNameProvided : - // 4 - id = IProblem.ExceptionTypeInternalNameProvided; - break; - case InheritedNameHidesEnclosingName : - // 5 - id = IProblem.ExceptionTypeInheritedNameHidesEnclosingName; - break; - case NoError : - // 0 - default : - needImplementation(); // want to fail to see why we were - // here... - return; - } - this.handle(id, new String[]{new String(methodDecl.selector), - new String(expectedType.readableName())}, new String[]{ - new String(methodDecl.selector), - new String(expectedType.shortReadableName())}, - exceptionType.sourceStart, exceptionType.sourceEnd); - } - public void expressionShouldBeAVariable(Expression expression) { - this.handle(IProblem.ExpressionShouldBeAVariable, NoArgument, - NoArgument, expression.sourceStart, expression.sourceEnd); - } - public void fieldsOrThisBeforeConstructorInvocation(ThisReference reference) { - this.handle(IProblem.ThisSuperDuringConstructorInvocation, NoArgument, - NoArgument, reference.sourceStart, reference.sourceEnd); - } - public void fieldTypeProblem(SourceTypeBinding type, - FieldDeclaration fieldDecl, TypeBinding expectedType) { - int problemId = expectedType.problemId(); - int id; - switch (problemId) { - case NotFound : - // 1 - id = IProblem.FieldTypeNotFound; - break; - case NotVisible : - // 2 - id = IProblem.FieldTypeNotVisible; - break; - case Ambiguous : - // 3 - id = IProblem.FieldTypeAmbiguous; - break; - case InternalNameProvided : - // 4 - id = IProblem.FieldTypeInternalNameProvided; - break; - case InheritedNameHidesEnclosingName : - // 5 - id = IProblem.FieldTypeInheritedNameHidesEnclosingName; - break; - case NoError : - // 0 - default : - needImplementation(); // want to fail to see why we were - // here... - return; - } - this.handle(id, new String[]{fieldDecl.name(), - new String(type.sourceName()), - new String(expectedType.readableName())}, new String[]{ - fieldDecl.name(), new String(type.sourceName()), - new String(expectedType.shortReadableName())}, - fieldDecl.type.sourceStart, fieldDecl.type.sourceEnd); - } - public void finalMethodCannotBeOverridden(MethodBinding currentMethod, - MethodBinding inheritedMethod) { - this.handle( - // Cannot override the final method from %1 - // 8.4.3.3 - Final methods cannot be overridden or hidden. - IProblem.FinalMethodCannotBeOverridden, - new String[]{new String(inheritedMethod.declaringClass - .readableName())}, new String[]{new String( - inheritedMethod.declaringClass.shortReadableName())}, - currentMethod.sourceStart(), currentMethod.sourceEnd()); - } - public void forwardReference(Reference reference, int indexInQualification, - TypeBinding type) { - this.handle(IProblem.ReferenceToForwardField, NoArgument, NoArgument, - reference.sourceStart, reference.sourceEnd); - } - // use this private API when the compilation unit result can be found - // through the - // reference context. Otherwise, use the other API taking a problem and a - // compilation result - // as arguments - private void handle(int problemId, String[] problemArguments, - String[] messageArguments, int problemStartPosition, - int problemEndPosition) { - this.handle(problemId, problemArguments, messageArguments, - problemStartPosition, problemEndPosition, referenceContext, - referenceContext == null ? null : referenceContext - .compilationResult()); - referenceContext = null; - } - // use this private API when the compilation unit result can be found - // through the - // reference context. Otherwise, use the other API taking a problem and a - // compilation result - // as arguments - private void handle(int problemId, String[] problemArguments, - String[] messageArguments, int severity, int problemStartPosition, - int problemEndPosition) { - this.handle(problemId, problemArguments, messageArguments, severity, - problemStartPosition, problemEndPosition, referenceContext, - referenceContext == null ? null : referenceContext - .compilationResult()); - referenceContext = null; - } - // use this private API when the compilation unit result cannot be found - // through the - // reference context. - private void handle(int problemId, String[] problemArguments, - String[] messageArguments, int problemStartPosition, - int problemEndPosition, CompilationResult unitResult) { - this.handle(problemId, problemArguments, messageArguments, - problemStartPosition, problemEndPosition, referenceContext, - unitResult); - referenceContext = null; - } - public void hidingEnclosingType(TypeDeclaration typeDecl) { - String[] arguments = new String[]{new String(typeDecl.name)}; - this.handle(IProblem.HidingEnclosingType, arguments, arguments, - typeDecl.sourceStart, typeDecl.sourceEnd); - } - public void hierarchyCircularity(SourceTypeBinding sourceType, - ReferenceBinding superType, TypeReference reference) { - int start = 0; - int end = 0; - String typeName = ""; //$NON-NLS-1$ - String shortTypeName = ""; //$NON-NLS-1$ - if (reference == null) { // can only happen when java.lang.Object is - // busted - start = sourceType.sourceStart(); - end = sourceType.sourceEnd(); - typeName = new String(superType.readableName()); - shortTypeName = new String(superType.sourceName()); - } else { - start = reference.sourceStart; - end = reference.sourceEnd; - char[][] qName = reference.getTypeName(); - typeName = CharOperation.toString(qName); - shortTypeName = new String(qName[qName.length - 1]); - } - if (sourceType == superType) - this - .handle(IProblem.HierarchyCircularitySelfReference, - new String[]{new String(sourceType.sourceName()), - typeName}, new String[]{ - new String(sourceType.sourceName()), - shortTypeName}, start, end); - else - this.handle(IProblem.HierarchyCircularity, new String[]{ - new String(sourceType.sourceName()), typeName}, - new String[]{new String(sourceType.sourceName()), - shortTypeName}, start, end); - } - public void hierarchyHasProblems(SourceTypeBinding type) { - String[] arguments = new String[]{new String(type.sourceName())}; - this.handle(IProblem.HierarchyHasProblems, arguments, arguments, type - .sourceStart(), type.sourceEnd()); - } - public void illegalAbstractModifierCombinationForMethod( - ReferenceBinding type, AbstractMethodDeclaration methodDecl) { - String[] arguments = new String[]{new String(type.sourceName()), - new String(methodDecl.selector)}; - this.handle(IProblem.IllegalAbstractModifierCombinationForMethod, - arguments, arguments, methodDecl.sourceStart, - methodDecl.sourceEnd); - } - public void illegalModifierCombinationFinalAbstractForClass( - SourceTypeBinding type) { - String[] arguments = new String[]{new String(type.sourceName())}; - this.handle(IProblem.IllegalModifierCombinationFinalAbstractForClass, - arguments, arguments, type.sourceStart(), type.sourceEnd()); - } - public void illegalModifierCombinationFinalVolatileForField( - ReferenceBinding type, FieldDeclaration fieldDecl) { - String[] arguments = new String[]{fieldDecl.name()}; - this.handle(IProblem.IllegalModifierCombinationFinalVolatileForField, - arguments, arguments, fieldDecl.sourceStart, - fieldDecl.sourceEnd); - } - public void illegalModifierForClass(SourceTypeBinding type) { - String[] arguments = new String[]{new String(type.sourceName())}; - this.handle(IProblem.IllegalModifierForClass, arguments, arguments, - type.sourceStart(), type.sourceEnd()); - } - public void illegalModifierForField(ReferenceBinding type, - FieldDeclaration fieldDecl) { - String[] arguments = new String[]{fieldDecl.name()}; - this.handle(IProblem.IllegalModifierForField, arguments, arguments, - fieldDecl.sourceStart, fieldDecl.sourceEnd); - } - public void illegalModifierForInterface(SourceTypeBinding type) { - String[] arguments = new String[]{new String(type.sourceName())}; - this.handle(IProblem.IllegalModifierForInterface, arguments, arguments, - type.sourceStart(), type.sourceEnd()); - } - public void illegalModifierForInterfaceField(ReferenceBinding type, - FieldDeclaration fieldDecl) { - String[] arguments = new String[]{fieldDecl.name()}; - this.handle(IProblem.IllegalModifierForInterfaceField, arguments, - arguments, fieldDecl.sourceStart, fieldDecl.sourceEnd); - } - public void illegalModifierForInterfaceMethod(ReferenceBinding type, - AbstractMethodDeclaration methodDecl) { - String[] arguments = new String[]{new String(type.sourceName()), - new String(methodDecl.selector)}; - this.handle(IProblem.IllegalModifierForInterfaceMethod, arguments, - arguments, methodDecl.sourceStart, methodDecl.sourceEnd); - } - public void illegalModifierForLocalClass(SourceTypeBinding type) { - String[] arguments = new String[]{new String(type.sourceName())}; - this.handle(IProblem.IllegalModifierForLocalClass, arguments, - arguments, type.sourceStart(), type.sourceEnd()); - } - public void illegalModifierForMemberClass(SourceTypeBinding type) { - String[] arguments = new String[]{new String(type.sourceName())}; - this.handle(IProblem.IllegalModifierForMemberClass, arguments, - arguments, type.sourceStart(), type.sourceEnd()); - } - public void illegalModifierForMemberInterface(SourceTypeBinding type) { - String[] arguments = new String[]{new String(type.sourceName())}; - this.handle(IProblem.IllegalModifierForMemberInterface, arguments, - arguments, type.sourceStart(), type.sourceEnd()); - } - public void illegalModifierForMethod(ReferenceBinding type, - AbstractMethodDeclaration methodDecl) { - String[] arguments = new String[]{new String(type.sourceName()), - new String(methodDecl.selector)}; - this.handle(IProblem.IllegalModifierForMethod, arguments, arguments, - methodDecl.sourceStart, methodDecl.sourceEnd); - } - public void illegalModifierForVariable(LocalDeclaration localDecl, - boolean complainAsArgument) { - String[] arguments = new String[]{localDecl.name()}; - this.handle(complainAsArgument - ? IProblem.IllegalModifierForArgument - : IProblem.IllegalModifierForVariable, arguments, arguments, - localDecl.sourceStart, localDecl.sourceEnd); - } - public void illegalPrimitiveOrArrayTypeForEnclosingInstance( - TypeBinding enclosingType, AstNode location) { - this.handle(IProblem.IllegalPrimitiveOrArrayTypeForEnclosingInstance, - new String[]{new String(enclosingType.readableName())}, - new String[]{new String(enclosingType.shortReadableName())}, - location.sourceStart, location.sourceEnd); - } - public void illegalStaticModifierForMemberType(SourceTypeBinding type) { - String[] arguments = new String[]{new String(type.sourceName())}; - this.handle(IProblem.IllegalStaticModifierForMemberType, arguments, - arguments, type.sourceStart(), type.sourceEnd()); - } - public void illegalVisibilityModifierCombinationForField( - ReferenceBinding type, FieldDeclaration fieldDecl) { - String[] arguments = new String[]{new String(fieldDecl.name())}; - this.handle(IProblem.IllegalVisibilityModifierCombinationForField, - arguments, arguments, fieldDecl.sourceStart, - fieldDecl.sourceEnd); - } - public void illegalVisibilityModifierCombinationForMemberType( - SourceTypeBinding type) { - String[] arguments = new String[]{new String(type.sourceName())}; - this.handle(IProblem.IllegalVisibilityModifierCombinationForMemberType, - arguments, arguments, type.sourceStart(), type.sourceEnd()); - } - public void illegalVisibilityModifierCombinationForMethod( - ReferenceBinding type, AbstractMethodDeclaration methodDecl) { - String[] arguments = new String[]{new String(type.sourceName()), - new String(methodDecl.selector)}; - this.handle(IProblem.IllegalVisibilityModifierCombinationForMethod, - arguments, arguments, methodDecl.sourceStart, - methodDecl.sourceEnd); - } - public void illegalVisibilityModifierForInterfaceMemberType( - SourceTypeBinding type) { - String[] arguments = new String[]{new String(type.sourceName())}; - this.handle(IProblem.IllegalVisibilityModifierForInterfaceMemberType, - arguments, arguments, type.sourceStart(), type.sourceEnd()); - } - public void illegalVoidExpression(AstNode location) { - this.handle(IProblem.InvalidVoidExpression, NoArgument, NoArgument, - location.sourceStart, location.sourceEnd); - } - public void importProblem(ImportReference importRef, Binding expectedImport) { - int problemId = expectedImport.problemId(); - int id; - switch (problemId) { - case NotFound : - // 1 - id = IProblem.ImportNotFound; - break; - case NotVisible : - // 2 - id = IProblem.ImportNotVisible; - break; - case Ambiguous : - // 3 - id = IProblem.ImportAmbiguous; - break; - case InternalNameProvided : - // 4 - id = IProblem.ImportInternalNameProvided; - break; - case InheritedNameHidesEnclosingName : - // 5 - id = IProblem.ImportInheritedNameHidesEnclosingName; - break; - case NoError : - // 0 - default : - needImplementation(); // want to fail to see why we were - // here... - return; - } - String argument; - if (expectedImport instanceof ProblemReferenceBinding) { - argument = CharOperation - .toString(((ProblemReferenceBinding) expectedImport).compoundName); - } else { - argument = CharOperation.toString(importRef.tokens); - } - String[] arguments = new String[]{argument}; - this.handle(id, arguments, arguments, importRef.sourceStart, - importRef.sourceEnd); - } - public void incompatibleExceptionInThrowsClause(SourceTypeBinding type, - MethodBinding currentMethod, MethodBinding inheritedMethod, - ReferenceBinding exceptionType) { - if (type == currentMethod.declaringClass) { - int id; - if (currentMethod.declaringClass.isInterface() - && !inheritedMethod.isPublic()) { // interface inheriting - // Object protected - // method - id = IProblem.IncompatibleExceptionInThrowsClauseForNonInheritedInterfaceMethod; - } else { - id = IProblem.IncompatibleExceptionInThrowsClause; - } - this - .handle( - // Exception %1 is not compatible with throws - // clause in %2 - // 9.4.4 - The type of exception in the throws - // clause is incompatible. - id, - new String[]{ - new String(exceptionType.sourceName()), - new String( - CharOperation - .concat( - inheritedMethod.declaringClass - .readableName(), - inheritedMethod - .readableName(), - '.'))}, - new String[]{ - new String(exceptionType.sourceName()), - new String( - CharOperation - .concat( - inheritedMethod.declaringClass - .shortReadableName(), - inheritedMethod - .shortReadableName(), - '.'))}, - currentMethod.sourceStart(), currentMethod - .sourceEnd()); - } else - this - .handle( - // Exception %1 in throws clause of %2 is not - // compatible with %3 - // 9.4.4 - The type of exception in the throws - // clause is incompatible. - IProblem.IncompatibleExceptionInInheritedMethodThrowsClause, - new String[]{ - new String(exceptionType.sourceName()), - new String(CharOperation.concat( - currentMethod.declaringClass - .sourceName(), - currentMethod.readableName(), '.')), - new String( - CharOperation - .concat( - inheritedMethod.declaringClass - .readableName(), - inheritedMethod - .readableName(), - '.'))}, - new String[]{ - new String(exceptionType.sourceName()), - new String(CharOperation.concat( - currentMethod.declaringClass - .sourceName(), - currentMethod.shortReadableName(), - '.')), - new String( - CharOperation - .concat( - inheritedMethod.declaringClass - .shortReadableName(), - inheritedMethod - .shortReadableName(), - '.'))}, type - .sourceStart(), type.sourceEnd()); - } - public void incompatibleReturnType(MethodBinding currentMethod, - MethodBinding inheritedMethod) { - StringBuffer methodSignature = new StringBuffer(); - methodSignature.append(inheritedMethod.declaringClass.readableName()) - .append('.').append(inheritedMethod.readableName()); - StringBuffer shortSignature = new StringBuffer(); - shortSignature.append( - inheritedMethod.declaringClass.shortReadableName()).append('.') - .append(inheritedMethod.shortReadableName()); - int id; - if (currentMethod.declaringClass.isInterface() - && !inheritedMethod.isPublic()) { // interface inheriting - // Object protected method - id = IProblem.IncompatibleReturnTypeForNonInheritedInterfaceMethod; - } else { - id = IProblem.IncompatibleReturnType; - } - this.handle(id, new String[]{methodSignature.toString()}, - new String[]{shortSignature.toString()}, currentMethod - .sourceStart(), currentMethod.sourceEnd()); - } - public void incorrectLocationForEmptyDimension( - ArrayAllocationExpression expression, int index) { - this.handle(IProblem.IllegalDimension, NoArgument, NoArgument, - expression.dimensions[index + 1].sourceStart, - expression.dimensions[index + 1].sourceEnd); - } - public void incorrectSwitchType(Expression expression, TypeBinding testType) { - this.handle(IProblem.IncorrectSwitchType, new String[]{new String( - testType.readableName())}, new String[]{new String(testType - .shortReadableName())}, expression.sourceStart, - expression.sourceEnd); - } - public void inheritedMethodReducesVisibility(SourceTypeBinding type, - MethodBinding concreteMethod, MethodBinding[] abstractMethods) { - StringBuffer concreteSignature = new StringBuffer(); - concreteSignature.append(concreteMethod.declaringClass.readableName()) - .append('.').append(concreteMethod.readableName()); - StringBuffer shortSignature = new StringBuffer(); - shortSignature - .append(concreteMethod.declaringClass.shortReadableName()) - .append('.').append(concreteMethod.shortReadableName()); - this.handle( - // The inherited method %1 cannot hide the public abstract method in %2 - IProblem.InheritedMethodReducesVisibility, new String[]{ - new String(concreteSignature.toString()), - new String(abstractMethods[0].declaringClass - .readableName())}, new String[]{ - new String(shortSignature.toString()), - new String(abstractMethods[0].declaringClass - .shortReadableName())}, type.sourceStart(), - type.sourceEnd()); - } - public void inheritedMethodsHaveIncompatibleReturnTypes( - SourceTypeBinding type, MethodBinding[] inheritedMethods, int length) { - StringBuffer methodSignatures = new StringBuffer(); - StringBuffer shortSignatures = new StringBuffer(); - for (int i = length; --i >= 0;) { - methodSignatures.append( - inheritedMethods[i].declaringClass.readableName()).append( - '.').append(inheritedMethods[i].readableName()); - shortSignatures.append( - inheritedMethods[i].declaringClass.shortReadableName()) - .append('.') - .append(inheritedMethods[i].shortReadableName()); - if (i != 0) { - methodSignatures.append(", "); //$NON-NLS-1$ - shortSignatures.append(", "); //$NON-NLS-1$ - } - } - this.handle( - // Return type is incompatible with %1 - // 9.4.2 - The return type from the method is incompatible with - // the declaration. - IProblem.IncompatibleReturnType, new String[]{methodSignatures - .toString()}, new String[]{shortSignatures.toString()}, - type.sourceStart(), type.sourceEnd()); - } - public void initializerMustCompleteNormally(FieldDeclaration fieldDecl) { - this.handle(IProblem.InitializerMustCompleteNormally, NoArgument, - NoArgument, fieldDecl.sourceStart, fieldDecl.sourceEnd); - } - public void innerTypesCannotDeclareStaticInitializers( - ReferenceBinding innerType, AstNode location) { - this.handle(IProblem.CannotDefineStaticInitializerInLocalType, - new String[]{new String(innerType.readableName())}, - new String[]{new String(innerType.shortReadableName())}, - location.sourceStart, location.sourceEnd); - } - public void interfaceCannotHaveConstructors( - ConstructorDeclaration constructor) { - this.handle(IProblem.InterfaceCannotHaveConstructors, NoArgument, - NoArgument, constructor.sourceStart, constructor.sourceEnd, - constructor, constructor.compilationResult()); - } - public void interfaceCannotHaveInitializers(SourceTypeBinding type, - FieldDeclaration fieldDecl) { - String[] arguments = new String[]{new String(type.sourceName())}; - this.handle(IProblem.InterfaceCannotHaveInitializers, arguments, - arguments, fieldDecl.sourceStart, fieldDecl.sourceEnd); - } - public void invalidBreak(AstNode location) { - this.handle(IProblem.InvalidBreak, NoArgument, NoArgument, - location.sourceStart, location.sourceEnd); - } - public void invalidConstructor(Statement statement, - MethodBinding targetConstructor) { - boolean insideDefaultConstructor = (referenceContext instanceof ConstructorDeclaration) - && ((ConstructorDeclaration) referenceContext) - .isDefaultConstructor(); - boolean insideImplicitConstructorCall = (statement instanceof ExplicitConstructorCall) - && (((ExplicitConstructorCall) statement).accessMode == ExplicitConstructorCall.ImplicitSuper); - int flag = IProblem.UndefinedConstructor; //default... - switch (targetConstructor.problemId()) { - case NotFound : - if (insideDefaultConstructor) { - flag = IProblem.UndefinedConstructorInDefaultConstructor; - } else if (insideImplicitConstructorCall) { - flag = IProblem.UndefinedConstructorInImplicitConstructorCall; - } else { - flag = IProblem.UndefinedConstructor; - } - break; - case NotVisible : - if (insideDefaultConstructor) { - flag = IProblem.NotVisibleConstructorInDefaultConstructor; - } else if (insideImplicitConstructorCall) { - flag = IProblem.NotVisibleConstructorInImplicitConstructorCall; - } else { - flag = IProblem.NotVisibleConstructor; - } - break; - case Ambiguous : - if (insideDefaultConstructor) { - flag = IProblem.AmbiguousConstructorInDefaultConstructor; - } else if (insideImplicitConstructorCall) { - flag = IProblem.AmbiguousConstructorInImplicitConstructorCall; - } else { - flag = IProblem.AmbiguousConstructor; - } - break; - case NoError : - // 0 - default : - needImplementation(); // want to fail to see why we were - // here... - break; - } - this.handle(flag, new String[]{ - new String(targetConstructor.declaringClass.readableName()), - parametersAsString(targetConstructor)}, - new String[]{ - new String(targetConstructor.declaringClass - .shortReadableName()), - parametersAsShortString(targetConstructor)}, - statement.sourceStart, statement.sourceEnd); - } - public void invalidContinue(AstNode location) { - this.handle(IProblem.InvalidContinue, NoArgument, NoArgument, - location.sourceStart, location.sourceEnd); - } - public void invalidEnclosingType(Expression expression, TypeBinding type, - ReferenceBinding enclosingType) { - if (enclosingType.isAnonymousType()) - enclosingType = enclosingType.superclass(); - int flag = IProblem.UndefinedType; // default - switch (type.problemId()) { - case NotFound : - // 1 - flag = IProblem.UndefinedType; - break; - case NotVisible : - // 2 - flag = IProblem.NotVisibleType; - break; - case Ambiguous : - // 3 - flag = IProblem.AmbiguousType; - break; - case InternalNameProvided : - flag = IProblem.InternalTypeNameProvided; - break; - case NoError : - // 0 - default : - needImplementation(); // want to fail to see why we were - // here... - break; - } - this.handle(flag, new String[]{new String(enclosingType.readableName()) - + "." + new String(type.readableName())}, //$NON-NLS-1$ - new String[]{new String(enclosingType.shortReadableName()) - + "." + new String(type.shortReadableName())}, //$NON-NLS-1$ - expression.sourceStart, expression.sourceEnd); - } - public void invalidExpressionAsStatement(Expression expression) { - this.handle(IProblem.InvalidExpressionAsStatement, NoArgument, - NoArgument, expression.sourceStart, expression.sourceEnd); - } - public void invalidField(FieldReference fieldRef, TypeBinding searchedType) { - int severity = Error; - int flag = IProblem.UndefinedField; - FieldBinding field = fieldRef.binding; - switch (field.problemId()) { - case NotFound : - flag = IProblem.UndefinedField; - /* - * also need to check that the searchedType is the receiver - * type if (searchedType.isHierarchyInconsistent()) severity = - * SecondaryError; - */ - break; - case NotVisible : - flag = IProblem.NotVisibleField; - break; - case Ambiguous : - flag = IProblem.AmbiguousField; - break; - case NonStaticReferenceInStaticContext : - flag = IProblem.NonStaticFieldFromStaticInvocation; - break; - case NonStaticReferenceInConstructorInvocation : - flag = IProblem.InstanceFieldDuringConstructorInvocation; - break; - case InheritedNameHidesEnclosingName : - flag = IProblem.InheritedFieldHidesEnclosingName; - break; - case ReceiverTypeNotVisible : - this.handle(IProblem.NotVisibleType, new String[]{new String( - searchedType.leafComponentType().readableName())}, - new String[]{new String(searchedType - .leafComponentType().shortReadableName())}, - fieldRef.receiver.sourceStart, - fieldRef.receiver.sourceEnd); - return; - case NoError : - // 0 - default : - needImplementation(); // want to fail to see why we were - // here... - break; - } - String[] arguments = new String[]{new String(field.readableName())}; - this.handle(flag, arguments, arguments, severity, fieldRef.sourceStart, - fieldRef.sourceEnd); - } - public void invalidField(NameReference nameRef, FieldBinding field) { - int flag = IProblem.UndefinedField; - switch (field.problemId()) { - case NotFound : - flag = IProblem.UndefinedField; - break; - case NotVisible : - flag = IProblem.NotVisibleField; - break; - case Ambiguous : - flag = IProblem.AmbiguousField; - break; - case NonStaticReferenceInStaticContext : - flag = IProblem.NonStaticFieldFromStaticInvocation; - break; - case NonStaticReferenceInConstructorInvocation : - flag = IProblem.InstanceFieldDuringConstructorInvocation; - break; - case InheritedNameHidesEnclosingName : - flag = IProblem.InheritedFieldHidesEnclosingName; - break; - case ReceiverTypeNotVisible : - this.handle(IProblem.NotVisibleType, - new String[]{new String(field.declaringClass - .leafComponentType().readableName())}, - new String[]{new String(field.declaringClass - .leafComponentType().shortReadableName())}, - nameRef.sourceStart, nameRef.sourceEnd); - return; - case NoError : - // 0 - default : - needImplementation(); // want to fail to see why we were - // here... - break; - } - String[] arguments = new String[]{new String(field.readableName())}; - this.handle(flag, arguments, arguments, nameRef.sourceStart, - nameRef.sourceEnd); - } - public void invalidField(QualifiedNameReference nameRef, - FieldBinding field, int index, TypeBinding searchedType) { - //the resolution of the index-th field of qname failed - //qname.otherBindings[index] is the binding that has produced the - // error - //The different targetted errors should be : - //UndefinedField - //NotVisibleField - //AmbiguousField - if (searchedType.isBaseType()) { - this.handle(IProblem.NoFieldOnBaseType, new String[]{ - new String(searchedType.readableName()), - CharOperation.toString(CharOperation.subarray( - nameRef.tokens, 0, index)), - new String(nameRef.tokens[index])}, new String[]{ - new String(searchedType.sourceName()), - CharOperation.toString(CharOperation.subarray( - nameRef.tokens, 0, index)), - new String(nameRef.tokens[index])}, nameRef.sourceStart, - nameRef.sourceEnd); - return; - } - int flag = IProblem.UndefinedField; - switch (field.problemId()) { - case NotFound : - flag = IProblem.UndefinedField; - /* - * also need to check that the searchedType is the receiver - * type if (searchedType.isHierarchyInconsistent()) severity = - * SecondaryError; - */ - break; - case NotVisible : - flag = IProblem.NotVisibleField; - break; - case Ambiguous : - flag = IProblem.AmbiguousField; - break; - case NonStaticReferenceInStaticContext : - flag = IProblem.NonStaticFieldFromStaticInvocation; - break; - case NonStaticReferenceInConstructorInvocation : - flag = IProblem.InstanceFieldDuringConstructorInvocation; - break; - case InheritedNameHidesEnclosingName : - flag = IProblem.InheritedFieldHidesEnclosingName; - break; - case ReceiverTypeNotVisible : - this.handle(IProblem.NotVisibleType, new String[]{new String( - searchedType.leafComponentType().readableName())}, - new String[]{new String(searchedType - .leafComponentType().shortReadableName())}, - nameRef.sourceStart, nameRef.sourceEnd); - return; - case NoError : - // 0 - default : - needImplementation(); // want to fail to see why we were - // here... - break; - } - String[] arguments = new String[]{CharOperation.toString(CharOperation - .subarray(nameRef.tokens, 0, index + 1))}; - this.handle(flag, arguments, arguments, nameRef.sourceStart, - nameRef.sourceEnd); - } - public void invalidMethod(MessageSend messageSend, MethodBinding method) { - // CODE should be UPDATED according to error coding in the different - // method binding errors - // The different targetted errors should be : - // UndefinedMethod - // NotVisibleMethod - // AmbiguousMethod - // InheritedNameHidesEnclosingName - // InstanceMethodDuringConstructorInvocation - // StaticMethodRequested - int flag = IProblem.UndefinedMethod; //default... - switch (method.problemId()) { - case NotFound : - flag = IProblem.UndefinedMethod; - break; - case NotVisible : - flag = IProblem.NotVisibleMethod; - break; - case Ambiguous : - flag = IProblem.AmbiguousMethod; - break; - case InheritedNameHidesEnclosingName : - flag = IProblem.InheritedMethodHidesEnclosingName; - break; - case NonStaticReferenceInConstructorInvocation : - flag = IProblem.InstanceMethodDuringConstructorInvocation; - break; - case NonStaticReferenceInStaticContext : - flag = IProblem.StaticMethodRequested; - break; - case ReceiverTypeNotVisible : - this.handle(IProblem.NotVisibleType, new String[]{new String( - method.declaringClass.leafComponentType() - .readableName())}, new String[]{new String( - method.declaringClass.leafComponentType() - .shortReadableName())}, - messageSend.receiver.sourceStart, - messageSend.receiver.sourceEnd); - return; - case NoError : - // 0 - default : - needImplementation(); // want to fail to see why we were - // here... - break; - } - if (flag == IProblem.UndefinedMethod) { - ProblemMethodBinding problemMethod = (ProblemMethodBinding) method; - if (problemMethod.closestMatch != null) { - String closestParameterTypeNames = parametersAsString(problemMethod.closestMatch); - String parameterTypeNames = parametersAsString(method); - String closestParameterTypeShortNames = parametersAsShortString(problemMethod.closestMatch); - String parameterTypeShortNames = parametersAsShortString(method); - if (closestParameterTypeShortNames - .equals(parameterTypeShortNames)) { - closestParameterTypeShortNames = closestParameterTypeNames; - parameterTypeShortNames = parameterTypeNames; - } - this - .handle( - IProblem.ParameterMismatch, - new String[]{ - new String( - problemMethod.closestMatch.declaringClass - .readableName()), - new String( - problemMethod.closestMatch.selector), - closestParameterTypeNames, - parameterTypeNames}, - new String[]{ - new String( - problemMethod.closestMatch.declaringClass - .shortReadableName()), - new String( - problemMethod.closestMatch.selector), - closestParameterTypeShortNames, - parameterTypeShortNames}, - (int) (messageSend.nameSourcePosition >>> 32), - (int) messageSend.nameSourcePosition); - return; - } - } - this.handle(flag, new String[]{ - new String(method.declaringClass.readableName()), - new String(method.selector), parametersAsString(method)}, - new String[]{ - new String(method.declaringClass.shortReadableName()), - new String(method.selector), - parametersAsShortString(method)}, - (int) (messageSend.nameSourcePosition >>> 32), - (int) messageSend.nameSourcePosition); - } - public void invalidNullToSynchronize(Expression expression) { - this.handle(IProblem.InvalidNullToSynchronized, NoArgument, NoArgument, - expression.sourceStart, expression.sourceEnd); - } - public void invalidOperator(BinaryExpression expression, - TypeBinding leftType, TypeBinding rightType) { - String leftName = new String(leftType.readableName()); - String rightName = new String(rightType.readableName()); - String leftShortName = new String(leftType.shortReadableName()); - String rightShortName = new String(rightType.shortReadableName()); - if (leftShortName.equals(rightShortName)) { - leftShortName = leftName; - rightShortName = rightName; - } - this.handle(IProblem.InvalidOperator, new String[]{ - expression.operatorToString(), leftName + ", " + rightName}, //$NON-NLS-1$ - new String[]{expression.operatorToString(), - leftShortName + ", " + rightShortName}, //$NON-NLS-1$ - expression.sourceStart, expression.sourceEnd); - } - public void invalidOperator(CompoundAssignment assign, - TypeBinding leftType, TypeBinding rightType) { - String leftName = new String(leftType.readableName()); - String rightName = new String(rightType.readableName()); - String leftShortName = new String(leftType.shortReadableName()); - String rightShortName = new String(rightType.shortReadableName()); - if (leftShortName.equals(rightShortName)) { - leftShortName = leftName; - rightShortName = rightName; - } - this.handle(IProblem.InvalidOperator, new String[]{ - assign.operatorToString(), leftName + ", " + rightName}, //$NON-NLS-1$ - new String[]{assign.operatorToString(), - leftShortName + ", " + rightShortName}, //$NON-NLS-1$ - assign.sourceStart, assign.sourceEnd); - } - public void invalidOperator(UnaryExpression expression, TypeBinding type) { - this.handle(IProblem.InvalidOperator, - new String[]{expression.operatorToString(), - new String(type.readableName())}, new String[]{ - expression.operatorToString(), - new String(type.shortReadableName())}, - expression.sourceStart, expression.sourceEnd); - } - public void invalidParenthesizedExpression(AstNode reference) { - this.handle(IProblem.InvalidParenthesizedExpression, NoArgument, - NoArgument, reference.sourceStart, reference.sourceEnd); - } - public void invalidSuperclass(SourceTypeBinding type, - TypeReference superclassRef, ReferenceBinding expectedType) { - int problemId = expectedType.problemId(); - int id; - switch (problemId) { - case NotFound : - // 1 - id = IProblem.SuperclassNotFound; - break; - case NotVisible : - // 2 - id = IProblem.SuperclassNotVisible; - break; - case Ambiguous : - // 3 - id = IProblem.SuperclassAmbiguous; - break; - case InternalNameProvided : - // 4 - id = IProblem.SuperclassInternalNameProvided; - break; - case InheritedNameHidesEnclosingName : - // 5 - id = IProblem.SuperclassInheritedNameHidesEnclosingName; - break; - case NoError : - // 0 - default : - needImplementation(); // want to fail to see why we were - // here... - return; - } - this.handle(id, new String[]{new String(expectedType.readableName()), - new String(type.sourceName())}, new String[]{ - new String(expectedType.shortReadableName()), - new String(type.sourceName())}, superclassRef.sourceStart, - superclassRef.sourceEnd); - } - public void invalidSuperinterface(SourceTypeBinding type, - TypeReference superinterfaceRef, ReferenceBinding expectedType) { - int problemId = expectedType.problemId(); - int id; - switch (problemId) { - case NotFound : - // 1 - id = IProblem.InterfaceNotFound; - break; - case NotVisible : - // 2 - id = IProblem.InterfaceNotVisible; - break; - case Ambiguous : - // 3 - id = IProblem.InterfaceAmbiguous; - break; - case InternalNameProvided : - // 4 - id = IProblem.InterfaceInternalNameProvided; - break; - case InheritedNameHidesEnclosingName : - // 5 - id = IProblem.InterfaceInheritedNameHidesEnclosingName; - break; - case NoError : - // 0 - default : - needImplementation(); // want to fail to see why we were - // here... - return; - } - this.handle(id, new String[]{new String(expectedType.readableName()), - new String(type.sourceName())}, new String[]{ - new String(expectedType.shortReadableName()), - new String(type.sourceName())}, superinterfaceRef.sourceStart, - superinterfaceRef.sourceEnd); - } - public void invalidType(AstNode location, TypeBinding type) { - int flag = IProblem.UndefinedType; // default - switch (type.problemId()) { - case NotFound : - flag = IProblem.UndefinedType; - break; - case NotVisible : - flag = IProblem.NotVisibleType; - break; - case Ambiguous : - flag = IProblem.AmbiguousType; - break; - case InternalNameProvided : - flag = IProblem.InternalTypeNameProvided; - break; - case InheritedNameHidesEnclosingName : - flag = IProblem.InheritedTypeHidesEnclosingName; - break; - case NoError : - // 0 - default : - needImplementation(); // want to fail to see why we were - // here... - break; - } - this.handle(flag, new String[]{new String(type.readableName())}, - new String[]{new String(type.shortReadableName())}, - location.sourceStart, location.sourceEnd); - } - public void invalidTypeReference(Expression expression) { - this.handle(IProblem.InvalidTypeExpression, NoArgument, NoArgument, - expression.sourceStart, expression.sourceEnd); - } - public void invalidTypeToSynchronize(Expression expression, TypeBinding type) { - this.handle(IProblem.InvalidTypeToSynchronized, - new String[]{new String(type.readableName())}, - new String[]{new String(type.shortReadableName())}, - expression.sourceStart, expression.sourceEnd); - } - public void invalidUnaryExpression(Expression expression) { - this.handle(IProblem.InvalidUnaryExpression, NoArgument, NoArgument, - expression.sourceStart, expression.sourceEnd); - } - public void isClassPathCorrect(char[][] wellKnownTypeName, - CompilationUnitDeclaration compUnitDecl) { - referenceContext = compUnitDecl; - String[] arguments = new String[]{CharOperation - .toString(wellKnownTypeName)}; - this.handle(IProblem.IsClassPathCorrect, arguments, arguments, - AbortCompilation | Error, compUnitDecl == null - ? 0 - : compUnitDecl.sourceStart, compUnitDecl == null - ? 1 - : compUnitDecl.sourceEnd); - } - public void maskedExceptionHandler(ReferenceBinding exceptionType, - AstNode location) { - this.handle(IProblem.MaskedCatch, NoArgument, NoArgument, - location.sourceStart, location.sourceEnd); - } - public void methodNeedingAbstractModifier(MethodDeclaration methodDecl) { - this.handle(IProblem.MethodRequiresBody, NoArgument, NoArgument, - methodDecl.sourceStart, methodDecl.sourceEnd); - } - public void methodNeedingNoBody(MethodDeclaration methodDecl) { - this.handle( - // ((methodDecl.modifiers & CompilerModifiers.AccNative) != 0) ? - // IProblem.BodyForNativeMethod : IProblem.BodyForAbstractMethod, - IProblem.BodyForAbstractMethod, NoArgument, NoArgument, - methodDecl.sourceStart, methodDecl.sourceEnd); - } - public void methodWithConstructorName(MethodDeclaration methodDecl) { - this.handle(IProblem.MethodButWithConstructorName, NoArgument, - NoArgument, methodDecl.sourceStart, methodDecl.sourceEnd); - } - //public void missingEnclosingInstanceSpecification(ReferenceBinding - // enclosingType, AstNode location) { - // boolean insideConstructorCall = - // (location instanceof ExplicitConstructorCall) - // && (((ExplicitConstructorCall) location).accessMode == - // ExplicitConstructorCall.ImplicitSuper); - // - // this.handle( - // insideConstructorCall - // ? IProblem.MissingEnclosingInstanceForConstructorCall - // : IProblem.MissingEnclosingInstance, - // new String[] {new String(enclosingType.readableName())}, - // new String[] {new String(enclosingType.shortReadableName())}, - // location.sourceStart, - // location.sourceEnd); - //} - public void missingReturnType(AbstractMethodDeclaration methodDecl) { - this.handle(IProblem.MissingReturnType, NoArgument, NoArgument, - methodDecl.sourceStart, methodDecl.sourceEnd); - } - public void missingSemiColon(Expression expression) { - this.handle(IProblem.MissingSemiColon, NoArgument, NoArgument, - expression.sourceStart, expression.sourceEnd); - } - public void mustDefineDimensionsOrInitializer( - ArrayAllocationExpression expression) { - this.handle(IProblem.MustDefineEitherDimensionExpressionsOrInitializer, - NoArgument, NoArgument, expression.sourceStart, - expression.sourceEnd); - } - public void mustSpecifyPackage(CompilationUnitDeclaration compUnitDecl) { - String[] arguments = new String[]{new String(compUnitDecl.getFileName())}; - this.handle(IProblem.MustSpecifyPackage, arguments, arguments, - compUnitDecl.sourceStart, compUnitDecl.sourceStart + 1); - } - public void mustUseAStaticMethod(MessageSend messageSend, - MethodBinding method) { - this.handle(IProblem.StaticMethodRequested, new String[]{ - new String(method.declaringClass.readableName()), - new String(method.selector), parametersAsString(method)}, - new String[]{ - new String(method.declaringClass.shortReadableName()), - new String(method.selector), - parametersAsShortString(method)}, - messageSend.sourceStart, messageSend.sourceEnd); - } - public void nativeMethodsCannotBeStrictfp(ReferenceBinding type, - AbstractMethodDeclaration methodDecl) { - String[] arguments = new String[]{new String(type.sourceName()), - new String(methodDecl.selector)}; - this.handle(IProblem.NativeMethodsCannotBeStrictfp, arguments, - arguments, methodDecl.sourceStart, methodDecl.sourceEnd); - } - public void needImplementation() { - this.abortDueToInternalError(Util.bind("abort.missingCode")); //$NON-NLS-1$ - } - public void needToEmulateFieldReadAccess(FieldBinding field, - AstNode location) { - this.handle(IProblem.NeedToEmulateFieldReadAccess, new String[]{ - new String(field.declaringClass.readableName()), - new String(field.name)}, new String[]{ - new String(field.declaringClass.shortReadableName()), - new String(field.name)}, location.sourceStart, - location.sourceEnd); - } - public void needToEmulateFieldWriteAccess(FieldBinding field, - AstNode location) { - this.handle(IProblem.NeedToEmulateFieldWriteAccess, new String[]{ - new String(field.declaringClass.readableName()), - new String(field.name)}, new String[]{ - new String(field.declaringClass.shortReadableName()), - new String(field.name)}, location.sourceStart, - location.sourceEnd); - } - public void needToEmulateMethodAccess(MethodBinding method, AstNode location) { - if (method.isConstructor()) - this.handle(IProblem.NeedToEmulateConstructorAccess, new String[]{ - new String(method.declaringClass.readableName()), - parametersAsString(method)}, new String[]{ - new String(method.declaringClass.shortReadableName()), - parametersAsShortString(method)}, location.sourceStart, - location.sourceEnd); - else - this.handle(IProblem.NeedToEmulateMethodAccess, new String[]{ - new String(method.declaringClass.readableName()), - new String(method.selector), parametersAsString(method)}, - new String[]{ - new String(method.declaringClass - .shortReadableName()), - new String(method.selector), - parametersAsShortString(method)}, - location.sourceStart, location.sourceEnd); - } - public void nestedClassCannotDeclareInterface(TypeDeclaration typeDecl) { - String[] arguments = new String[]{new String(typeDecl.name)}; - this.handle(IProblem.CannotDefineInterfaceInLocalType, arguments, - arguments, typeDecl.sourceStart, typeDecl.sourceEnd); - } - public void noMoreAvailableSpaceForArgument(LocalVariableBinding local, - AstNode location) { - String[] arguments = new String[]{new String(local.name)}; - this.handle(local instanceof SyntheticArgumentBinding - ? IProblem.TooManySyntheticArgumentSlots - : IProblem.TooManyArgumentSlots, arguments, arguments, Abort - | Error, location.sourceStart, location.sourceEnd); - } - public void noMoreAvailableSpaceForLocal(LocalVariableBinding local, - AstNode location) { - String[] arguments = new String[]{new String(local.name)}; - this.handle(IProblem.TooManyLocalVariableSlots, arguments, arguments, - Abort | Error, location.sourceStart, location.sourceEnd); - } - public void noSuchEnclosingInstance(TypeBinding targetType, - AstNode location, boolean isConstructorCall) { - int id; - if (isConstructorCall) { - //28 = No enclosing instance of type {0} is available due to some - // intermediate constructor invocation - id = IProblem.EnclosingInstanceInConstructorCall; - } else if ((location instanceof ExplicitConstructorCall) - && ((ExplicitConstructorCall) location).accessMode == ExplicitConstructorCall.ImplicitSuper) { - //20 = No enclosing instance of type {0} is accessible to invoke - // the super constructor. Must define a constructor and explicitly - // qualify its super constructor invocation with an instance of {0} - // (e.g. x.super() where x is an instance of {0}). - id = IProblem.MissingEnclosingInstanceForConstructorCall; - } else if (location instanceof AllocationExpression - && (((AllocationExpression) location).binding.declaringClass - .isMemberType() || (((AllocationExpression) location).binding.declaringClass - .isAnonymousType() && ((AllocationExpression) location).binding.declaringClass - .superclass().isMemberType()))) { - //21 = No enclosing instance of type {0} is accessible. Must - // qualify the allocation with an enclosing instance of type {0} - // (e.g. x.new A() where x is an instance of {0}). - id = IProblem.MissingEnclosingInstance; - } else { // default - //22 = No enclosing instance of the type {0} is accessible in - // scope - id = IProblem.IncorrectEnclosingInstanceReference; - } - this.handle(id, new String[]{new String(targetType.readableName())}, - new String[]{new String(targetType.shortReadableName())}, - location.sourceStart, location.sourceEnd); - } - public void notCompatibleTypesError(EqualExpression expression, - TypeBinding leftType, TypeBinding rightType) { - String leftName = new String(leftType.readableName()); - String rightName = new String(rightType.readableName()); - String leftShortName = new String(leftType.shortReadableName()); - String rightShortName = new String(rightType.shortReadableName()); - if (leftShortName.equals(rightShortName)) { - leftShortName = leftName; - rightShortName = rightName; - } - this.handle(IProblem.IncompatibleTypesInEqualityOperator, new String[]{ - leftName, rightName}, new String[]{leftShortName, - rightShortName}, expression.sourceStart, expression.sourceEnd); - } - public void notCompatibleTypesError(InstanceOfExpression expression, - TypeBinding leftType, TypeBinding rightType) { - String leftName = new String(leftType.readableName()); - String rightName = new String(rightType.readableName()); - String leftShortName = new String(leftType.shortReadableName()); - String rightShortName = new String(rightType.shortReadableName()); - if (leftShortName.equals(rightShortName)) { - leftShortName = leftName; - rightShortName = rightName; - } - this.handle(IProblem.IncompatibleTypesInConditionalOperator, - new String[]{leftName, rightName}, new String[]{leftShortName, - rightShortName}, expression.sourceStart, - expression.sourceEnd); - } - public void objectCannotHaveSuperTypes(SourceTypeBinding type) { - this.handle(IProblem.ObjectCannotHaveSuperTypes, NoArgument, - NoArgument, type.sourceStart(), type.sourceEnd()); - } - public void operatorOnlyValidOnNumericType(CompoundAssignment assignment, - TypeBinding leftType, TypeBinding rightType) { - String leftName = new String(leftType.readableName()); - String rightName = new String(rightType.readableName()); - String leftShortName = new String(leftType.shortReadableName()); - String rightShortName = new String(rightType.shortReadableName()); - if (leftShortName.equals(rightShortName)) { - leftShortName = leftName; - rightShortName = rightName; - } - this.handle(IProblem.TypeMismatch, new String[]{leftName, rightName}, - new String[]{leftShortName, rightShortName}, - assignment.sourceStart, assignment.sourceEnd); - } - public void overridesDeprecatedMethod(MethodBinding localMethod, - MethodBinding inheritedMethod) { - this.handle(IProblem.OverridingDeprecatedMethod, new String[]{ - new String(CharOperation.concat(localMethod.declaringClass - .readableName(), localMethod.readableName(), '.')), - new String(inheritedMethod.declaringClass.readableName())}, - new String[]{ - new String(CharOperation.concat( - localMethod.declaringClass.shortReadableName(), - localMethod.shortReadableName(), '.')), - new String(inheritedMethod.declaringClass - .shortReadableName())}, localMethod - .sourceStart(), localMethod.sourceEnd()); - } - public void overridesPackageDefaultMethod(MethodBinding localMethod, - MethodBinding inheritedMethod) { - this.handle(IProblem.OverridingNonVisibleMethod, new String[]{ - new String(CharOperation.concat(localMethod.declaringClass - .readableName(), localMethod.readableName(), '.')), - new String(inheritedMethod.declaringClass.readableName())}, - new String[]{ - new String(CharOperation.concat( - localMethod.declaringClass.shortReadableName(), - localMethod.shortReadableName(), '.')), - new String(inheritedMethod.declaringClass - .shortReadableName())}, localMethod - .sourceStart(), localMethod.sourceEnd()); - } - public void packageCollidesWithType(CompilationUnitDeclaration compUnitDecl) { - String[] arguments = new String[]{CharOperation - .toString(compUnitDecl.currentPackage.tokens)}; - this.handle(IProblem.PackageCollidesWithType, arguments, arguments, - compUnitDecl.currentPackage.sourceStart, - compUnitDecl.currentPackage.sourceEnd); - } - public void packageIsNotExpectedPackage( - CompilationUnitDeclaration compUnitDecl) { - String[] arguments = new String[]{CharOperation - .toString(compUnitDecl.compilationResult.compilationUnit - .getPackageName())}; - this.handle(IProblem.PackageIsNotExpectedPackage, arguments, arguments, - compUnitDecl.currentPackage == null - ? 0 - : compUnitDecl.currentPackage.sourceStart, - compUnitDecl.currentPackage == null - ? 0 - : compUnitDecl.currentPackage.sourceEnd); - } - private String parametersAsString(MethodBinding method) { - TypeBinding[] params = method.parameters; - StringBuffer buffer = new StringBuffer(); - for (int i = 0, length = params.length; i < length; i++) { - if (i != 0) - buffer.append(", "); //$NON-NLS-1$ - buffer.append(new String(params[i].readableName())); - } - return buffer.toString(); - } - private String parametersAsShortString(MethodBinding method) { - TypeBinding[] params = method.parameters; - StringBuffer buffer = new StringBuffer(); - for (int i = 0, length = params.length; i < length; i++) { - if (i != 0) - buffer.append(", "); //$NON-NLS-1$ - buffer.append(new String(params[i].shortReadableName())); - } - return buffer.toString(); - } - public void parseError(int startPosition, int endPosition, - char[] currentTokenSource, String errorTokenName, - String[] possibleTokens) { - if (possibleTokens.length == 0) { //no suggestion available - if (isKeyword(currentTokenSource)) { - String[] arguments = new String[]{new String(currentTokenSource)}; - this.handle(IProblem.ParsingErrorOnKeywordNoSuggestion, - arguments, arguments, - // this is the current -invalid- token position - startPosition, endPosition); - return; - } else { - String[] arguments = new String[]{errorTokenName}; - this.handle(IProblem.ParsingErrorNoSuggestion, arguments, - arguments, - // this is the current -invalid- token position - startPosition, endPosition); - return; - } - } - //build a list of probable right tokens - StringBuffer list = new StringBuffer(20); - for (int i = 0, max = possibleTokens.length; i < max; i++) { - if (i > 0) - list.append(", "); //$NON-NLS-1$ - list.append('"'); - list.append(possibleTokens[i]); - list.append('"'); - } - if (isKeyword(currentTokenSource)) { - String[] arguments = new String[]{new String(currentTokenSource), - list.toString()}; - this.handle(IProblem.ParsingErrorOnKeyword, arguments, arguments, - // this is the current -invalid- token position - startPosition, endPosition); - return; - } - //extract the literal when it's a literal - if ((errorTokenName.equals("IntegerLiteral")) || //$NON-NLS-1$ - (errorTokenName.equals("LongLiteral")) || //$NON-NLS-1$ - (errorTokenName.equals("FloatingPointLiteral")) || //$NON-NLS-1$ - (errorTokenName.equals("DoubleLiteral")) || //$NON-NLS-1$ - (errorTokenName.equals("StringLiteral")) || //$NON-NLS-1$ - (errorTokenName.equals("CharacterLiteral")) || //$NON-NLS-1$ - (errorTokenName.equals("Identifier"))) { //$NON-NLS-1$ - errorTokenName = new String(currentTokenSource); - } - String[] arguments = new String[]{errorTokenName, list.toString()}; - this.handle(IProblem.ParsingError, arguments, arguments, - // this is the current -invalid- token position - startPosition, endPosition); - } - public void publicClassMustMatchFileName( - CompilationUnitDeclaration compUnitDecl, TypeDeclaration typeDecl) { - this.referenceContext = typeDecl; // report the problem against the - // type not the entire compilation - // unit - String[] arguments = new String[]{ - new String(compUnitDecl.getFileName()), - new String(typeDecl.name)}; - this.handle(IProblem.PublicClassMustMatchFileName, arguments, - arguments, typeDecl.sourceStart, typeDecl.sourceEnd, - compUnitDecl.compilationResult); - } - public void recursiveConstructorInvocation( - ExplicitConstructorCall constructorCall) { - this.handle(IProblem.RecursiveConstructorInvocation, new String[]{ - new String(constructorCall.binding.declaringClass - .readableName()), - parametersAsString(constructorCall.binding)}, new String[]{ - new String(constructorCall.binding.declaringClass - .shortReadableName()), - parametersAsShortString(constructorCall.binding)}, - constructorCall.sourceStart, constructorCall.sourceEnd); - } - public void redefineArgument(Argument arg) { - String[] arguments = new String[]{new String(arg.name)}; - this.handle(IProblem.RedefinedArgument, arguments, arguments, - arg.sourceStart, arg.sourceEnd); - } - public void redefineLocal(LocalDeclaration localDecl) { - String[] arguments = new String[]{new String(localDecl.name)}; - this.handle(IProblem.RedefinedLocal, arguments, arguments, - localDecl.sourceStart, localDecl.sourceEnd); - } - public void referenceMustBeArrayTypeAt(TypeBinding arrayType, - ArrayReference arrayRef) { - this.handle(IProblem.ArrayReferenceRequired, new String[]{new String( - arrayType.readableName())}, new String[]{new String(arrayType - .shortReadableName())}, arrayRef.sourceStart, - arrayRef.sourceEnd); - } - public void returnTypeCannotBeVoidArray(SourceTypeBinding type, - MethodDeclaration methodDecl) { - String[] arguments = new String[]{new String(methodDecl.selector)}; - this.handle(IProblem.ReturnTypeCannotBeVoidArray, arguments, arguments, - methodDecl.sourceStart, methodDecl.sourceEnd); - } - public void returnTypeProblem(SourceTypeBinding type, - MethodDeclaration methodDecl, TypeBinding expectedType) { - int problemId = expectedType.problemId(); - int id; - switch (problemId) { - case NotFound : - // 1 - id = IProblem.ReturnTypeNotFound; - break; - case NotVisible : - // 2 - id = IProblem.ReturnTypeNotVisible; - break; - case Ambiguous : - // 3 - id = IProblem.ReturnTypeAmbiguous; - break; - case InternalNameProvided : - // 4 - id = IProblem.ReturnTypeInternalNameProvided; - break; - case InheritedNameHidesEnclosingName : - // 5 - id = IProblem.ReturnTypeInheritedNameHidesEnclosingName; - break; - case NoError : - // 0 - default : - needImplementation(); // want to fail to see why we were - // here... - return; - } - this.handle(id, new String[]{new String(methodDecl.selector), - new String(expectedType.readableName())}, new String[]{ - new String(methodDecl.selector), - new String(expectedType.shortReadableName())}, - methodDecl.returnType.sourceStart, - methodDecl.returnType.sourceEnd); - } - public void scannerError(Parser parser, String errorTokenName) { - Scanner scanner = parser.scanner; - int flag = IProblem.ParsingErrorNoSuggestion; - int startPos = scanner.startPosition; - //special treatment for recognized errors.... - if (errorTokenName.equals(Scanner.END_OF_SOURCE)) - flag = IProblem.EndOfSource; - else if (errorTokenName.equals(Scanner.INVALID_HEXA)) - flag = IProblem.InvalidHexa; - else if (errorTokenName.equals(Scanner.INVALID_OCTAL)) - flag = IProblem.InvalidOctal; - else if (errorTokenName.equals(Scanner.INVALID_CHARACTER_CONSTANT)) - flag = IProblem.InvalidCharacterConstant; - else if (errorTokenName.equals(Scanner.INVALID_ESCAPE)) - flag = IProblem.InvalidEscape; - else if (errorTokenName.equals(Scanner.INVALID_UNICODE_ESCAPE)) { - flag = IProblem.InvalidUnicodeEscape; - // better locate the error message - char[] source = scanner.source; - int checkPos = scanner.currentPosition - 1; - if (checkPos >= source.length) - checkPos = source.length - 1; - while (checkPos >= startPos) { - if (source[checkPos] == '\\') - break; - checkPos--; - } - startPos = checkPos; - } else if (errorTokenName.equals(Scanner.INVALID_FLOAT)) - flag = IProblem.InvalidFloat; - else if (errorTokenName.equals(Scanner.UNTERMINATED_STRING)) - flag = IProblem.UnterminatedString; - else if (errorTokenName.equals(Scanner.UNTERMINATED_COMMENT)) - flag = IProblem.UnterminatedComment; - else if (errorTokenName.equals(Scanner.INVALID_CHAR_IN_STRING)) - flag = IProblem.UnterminatedString; - String[] arguments = flag == IProblem.ParsingErrorNoSuggestion - ? new String[]{errorTokenName} - : NoArgument; - this.handle(flag, arguments, arguments, - // this is the current -invalid- token position - startPos, scanner.currentPosition - 1, - parser.compilationUnit.compilationResult); - } - public void shouldReturn(TypeBinding returnType, AstNode location) { - this.handle(IProblem.ShouldReturnValue, new String[]{new String( - returnType.readableName())}, new String[]{new String(returnType - .shortReadableName())}, location.sourceStart, - location.sourceEnd); - } - public void signalNoImplicitStringConversionForCharArrayExpression( - Expression expression) { - this.handle(IProblem.NoImplicitStringConversionForCharArrayExpression, - NoArgument, NoArgument, expression.sourceStart, - expression.sourceEnd); - } - public void staticAndInstanceConflict(MethodBinding currentMethod, - MethodBinding inheritedMethod) { - if (currentMethod.isStatic()) - this.handle( - // This static method cannot hide the instance method from %1 - // 8.4.6.4 - If a class inherits more than one method with - // the same signature a static (non-abstract) method cannot - // hide an instance method. - IProblem.CannotHideAnInstanceMethodWithAStaticMethod, - new String[]{new String(inheritedMethod.declaringClass - .readableName())}, - new String[]{new String(inheritedMethod.declaringClass - .shortReadableName())}, - currentMethod.sourceStart(), currentMethod.sourceEnd()); - else - this.handle( - // This instance method cannot override the static method from %1 - // 8.4.6.4 - If a class inherits more than one method with - // the same signature an instance (non-abstract) method - // cannot override a static method. - IProblem.CannotOverrideAStaticMethodWithAnInstanceMethod, - new String[]{new String(inheritedMethod.declaringClass - .readableName())}, - new String[]{new String(inheritedMethod.declaringClass - .shortReadableName())}, - currentMethod.sourceStart(), currentMethod.sourceEnd()); - } - public void staticFieldAccessToNonStaticVariable(FieldReference fieldRef, - FieldBinding field) { - String[] arguments = new String[]{new String(field.readableName())}; - this.handle(IProblem.NonStaticFieldFromStaticInvocation, arguments, - arguments, fieldRef.sourceStart, fieldRef.sourceEnd); - } - public void staticFieldAccessToNonStaticVariable( - QualifiedNameReference nameRef, FieldBinding field) { - String[] arguments = new String[]{new String(field.readableName())}; - this.handle(IProblem.NonStaticFieldFromStaticInvocation, arguments, - arguments, nameRef.sourceStart, nameRef.sourceEnd); - } - public void staticFieldAccessToNonStaticVariable( - SingleNameReference nameRef, FieldBinding field) { - String[] arguments = new String[]{new String(field.readableName())}; - this.handle(IProblem.NonStaticFieldFromStaticInvocation, arguments, - arguments, nameRef.sourceStart, nameRef.sourceEnd); - } - public void staticInheritedMethodConflicts(SourceTypeBinding type, - MethodBinding concreteMethod, MethodBinding[] abstractMethods) { - this.handle( - // The static method %1 conflicts with the abstract method in %2 - // 8.4.6.4 - If a class inherits more than one method with the - // same signature it is an error for one to be static - // (non-abstract) and the other abstract. - IProblem.StaticInheritedMethodConflicts, new String[]{ - new String(concreteMethod.readableName()), - new String(abstractMethods[0].declaringClass - .readableName())}, new String[]{ - new String(concreteMethod.readableName()), - new String(abstractMethods[0].declaringClass - .shortReadableName())}, type.sourceStart(), - type.sourceEnd()); - } - public void stringConstantIsExceedingUtf8Limit(AstNode location) { - this.handle(IProblem.StringConstantIsExceedingUtf8Limit, NoArgument, - NoArgument, location.sourceStart, location.sourceEnd); - } - public void superclassMustBeAClass(SourceTypeBinding type, - TypeReference superclassRef, ReferenceBinding superType) { - this.handle(IProblem.SuperclassMustBeAClass, new String[]{ - new String(superType.readableName()), - new String(type.sourceName())}, new String[]{ - new String(superType.shortReadableName()), - new String(type.sourceName())}, superclassRef.sourceStart, - superclassRef.sourceEnd); - } - public void superinterfaceMustBeAnInterface(SourceTypeBinding type, - TypeDeclaration typeDecl, ReferenceBinding superType) { - this.handle(IProblem.SuperInterfaceMustBeAnInterface, new String[]{ - new String(superType.readableName()), - new String(type.sourceName())}, new String[]{ - new String(superType.shortReadableName()), - new String(type.sourceName())}, typeDecl.sourceStart, - typeDecl.sourceEnd); - } - public void task(String tag, String message, String priority, int start, - int end) { - this - .handle( - IProblem.Task, - new String[]{tag, message, priority/* - * secret argument - * that is not - * surfaced in - * getMessage() - */}, - new String[]{tag, message, priority/* - * secret argument - * that is not - * surfaced in - * getMessage() - */}, - start, end); - } - public void tooManyDimensions(AstNode expression) { - this.handle(IProblem.TooManyArrayDimensions, NoArgument, NoArgument, - expression.sourceStart, expression.sourceEnd); - } - public void tooManyFields(TypeDeclaration typeDeclaration) { - this.handle(IProblem.TooManyFields, new String[]{new String( - typeDeclaration.binding.readableName())}, - new String[]{new String(typeDeclaration.binding - .shortReadableName())}, Abort | Error, - typeDeclaration.sourceStart, typeDeclaration.sourceEnd); - } - public void tooManyMethods(TypeDeclaration typeDeclaration) { - this.handle(IProblem.TooManyMethods, new String[]{new String( - typeDeclaration.binding.readableName())}, - new String[]{new String(typeDeclaration.binding - .shortReadableName())}, Abort | Error, - typeDeclaration.sourceStart, typeDeclaration.sourceEnd); - } - public void typeCastError(CastExpression expression, TypeBinding leftType, - TypeBinding rightType) { - String leftName = new String(leftType.readableName()); - String rightName = new String(rightType.readableName()); - String leftShortName = new String(leftType.shortReadableName()); - String rightShortName = new String(rightType.shortReadableName()); - if (leftShortName.equals(rightShortName)) { - leftShortName = leftName; - rightShortName = rightName; - } - this.handle(IProblem.IllegalCast, new String[]{rightName, leftName}, - new String[]{rightShortName, leftShortName}, - expression.sourceStart, expression.sourceEnd); - } - public void typeCollidesWithPackage( - CompilationUnitDeclaration compUnitDecl, TypeDeclaration typeDecl) { - this.referenceContext = typeDecl; // report the problem against the - // type not the entire compilation - // unit - String[] arguments = new String[]{ - new String(compUnitDecl.getFileName()), - new String(typeDecl.name)}; - this.handle(IProblem.TypeCollidesWithPackage, arguments, arguments, - typeDecl.sourceStart, typeDecl.sourceEnd, - compUnitDecl.compilationResult); - } - public void typeMismatchError(TypeBinding resultType, - TypeBinding expectedType, AstNode location) { - String resultTypeName = new String(resultType.readableName()); - String expectedTypeName = new String(expectedType.readableName()); - String resultTypeShortName = new String(resultType.shortReadableName()); - String expectedTypeShortName = new String(expectedType - .shortReadableName()); - if (resultTypeShortName.equals(expectedTypeShortName)) { - resultTypeShortName = resultTypeName; - expectedTypeShortName = expectedTypeName; - } - this.handle(IProblem.TypeMismatch, new String[]{resultTypeName, - expectedTypeName}, new String[]{resultTypeShortName, - expectedTypeShortName}, location.sourceStart, - location.sourceEnd); - } - public void typeMismatchErrorActualTypeExpectedType(Expression expression, - TypeBinding constantType, TypeBinding expectedType) { - String constantTypeName = new String(constantType.readableName()); - String expectedTypeName = new String(expectedType.readableName()); - String constantTypeShortName = new String(constantType - .shortReadableName()); - String expectedTypeShortName = new String(expectedType - .shortReadableName()); - if (constantTypeShortName.equals(expectedTypeShortName)) { - constantTypeShortName = constantTypeName; - expectedTypeShortName = expectedTypeName; - } - this.handle(IProblem.TypeMismatch, new String[]{constantTypeName, - expectedTypeName}, new String[]{constantTypeShortName, - expectedTypeShortName}, expression.sourceStart, - expression.sourceEnd); - } - public void undefinedLabel(BranchStatement statement) { - String[] arguments = new String[]{new String(statement.label)}; - this.handle(IProblem.UndefinedLabel, arguments, arguments, - statement.sourceStart, statement.sourceEnd); - } - public void unexpectedStaticModifierForField(SourceTypeBinding type, - FieldDeclaration fieldDecl) { - String[] arguments = new String[]{fieldDecl.name()}; - this.handle(IProblem.UnexpectedStaticModifierForField, arguments, - arguments, fieldDecl.sourceStart, fieldDecl.sourceEnd); - } - public void unexpectedStaticModifierForMethod(ReferenceBinding type, - AbstractMethodDeclaration methodDecl) { - String[] arguments = new String[]{new String(type.sourceName()), - new String(methodDecl.selector)}; - this.handle(IProblem.UnexpectedStaticModifierForMethod, arguments, - arguments, methodDecl.sourceStart, methodDecl.sourceEnd); - } - public void unhandledException(TypeBinding exceptionType, AstNode location) { - boolean insideDefaultConstructor = (referenceContext instanceof ConstructorDeclaration) - && ((ConstructorDeclaration) referenceContext) - .isDefaultConstructor(); - boolean insideImplicitConstructorCall = (location instanceof ExplicitConstructorCall) - && (((ExplicitConstructorCall) location).accessMode == ExplicitConstructorCall.ImplicitSuper); - this - .handle( - insideDefaultConstructor - ? IProblem.UnhandledExceptionInDefaultConstructor - : (insideImplicitConstructorCall - ? IProblem.UndefinedConstructorInImplicitConstructorCall - : IProblem.UnhandledException), - new String[]{new String(exceptionType.readableName())}, - new String[]{new String(exceptionType - .shortReadableName())}, location.sourceStart, - location.sourceEnd); - } - public void uninitializedBlankFinalField(FieldBinding binding, - AstNode location) { - String[] arguments = new String[]{new String(binding.readableName())}; - this.handle(IProblem.UninitializedBlankFinalField, arguments, - arguments, location.sourceStart, location.sourceEnd); - } - public void uninitializedLocalVariable(LocalVariableBinding binding, - AstNode location) { - String[] arguments = new String[]{new String(binding.readableName())}; - this.handle(IProblem.UninitializedLocalVariable, arguments, arguments, - location.sourceStart, location.sourceEnd); - } - public void unmatchedBracket(int position, ReferenceContext context, - CompilationResult compilationResult) { - this.handle(IProblem.UnmatchedBracket, NoArgument, NoArgument, - position, position, context, compilationResult); - } - public void unnecessaryEnclosingInstanceSpecification( - Expression expression, ReferenceBinding targetType) { - this.handle(IProblem.IllegalEnclosingInstanceSpecification, - new String[]{new String(targetType.readableName())}, - new String[]{new String(targetType.shortReadableName())}, - expression.sourceStart, expression.sourceEnd); - } - public void unnecessaryReceiverForStaticMethod(AstNode location, - MethodBinding method) { - this.handle(IProblem.NonStaticAccessToStaticMethod, new String[]{ - new String(method.declaringClass.readableName()), - new String(method.selector), parametersAsString(method)}, - new String[]{ - new String(method.declaringClass.shortReadableName()), - new String(method.selector), - parametersAsShortString(method)}, location.sourceStart, - location.sourceEnd); - } - public void unnecessaryReceiverForStaticField(AstNode location, - FieldBinding field) { - this.handle(IProblem.NonStaticAccessToStaticField, new String[]{ - new String(field.declaringClass.readableName()), - new String(field.name)}, new String[]{ - new String(field.declaringClass.shortReadableName()), - new String(field.name)}, location.sourceStart, - location.sourceEnd); - } - public void unreachableCode(Statement statement) { - this.handle(IProblem.CodeCannotBeReached, NoArgument, NoArgument, - statement.sourceStart, statement.sourceEnd); - } - public void unreachableExceptionHandler(ReferenceBinding exceptionType, - AstNode location) { - this.handle(IProblem.UnreachableCatch, NoArgument, NoArgument, - location.sourceStart, location.sourceEnd); - } - public void unresolvableReference(NameReference nameRef, Binding binding) { - int severity = Error; - /* - * also need to check that the searchedType is the receiver type if - * (binding instanceof ProblemBinding) { ProblemBinding problem = - * (ProblemBinding) binding; if (problem.searchType != null && - * problem.searchType.isHierarchyInconsistent()) severity = - * SecondaryError; } - */ - String[] arguments = new String[]{new String(binding.readableName())}; - this.handle(IProblem.UndefinedName, arguments, arguments, severity, - nameRef.sourceStart, nameRef.sourceEnd); - } - public void unusedArgument(LocalDeclaration localDecl) { - String[] arguments = new String[]{localDecl.name()}; - this.handle(IProblem.ArgumentIsNeverUsed, arguments, arguments, - localDecl.sourceStart, localDecl.sourceEnd); - } - public void unusedImport(ImportReference importRef) { - String[] arguments = new String[]{CharOperation - .toString(importRef.tokens)}; - this.handle(IProblem.UnusedImport, arguments, arguments, - importRef.sourceStart, importRef.sourceEnd); - } - public void unusedLocalVariable(LocalDeclaration localDecl) { - String[] arguments = new String[]{localDecl.name()}; - this.handle(IProblem.LocalVariableIsNeverUsed, arguments, arguments, - localDecl.sourceStart, localDecl.sourceEnd); - } - public void unusedPrivateConstructor(ConstructorDeclaration constructorDecl) { - if (computeSeverity(IProblem.UnusedPrivateConstructor) == Ignore) - return; - // no complaint for no-arg constructors (or default ones) - known - // pattern to block instantiation - if (constructorDecl.arguments == null - || constructorDecl.arguments.length == 0) - return; - MethodBinding constructor = constructorDecl.binding; - this.handle(IProblem.UnusedPrivateConstructor, new String[]{ - new String(constructor.declaringClass.readableName()), - parametersAsString(constructor)}, new String[]{ - new String(constructor.declaringClass.shortReadableName()), - parametersAsShortString(constructor)}, - constructorDecl.sourceStart, constructorDecl.sourceEnd); - } - public void unusedPrivateField(FieldDeclaration fieldDecl) { - if (computeSeverity(IProblem.UnusedPrivateField) == Ignore) - return; - FieldBinding field = fieldDecl.binding; - if (CharOperation.equals(TypeConstants.SERIALVERSIONUID, field.name) - && field.isStatic() && field.isFinal() - && TypeBinding.LongBinding == field.type) { - return; // do not report unused serialVersionUID field - } - this.handle(IProblem.UnusedPrivateField, new String[]{ - new String(field.declaringClass.readableName()), - new String(field.name),}, new String[]{ - new String(field.declaringClass.shortReadableName()), - new String(field.name),}, fieldDecl.sourceStart, - fieldDecl.sourceEnd); - } - public void unusedPrivateMethod(AbstractMethodDeclaration methodDecl) { - if (computeSeverity(IProblem.UnusedPrivateMethod) == Ignore) - return; - MethodBinding method = methodDecl.binding; - // no report for serialization support 'void - // readObject(ObjectInputStream)' - if (!method.isStatic() - && TypeBinding.VoidBinding == method.returnType - && method.parameters.length == 1 - && method.parameters[0].dimensions() == 0 - && CharOperation.equals(method.selector, - TypeConstants.READOBJECT) - && CharOperation.equals( - TypeConstants.CharArray_JAVA_IO_OBJECTINPUTSTREAM, - method.parameters[0].readableName())) { - return; - } - // no report for serialization support 'void - // writeObject(ObjectOutputStream)' - if (!method.isStatic() - && TypeBinding.VoidBinding == method.returnType - && method.parameters.length == 1 - && method.parameters[0].dimensions() == 0 - && CharOperation.equals(method.selector, - TypeConstants.WRITEOBJECT) - && CharOperation.equals( - TypeConstants.CharArray_JAVA_IO_OBJECTOUTPUTSTREAM, - method.parameters[0].readableName())) { - return; - } - // no report for serialization support 'Object readResolve()' - if (!method.isStatic() - && TypeBinding.T_Object == method.returnType.id - && method.parameters.length == 0 - && CharOperation.equals(method.selector, - TypeConstants.READRESOLVE)) { - return; - } - // no report for serialization support 'Object writeReplace()' - if (!method.isStatic() - && TypeBinding.T_Object == method.returnType.id - && method.parameters.length == 0 - && CharOperation.equals(method.selector, - TypeConstants.WRITEREPLACE)) { - return; - } - this.handle(IProblem.UnusedPrivateMethod, new String[]{ - new String(method.declaringClass.readableName()), - new String(method.selector), parametersAsString(method)}, - new String[]{ - new String(method.declaringClass.shortReadableName()), - new String(method.selector), - parametersAsShortString(method)}, - methodDecl.sourceStart, methodDecl.sourceEnd); - } - public void unusedPrivateType(TypeDeclaration typeDecl) { - if (computeSeverity(IProblem.UnusedPrivateType) == Ignore) - return; - ReferenceBinding type = typeDecl.binding; - this.handle(IProblem.UnusedPrivateType, new String[]{new String(type - .readableName()),}, new String[]{new String(type - .shortReadableName()),}, typeDecl.sourceStart, - typeDecl.sourceEnd); - } - public void useAssertAsAnIdentifier(int sourceStart, int sourceEnd) { - this.handle(IProblem.UseAssertAsAnIdentifier, NoArgument, NoArgument, - sourceStart, sourceEnd); - } - public void variableTypeCannotBeVoid(AbstractVariableDeclaration varDecl) { - String[] arguments = new String[]{new String(varDecl.name)}; - this.handle(IProblem.VariableTypeCannotBeVoid, arguments, arguments, - varDecl.sourceStart, varDecl.sourceEnd); - } - public void variableTypeCannotBeVoidArray( - AbstractVariableDeclaration varDecl) { - String[] arguments = new String[]{new String(varDecl.name)}; - this.handle(IProblem.VariableTypeCannotBeVoidArray, arguments, - arguments, varDecl.sourceStart, varDecl.sourceEnd); - } - public void visibilityConflict(MethodBinding currentMethod, - MethodBinding inheritedMethod) { - this.handle( - // Cannot reduce the visibility of the inherited method from %1 - // 8.4.6.3 - The access modifier of an hiding method must - // provide at least as much access as the hidden method. - // 8.4.6.3 - The access modifier of an overiding method must - // provide at least as much access as the overriden method. - IProblem.MethodReducesVisibility, new String[]{new String( - inheritedMethod.declaringClass.readableName())}, - new String[]{new String(inheritedMethod.declaringClass - .shortReadableName())}, currentMethod.sourceStart(), - currentMethod.sourceEnd()); - } - public void wrongSequenceOfExceptionTypesError(TryStatement statement, - int under, int upper) { - //the two catch block under and upper are in an incorrect order. - //under should be define BEFORE upper in the source - TypeReference typeRef = statement.catchArguments[under].type; - this.handle(IProblem.UnreachableCatch, NoArgument, NoArgument, - typeRef.sourceStart, typeRef.sourceEnd); - } - public void nonExternalizedStringLiteral(AstNode location) { - this.handle(IProblem.NonExternalizedStringLiteral, NoArgument, - NoArgument, location.sourceStart, location.sourceEnd); - } - public void noMoreAvailableSpaceForConstant(TypeDeclaration typeDeclaration) { - this - .handle(IProblem.TooManyBytesForStringConstant, - new String[]{new String(typeDeclaration.binding - .readableName())}, new String[]{new String( - typeDeclaration.binding.shortReadableName())}, - Abort | Error, typeDeclaration.sourceStart, - typeDeclaration.sourceEnd); - } - public void noMoreAvailableSpaceInConstantPool( - TypeDeclaration typeDeclaration) { - this - .handle(IProblem.TooManyConstantsInConstantPool, - new String[]{new String(typeDeclaration.binding - .readableName())}, new String[]{new String( - typeDeclaration.binding.shortReadableName())}, - Abort | Error, typeDeclaration.sourceStart, - typeDeclaration.sourceEnd); - } - private boolean isKeyword(char[] tokenSource) { - /* - * This code is heavily grammar dependant - */ - if (tokenSource == null) { - return false; - } - try { - Scanner scanner = new Scanner(); - scanner.setSource(tokenSource); - int token = scanner.getNextToken(); - char[] currentKeyword; - try { - currentKeyword = scanner.getCurrentIdentifierSource(); - } catch (ArrayIndexOutOfBoundsException e) { - return false; - } - int nextToken = scanner.getNextToken(); - if (nextToken == Scanner.TokenNameEOF - && scanner.startPosition == scanner.source.length) { // to - // handle - // case - // where - // we - // had - // an - // ArrayIndexOutOfBoundsException - // while reading the last token - switch (token) { - case Scanner.TokenNameERROR : - if (CharOperation.equals("goto".toCharArray(), - currentKeyword) - || CharOperation.equals("const".toCharArray(), - currentKeyword)) { //$NON-NLS-1$ //$NON-NLS-2$ - return true; - } else { - return false; - } - case Scanner.TokenNameabstract : - // case Scanner.TokenNameassert: - // case Scanner.TokenNamebyte: - case Scanner.TokenNamebreak : - // case Scanner.TokenNameboolean: - case Scanner.TokenNamecase : - // case Scanner.TokenNamechar: - case Scanner.TokenNamecatch : - case Scanner.TokenNameclass : - case Scanner.TokenNamecontinue : - case Scanner.TokenNamedo : - // case Scanner.TokenNamedouble: - case Scanner.TokenNamedefault : - case Scanner.TokenNameelse : - case Scanner.TokenNameextends : - case Scanner.TokenNamefor : - // case Scanner.TokenNamefinal: - // case Scanner.TokenNamefloat: - case Scanner.TokenNamefalse : - case Scanner.TokenNamefinally : - case Scanner.TokenNameif : - // case Scanner.TokenNameint: - // case Scanner.TokenNameimport: - case Scanner.TokenNameinterface : - case Scanner.TokenNameimplements : - case Scanner.TokenNameinstanceof : - // case Scanner.TokenNamelong: - case Scanner.TokenNamenew : - case Scanner.TokenNamenull : - // case Scanner.TokenNamenative: - case Scanner.TokenNamepublic : - // case Scanner.TokenNamepackage: - case Scanner.TokenNameprivate : - case Scanner.TokenNameprotected : - case Scanner.TokenNamereturn : - // case Scanner.TokenNameshort: - case Scanner.TokenNamesuper : - case Scanner.TokenNamestatic : - case Scanner.TokenNameswitch : - // case Scanner.TokenNamestrictfp: - // case Scanner.TokenNamesynchronized: - case Scanner.TokenNametry : - case Scanner.TokenNamethis : - case Scanner.TokenNametrue : - case Scanner.TokenNamethrow : - // case Scanner.TokenNamethrows: - // case Scanner.TokenNametransient: - // case Scanner.TokenNamevoid: - // case Scanner.TokenNamevolatile: - case Scanner.TokenNamewhile : - return true; - default : - return false; - } - } else { - return false; - } - } catch (InvalidInputException e) { - return false; - } - } - // jsurfer start - public void phpParsingError(String[] messageArguments, - int problemStartPosition, int problemEndPosition, - ReferenceContext context, CompilationResult compilationResult) { - this.handle(IProblem.PHPParsingError, NoArgument, messageArguments, - problemStartPosition, problemEndPosition, context, - compilationResult); - } + public ReferenceContext referenceContext; + public ProblemReporter(IErrorHandlingPolicy policy, + IProblemFactory problemFactory) { + //CompilerOptions options, IProblemFactory problemFactory) { + super(policy, problemFactory);//options, problemFactory); + } + public void abortDueToInternalError(String errorMessage) { + String[] arguments = new String[]{errorMessage}; + this.handle(IProblem.Unclassified, arguments, arguments, Error | Abort, 0, + 0); + } + public void abortDueToInternalError(String errorMessage, AstNode location) { + String[] arguments = new String[]{errorMessage}; + this.handle(IProblem.Unclassified, arguments, arguments, Error | Abort, + location.sourceStart, location.sourceEnd); + } + public void abstractMethodCannotBeOverridden(SourceTypeBinding type, + MethodBinding concreteMethod) { + this + .handle( + // %1 must be abstract since it cannot override the inherited + // package-private abstract method %2 + IProblem.AbstractMethodCannotBeOverridden, new String[]{ + new String(type.sourceName()), + new String(CharOperation.concat(concreteMethod.declaringClass + .readableName(), concreteMethod.readableName(), '.'))}, + new String[]{ + new String(type.sourceName()), + new String(CharOperation.concat(concreteMethod.declaringClass + .shortReadableName(), concreteMethod.shortReadableName(), + '.'))}, type.sourceStart(), type.sourceEnd()); + } + public void abstractMethodInAbstractClass(SourceTypeBinding type, + AbstractMethodDeclaration methodDecl) { + String[] arguments = new String[]{new String(type.sourceName()), + new String(methodDecl.selector)}; + this.handle(IProblem.AbstractMethodInAbstractClass, arguments, arguments, + methodDecl.sourceStart, methodDecl.sourceEnd); + } + public void abstractMethodMustBeImplemented(SourceTypeBinding type, + MethodBinding abstractMethod) { + this.handle( + // Must implement the inherited abstract method %1 + // 8.4.3 - Every non-abstract subclass of an abstract type, A, + // must provide a concrete implementation of all of A's + // methods. + IProblem.AbstractMethodMustBeImplemented, new String[]{new String( + CharOperation.concat(abstractMethod.declaringClass.readableName(), + abstractMethod.readableName(), '.'))}, + new String[]{new String(CharOperation.concat( + abstractMethod.declaringClass.shortReadableName(), abstractMethod + .shortReadableName(), '.'))}, type.sourceStart(), type + .sourceEnd()); + } + public void abstractMethodNeedingNoBody(AbstractMethodDeclaration method) { + this.handle(IProblem.BodyForAbstractMethod, NoArgument, NoArgument, + method.sourceStart, method.sourceEnd, method, method + .compilationResult()); + } + public void alreadyDefinedLabel(char[] labelName, AstNode location) { + String[] arguments = new String[]{new String(labelName)}; + this.handle(IProblem.DuplicateLabel, arguments, arguments, + location.sourceStart, location.sourceEnd); + } + public void anonymousClassCannotExtendFinalClass(Expression expression, + TypeBinding type) { + this.handle(IProblem.AnonymousClassCannotExtendFinalClass, + new String[]{new String(type.readableName())}, new String[]{new String( + type.shortReadableName())}, expression.sourceStart, + expression.sourceEnd); + } + public void argumentTypeCannotBeVoid(SourceTypeBinding type, + AbstractMethodDeclaration methodDecl, Argument arg) { + String[] arguments = new String[]{new String(methodDecl.selector), + new String(arg.name)}; + this.handle(IProblem.ArgumentTypeCannotBeVoid, arguments, arguments, + methodDecl.sourceStart, methodDecl.sourceEnd); + } + public void argumentTypeCannotBeVoidArray(SourceTypeBinding type, + AbstractMethodDeclaration methodDecl, Argument arg) { + String[] arguments = new String[]{new String(methodDecl.selector), + new String(arg.name)}; + this.handle(IProblem.ArgumentTypeCannotBeVoidArray, arguments, arguments, + methodDecl.sourceStart, methodDecl.sourceEnd); + } + public void argumentTypeProblem(SourceTypeBinding type, + AbstractMethodDeclaration methodDecl, Argument arg, + TypeBinding expectedType) { + int problemId = expectedType.problemId(); + int id; + switch (problemId) { + case NotFound : + // 1 + id = IProblem.ArgumentTypeNotFound; + break; + case NotVisible : + // 2 + id = IProblem.ArgumentTypeNotVisible; + break; + case Ambiguous : + // 3 + id = IProblem.ArgumentTypeAmbiguous; + break; + case InternalNameProvided : + // 4 + id = IProblem.ArgumentTypeInternalNameProvided; + break; + case InheritedNameHidesEnclosingName : + // 5 + id = IProblem.ArgumentTypeInheritedNameHidesEnclosingName; + break; + case NoError : + // 0 + default : + needImplementation(); // want to fail to see why we were + // here... + return; + } + this.handle(id, new String[]{new String(methodDecl.selector), arg.name(), + new String(expectedType.readableName())}, new String[]{ + new String(methodDecl.selector), arg.name(), + new String(expectedType.shortReadableName())}, arg.type.sourceStart, + arg.type.sourceEnd); + } + public void arrayConstantsOnlyInArrayInitializers(int sourceStart, + int sourceEnd) { + this.handle(IProblem.ArrayConstantsOnlyInArrayInitializers, NoArgument, + NoArgument, sourceStart, sourceEnd); + } + public void assignmentHasNoEffect(Assignment assignment, char[] name) { + String[] arguments = new String[]{new String(name)}; + this.handle(IProblem.AssignmentHasNoEffect, arguments, arguments, + assignment.sourceStart, assignment.sourceEnd); + } + public void attemptToReturnNonVoidExpression(ReturnStatement returnStatement, + TypeBinding expectedType) { + this.handle(IProblem.VoidMethodReturnsValue, new String[]{new String( + expectedType.readableName())}, new String[]{new String(expectedType + .shortReadableName())}, returnStatement.sourceStart, + returnStatement.sourceEnd); + } + public void attemptToReturnVoidValue(ReturnStatement returnStatement) { + this.handle(IProblem.MethodReturnsVoid, NoArgument, NoArgument, + returnStatement.sourceStart, returnStatement.sourceEnd); + } + //public void bytecodeExceeds64KLimit(AbstractMethodDeclaration location) + // { + // String[] arguments = new String[] {new String(location.selector), + // parametersAsString(location.binding)}; + // if (location.isConstructor()) { + // this.handle( + // IProblem.BytecodeExceeds64KLimitForConstructor, + // arguments, + // arguments, + // Error | Abort, + // location.sourceStart, + // location.sourceEnd); + // } else { + // this.handle( + // IProblem.BytecodeExceeds64KLimit, + // arguments, + // arguments, + // Error | Abort, + // location.sourceStart, + // location.sourceEnd); + // } + //} + public void bytecodeExceeds64KLimit(TypeDeclaration location) { + this.handle(IProblem.BytecodeExceeds64KLimitForClinit, NoArgument, + NoArgument, Error | Abort, location.sourceStart, location.sourceEnd); + } + public void cannotAllocateVoidArray(Expression expression) { + this.handle(IProblem.CannotAllocateVoidArray, NoArgument, NoArgument, + expression.sourceStart, expression.sourceEnd); + } + public void cannotAssignToFinalField(FieldBinding field, AstNode location) { + this.handle(IProblem.FinalFieldAssignment, new String[]{ + (field.declaringClass == null ? "array" : new String( + field.declaringClass.readableName())), //$NON-NLS-1$ + new String(field.readableName())}, new String[]{ + (field.declaringClass == null ? "array" : new String( + field.declaringClass.shortReadableName())), //$NON-NLS-1$ + new String(field.shortReadableName())}, location.sourceStart, + location.sourceEnd); + } + public void cannotAssignToFinalLocal(LocalVariableBinding local, + AstNode location) { + String[] arguments = new String[]{new String(local.readableName())}; + this.handle(IProblem.NonBlankFinalLocalAssignment, arguments, arguments, + location.sourceStart, location.sourceEnd); + } + public void cannotAssignToFinalOuterLocal(LocalVariableBinding local, + AstNode location) { + String[] arguments = new String[]{new String(local.readableName())}; + this.handle(IProblem.FinalOuterLocalAssignment, arguments, arguments, + location.sourceStart, location.sourceEnd); + } + public void cannotDeclareLocalInterface(char[] interfaceName, + int sourceStart, int sourceEnd) { + String[] arguments = new String[]{new String(interfaceName)}; + this.handle(IProblem.CannotDefineInterfaceInLocalType, arguments, + arguments, sourceStart, sourceEnd); + } + public void cannotDefineDimensionsAndInitializer( + ArrayAllocationExpression expresssion) { + this.handle(IProblem.CannotDefineDimensionExpressionsWithInit, NoArgument, + NoArgument, expresssion.sourceStart, expresssion.sourceEnd); + } + public void cannotDireclyInvokeAbstractMethod(MessageSend messageSend, + MethodBinding method) { + this.handle(IProblem.DirectInvocationOfAbstractMethod, new String[]{ + new String(method.declaringClass.readableName()), + new String(method.selector), parametersAsString(method)}, new String[]{ + new String(method.declaringClass.shortReadableName()), + new String(method.selector), parametersAsShortString(method)}, + messageSend.sourceStart, messageSend.sourceEnd); + } + public void cannotImportPackage(ImportReference importRef) { + String[] arguments = new String[]{CharOperation.toString(importRef.tokens)}; + this.handle(IProblem.CannotImportPackage, arguments, arguments, + importRef.sourceStart, importRef.sourceEnd); + } + public void cannotInstantiate(TypeReference typeRef, TypeBinding type) { + this.handle(IProblem.InvalidClassInstantiation, new String[]{new String( + type.readableName())}, + new String[]{new String(type.shortReadableName())}, + typeRef.sourceStart, typeRef.sourceEnd); + } + public void cannotReferToNonFinalOuterLocal(LocalVariableBinding local, + AstNode location) { + String[] arguments = new String[]{new String(local.readableName())}; + this.handle(IProblem.OuterLocalMustBeFinal, arguments, arguments, + location.sourceStart, location.sourceEnd); + } + public void cannotReturnInInitializer(AstNode location) { + this.handle(IProblem.CannotReturnInInitializer, NoArgument, NoArgument, + location.sourceStart, location.sourceEnd); + } + public void cannotThrowNull(ThrowStatement statement) { + this.handle(IProblem.CannotThrowNull, NoArgument, NoArgument, + statement.sourceStart, statement.sourceEnd); + } + public void cannotThrowType(SourceTypeBinding type, + AbstractMethodDeclaration methodDecl, TypeReference exceptionType, + TypeBinding expectedType) { + this.handle(IProblem.CannotThrowType, new String[]{new String(expectedType + .readableName())}, new String[]{new String(expectedType + .shortReadableName())}, exceptionType.sourceStart, + exceptionType.sourceEnd); + } + public void cannotUseSuperInJavaLangObject(AstNode reference) { + this.handle(IProblem.ObjectHasNoSuperclass, NoArgument, NoArgument, + reference.sourceStart, reference.sourceEnd); + } + public void cannotUseSuperInCodeSnippet(int start, int end) { + this.handle(IProblem.CannotUseSuperInCodeSnippet, NoArgument, NoArgument, + Error | Abort, start, end); + } + public void caseExpressionMustBeConstant(Expression expression) { + this.handle(IProblem.NonConstantExpression, NoArgument, NoArgument, + expression.sourceStart, expression.sourceEnd); + } + public void classExtendFinalClass(SourceTypeBinding type, + TypeReference superclass, TypeBinding expectedType) { + String name = new String(type.sourceName()); + String expectedFullName = new String(expectedType.readableName()); + String expectedShortName = new String(expectedType.shortReadableName()); + if (expectedShortName.equals(name)) + expectedShortName = expectedFullName; + this.handle(IProblem.ClassExtendFinalClass, new String[]{expectedFullName, + name}, new String[]{expectedShortName, name}, superclass.sourceStart, + superclass.sourceEnd); + } + public void codeSnippetMissingClass(String missing, int start, int end) { + String[] arguments = new String[]{missing}; + this.handle(IProblem.CodeSnippetMissingClass, arguments, arguments, Error + | Abort, start, end); + } + public void codeSnippetMissingMethod(String className, String missingMethod, + String argumentTypes, int start, int end) { + String[] arguments = new String[]{className, missingMethod, argumentTypes}; + this.handle(IProblem.CodeSnippetMissingMethod, arguments, arguments, Error + | Abort, start, end); + } + /* + * Given the current configuration, answers which category the problem falls + * into: Error | Warning | Ignore + */ + //public int computeSeverity(int problemId){ + // + // // severity can have been preset on the problem + //// if ((problem.severity & Fatal) != 0){ + //// return Error; + //// } + // + // // if not then check whether it is a configurable problem + // int errorThreshold = options.errorThreshold; + // int warningThreshold = options.warningThreshold; + // + // switch(problemId){ + // + // case IProblem.UnreachableCatch : + // case IProblem.CodeCannotBeReached : + // if ((errorThreshold & CompilerOptions.UnreachableCode) != 0){ + // return Error; + // } + // if ((warningThreshold & CompilerOptions.UnreachableCode) != 0){ + // return Warning; + // } + // return Ignore; + // + // case IProblem.MaskedCatch : + // if ((errorThreshold & CompilerOptions.MaskedCatchBlock) != 0){ + // return Error; + // } + // if ((warningThreshold & CompilerOptions.MaskedCatchBlock) != 0){ + // return Warning; + // } + // return Ignore; + // + ///* + // case Never Used : + // if ((errorThreshold & ParsingOptionalError) != 0){ + // return Error; + // } + // if ((warningThreshold & ParsingOptionalError) != 0){ + // return Warning; + // } + // return Ignore; + //*/ + // case IProblem.ImportNotFound : + // case IProblem.ImportNotVisible : + // case IProblem.ImportAmbiguous : + // case IProblem.ImportInternalNameProvided : + // case IProblem.ImportInheritedNameHidesEnclosingName : + // case IProblem.DuplicateImport : + // case IProblem.ConflictingImport : + // case IProblem.CannotImportPackage : + // if ((errorThreshold & CompilerOptions.ImportProblem) != 0){ + // return Error; + // } + // if ((warningThreshold & CompilerOptions.ImportProblem) != 0){ + // return Warning; + // } + // return Ignore; + // + // case IProblem.UnusedImport : + // // if import problem are disabled, then ignore + // if ((errorThreshold & CompilerOptions.ImportProblem) == 0 + // && (warningThreshold & CompilerOptions.ImportProblem) == 0){ + // return Ignore; + // } + // if ((errorThreshold & CompilerOptions.UnusedImport) != 0){ + // return Error; + // } + // if ((warningThreshold & CompilerOptions.UnusedImport) != 0){ + // return Warning; + // } + // return Ignore; + // + // case IProblem.MethodButWithConstructorName : + // if ((errorThreshold & CompilerOptions.MethodWithConstructorName) != 0){ + // return Error; + // } + // if ((warningThreshold & CompilerOptions.MethodWithConstructorName) != + // 0){ + // return Warning; + // } + // return Ignore; + // + // case IProblem.OverridingNonVisibleMethod : + // if ((errorThreshold & CompilerOptions.OverriddenPackageDefaultMethod) != + // 0){ + // return Error; + // } + // if ((warningThreshold & CompilerOptions.OverriddenPackageDefaultMethod) + // != 0){ + // return Warning; + // } + // return Ignore; + // + // case IProblem.IncompatibleReturnTypeForNonInheritedInterfaceMethod : + // case + // IProblem.IncompatibleExceptionInThrowsClauseForNonInheritedInterfaceMethod + // : + // if ((errorThreshold & + // CompilerOptions.IncompatibleNonInheritedInterfaceMethod) != 0){ + // return Error; + // } + // if ((warningThreshold & + // CompilerOptions.IncompatibleNonInheritedInterfaceMethod) != 0){ + // return Warning; + // } + // return Ignore; + // + // case IProblem.OverridingDeprecatedMethod : + // case IProblem.UsingDeprecatedType : + // case IProblem.UsingDeprecatedMethod : + // case IProblem.UsingDeprecatedConstructor : + // case IProblem.UsingDeprecatedField : + // if ((errorThreshold & CompilerOptions.UsingDeprecatedAPI) != 0){ + // return Error; + // } + // if ((warningThreshold & CompilerOptions.UsingDeprecatedAPI) != 0){ + // return Warning; + // } + // return Ignore; + // + // case IProblem.LocalVariableIsNeverUsed : + // if ((errorThreshold & CompilerOptions.UnusedLocalVariable) != 0){ + // return Error; + // } + // if ((warningThreshold & CompilerOptions.UnusedLocalVariable) != 0){ + // return Warning; + // } + // return Ignore; + // + // case IProblem.ArgumentIsNeverUsed : + // if ((errorThreshold & CompilerOptions.UnusedArgument) != 0){ + // return Error; + // } + // if ((warningThreshold & CompilerOptions.UnusedArgument) != 0){ + // return Warning; + // } + // return Ignore; + // + // case IProblem.NoImplicitStringConversionForCharArrayExpression : + // if ((errorThreshold & CompilerOptions.NoImplicitStringConversion) != 0){ + // return Error; + // } + // if ((warningThreshold & CompilerOptions.NoImplicitStringConversion) != + // 0){ + // return Warning; + // } + // return Ignore; + // + // case IProblem.NeedToEmulateFieldReadAccess : + // case IProblem.NeedToEmulateFieldWriteAccess : + // case IProblem.NeedToEmulateMethodAccess : + // case IProblem.NeedToEmulateConstructorAccess : + // if ((errorThreshold & CompilerOptions.AccessEmulation) != 0){ + // return Error; + // } + // if ((warningThreshold & CompilerOptions.AccessEmulation) != 0){ + // return Warning; + // } + // return Ignore; + // case IProblem.NonExternalizedStringLiteral : + // if ((errorThreshold & CompilerOptions.NonExternalizedString) != 0){ + // return Error; + // } + // if ((warningThreshold & CompilerOptions.NonExternalizedString) != 0){ + // return Warning; + // } + // return Ignore; + // case IProblem.UseAssertAsAnIdentifier : + // if ((errorThreshold & CompilerOptions.AssertUsedAsAnIdentifier) != 0){ + // return Error; + // } + // if ((warningThreshold & CompilerOptions.AssertUsedAsAnIdentifier) != 0){ + // return Warning; + // } + // return Ignore; + // case IProblem.NonStaticAccessToStaticMethod : + // case IProblem.NonStaticAccessToStaticField : + // if ((errorThreshold & CompilerOptions.StaticAccessReceiver) != 0){ + // return Error; + // } + // if ((warningThreshold & CompilerOptions.StaticAccessReceiver) != 0){ + // return Warning; + // } + // return Ignore; + // case IProblem.AssignmentHasNoEffect: + // if ((errorThreshold & CompilerOptions.NoEffectAssignment) != 0){ + // return Error; + // } + // if ((warningThreshold & CompilerOptions.NoEffectAssignment) != 0){ + // return Warning; + // } + // return Ignore; + // case IProblem.UnusedPrivateConstructor: + // case IProblem.UnusedPrivateMethod: + // case IProblem.UnusedPrivateField: + // case IProblem.UnusedPrivateType: + // if ((errorThreshold & CompilerOptions.UnusedPrivateMember) != 0){ + // return Error; + // } + // if ((warningThreshold & CompilerOptions.UnusedPrivateMember) != 0){ + // return Warning; + // } + // return Ignore; + // + // case IProblem.Task : + // return Warning; + // default: + // return Error; + // } + //} + //public void conditionalArgumentsIncompatibleTypes(ConditionalExpression + // expression, TypeBinding trueType, TypeBinding falseType) { + // this.handle( + // IProblem.IncompatibleTypesInConditionalOperator, + // new String[] {new String(trueType.readableName()), new + // String(falseType.readableName())}, + // new String[] {new String(trueType.sourceName()), new + // String(falseType.sourceName())}, + // expression.sourceStart, + // expression.sourceEnd); + //} + public void conflictingImport(ImportReference importRef) { + String[] arguments = new String[]{CharOperation.toString(importRef.tokens)}; + this.handle(IProblem.ConflictingImport, arguments, arguments, + importRef.sourceStart, importRef.sourceEnd); + } + public void constantOutOfFormat(NumberLiteral lit) { + // the literal is not in a correct format + // this code is called on IntLiteral and LongLiteral + // example 000811 ...the 8 is uncorrect. + if ((lit instanceof LongLiteral) || (lit instanceof IntLiteral)) { + char[] source = lit.source(); + try { + final String Radix; + final int radix; + if ((source[1] == 'x') || (source[1] == 'X')) { + radix = 16; + Radix = "Hexa"; //$NON-NLS-1$ + } else { + radix = 8; + Radix = "Octal"; //$NON-NLS-1$ + } + //look for the first digit that is incorrect + int place = -1; + label : for (int i = radix == 8 ? 1 : 2; i < source.length; i++) { + if (Character.digit(source[i], radix) == -1) { + place = i; + break label; + } + } + String[] arguments = new String[]{Radix + " " + new String(source) + + " (digit " + new String(new char[]{source[place]}) + ")"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + this.handle(IProblem.NumericValueOutOfRange, arguments, arguments, + lit.sourceStart, lit.sourceEnd); + return; + } catch (IndexOutOfBoundsException ex) { + } + // just in case .... use a predefined error.. + // we should never come here...(except if the code changes !) + this.constantOutOfRange(lit); + } + } + public void constantOutOfRange(Literal lit) { + // lit is some how out of range of it declared type + // example + // 9999999999999999999999999999999999999999999999999999999999999999999 + String[] arguments = new String[]{new String(lit.source())}; + this.handle(IProblem.NumericValueOutOfRange, arguments, arguments, + lit.sourceStart, lit.sourceEnd); + } + public void deprecatedField(FieldBinding field, AstNode location) { + this.handle(IProblem.UsingDeprecatedField, + new String[]{new String(field.declaringClass.readableName()), + new String(field.name)}, new String[]{ + new String(field.declaringClass.shortReadableName()), + new String(field.name)}, location.sourceStart, location.sourceEnd); + } + public void deprecatedMethod(MethodBinding method, AstNode location) { + if (method.isConstructor()) + this.handle(IProblem.UsingDeprecatedConstructor, new String[]{ + new String(method.declaringClass.readableName()), + parametersAsString(method)}, new String[]{ + new String(method.declaringClass.shortReadableName()), + parametersAsShortString(method)}, location.sourceStart, + location.sourceEnd); + else + this.handle(IProblem.UsingDeprecatedMethod, new String[]{ + new String(method.declaringClass.readableName()), + new String(method.selector), parametersAsString(method)}, + new String[]{new String(method.declaringClass.shortReadableName()), + new String(method.selector), parametersAsShortString(method)}, + location.sourceStart, location.sourceEnd); + } + public void deprecatedType(TypeBinding type, AstNode location) { + if (location == null) + return; // 1G828DN - no type ref for synthetic arguments + this.handle(IProblem.UsingDeprecatedType, new String[]{new String(type + .readableName())}, new String[]{new String(type.shortReadableName())}, + location.sourceStart, location.sourceEnd); + } + public void duplicateCase(Case statement, Constant constant) { + String[] arguments = new String[]{String.valueOf(constant.intValue())}; + this.handle(IProblem.DuplicateCase, arguments, arguments, + statement.sourceStart, statement.sourceEnd); + } + public void duplicateDefaultCase(DefaultCase statement) { + this.handle(IProblem.DuplicateDefaultCase, NoArgument, NoArgument, + statement.sourceStart, statement.sourceEnd); + } + public void duplicateFieldInType(SourceTypeBinding type, + FieldDeclaration fieldDecl) { + this.handle(IProblem.DuplicateField, new String[]{ + new String(type.sourceName()), fieldDecl.name()}, new String[]{ + new String(type.shortReadableName()), fieldDecl.name()}, + fieldDecl.sourceStart, fieldDecl.sourceEnd); + } + public void duplicateImport(ImportReference importRef) { + String[] arguments = new String[]{CharOperation.toString(importRef.tokens)}; + this.handle(IProblem.DuplicateImport, arguments, arguments, + importRef.sourceStart, importRef.sourceEnd); + } + public void duplicateInitializationOfBlankFinalField(FieldBinding field, + Reference reference) { + String[] arguments = new String[]{new String(field.readableName())}; + this.handle(IProblem.DuplicateBlankFinalFieldInitialization, arguments, + arguments, reference.sourceStart, reference.sourceEnd); + } + public void duplicateInitializationOfFinalLocal(LocalVariableBinding local, + AstNode location) { + String[] arguments = new String[]{new String(local.readableName())}; + this.handle(IProblem.DuplicateFinalLocalInitialization, arguments, + arguments, location.sourceStart, location.sourceEnd); + } + public void duplicateMethodInType(SourceTypeBinding type, + AbstractMethodDeclaration methodDecl) { + String[] arguments = new String[]{new String(methodDecl.selector), + new String(type.sourceName())}; + this.handle(IProblem.DuplicateMethod, arguments, arguments, + methodDecl.sourceStart, methodDecl.sourceEnd); + } + public void duplicateModifierForField(ReferenceBinding type, + FieldDeclaration fieldDecl) { + /* + * to highlight modifiers use: this.handle( new Problem( + * DuplicateModifierForField, new String[] {fieldDecl.name()}, + * fieldDecl.modifiers.sourceStart, fieldDecl.modifiers.sourceEnd)); + */ + String[] arguments = new String[]{fieldDecl.name()}; + this.handle(IProblem.DuplicateModifierForField, arguments, arguments, + fieldDecl.sourceStart, fieldDecl.sourceEnd); + } + public void duplicateModifierForMethod(ReferenceBinding type, + AbstractMethodDeclaration methodDecl) { + this.handle(IProblem.DuplicateModifierForMethod, new String[]{ + new String(type.sourceName()), new String(methodDecl.selector)}, + new String[]{new String(type.shortReadableName()), + new String(methodDecl.selector)}, methodDecl.sourceStart, + methodDecl.sourceEnd); + } + public void duplicateModifierForType(SourceTypeBinding type) { + String[] arguments = new String[]{new String(type.sourceName())}; + this.handle(IProblem.DuplicateModifierForType, arguments, arguments, type + .sourceStart(), type.sourceEnd()); + } + public void duplicateModifierForVariable(LocalDeclaration localDecl, + boolean complainForArgument) { + String[] arguments = new String[]{localDecl.name()}; + this.handle(complainForArgument + ? IProblem.DuplicateModifierForArgument + : IProblem.DuplicateModifierForVariable, arguments, arguments, + localDecl.sourceStart, localDecl.sourceEnd); + } + public void duplicateNestedType(TypeDeclaration typeDecl) { + String[] arguments = new String[]{new String(typeDecl.name)}; + this.handle(IProblem.DuplicateNestedType, arguments, arguments, + typeDecl.sourceStart, typeDecl.sourceEnd); + } + public void duplicateSuperinterface(SourceTypeBinding type, + TypeDeclaration typeDecl, ReferenceBinding superType) { + this.handle(IProblem.DuplicateSuperInterface, new String[]{ + new String(superType.readableName()), new String(type.sourceName())}, + new String[]{new String(superType.shortReadableName()), + new String(type.sourceName())}, typeDecl.sourceStart, + typeDecl.sourceEnd); + } + public void duplicateTypes(CompilationUnitDeclaration compUnitDecl, + TypeDeclaration typeDecl) { + String[] arguments = new String[]{new String(compUnitDecl.getFileName()), + new String(typeDecl.name)}; + this.referenceContext = typeDecl; // report the problem against the + // type not the entire compilation + // unit + this.handle(IProblem.DuplicateTypes, arguments, arguments, + typeDecl.sourceStart, typeDecl.sourceEnd, + compUnitDecl.compilationResult); + } + public void errorNoMethodFor(MessageSend messageSend, TypeBinding recType, + TypeBinding[] params) { + StringBuffer buffer = new StringBuffer(); + StringBuffer shortBuffer = new StringBuffer(); + for (int i = 0, length = params.length; i < length; i++) { + if (i != 0) { + buffer.append(", "); //$NON-NLS-1$ + shortBuffer.append(", "); //$NON-NLS-1$ + } + buffer.append(new String(params[i].readableName())); + shortBuffer.append(new String(params[i].shortReadableName())); + } + this.handle(recType.isArrayType() + ? IProblem.NoMessageSendOnArrayType + : IProblem.NoMessageSendOnBaseType, new String[]{ + new String(recType.readableName()), new String(messageSend.selector), + buffer.toString()}, new String[]{ + new String(recType.shortReadableName()), + new String(messageSend.selector), shortBuffer.toString()}, + messageSend.sourceStart, messageSend.sourceEnd); + } + public void errorThisSuperInStatic(AstNode reference) { + String[] arguments = new String[]{reference.isSuper() ? "super" : "this"}; //$NON-NLS-2$ //$NON-NLS-1$ + this.handle(IProblem.ThisInStaticContext, arguments, arguments, + reference.sourceStart, reference.sourceEnd); + } + public void exceptionTypeProblem(SourceTypeBinding type, + AbstractMethodDeclaration methodDecl, TypeReference exceptionType, + TypeBinding expectedType) { + int problemId = expectedType.problemId(); + int id; + switch (problemId) { + case NotFound : + // 1 + id = IProblem.ExceptionTypeNotFound; + break; + case NotVisible : + // 2 + id = IProblem.ExceptionTypeNotVisible; + break; + case Ambiguous : + // 3 + id = IProblem.ExceptionTypeAmbiguous; + break; + case InternalNameProvided : + // 4 + id = IProblem.ExceptionTypeInternalNameProvided; + break; + case InheritedNameHidesEnclosingName : + // 5 + id = IProblem.ExceptionTypeInheritedNameHidesEnclosingName; + break; + case NoError : + // 0 + default : + needImplementation(); // want to fail to see why we were + // here... + return; + } + this.handle(id, new String[]{new String(methodDecl.selector), + new String(expectedType.readableName())}, new String[]{ + new String(methodDecl.selector), + new String(expectedType.shortReadableName())}, + exceptionType.sourceStart, exceptionType.sourceEnd); + } + public void expressionShouldBeAVariable(Expression expression) { + this.handle(IProblem.ExpressionShouldBeAVariable, NoArgument, NoArgument, + expression.sourceStart, expression.sourceEnd); + } + public void fieldsOrThisBeforeConstructorInvocation(ThisReference reference) { + this.handle(IProblem.ThisSuperDuringConstructorInvocation, NoArgument, + NoArgument, reference.sourceStart, reference.sourceEnd); + } + public void fieldTypeProblem(SourceTypeBinding type, + FieldDeclaration fieldDecl, TypeBinding expectedType) { + int problemId = expectedType.problemId(); + int id; + switch (problemId) { + case NotFound : + // 1 + id = IProblem.FieldTypeNotFound; + break; + case NotVisible : + // 2 + id = IProblem.FieldTypeNotVisible; + break; + case Ambiguous : + // 3 + id = IProblem.FieldTypeAmbiguous; + break; + case InternalNameProvided : + // 4 + id = IProblem.FieldTypeInternalNameProvided; + break; + case InheritedNameHidesEnclosingName : + // 5 + id = IProblem.FieldTypeInheritedNameHidesEnclosingName; + break; + case NoError : + // 0 + default : + needImplementation(); // want to fail to see why we were + // here... + return; + } + this.handle(id, + new String[]{fieldDecl.name(), new String(type.sourceName()), + new String(expectedType.readableName())}, new String[]{ + fieldDecl.name(), new String(type.sourceName()), + new String(expectedType.shortReadableName())}, + fieldDecl.type.sourceStart, fieldDecl.type.sourceEnd); + } + public void finalMethodCannotBeOverridden(MethodBinding currentMethod, + MethodBinding inheritedMethod) { + this.handle( + // Cannot override the final method from %1 + // 8.4.3.3 - Final methods cannot be overridden or hidden. + IProblem.FinalMethodCannotBeOverridden, new String[]{new String( + inheritedMethod.declaringClass.readableName())}, + new String[]{new String(inheritedMethod.declaringClass + .shortReadableName())}, currentMethod.sourceStart(), currentMethod + .sourceEnd()); + } + public void forwardReference(Reference reference, int indexInQualification, + TypeBinding type) { + this.handle(IProblem.ReferenceToForwardField, NoArgument, NoArgument, + reference.sourceStart, reference.sourceEnd); + } + // use this private API when the compilation unit result can be found + // through the + // reference context. Otherwise, use the other API taking a problem and a + // compilation result + // as arguments + private void handle(int problemId, String[] problemArguments, + String[] messageArguments, int problemStartPosition, + int problemEndPosition) { + this.handle(problemId, problemArguments, messageArguments, + problemStartPosition, problemEndPosition, referenceContext, + referenceContext == null ? null : referenceContext.compilationResult()); + referenceContext = null; + } + // use this private API when the compilation unit result can be found + // through the + // reference context. Otherwise, use the other API taking a problem and a + // compilation result + // as arguments + private void handle(int problemId, String[] problemArguments, + String[] messageArguments, int severity, int problemStartPosition, + int problemEndPosition) { + this.handle(problemId, problemArguments, messageArguments, severity, + problemStartPosition, problemEndPosition, referenceContext, + referenceContext == null ? null : referenceContext.compilationResult()); + referenceContext = null; + } + // use this private API when the compilation unit result cannot be found + // through the + // reference context. + private void handle(int problemId, String[] problemArguments, + String[] messageArguments, int problemStartPosition, + int problemEndPosition, CompilationResult unitResult) { + this.handle(problemId, problemArguments, messageArguments, + problemStartPosition, problemEndPosition, referenceContext, unitResult); + referenceContext = null; + } + public void hidingEnclosingType(TypeDeclaration typeDecl) { + String[] arguments = new String[]{new String(typeDecl.name)}; + this.handle(IProblem.HidingEnclosingType, arguments, arguments, + typeDecl.sourceStart, typeDecl.sourceEnd); + } + public void hierarchyCircularity(SourceTypeBinding sourceType, + ReferenceBinding superType, TypeReference reference) { + int start = 0; + int end = 0; + String typeName = ""; //$NON-NLS-1$ + String shortTypeName = ""; //$NON-NLS-1$ + if (reference == null) { // can only happen when java.lang.Object is + // busted + start = sourceType.sourceStart(); + end = sourceType.sourceEnd(); + typeName = new String(superType.readableName()); + shortTypeName = new String(superType.sourceName()); + } else { + start = reference.sourceStart; + end = reference.sourceEnd; + char[][] qName = reference.getTypeName(); + typeName = CharOperation.toString(qName); + shortTypeName = new String(qName[qName.length - 1]); + } + if (sourceType == superType) + this.handle(IProblem.HierarchyCircularitySelfReference, new String[]{ + new String(sourceType.sourceName()), typeName}, new String[]{ + new String(sourceType.sourceName()), shortTypeName}, start, end); + else + this.handle(IProblem.HierarchyCircularity, new String[]{ + new String(sourceType.sourceName()), typeName}, new String[]{ + new String(sourceType.sourceName()), shortTypeName}, start, end); + } + public void hierarchyHasProblems(SourceTypeBinding type) { + String[] arguments = new String[]{new String(type.sourceName())}; + this.handle(IProblem.HierarchyHasProblems, arguments, arguments, type + .sourceStart(), type.sourceEnd()); + } + public void illegalAbstractModifierCombinationForMethod( + ReferenceBinding type, AbstractMethodDeclaration methodDecl) { + String[] arguments = new String[]{new String(type.sourceName()), + new String(methodDecl.selector)}; + this.handle(IProblem.IllegalAbstractModifierCombinationForMethod, + arguments, arguments, methodDecl.sourceStart, methodDecl.sourceEnd); + } + public void illegalModifierCombinationFinalAbstractForClass( + SourceTypeBinding type) { + String[] arguments = new String[]{new String(type.sourceName())}; + this.handle(IProblem.IllegalModifierCombinationFinalAbstractForClass, + arguments, arguments, type.sourceStart(), type.sourceEnd()); + } + public void illegalModifierCombinationFinalVolatileForField( + ReferenceBinding type, FieldDeclaration fieldDecl) { + String[] arguments = new String[]{fieldDecl.name()}; + this.handle(IProblem.IllegalModifierCombinationFinalVolatileForField, + arguments, arguments, fieldDecl.sourceStart, fieldDecl.sourceEnd); + } + public void illegalModifierForClass(SourceTypeBinding type) { + String[] arguments = new String[]{new String(type.sourceName())}; + this.handle(IProblem.IllegalModifierForClass, arguments, arguments, type + .sourceStart(), type.sourceEnd()); + } + public void illegalModifierForField(ReferenceBinding type, + FieldDeclaration fieldDecl) { + String[] arguments = new String[]{fieldDecl.name()}; + this.handle(IProblem.IllegalModifierForField, arguments, arguments, + fieldDecl.sourceStart, fieldDecl.sourceEnd); + } + public void illegalModifierForInterface(SourceTypeBinding type) { + String[] arguments = new String[]{new String(type.sourceName())}; + this.handle(IProblem.IllegalModifierForInterface, arguments, arguments, + type.sourceStart(), type.sourceEnd()); + } + public void illegalModifierForInterfaceField(ReferenceBinding type, + FieldDeclaration fieldDecl) { + String[] arguments = new String[]{fieldDecl.name()}; + this.handle(IProblem.IllegalModifierForInterfaceField, arguments, + arguments, fieldDecl.sourceStart, fieldDecl.sourceEnd); + } + public void illegalModifierForInterfaceMethod(ReferenceBinding type, + AbstractMethodDeclaration methodDecl) { + String[] arguments = new String[]{new String(type.sourceName()), + new String(methodDecl.selector)}; + this.handle(IProblem.IllegalModifierForInterfaceMethod, arguments, + arguments, methodDecl.sourceStart, methodDecl.sourceEnd); + } + public void illegalModifierForLocalClass(SourceTypeBinding type) { + String[] arguments = new String[]{new String(type.sourceName())}; + this.handle(IProblem.IllegalModifierForLocalClass, arguments, arguments, + type.sourceStart(), type.sourceEnd()); + } + public void illegalModifierForMemberClass(SourceTypeBinding type) { + String[] arguments = new String[]{new String(type.sourceName())}; + this.handle(IProblem.IllegalModifierForMemberClass, arguments, arguments, + type.sourceStart(), type.sourceEnd()); + } + public void illegalModifierForMemberInterface(SourceTypeBinding type) { + String[] arguments = new String[]{new String(type.sourceName())}; + this.handle(IProblem.IllegalModifierForMemberInterface, arguments, + arguments, type.sourceStart(), type.sourceEnd()); + } + public void illegalModifierForMethod(ReferenceBinding type, + AbstractMethodDeclaration methodDecl) { + String[] arguments = new String[]{new String(type.sourceName()), + new String(methodDecl.selector)}; + this.handle(IProblem.IllegalModifierForMethod, arguments, arguments, + methodDecl.sourceStart, methodDecl.sourceEnd); + } + public void illegalModifierForVariable(LocalDeclaration localDecl, + boolean complainAsArgument) { + String[] arguments = new String[]{localDecl.name()}; + this.handle(complainAsArgument + ? IProblem.IllegalModifierForArgument + : IProblem.IllegalModifierForVariable, arguments, arguments, + localDecl.sourceStart, localDecl.sourceEnd); + } + public void illegalPrimitiveOrArrayTypeForEnclosingInstance( + TypeBinding enclosingType, AstNode location) { + this.handle(IProblem.IllegalPrimitiveOrArrayTypeForEnclosingInstance, + new String[]{new String(enclosingType.readableName())}, + new String[]{new String(enclosingType.shortReadableName())}, + location.sourceStart, location.sourceEnd); + } + public void illegalStaticModifierForMemberType(SourceTypeBinding type) { + String[] arguments = new String[]{new String(type.sourceName())}; + this.handle(IProblem.IllegalStaticModifierForMemberType, arguments, + arguments, type.sourceStart(), type.sourceEnd()); + } + public void illegalVisibilityModifierCombinationForField( + ReferenceBinding type, FieldDeclaration fieldDecl) { + String[] arguments = new String[]{new String(fieldDecl.name())}; + this.handle(IProblem.IllegalVisibilityModifierCombinationForField, + arguments, arguments, fieldDecl.sourceStart, fieldDecl.sourceEnd); + } + public void illegalVisibilityModifierCombinationForMemberType( + SourceTypeBinding type) { + String[] arguments = new String[]{new String(type.sourceName())}; + this.handle(IProblem.IllegalVisibilityModifierCombinationForMemberType, + arguments, arguments, type.sourceStart(), type.sourceEnd()); + } + public void illegalVisibilityModifierCombinationForMethod( + ReferenceBinding type, AbstractMethodDeclaration methodDecl) { + String[] arguments = new String[]{new String(type.sourceName()), + new String(methodDecl.selector)}; + this.handle(IProblem.IllegalVisibilityModifierCombinationForMethod, + arguments, arguments, methodDecl.sourceStart, methodDecl.sourceEnd); + } + public void illegalVisibilityModifierForInterfaceMemberType( + SourceTypeBinding type) { + String[] arguments = new String[]{new String(type.sourceName())}; + this.handle(IProblem.IllegalVisibilityModifierForInterfaceMemberType, + arguments, arguments, type.sourceStart(), type.sourceEnd()); + } + public void illegalVoidExpression(AstNode location) { + this.handle(IProblem.InvalidVoidExpression, NoArgument, NoArgument, + location.sourceStart, location.sourceEnd); + } + public void importProblem(ImportReference importRef, Binding expectedImport) { + int problemId = expectedImport.problemId(); + int id; + switch (problemId) { + case NotFound : + // 1 + id = IProblem.ImportNotFound; + break; + case NotVisible : + // 2 + id = IProblem.ImportNotVisible; + break; + case Ambiguous : + // 3 + id = IProblem.ImportAmbiguous; + break; + case InternalNameProvided : + // 4 + id = IProblem.ImportInternalNameProvided; + break; + case InheritedNameHidesEnclosingName : + // 5 + id = IProblem.ImportInheritedNameHidesEnclosingName; + break; + case NoError : + // 0 + default : + needImplementation(); // want to fail to see why we were + // here... + return; + } + String argument; + if (expectedImport instanceof ProblemReferenceBinding) { + argument = CharOperation + .toString(((ProblemReferenceBinding) expectedImport).compoundName); + } else { + argument = CharOperation.toString(importRef.tokens); + } + String[] arguments = new String[]{argument}; + this.handle(id, arguments, arguments, importRef.sourceStart, + importRef.sourceEnd); + } + public void incompatibleExceptionInThrowsClause(SourceTypeBinding type, + MethodBinding currentMethod, MethodBinding inheritedMethod, + ReferenceBinding exceptionType) { + if (type == currentMethod.declaringClass) { + int id; + if (currentMethod.declaringClass.isInterface() + && !inheritedMethod.isPublic()) { // interface inheriting + // Object protected + // method + id = IProblem.IncompatibleExceptionInThrowsClauseForNonInheritedInterfaceMethod; + } else { + id = IProblem.IncompatibleExceptionInThrowsClause; + } + this.handle( + // Exception %1 is not compatible with throws + // clause in %2 + // 9.4.4 - The type of exception in the throws + // clause is incompatible. + id, new String[]{ + new String(exceptionType.sourceName()), + new String(CharOperation.concat(inheritedMethod.declaringClass + .readableName(), inheritedMethod.readableName(), '.'))}, + new String[]{ + new String(exceptionType.sourceName()), + new String(CharOperation.concat(inheritedMethod.declaringClass + .shortReadableName(), inheritedMethod.shortReadableName(), + '.'))}, currentMethod.sourceStart(), currentMethod + .sourceEnd()); + } else + this.handle( + // Exception %1 in throws clause of %2 is not + // compatible with %3 + // 9.4.4 - The type of exception in the throws + // clause is incompatible. + IProblem.IncompatibleExceptionInInheritedMethodThrowsClause, + new String[]{ + new String(exceptionType.sourceName()), + new String(CharOperation.concat(currentMethod.declaringClass + .sourceName(), currentMethod.readableName(), '.')), + new String(CharOperation.concat(inheritedMethod.declaringClass + .readableName(), inheritedMethod.readableName(), '.'))}, + new String[]{ + new String(exceptionType.sourceName()), + new String(CharOperation.concat(currentMethod.declaringClass + .sourceName(), currentMethod.shortReadableName(), '.')), + new String(CharOperation.concat(inheritedMethod.declaringClass + .shortReadableName(), inheritedMethod.shortReadableName(), + '.'))}, type.sourceStart(), type.sourceEnd()); + } + public void incompatibleReturnType(MethodBinding currentMethod, + MethodBinding inheritedMethod) { + StringBuffer methodSignature = new StringBuffer(); + methodSignature.append(inheritedMethod.declaringClass.readableName()) + .append('.').append(inheritedMethod.readableName()); + StringBuffer shortSignature = new StringBuffer(); + shortSignature.append(inheritedMethod.declaringClass.shortReadableName()) + .append('.').append(inheritedMethod.shortReadableName()); + int id; + if (currentMethod.declaringClass.isInterface() + && !inheritedMethod.isPublic()) { // interface inheriting + // Object protected method + id = IProblem.IncompatibleReturnTypeForNonInheritedInterfaceMethod; + } else { + id = IProblem.IncompatibleReturnType; + } + this.handle(id, new String[]{methodSignature.toString()}, + new String[]{shortSignature.toString()}, currentMethod.sourceStart(), + currentMethod.sourceEnd()); + } + public void incorrectLocationForEmptyDimension( + ArrayAllocationExpression expression, int index) { + this.handle(IProblem.IllegalDimension, NoArgument, NoArgument, + expression.dimensions[index + 1].sourceStart, + expression.dimensions[index + 1].sourceEnd); + } + public void incorrectSwitchType(Expression expression, TypeBinding testType) { + this.handle(IProblem.IncorrectSwitchType, new String[]{new String(testType + .readableName())}, + new String[]{new String(testType.shortReadableName())}, + expression.sourceStart, expression.sourceEnd); + } + public void inheritedMethodReducesVisibility(SourceTypeBinding type, + MethodBinding concreteMethod, MethodBinding[] abstractMethods) { + StringBuffer concreteSignature = new StringBuffer(); + concreteSignature.append(concreteMethod.declaringClass.readableName()) + .append('.').append(concreteMethod.readableName()); + StringBuffer shortSignature = new StringBuffer(); + shortSignature.append(concreteMethod.declaringClass.shortReadableName()) + .append('.').append(concreteMethod.shortReadableName()); + this.handle( + // The inherited method %1 cannot hide the public abstract method in %2 + IProblem.InheritedMethodReducesVisibility, new String[]{ + new String(concreteSignature.toString()), + new String(abstractMethods[0].declaringClass.readableName())}, + new String[]{new String(shortSignature.toString()), + new String(abstractMethods[0].declaringClass.shortReadableName())}, + type.sourceStart(), type.sourceEnd()); + } + public void inheritedMethodsHaveIncompatibleReturnTypes( + SourceTypeBinding type, MethodBinding[] inheritedMethods, int length) { + StringBuffer methodSignatures = new StringBuffer(); + StringBuffer shortSignatures = new StringBuffer(); + for (int i = length; --i >= 0;) { + methodSignatures + .append(inheritedMethods[i].declaringClass.readableName()) + .append('.').append(inheritedMethods[i].readableName()); + shortSignatures.append( + inheritedMethods[i].declaringClass.shortReadableName()).append('.') + .append(inheritedMethods[i].shortReadableName()); + if (i != 0) { + methodSignatures.append(", "); //$NON-NLS-1$ + shortSignatures.append(", "); //$NON-NLS-1$ + } + } + this.handle( + // Return type is incompatible with %1 + // 9.4.2 - The return type from the method is incompatible with + // the declaration. + IProblem.IncompatibleReturnType, new String[]{methodSignatures + .toString()}, new String[]{shortSignatures.toString()}, type + .sourceStart(), type.sourceEnd()); + } + public void initializerMustCompleteNormally(FieldDeclaration fieldDecl) { + this.handle(IProblem.InitializerMustCompleteNormally, NoArgument, + NoArgument, fieldDecl.sourceStart, fieldDecl.sourceEnd); + } + public void innerTypesCannotDeclareStaticInitializers( + ReferenceBinding innerType, AstNode location) { + this.handle(IProblem.CannotDefineStaticInitializerInLocalType, + new String[]{new String(innerType.readableName())}, + new String[]{new String(innerType.shortReadableName())}, + location.sourceStart, location.sourceEnd); + } + public void interfaceCannotHaveConstructors(ConstructorDeclaration constructor) { + this.handle(IProblem.InterfaceCannotHaveConstructors, NoArgument, + NoArgument, constructor.sourceStart, constructor.sourceEnd, + constructor, constructor.compilationResult()); + } + public void interfaceCannotHaveInitializers(SourceTypeBinding type, + FieldDeclaration fieldDecl) { + String[] arguments = new String[]{new String(type.sourceName())}; + this.handle(IProblem.InterfaceCannotHaveInitializers, arguments, arguments, + fieldDecl.sourceStart, fieldDecl.sourceEnd); + } + public void invalidBreak(AstNode location) { + this.handle(IProblem.InvalidBreak, NoArgument, NoArgument, + location.sourceStart, location.sourceEnd); + } + public void invalidConstructor(Statement statement, + MethodBinding targetConstructor) { + boolean insideDefaultConstructor = (referenceContext instanceof ConstructorDeclaration) + && ((ConstructorDeclaration) referenceContext).isDefaultConstructor(); + boolean insideImplicitConstructorCall = (statement instanceof ExplicitConstructorCall) + && (((ExplicitConstructorCall) statement).accessMode == ExplicitConstructorCall.ImplicitSuper); + int flag = IProblem.UndefinedConstructor; //default... + switch (targetConstructor.problemId()) { + case NotFound : + if (insideDefaultConstructor) { + flag = IProblem.UndefinedConstructorInDefaultConstructor; + } else if (insideImplicitConstructorCall) { + flag = IProblem.UndefinedConstructorInImplicitConstructorCall; + } else { + flag = IProblem.UndefinedConstructor; + } + break; + case NotVisible : + if (insideDefaultConstructor) { + flag = IProblem.NotVisibleConstructorInDefaultConstructor; + } else if (insideImplicitConstructorCall) { + flag = IProblem.NotVisibleConstructorInImplicitConstructorCall; + } else { + flag = IProblem.NotVisibleConstructor; + } + break; + case Ambiguous : + if (insideDefaultConstructor) { + flag = IProblem.AmbiguousConstructorInDefaultConstructor; + } else if (insideImplicitConstructorCall) { + flag = IProblem.AmbiguousConstructorInImplicitConstructorCall; + } else { + flag = IProblem.AmbiguousConstructor; + } + break; + case NoError : + // 0 + default : + needImplementation(); // want to fail to see why we were + // here... + break; + } + this.handle(flag, new String[]{ + new String(targetConstructor.declaringClass.readableName()), + parametersAsString(targetConstructor)}, new String[]{ + new String(targetConstructor.declaringClass.shortReadableName()), + parametersAsShortString(targetConstructor)}, statement.sourceStart, + statement.sourceEnd); + } + public void invalidContinue(AstNode location) { + this.handle(IProblem.InvalidContinue, NoArgument, NoArgument, + location.sourceStart, location.sourceEnd); + } + public void invalidEnclosingType(Expression expression, TypeBinding type, + ReferenceBinding enclosingType) { + if (enclosingType.isAnonymousType()) + enclosingType = enclosingType.superclass(); + int flag = IProblem.UndefinedType; // default + switch (type.problemId()) { + case NotFound : + // 1 + flag = IProblem.UndefinedType; + break; + case NotVisible : + // 2 + flag = IProblem.NotVisibleType; + break; + case Ambiguous : + // 3 + flag = IProblem.AmbiguousType; + break; + case InternalNameProvided : + flag = IProblem.InternalTypeNameProvided; + break; + case NoError : + // 0 + default : + needImplementation(); // want to fail to see why we were + // here... + break; + } + this.handle(flag, new String[]{new String(enclosingType.readableName()) + + "." + new String(type.readableName())}, //$NON-NLS-1$ + new String[]{new String(enclosingType.shortReadableName()) + "." + + new String(type.shortReadableName())}, //$NON-NLS-1$ + expression.sourceStart, expression.sourceEnd); + } + public void invalidExpressionAsStatement(Expression expression) { + this.handle(IProblem.InvalidExpressionAsStatement, NoArgument, NoArgument, + expression.sourceStart, expression.sourceEnd); + } + public void invalidField(FieldReference fieldRef, TypeBinding searchedType) { + int severity = Error; + int flag = IProblem.UndefinedField; + FieldBinding field = fieldRef.binding; + switch (field.problemId()) { + case NotFound : + flag = IProblem.UndefinedField; + /* + * also need to check that the searchedType is the receiver type if + * (searchedType.isHierarchyInconsistent()) severity = SecondaryError; + */ + break; + case NotVisible : + flag = IProblem.NotVisibleField; + break; + case Ambiguous : + flag = IProblem.AmbiguousField; + break; + case NonStaticReferenceInStaticContext : + flag = IProblem.NonStaticFieldFromStaticInvocation; + break; + case NonStaticReferenceInConstructorInvocation : + flag = IProblem.InstanceFieldDuringConstructorInvocation; + break; + case InheritedNameHidesEnclosingName : + flag = IProblem.InheritedFieldHidesEnclosingName; + break; + case ReceiverTypeNotVisible : + this.handle(IProblem.NotVisibleType, new String[]{new String( + searchedType.leafComponentType().readableName())}, + new String[]{new String(searchedType.leafComponentType() + .shortReadableName())}, fieldRef.receiver.sourceStart, + fieldRef.receiver.sourceEnd); + return; + case NoError : + // 0 + default : + needImplementation(); // want to fail to see why we were + // here... + break; + } + String[] arguments = new String[]{new String(field.readableName())}; + this.handle(flag, arguments, arguments, severity, fieldRef.sourceStart, + fieldRef.sourceEnd); + } + public void invalidField(NameReference nameRef, FieldBinding field) { + int flag = IProblem.UndefinedField; + switch (field.problemId()) { + case NotFound : + flag = IProblem.UndefinedField; + break; + case NotVisible : + flag = IProblem.NotVisibleField; + break; + case Ambiguous : + flag = IProblem.AmbiguousField; + break; + case NonStaticReferenceInStaticContext : + flag = IProblem.NonStaticFieldFromStaticInvocation; + break; + case NonStaticReferenceInConstructorInvocation : + flag = IProblem.InstanceFieldDuringConstructorInvocation; + break; + case InheritedNameHidesEnclosingName : + flag = IProblem.InheritedFieldHidesEnclosingName; + break; + case ReceiverTypeNotVisible : + this.handle(IProblem.NotVisibleType, new String[]{new String( + field.declaringClass.leafComponentType().readableName())}, + new String[]{new String(field.declaringClass.leafComponentType() + .shortReadableName())}, nameRef.sourceStart, nameRef.sourceEnd); + return; + case NoError : + // 0 + default : + needImplementation(); // want to fail to see why we were + // here... + break; + } + String[] arguments = new String[]{new String(field.readableName())}; + this.handle(flag, arguments, arguments, nameRef.sourceStart, + nameRef.sourceEnd); + } + public void invalidField(QualifiedNameReference nameRef, FieldBinding field, + int index, TypeBinding searchedType) { + //the resolution of the index-th field of qname failed + //qname.otherBindings[index] is the binding that has produced the + // error + //The different targetted errors should be : + //UndefinedField + //NotVisibleField + //AmbiguousField + if (searchedType.isBaseType()) { + this.handle(IProblem.NoFieldOnBaseType, new String[]{ + new String(searchedType.readableName()), + CharOperation.toString(CharOperation.subarray(nameRef.tokens, 0, + index)), new String(nameRef.tokens[index])}, new String[]{ + new String(searchedType.sourceName()), + CharOperation.toString(CharOperation.subarray(nameRef.tokens, 0, + index)), new String(nameRef.tokens[index])}, nameRef.sourceStart, + nameRef.sourceEnd); + return; + } + int flag = IProblem.UndefinedField; + switch (field.problemId()) { + case NotFound : + flag = IProblem.UndefinedField; + /* + * also need to check that the searchedType is the receiver type if + * (searchedType.isHierarchyInconsistent()) severity = SecondaryError; + */ + break; + case NotVisible : + flag = IProblem.NotVisibleField; + break; + case Ambiguous : + flag = IProblem.AmbiguousField; + break; + case NonStaticReferenceInStaticContext : + flag = IProblem.NonStaticFieldFromStaticInvocation; + break; + case NonStaticReferenceInConstructorInvocation : + flag = IProblem.InstanceFieldDuringConstructorInvocation; + break; + case InheritedNameHidesEnclosingName : + flag = IProblem.InheritedFieldHidesEnclosingName; + break; + case ReceiverTypeNotVisible : + this.handle(IProblem.NotVisibleType, new String[]{new String( + searchedType.leafComponentType().readableName())}, + new String[]{new String(searchedType.leafComponentType() + .shortReadableName())}, nameRef.sourceStart, nameRef.sourceEnd); + return; + case NoError : + // 0 + default : + needImplementation(); // want to fail to see why we were + // here... + break; + } + String[] arguments = new String[]{CharOperation.toString(CharOperation + .subarray(nameRef.tokens, 0, index + 1))}; + this.handle(flag, arguments, arguments, nameRef.sourceStart, + nameRef.sourceEnd); + } + public void invalidMethod(MessageSend messageSend, MethodBinding method) { + // CODE should be UPDATED according to error coding in the different + // method binding errors + // The different targetted errors should be : + // UndefinedMethod + // NotVisibleMethod + // AmbiguousMethod + // InheritedNameHidesEnclosingName + // InstanceMethodDuringConstructorInvocation + // StaticMethodRequested + int flag = IProblem.UndefinedMethod; //default... + switch (method.problemId()) { + case NotFound : + flag = IProblem.UndefinedMethod; + break; + case NotVisible : + flag = IProblem.NotVisibleMethod; + break; + case Ambiguous : + flag = IProblem.AmbiguousMethod; + break; + case InheritedNameHidesEnclosingName : + flag = IProblem.InheritedMethodHidesEnclosingName; + break; + case NonStaticReferenceInConstructorInvocation : + flag = IProblem.InstanceMethodDuringConstructorInvocation; + break; + case NonStaticReferenceInStaticContext : + flag = IProblem.StaticMethodRequested; + break; + case ReceiverTypeNotVisible : + this.handle(IProblem.NotVisibleType, new String[]{new String( + method.declaringClass.leafComponentType().readableName())}, + new String[]{new String(method.declaringClass.leafComponentType() + .shortReadableName())}, messageSend.receiver.sourceStart, + messageSend.receiver.sourceEnd); + return; + case NoError : + // 0 + default : + needImplementation(); // want to fail to see why we were + // here... + break; + } + if (flag == IProblem.UndefinedMethod) { + ProblemMethodBinding problemMethod = (ProblemMethodBinding) method; + if (problemMethod.closestMatch != null) { + String closestParameterTypeNames = parametersAsString(problemMethod.closestMatch); + String parameterTypeNames = parametersAsString(method); + String closestParameterTypeShortNames = parametersAsShortString(problemMethod.closestMatch); + String parameterTypeShortNames = parametersAsShortString(method); + if (closestParameterTypeShortNames.equals(parameterTypeShortNames)) { + closestParameterTypeShortNames = closestParameterTypeNames; + parameterTypeShortNames = parameterTypeNames; + } + this.handle(IProblem.ParameterMismatch, + new String[]{ + new String(problemMethod.closestMatch.declaringClass + .readableName()), + new String(problemMethod.closestMatch.selector), + closestParameterTypeNames, parameterTypeNames}, new String[]{ + new String(problemMethod.closestMatch.declaringClass + .shortReadableName()), + new String(problemMethod.closestMatch.selector), + closestParameterTypeShortNames, parameterTypeShortNames}, + (int) (messageSend.nameSourcePosition >>> 32), + (int) messageSend.nameSourcePosition); + return; + } + } + this.handle(flag, new String[]{ + new String(method.declaringClass.readableName()), + new String(method.selector), parametersAsString(method)}, new String[]{ + new String(method.declaringClass.shortReadableName()), + new String(method.selector), parametersAsShortString(method)}, + (int) (messageSend.nameSourcePosition >>> 32), + (int) messageSend.nameSourcePosition); + } + public void invalidNullToSynchronize(Expression expression) { + this.handle(IProblem.InvalidNullToSynchronized, NoArgument, NoArgument, + expression.sourceStart, expression.sourceEnd); + } + public void invalidOperator(BinaryExpression expression, + TypeBinding leftType, TypeBinding rightType) { + String leftName = new String(leftType.readableName()); + String rightName = new String(rightType.readableName()); + String leftShortName = new String(leftType.shortReadableName()); + String rightShortName = new String(rightType.shortReadableName()); + if (leftShortName.equals(rightShortName)) { + leftShortName = leftName; + rightShortName = rightName; + } + this.handle(IProblem.InvalidOperator, new String[]{ + expression.operatorToString(), leftName + ", " + rightName}, //$NON-NLS-1$ + new String[]{expression.operatorToString(), + leftShortName + ", " + rightShortName}, //$NON-NLS-1$ + expression.sourceStart, expression.sourceEnd); + } + public void invalidOperator(CompoundAssignment assign, TypeBinding leftType, + TypeBinding rightType) { + String leftName = new String(leftType.readableName()); + String rightName = new String(rightType.readableName()); + String leftShortName = new String(leftType.shortReadableName()); + String rightShortName = new String(rightType.shortReadableName()); + if (leftShortName.equals(rightShortName)) { + leftShortName = leftName; + rightShortName = rightName; + } + this.handle(IProblem.InvalidOperator, new String[]{ + assign.operatorToString(), leftName + ", " + rightName}, //$NON-NLS-1$ + new String[]{assign.operatorToString(), + leftShortName + ", " + rightShortName}, //$NON-NLS-1$ + assign.sourceStart, assign.sourceEnd); + } + public void invalidOperator(UnaryExpression expression, TypeBinding type) { + this.handle(IProblem.InvalidOperator, new String[]{ + expression.operatorToString(), new String(type.readableName())}, + new String[]{expression.operatorToString(), + new String(type.shortReadableName())}, expression.sourceStart, + expression.sourceEnd); + } + public void invalidParenthesizedExpression(AstNode reference) { + this.handle(IProblem.InvalidParenthesizedExpression, NoArgument, + NoArgument, reference.sourceStart, reference.sourceEnd); + } + public void invalidSuperclass(SourceTypeBinding type, + TypeReference superclassRef, ReferenceBinding expectedType) { + int problemId = expectedType.problemId(); + int id; + switch (problemId) { + case NotFound : + // 1 + id = IProblem.SuperclassNotFound; + break; + case NotVisible : + // 2 + id = IProblem.SuperclassNotVisible; + break; + case Ambiguous : + // 3 + id = IProblem.SuperclassAmbiguous; + break; + case InternalNameProvided : + // 4 + id = IProblem.SuperclassInternalNameProvided; + break; + case InheritedNameHidesEnclosingName : + // 5 + id = IProblem.SuperclassInheritedNameHidesEnclosingName; + break; + case NoError : + // 0 + default : + needImplementation(); // want to fail to see why we were + // here... + return; + } + this.handle(id, new String[]{new String(expectedType.readableName()), + new String(type.sourceName())}, new String[]{ + new String(expectedType.shortReadableName()), + new String(type.sourceName())}, superclassRef.sourceStart, + superclassRef.sourceEnd); + } + public void invalidSuperinterface(SourceTypeBinding type, + TypeReference superinterfaceRef, ReferenceBinding expectedType) { + int problemId = expectedType.problemId(); + int id; + switch (problemId) { + case NotFound : + // 1 + id = IProblem.InterfaceNotFound; + break; + case NotVisible : + // 2 + id = IProblem.InterfaceNotVisible; + break; + case Ambiguous : + // 3 + id = IProblem.InterfaceAmbiguous; + break; + case InternalNameProvided : + // 4 + id = IProblem.InterfaceInternalNameProvided; + break; + case InheritedNameHidesEnclosingName : + // 5 + id = IProblem.InterfaceInheritedNameHidesEnclosingName; + break; + case NoError : + // 0 + default : + needImplementation(); // want to fail to see why we were + // here... + return; + } + this.handle(id, new String[]{new String(expectedType.readableName()), + new String(type.sourceName())}, new String[]{ + new String(expectedType.shortReadableName()), + new String(type.sourceName())}, superinterfaceRef.sourceStart, + superinterfaceRef.sourceEnd); + } + public void invalidType(AstNode location, TypeBinding type) { + int flag = IProblem.UndefinedType; // default + switch (type.problemId()) { + case NotFound : + flag = IProblem.UndefinedType; + break; + case NotVisible : + flag = IProblem.NotVisibleType; + break; + case Ambiguous : + flag = IProblem.AmbiguousType; + break; + case InternalNameProvided : + flag = IProblem.InternalTypeNameProvided; + break; + case InheritedNameHidesEnclosingName : + flag = IProblem.InheritedTypeHidesEnclosingName; + break; + case NoError : + // 0 + default : + needImplementation(); // want to fail to see why we were + // here... + break; + } + this.handle(flag, new String[]{new String(type.readableName())}, + new String[]{new String(type.shortReadableName())}, + location.sourceStart, location.sourceEnd); + } + public void invalidTypeReference(Expression expression) { + this.handle(IProblem.InvalidTypeExpression, NoArgument, NoArgument, + expression.sourceStart, expression.sourceEnd); + } + public void invalidTypeToSynchronize(Expression expression, TypeBinding type) { + this.handle(IProblem.InvalidTypeToSynchronized, new String[]{new String( + type.readableName())}, + new String[]{new String(type.shortReadableName())}, + expression.sourceStart, expression.sourceEnd); + } + public void invalidUnaryExpression(Expression expression) { + this.handle(IProblem.InvalidUnaryExpression, NoArgument, NoArgument, + expression.sourceStart, expression.sourceEnd); + } + public void isClassPathCorrect(char[][] wellKnownTypeName, + CompilationUnitDeclaration compUnitDecl) { + referenceContext = compUnitDecl; + String[] arguments = new String[]{CharOperation.toString(wellKnownTypeName)}; + this.handle(IProblem.IsClassPathCorrect, arguments, arguments, + AbortCompilation | Error, compUnitDecl == null + ? 0 + : compUnitDecl.sourceStart, compUnitDecl == null + ? 1 + : compUnitDecl.sourceEnd); + } + public void maskedExceptionHandler(ReferenceBinding exceptionType, + AstNode location) { + this.handle(IProblem.MaskedCatch, NoArgument, NoArgument, + location.sourceStart, location.sourceEnd); + } + public void methodNeedingAbstractModifier(MethodDeclaration methodDecl) { + this.handle(IProblem.MethodRequiresBody, NoArgument, NoArgument, + methodDecl.sourceStart, methodDecl.sourceEnd); + } + public void methodNeedingNoBody(MethodDeclaration methodDecl) { + this.handle( + // ((methodDecl.modifiers & CompilerModifiers.AccNative) != 0) ? + // IProblem.BodyForNativeMethod : IProblem.BodyForAbstractMethod, + IProblem.BodyForAbstractMethod, NoArgument, NoArgument, + methodDecl.sourceStart, methodDecl.sourceEnd); + } + public void methodWithConstructorName(MethodDeclaration methodDecl) { + this.handle(IProblem.MethodButWithConstructorName, NoArgument, NoArgument, + methodDecl.sourceStart, methodDecl.sourceEnd); + } + //public void missingEnclosingInstanceSpecification(ReferenceBinding + // enclosingType, AstNode location) { + // boolean insideConstructorCall = + // (location instanceof ExplicitConstructorCall) + // && (((ExplicitConstructorCall) location).accessMode == + // ExplicitConstructorCall.ImplicitSuper); + // + // this.handle( + // insideConstructorCall + // ? IProblem.MissingEnclosingInstanceForConstructorCall + // : IProblem.MissingEnclosingInstance, + // new String[] {new String(enclosingType.readableName())}, + // new String[] {new String(enclosingType.shortReadableName())}, + // location.sourceStart, + // location.sourceEnd); + //} + public void missingReturnType(AbstractMethodDeclaration methodDecl) { + this.handle(IProblem.MissingReturnType, NoArgument, NoArgument, + methodDecl.sourceStart, methodDecl.sourceEnd); + } + public void missingSemiColon(Expression expression) { + this.handle(IProblem.MissingSemiColon, NoArgument, NoArgument, + expression.sourceStart, expression.sourceEnd); + } + public void mustDefineDimensionsOrInitializer( + ArrayAllocationExpression expression) { + this.handle(IProblem.MustDefineEitherDimensionExpressionsOrInitializer, + NoArgument, NoArgument, expression.sourceStart, expression.sourceEnd); + } + public void mustSpecifyPackage(CompilationUnitDeclaration compUnitDecl) { + String[] arguments = new String[]{new String(compUnitDecl.getFileName())}; + this.handle(IProblem.MustSpecifyPackage, arguments, arguments, + compUnitDecl.sourceStart, compUnitDecl.sourceStart + 1); + } + public void mustUseAStaticMethod(MessageSend messageSend, MethodBinding method) { + this.handle(IProblem.StaticMethodRequested, new String[]{ + new String(method.declaringClass.readableName()), + new String(method.selector), parametersAsString(method)}, new String[]{ + new String(method.declaringClass.shortReadableName()), + new String(method.selector), parametersAsShortString(method)}, + messageSend.sourceStart, messageSend.sourceEnd); + } + public void nativeMethodsCannotBeStrictfp(ReferenceBinding type, + AbstractMethodDeclaration methodDecl) { + String[] arguments = new String[]{new String(type.sourceName()), + new String(methodDecl.selector)}; + this.handle(IProblem.NativeMethodsCannotBeStrictfp, arguments, arguments, + methodDecl.sourceStart, methodDecl.sourceEnd); + } + public void needImplementation() { + this.abortDueToInternalError(Util.bind("abort.missingCode")); //$NON-NLS-1$ + } + public void needToEmulateFieldReadAccess(FieldBinding field, AstNode location) { + this.handle(IProblem.NeedToEmulateFieldReadAccess, + new String[]{new String(field.declaringClass.readableName()), + new String(field.name)}, new String[]{ + new String(field.declaringClass.shortReadableName()), + new String(field.name)}, location.sourceStart, location.sourceEnd); + } + public void needToEmulateFieldWriteAccess(FieldBinding field, AstNode location) { + this.handle(IProblem.NeedToEmulateFieldWriteAccess, + new String[]{new String(field.declaringClass.readableName()), + new String(field.name)}, new String[]{ + new String(field.declaringClass.shortReadableName()), + new String(field.name)}, location.sourceStart, location.sourceEnd); + } + public void needToEmulateMethodAccess(MethodBinding method, AstNode location) { + if (method.isConstructor()) + this.handle(IProblem.NeedToEmulateConstructorAccess, new String[]{ + new String(method.declaringClass.readableName()), + parametersAsString(method)}, new String[]{ + new String(method.declaringClass.shortReadableName()), + parametersAsShortString(method)}, location.sourceStart, + location.sourceEnd); + else + this.handle(IProblem.NeedToEmulateMethodAccess, new String[]{ + new String(method.declaringClass.readableName()), + new String(method.selector), parametersAsString(method)}, + new String[]{new String(method.declaringClass.shortReadableName()), + new String(method.selector), parametersAsShortString(method)}, + location.sourceStart, location.sourceEnd); + } + public void nestedClassCannotDeclareInterface(TypeDeclaration typeDecl) { + String[] arguments = new String[]{new String(typeDecl.name)}; + this.handle(IProblem.CannotDefineInterfaceInLocalType, arguments, + arguments, typeDecl.sourceStart, typeDecl.sourceEnd); + } + public void noMoreAvailableSpaceForArgument(LocalVariableBinding local, + AstNode location) { + String[] arguments = new String[]{new String(local.name)}; + this.handle(local instanceof SyntheticArgumentBinding + ? IProblem.TooManySyntheticArgumentSlots + : IProblem.TooManyArgumentSlots, arguments, arguments, Abort | Error, + location.sourceStart, location.sourceEnd); + } + public void noMoreAvailableSpaceForLocal(LocalVariableBinding local, + AstNode location) { + String[] arguments = new String[]{new String(local.name)}; + this.handle(IProblem.TooManyLocalVariableSlots, arguments, arguments, Abort + | Error, location.sourceStart, location.sourceEnd); + } + public void noSuchEnclosingInstance(TypeBinding targetType, AstNode location, + boolean isConstructorCall) { + int id; + if (isConstructorCall) { + //28 = No enclosing instance of type {0} is available due to some + // intermediate constructor invocation + id = IProblem.EnclosingInstanceInConstructorCall; + } else if ((location instanceof ExplicitConstructorCall) + && ((ExplicitConstructorCall) location).accessMode == ExplicitConstructorCall.ImplicitSuper) { + //20 = No enclosing instance of type {0} is accessible to invoke + // the super constructor. Must define a constructor and explicitly + // qualify its super constructor invocation with an instance of {0} + // (e.g. x.super() where x is an instance of {0}). + id = IProblem.MissingEnclosingInstanceForConstructorCall; + } else if (location instanceof AllocationExpression + && (((AllocationExpression) location).binding.declaringClass + .isMemberType() || (((AllocationExpression) location).binding.declaringClass + .isAnonymousType() && ((AllocationExpression) location).binding.declaringClass + .superclass().isMemberType()))) { + //21 = No enclosing instance of type {0} is accessible. Must + // qualify the allocation with an enclosing instance of type {0} + // (e.g. x.new A() where x is an instance of {0}). + id = IProblem.MissingEnclosingInstance; + } else { // default + //22 = No enclosing instance of the type {0} is accessible in + // scope + id = IProblem.IncorrectEnclosingInstanceReference; + } + this.handle(id, new String[]{new String(targetType.readableName())}, + new String[]{new String(targetType.shortReadableName())}, + location.sourceStart, location.sourceEnd); + } + public void notCompatibleTypesError(EqualExpression expression, + TypeBinding leftType, TypeBinding rightType) { + String leftName = new String(leftType.readableName()); + String rightName = new String(rightType.readableName()); + String leftShortName = new String(leftType.shortReadableName()); + String rightShortName = new String(rightType.shortReadableName()); + if (leftShortName.equals(rightShortName)) { + leftShortName = leftName; + rightShortName = rightName; + } + this.handle(IProblem.IncompatibleTypesInEqualityOperator, new String[]{ + leftName, rightName}, new String[]{leftShortName, rightShortName}, + expression.sourceStart, expression.sourceEnd); + } + public void notCompatibleTypesError(InstanceOfExpression expression, + TypeBinding leftType, TypeBinding rightType) { + String leftName = new String(leftType.readableName()); + String rightName = new String(rightType.readableName()); + String leftShortName = new String(leftType.shortReadableName()); + String rightShortName = new String(rightType.shortReadableName()); + if (leftShortName.equals(rightShortName)) { + leftShortName = leftName; + rightShortName = rightName; + } + this.handle(IProblem.IncompatibleTypesInConditionalOperator, new String[]{ + leftName, rightName}, new String[]{leftShortName, rightShortName}, + expression.sourceStart, expression.sourceEnd); + } + public void objectCannotHaveSuperTypes(SourceTypeBinding type) { + this.handle(IProblem.ObjectCannotHaveSuperTypes, NoArgument, NoArgument, + type.sourceStart(), type.sourceEnd()); + } + public void operatorOnlyValidOnNumericType(CompoundAssignment assignment, + TypeBinding leftType, TypeBinding rightType) { + String leftName = new String(leftType.readableName()); + String rightName = new String(rightType.readableName()); + String leftShortName = new String(leftType.shortReadableName()); + String rightShortName = new String(rightType.shortReadableName()); + if (leftShortName.equals(rightShortName)) { + leftShortName = leftName; + rightShortName = rightName; + } + this.handle(IProblem.TypeMismatch, new String[]{leftName, rightName}, + new String[]{leftShortName, rightShortName}, assignment.sourceStart, + assignment.sourceEnd); + } + public void overridesDeprecatedMethod(MethodBinding localMethod, + MethodBinding inheritedMethod) { + this.handle(IProblem.OverridingDeprecatedMethod, new String[]{ + new String(CharOperation.concat(localMethod.declaringClass + .readableName(), localMethod.readableName(), '.')), + new String(inheritedMethod.declaringClass.readableName())}, + new String[]{ + new String(CharOperation.concat(localMethod.declaringClass + .shortReadableName(), localMethod.shortReadableName(), '.')), + new String(inheritedMethod.declaringClass.shortReadableName())}, + localMethod.sourceStart(), localMethod.sourceEnd()); + } + public void overridesPackageDefaultMethod(MethodBinding localMethod, + MethodBinding inheritedMethod) { + this.handle(IProblem.OverridingNonVisibleMethod, new String[]{ + new String(CharOperation.concat(localMethod.declaringClass + .readableName(), localMethod.readableName(), '.')), + new String(inheritedMethod.declaringClass.readableName())}, + new String[]{ + new String(CharOperation.concat(localMethod.declaringClass + .shortReadableName(), localMethod.shortReadableName(), '.')), + new String(inheritedMethod.declaringClass.shortReadableName())}, + localMethod.sourceStart(), localMethod.sourceEnd()); + } + public void packageCollidesWithType(CompilationUnitDeclaration compUnitDecl) { + String[] arguments = new String[]{CharOperation + .toString(compUnitDecl.currentPackage.tokens)}; + this.handle(IProblem.PackageCollidesWithType, arguments, arguments, + compUnitDecl.currentPackage.sourceStart, + compUnitDecl.currentPackage.sourceEnd); + } + public void packageIsNotExpectedPackage( + CompilationUnitDeclaration compUnitDecl) { + String[] arguments = new String[]{CharOperation + .toString(compUnitDecl.compilationResult.compilationUnit + .getPackageName())}; + this.handle(IProblem.PackageIsNotExpectedPackage, arguments, arguments, + compUnitDecl.currentPackage == null + ? 0 + : compUnitDecl.currentPackage.sourceStart, + compUnitDecl.currentPackage == null + ? 0 + : compUnitDecl.currentPackage.sourceEnd); + } + private String parametersAsString(MethodBinding method) { + TypeBinding[] params = method.parameters; + StringBuffer buffer = new StringBuffer(); + for (int i = 0, length = params.length; i < length; i++) { + if (i != 0) + buffer.append(", "); //$NON-NLS-1$ + buffer.append(new String(params[i].readableName())); + } + return buffer.toString(); + } + private String parametersAsShortString(MethodBinding method) { + TypeBinding[] params = method.parameters; + StringBuffer buffer = new StringBuffer(); + for (int i = 0, length = params.length; i < length; i++) { + if (i != 0) + buffer.append(", "); //$NON-NLS-1$ + buffer.append(new String(params[i].shortReadableName())); + } + return buffer.toString(); + } + public void parseError(int startPosition, int endPosition, + char[] currentTokenSource, String errorTokenName, String[] possibleTokens) { + if (possibleTokens.length == 0) { //no suggestion available + if (isKeyword(currentTokenSource)) { + String[] arguments = new String[]{new String(currentTokenSource)}; + this.handle(IProblem.ParsingErrorOnKeywordNoSuggestion, arguments, + arguments, + // this is the current -invalid- token position + startPosition, endPosition); + return; + } else { + String[] arguments = new String[]{errorTokenName}; + this.handle(IProblem.ParsingErrorNoSuggestion, arguments, arguments, + // this is the current -invalid- token position + startPosition, endPosition); + return; + } + } + //build a list of probable right tokens + StringBuffer list = new StringBuffer(20); + for (int i = 0, max = possibleTokens.length; i < max; i++) { + if (i > 0) + list.append(", "); //$NON-NLS-1$ + list.append('"'); + list.append(possibleTokens[i]); + list.append('"'); + } + if (isKeyword(currentTokenSource)) { + String[] arguments = new String[]{new String(currentTokenSource), + list.toString()}; + this.handle(IProblem.ParsingErrorOnKeyword, arguments, arguments, + // this is the current -invalid- token position + startPosition, endPosition); + return; + } + //extract the literal when it's a literal + if ((errorTokenName.equals("IntegerLiteral")) || //$NON-NLS-1$ + (errorTokenName.equals("LongLiteral")) || //$NON-NLS-1$ + (errorTokenName.equals("FloatingPointLiteral")) || //$NON-NLS-1$ + (errorTokenName.equals("DoubleLiteral")) || //$NON-NLS-1$ + (errorTokenName.equals("StringLiteral")) || //$NON-NLS-1$ + (errorTokenName.equals("CharacterLiteral")) || //$NON-NLS-1$ + (errorTokenName.equals("Identifier"))) { //$NON-NLS-1$ + errorTokenName = new String(currentTokenSource); + } + String[] arguments = new String[]{errorTokenName, list.toString()}; + this.handle(IProblem.ParsingError, arguments, arguments, + // this is the current -invalid- token position + startPosition, endPosition); + } + public void publicClassMustMatchFileName( + CompilationUnitDeclaration compUnitDecl, TypeDeclaration typeDecl) { + this.referenceContext = typeDecl; // report the problem against the + // type not the entire compilation + // unit + String[] arguments = new String[]{new String(compUnitDecl.getFileName()), + new String(typeDecl.name)}; + this.handle(IProblem.PublicClassMustMatchFileName, arguments, arguments, + typeDecl.sourceStart, typeDecl.sourceEnd, + compUnitDecl.compilationResult); + } + public void recursiveConstructorInvocation( + ExplicitConstructorCall constructorCall) { + this.handle(IProblem.RecursiveConstructorInvocation, new String[]{ + new String(constructorCall.binding.declaringClass.readableName()), + parametersAsString(constructorCall.binding)}, new String[]{ + new String(constructorCall.binding.declaringClass.shortReadableName()), + parametersAsShortString(constructorCall.binding)}, + constructorCall.sourceStart, constructorCall.sourceEnd); + } + public void redefineArgument(Argument arg) { + String[] arguments = new String[]{new String(arg.name)}; + this.handle(IProblem.RedefinedArgument, arguments, arguments, + arg.sourceStart, arg.sourceEnd); + } + public void redefineLocal(LocalDeclaration localDecl) { + String[] arguments = new String[]{new String(localDecl.name)}; + this.handle(IProblem.RedefinedLocal, arguments, arguments, + localDecl.sourceStart, localDecl.sourceEnd); + } + public void referenceMustBeArrayTypeAt(TypeBinding arrayType, + ArrayReference arrayRef) { + this.handle(IProblem.ArrayReferenceRequired, new String[]{new String( + arrayType.readableName())}, new String[]{new String(arrayType + .shortReadableName())}, arrayRef.sourceStart, arrayRef.sourceEnd); + } + public void returnTypeCannotBeVoidArray(SourceTypeBinding type, + MethodDeclaration methodDecl) { + String[] arguments = new String[]{new String(methodDecl.selector)}; + this.handle(IProblem.ReturnTypeCannotBeVoidArray, arguments, arguments, + methodDecl.sourceStart, methodDecl.sourceEnd); + } + public void returnTypeProblem(SourceTypeBinding type, + MethodDeclaration methodDecl, TypeBinding expectedType) { + int problemId = expectedType.problemId(); + int id; + switch (problemId) { + case NotFound : + // 1 + id = IProblem.ReturnTypeNotFound; + break; + case NotVisible : + // 2 + id = IProblem.ReturnTypeNotVisible; + break; + case Ambiguous : + // 3 + id = IProblem.ReturnTypeAmbiguous; + break; + case InternalNameProvided : + // 4 + id = IProblem.ReturnTypeInternalNameProvided; + break; + case InheritedNameHidesEnclosingName : + // 5 + id = IProblem.ReturnTypeInheritedNameHidesEnclosingName; + break; + case NoError : + // 0 + default : + needImplementation(); // want to fail to see why we were + // here... + return; + } + this.handle(id, new String[]{new String(methodDecl.selector), + new String(expectedType.readableName())}, new String[]{ + new String(methodDecl.selector), + new String(expectedType.shortReadableName())}, + methodDecl.returnType.sourceStart, methodDecl.returnType.sourceEnd); + } + public void scannerError(Parser parser, String errorTokenName) { + Scanner scanner = parser.scanner; + int flag = IProblem.ParsingErrorNoSuggestion; + int startPos = scanner.startPosition; + //special treatment for recognized errors.... + if (errorTokenName.equals(Scanner.END_OF_SOURCE)) + flag = IProblem.EndOfSource; + else if (errorTokenName.equals(Scanner.INVALID_HEXA)) + flag = IProblem.InvalidHexa; + else if (errorTokenName.equals(Scanner.INVALID_OCTAL)) + flag = IProblem.InvalidOctal; + else if (errorTokenName.equals(Scanner.INVALID_CHARACTER_CONSTANT)) + flag = IProblem.InvalidCharacterConstant; + else if (errorTokenName.equals(Scanner.INVALID_ESCAPE)) + flag = IProblem.InvalidEscape; + else if (errorTokenName.equals(Scanner.INVALID_UNICODE_ESCAPE)) { + flag = IProblem.InvalidUnicodeEscape; + // better locate the error message + char[] source = scanner.source; + int checkPos = scanner.currentPosition - 1; + if (checkPos >= source.length) + checkPos = source.length - 1; + while (checkPos >= startPos) { + if (source[checkPos] == '\\') + break; + checkPos--; + } + startPos = checkPos; + } else if (errorTokenName.equals(Scanner.INVALID_FLOAT)) + flag = IProblem.InvalidFloat; + else if (errorTokenName.equals(Scanner.UNTERMINATED_STRING)) + flag = IProblem.UnterminatedString; + else if (errorTokenName.equals(Scanner.UNTERMINATED_COMMENT)) + flag = IProblem.UnterminatedComment; + else if (errorTokenName.equals(Scanner.INVALID_CHAR_IN_STRING)) + flag = IProblem.UnterminatedString; + String[] arguments = flag == IProblem.ParsingErrorNoSuggestion + ? new String[]{errorTokenName} + : NoArgument; + this.handle(flag, arguments, arguments, + // this is the current -invalid- token position + startPos, scanner.currentPosition - 1, + parser.compilationUnit.compilationResult); + } + public void shouldReturn(TypeBinding returnType, AstNode location) { + this.handle(IProblem.ShouldReturnValue, new String[]{new String(returnType + .readableName())}, new String[]{new String(returnType + .shortReadableName())}, location.sourceStart, location.sourceEnd); + } + public void signalNoImplicitStringConversionForCharArrayExpression( + Expression expression) { + this.handle(IProblem.NoImplicitStringConversionForCharArrayExpression, + NoArgument, NoArgument, expression.sourceStart, expression.sourceEnd); + } + public void staticAndInstanceConflict(MethodBinding currentMethod, + MethodBinding inheritedMethod) { + if (currentMethod.isStatic()) + this + .handle( + // This static method cannot hide the instance method from %1 + // 8.4.6.4 - If a class inherits more than one method with + // the same signature a static (non-abstract) method cannot + // hide an instance method. + IProblem.CannotHideAnInstanceMethodWithAStaticMethod, + new String[]{new String(inheritedMethod.declaringClass + .readableName())}, new String[]{new String( + inheritedMethod.declaringClass.shortReadableName())}, + currentMethod.sourceStart(), currentMethod.sourceEnd()); + else + this + .handle( + // This instance method cannot override the static method from %1 + // 8.4.6.4 - If a class inherits more than one method with + // the same signature an instance (non-abstract) method + // cannot override a static method. + IProblem.CannotOverrideAStaticMethodWithAnInstanceMethod, + new String[]{new String(inheritedMethod.declaringClass + .readableName())}, new String[]{new String( + inheritedMethod.declaringClass.shortReadableName())}, + currentMethod.sourceStart(), currentMethod.sourceEnd()); + } + public void staticFieldAccessToNonStaticVariable(FieldReference fieldRef, + FieldBinding field) { + String[] arguments = new String[]{new String(field.readableName())}; + this.handle(IProblem.NonStaticFieldFromStaticInvocation, arguments, + arguments, fieldRef.sourceStart, fieldRef.sourceEnd); + } + public void staticFieldAccessToNonStaticVariable( + QualifiedNameReference nameRef, FieldBinding field) { + String[] arguments = new String[]{new String(field.readableName())}; + this.handle(IProblem.NonStaticFieldFromStaticInvocation, arguments, + arguments, nameRef.sourceStart, nameRef.sourceEnd); + } + public void staticFieldAccessToNonStaticVariable(SingleNameReference nameRef, + FieldBinding field) { + String[] arguments = new String[]{new String(field.readableName())}; + this.handle(IProblem.NonStaticFieldFromStaticInvocation, arguments, + arguments, nameRef.sourceStart, nameRef.sourceEnd); + } + public void staticInheritedMethodConflicts(SourceTypeBinding type, + MethodBinding concreteMethod, MethodBinding[] abstractMethods) { + this.handle( + // The static method %1 conflicts with the abstract method in %2 + // 8.4.6.4 - If a class inherits more than one method with the + // same signature it is an error for one to be static + // (non-abstract) and the other abstract. + IProblem.StaticInheritedMethodConflicts, new String[]{ + new String(concreteMethod.readableName()), + new String(abstractMethods[0].declaringClass.readableName())}, + new String[]{new String(concreteMethod.readableName()), + new String(abstractMethods[0].declaringClass.shortReadableName())}, + type.sourceStart(), type.sourceEnd()); + } + public void stringConstantIsExceedingUtf8Limit(AstNode location) { + this.handle(IProblem.StringConstantIsExceedingUtf8Limit, NoArgument, + NoArgument, location.sourceStart, location.sourceEnd); + } + public void superclassMustBeAClass(SourceTypeBinding type, + TypeReference superclassRef, ReferenceBinding superType) { + this.handle(IProblem.SuperclassMustBeAClass, new String[]{ + new String(superType.readableName()), new String(type.sourceName())}, + new String[]{new String(superType.shortReadableName()), + new String(type.sourceName())}, superclassRef.sourceStart, + superclassRef.sourceEnd); + } + public void superinterfaceMustBeAnInterface(SourceTypeBinding type, + TypeDeclaration typeDecl, ReferenceBinding superType) { + this.handle(IProblem.SuperInterfaceMustBeAnInterface, new String[]{ + new String(superType.readableName()), new String(type.sourceName())}, + new String[]{new String(superType.shortReadableName()), + new String(type.sourceName())}, typeDecl.sourceStart, + typeDecl.sourceEnd); + } + public void task(String tag, String message, String priority, int start, + int end) { + this.handle(IProblem.Task, new String[]{tag, message, priority/* + * secret + * argument + * that is + * not + * surfaced + * in + * getMessage() + */}, new String[]{tag, message, priority/* + * secret argument that is not + * surfaced in getMessage() + */}, start, end); + } + public void tooManyDimensions(AstNode expression) { + this.handle(IProblem.TooManyArrayDimensions, NoArgument, NoArgument, + expression.sourceStart, expression.sourceEnd); + } + public void tooManyFields(TypeDeclaration typeDeclaration) { + this.handle(IProblem.TooManyFields, new String[]{new String( + typeDeclaration.binding.readableName())}, new String[]{new String( + typeDeclaration.binding.shortReadableName())}, Abort | Error, + typeDeclaration.sourceStart, typeDeclaration.sourceEnd); + } + public void tooManyMethods(TypeDeclaration typeDeclaration) { + this.handle(IProblem.TooManyMethods, new String[]{new String( + typeDeclaration.binding.readableName())}, new String[]{new String( + typeDeclaration.binding.shortReadableName())}, Abort | Error, + typeDeclaration.sourceStart, typeDeclaration.sourceEnd); + } + public void typeCastError(CastExpression expression, TypeBinding leftType, + TypeBinding rightType) { + String leftName = new String(leftType.readableName()); + String rightName = new String(rightType.readableName()); + String leftShortName = new String(leftType.shortReadableName()); + String rightShortName = new String(rightType.shortReadableName()); + if (leftShortName.equals(rightShortName)) { + leftShortName = leftName; + rightShortName = rightName; + } + this.handle(IProblem.IllegalCast, new String[]{rightName, leftName}, + new String[]{rightShortName, leftShortName}, expression.sourceStart, + expression.sourceEnd); + } + public void typeCollidesWithPackage(CompilationUnitDeclaration compUnitDecl, + TypeDeclaration typeDecl) { + this.referenceContext = typeDecl; // report the problem against the + // type not the entire compilation + // unit + String[] arguments = new String[]{new String(compUnitDecl.getFileName()), + new String(typeDecl.name)}; + this.handle(IProblem.TypeCollidesWithPackage, arguments, arguments, + typeDecl.sourceStart, typeDecl.sourceEnd, + compUnitDecl.compilationResult); + } + public void typeMismatchError(TypeBinding resultType, + TypeBinding expectedType, AstNode location) { + String resultTypeName = new String(resultType.readableName()); + String expectedTypeName = new String(expectedType.readableName()); + String resultTypeShortName = new String(resultType.shortReadableName()); + String expectedTypeShortName = new String(expectedType.shortReadableName()); + if (resultTypeShortName.equals(expectedTypeShortName)) { + resultTypeShortName = resultTypeName; + expectedTypeShortName = expectedTypeName; + } + this.handle(IProblem.TypeMismatch, new String[]{resultTypeName, + expectedTypeName}, new String[]{resultTypeShortName, + expectedTypeShortName}, location.sourceStart, location.sourceEnd); + } + public void typeMismatchErrorActualTypeExpectedType(Expression expression, + TypeBinding constantType, TypeBinding expectedType) { + String constantTypeName = new String(constantType.readableName()); + String expectedTypeName = new String(expectedType.readableName()); + String constantTypeShortName = new String(constantType.shortReadableName()); + String expectedTypeShortName = new String(expectedType.shortReadableName()); + if (constantTypeShortName.equals(expectedTypeShortName)) { + constantTypeShortName = constantTypeName; + expectedTypeShortName = expectedTypeName; + } + this.handle(IProblem.TypeMismatch, new String[]{constantTypeName, + expectedTypeName}, new String[]{constantTypeShortName, + expectedTypeShortName}, expression.sourceStart, expression.sourceEnd); + } + public void undefinedLabel(BranchStatement statement) { + String[] arguments = new String[]{new String(statement.label)}; + this.handle(IProblem.UndefinedLabel, arguments, arguments, + statement.sourceStart, statement.sourceEnd); + } + public void unexpectedStaticModifierForField(SourceTypeBinding type, + FieldDeclaration fieldDecl) { + String[] arguments = new String[]{fieldDecl.name()}; + this.handle(IProblem.UnexpectedStaticModifierForField, arguments, + arguments, fieldDecl.sourceStart, fieldDecl.sourceEnd); + } + public void unexpectedStaticModifierForMethod(ReferenceBinding type, + AbstractMethodDeclaration methodDecl) { + String[] arguments = new String[]{new String(type.sourceName()), + new String(methodDecl.selector)}; + this.handle(IProblem.UnexpectedStaticModifierForMethod, arguments, + arguments, methodDecl.sourceStart, methodDecl.sourceEnd); + } + public void unhandledException(TypeBinding exceptionType, AstNode location) { + boolean insideDefaultConstructor = (referenceContext instanceof ConstructorDeclaration) + && ((ConstructorDeclaration) referenceContext).isDefaultConstructor(); + boolean insideImplicitConstructorCall = (location instanceof ExplicitConstructorCall) + && (((ExplicitConstructorCall) location).accessMode == ExplicitConstructorCall.ImplicitSuper); + this.handle(insideDefaultConstructor + ? IProblem.UnhandledExceptionInDefaultConstructor + : (insideImplicitConstructorCall + ? IProblem.UndefinedConstructorInImplicitConstructorCall + : IProblem.UnhandledException), new String[]{new String( + exceptionType.readableName())}, new String[]{new String(exceptionType + .shortReadableName())}, location.sourceStart, location.sourceEnd); + } + public void uninitializedBlankFinalField(FieldBinding binding, + AstNode location) { + String[] arguments = new String[]{new String(binding.readableName())}; + this.handle(IProblem.UninitializedBlankFinalField, arguments, arguments, + location.sourceStart, location.sourceEnd); + } + public void uninitializedLocalVariable(LocalVariableBinding binding, + AstNode location) { + String[] arguments = new String[]{new String(binding.readableName())}; + this.handle(IProblem.UninitializedLocalVariable, arguments, arguments, + location.sourceStart, location.sourceEnd); + } + public void unmatchedBracket(int position, ReferenceContext context, + CompilationResult compilationResult) { + this.handle(IProblem.UnmatchedBracket, NoArgument, NoArgument, position, + position, context, compilationResult); + } + public void unnecessaryEnclosingInstanceSpecification(Expression expression, + ReferenceBinding targetType) { + this.handle(IProblem.IllegalEnclosingInstanceSpecification, + new String[]{new String(targetType.readableName())}, + new String[]{new String(targetType.shortReadableName())}, + expression.sourceStart, expression.sourceEnd); + } + public void unnecessaryReceiverForStaticMethod(AstNode location, + MethodBinding method) { + this.handle(IProblem.NonStaticAccessToStaticMethod, new String[]{ + new String(method.declaringClass.readableName()), + new String(method.selector), parametersAsString(method)}, new String[]{ + new String(method.declaringClass.shortReadableName()), + new String(method.selector), parametersAsShortString(method)}, + location.sourceStart, location.sourceEnd); + } + public void unnecessaryReceiverForStaticField(AstNode location, + FieldBinding field) { + this.handle(IProblem.NonStaticAccessToStaticField, + new String[]{new String(field.declaringClass.readableName()), + new String(field.name)}, new String[]{ + new String(field.declaringClass.shortReadableName()), + new String(field.name)}, location.sourceStart, location.sourceEnd); + } + public void unreachableCode(Statement statement) { + this.handle(IProblem.CodeCannotBeReached, NoArgument, NoArgument, + statement.sourceStart, statement.sourceEnd); + } + public void unreachableExceptionHandler(ReferenceBinding exceptionType, + AstNode location) { + this.handle(IProblem.UnreachableCatch, NoArgument, NoArgument, + location.sourceStart, location.sourceEnd); + } + public void unresolvableReference(NameReference nameRef, Binding binding) { + int severity = Error; + /* + * also need to check that the searchedType is the receiver type if + * (binding instanceof ProblemBinding) { ProblemBinding problem = + * (ProblemBinding) binding; if (problem.searchType != null && + * problem.searchType.isHierarchyInconsistent()) severity = SecondaryError; } + */ + String[] arguments = new String[]{new String(binding.readableName())}; + this.handle(IProblem.UndefinedName, arguments, arguments, severity, + nameRef.sourceStart, nameRef.sourceEnd); + } + public void unusedArgument(LocalDeclaration localDecl) { + String[] arguments = new String[]{localDecl.name()}; + this.handle(IProblem.ArgumentIsNeverUsed, arguments, arguments, + localDecl.sourceStart, localDecl.sourceEnd); + } + public void unusedImport(ImportReference importRef) { + String[] arguments = new String[]{CharOperation.toString(importRef.tokens)}; + this.handle(IProblem.UnusedImport, arguments, arguments, + importRef.sourceStart, importRef.sourceEnd); + } + public void unusedLocalVariable(LocalDeclaration localDecl) { + String[] arguments = new String[]{localDecl.name()}; + this.handle(IProblem.LocalVariableIsNeverUsed, arguments, arguments, + localDecl.sourceStart, localDecl.sourceEnd); + } + public void unusedPrivateConstructor(ConstructorDeclaration constructorDecl) { + if (computeSeverity(IProblem.UnusedPrivateConstructor) == Ignore) + return; + // no complaint for no-arg constructors (or default ones) - known + // pattern to block instantiation + if (constructorDecl.arguments == null + || constructorDecl.arguments.length == 0) + return; + MethodBinding constructor = constructorDecl.binding; + this.handle(IProblem.UnusedPrivateConstructor, new String[]{ + new String(constructor.declaringClass.readableName()), + parametersAsString(constructor)}, new String[]{ + new String(constructor.declaringClass.shortReadableName()), + parametersAsShortString(constructor)}, constructorDecl.sourceStart, + constructorDecl.sourceEnd); + } + public void unusedPrivateField(FieldDeclaration fieldDecl) { + if (computeSeverity(IProblem.UnusedPrivateField) == Ignore) + return; + FieldBinding field = fieldDecl.binding; + if (CharOperation.equals(TypeConstants.SERIALVERSIONUID, field.name) + && field.isStatic() && field.isFinal() + && TypeBinding.LongBinding == field.type) { + return; // do not report unused serialVersionUID field + } + this.handle(IProblem.UnusedPrivateField, new String[]{ + new String(field.declaringClass.readableName()), + new String(field.name),}, new String[]{ + new String(field.declaringClass.shortReadableName()), + new String(field.name),}, fieldDecl.sourceStart, fieldDecl.sourceEnd); + } + public void unusedPrivateMethod(AbstractMethodDeclaration methodDecl) { + if (computeSeverity(IProblem.UnusedPrivateMethod) == Ignore) + return; + MethodBinding method = methodDecl.binding; + // no report for serialization support 'void + // readObject(ObjectInputStream)' + if (!method.isStatic() + && TypeBinding.VoidBinding == method.returnType + && method.parameters.length == 1 + && method.parameters[0].dimensions() == 0 + && CharOperation.equals(method.selector, TypeConstants.READOBJECT) + && CharOperation.equals( + TypeConstants.CharArray_JAVA_IO_OBJECTINPUTSTREAM, + method.parameters[0].readableName())) { + return; + } + // no report for serialization support 'void + // writeObject(ObjectOutputStream)' + if (!method.isStatic() + && TypeBinding.VoidBinding == method.returnType + && method.parameters.length == 1 + && method.parameters[0].dimensions() == 0 + && CharOperation.equals(method.selector, TypeConstants.WRITEOBJECT) + && CharOperation.equals( + TypeConstants.CharArray_JAVA_IO_OBJECTOUTPUTSTREAM, + method.parameters[0].readableName())) { + return; + } + // no report for serialization support 'Object readResolve()' + if (!method.isStatic() && TypeBinding.T_Object == method.returnType.id + && method.parameters.length == 0 + && CharOperation.equals(method.selector, TypeConstants.READRESOLVE)) { + return; + } + // no report for serialization support 'Object writeReplace()' + if (!method.isStatic() && TypeBinding.T_Object == method.returnType.id + && method.parameters.length == 0 + && CharOperation.equals(method.selector, TypeConstants.WRITEREPLACE)) { + return; + } + this.handle(IProblem.UnusedPrivateMethod, new String[]{ + new String(method.declaringClass.readableName()), + new String(method.selector), parametersAsString(method)}, new String[]{ + new String(method.declaringClass.shortReadableName()), + new String(method.selector), parametersAsShortString(method)}, + methodDecl.sourceStart, methodDecl.sourceEnd); + } + public void unusedPrivateType(TypeDeclaration typeDecl) { + if (computeSeverity(IProblem.UnusedPrivateType) == Ignore) + return; + ReferenceBinding type = typeDecl.binding; + this.handle(IProblem.UnusedPrivateType, new String[]{new String(type + .readableName()),}, + new String[]{new String(type.shortReadableName()),}, + typeDecl.sourceStart, typeDecl.sourceEnd); + } + public void useAssertAsAnIdentifier(int sourceStart, int sourceEnd) { + this.handle(IProblem.UseAssertAsAnIdentifier, NoArgument, NoArgument, + sourceStart, sourceEnd); + } + public void variableTypeCannotBeVoid(AbstractVariableDeclaration varDecl) { + String[] arguments = new String[]{new String(varDecl.name)}; + this.handle(IProblem.VariableTypeCannotBeVoid, arguments, arguments, + varDecl.sourceStart, varDecl.sourceEnd); + } + public void variableTypeCannotBeVoidArray(AbstractVariableDeclaration varDecl) { + String[] arguments = new String[]{new String(varDecl.name)}; + this.handle(IProblem.VariableTypeCannotBeVoidArray, arguments, arguments, + varDecl.sourceStart, varDecl.sourceEnd); + } + public void visibilityConflict(MethodBinding currentMethod, + MethodBinding inheritedMethod) { + this.handle( + // Cannot reduce the visibility of the inherited method from %1 + // 8.4.6.3 - The access modifier of an hiding method must + // provide at least as much access as the hidden method. + // 8.4.6.3 - The access modifier of an overiding method must + // provide at least as much access as the overriden method. + IProblem.MethodReducesVisibility, new String[]{new String( + inheritedMethod.declaringClass.readableName())}, + new String[]{new String(inheritedMethod.declaringClass + .shortReadableName())}, currentMethod.sourceStart(), currentMethod + .sourceEnd()); + } + public void wrongSequenceOfExceptionTypesError(TryStatement statement, + int under, int upper) { + //the two catch block under and upper are in an incorrect order. + //under should be define BEFORE upper in the source + TypeReference typeRef = statement.catchArguments[under].type; + this.handle(IProblem.UnreachableCatch, NoArgument, NoArgument, + typeRef.sourceStart, typeRef.sourceEnd); + } + public void nonExternalizedStringLiteral(AstNode location) { + this.handle(IProblem.NonExternalizedStringLiteral, NoArgument, NoArgument, + location.sourceStart, location.sourceEnd); + } + public void noMoreAvailableSpaceForConstant(TypeDeclaration typeDeclaration) { + this.handle(IProblem.TooManyBytesForStringConstant, + new String[]{new String(typeDeclaration.binding.readableName())}, + new String[]{new String(typeDeclaration.binding.shortReadableName())}, + Abort | Error, typeDeclaration.sourceStart, typeDeclaration.sourceEnd); + } + public void noMoreAvailableSpaceInConstantPool(TypeDeclaration typeDeclaration) { + this.handle(IProblem.TooManyConstantsInConstantPool, + new String[]{new String(typeDeclaration.binding.readableName())}, + new String[]{new String(typeDeclaration.binding.shortReadableName())}, + Abort | Error, typeDeclaration.sourceStart, typeDeclaration.sourceEnd); + } + private boolean isKeyword(char[] tokenSource) { + /* + * This code is heavily grammar dependant + */ + if (tokenSource == null) { + return false; + } + try { + Scanner scanner = new Scanner(); + scanner.setSource(tokenSource); + int token = scanner.getNextToken(); + char[] currentKeyword; + try { + currentKeyword = scanner.getCurrentIdentifierSource(); + } catch (ArrayIndexOutOfBoundsException e) { + return false; + } + int nextToken = scanner.getNextToken(); + if (nextToken == Scanner.TokenNameEOF + && scanner.startPosition == scanner.source.length) { // to + // handle + // case + // where + // we + // had + // an + // ArrayIndexOutOfBoundsException + // while reading the last token + switch (token) { + case Scanner.TokenNameERROR : + if (CharOperation.equals("goto".toCharArray(), currentKeyword) + || CharOperation.equals("const".toCharArray(), currentKeyword)) { //$NON-NLS-1$ //$NON-NLS-2$ + return true; + } else { + return false; + } + case Scanner.TokenNameabstract : + // case Scanner.TokenNameassert: + // case Scanner.TokenNamebyte: + case Scanner.TokenNamebreak : + // case Scanner.TokenNameboolean: + case Scanner.TokenNamecase : + // case Scanner.TokenNamechar: + case Scanner.TokenNamecatch : + case Scanner.TokenNameclass : + case Scanner.TokenNamecontinue : + case Scanner.TokenNamedo : + // case Scanner.TokenNamedouble: + case Scanner.TokenNamedefault : + case Scanner.TokenNameelse : + case Scanner.TokenNameextends : + case Scanner.TokenNamefor : + // case Scanner.TokenNamefinal: + // case Scanner.TokenNamefloat: + // case Scanner.TokenNamefalse : + case Scanner.TokenNamefinally : + case Scanner.TokenNameif : + // case Scanner.TokenNameint: + // case Scanner.TokenNameimport: + case Scanner.TokenNameinterface : + case Scanner.TokenNameimplements : + case Scanner.TokenNameinstanceof : + // case Scanner.TokenNamelong: + case Scanner.TokenNamenew : + // case Scanner.TokenNamenull : + // case Scanner.TokenNamenative: + case Scanner.TokenNamepublic : + // case Scanner.TokenNamepackage: + case Scanner.TokenNameprivate : + case Scanner.TokenNameprotected : + case Scanner.TokenNamereturn : + // case Scanner.TokenNameshort: + case Scanner.TokenNamesuper : + case Scanner.TokenNamestatic : + case Scanner.TokenNameswitch : + // case Scanner.TokenNamestrictfp: + // case Scanner.TokenNamesynchronized: + case Scanner.TokenNametry : + case Scanner.TokenNamethis : + // case Scanner.TokenNametrue : + case Scanner.TokenNamethrow : + // case Scanner.TokenNamethrows: + // case Scanner.TokenNametransient: + // case Scanner.TokenNamevoid: + // case Scanner.TokenNamevolatile: + case Scanner.TokenNamewhile : + return true; + default : + return false; + } + } else { + return false; + } + } catch (InvalidInputException e) { + return false; + } + } + // jsurfer start + public void phpParsingError(String[] messageArguments, + int problemStartPosition, int problemEndPosition, + ReferenceContext context, CompilationResult compilationResult) { + this.handle(IProblem.PHPParsingError, NoArgument, messageArguments, + problemStartPosition, problemEndPosition, context, compilationResult); + } + public void phpParsingWarning(String[] messageArguments, + int problemStartPosition, int problemEndPosition, + ReferenceContext context, CompilationResult compilationResult) { + this.handle(IProblem.PHPParsingWarning, NoArgument, messageArguments, + problemStartPosition, problemEndPosition, context, compilationResult); + } + public void phpVarDeprecatedWarning( + int problemStartPosition, int problemEndPosition, + ReferenceContext context, CompilationResult compilationResult) { + this.handle(IProblem.PHPVarDeprecatedWarning, NoArgument, new String[]{}, + problemStartPosition, problemEndPosition, context, compilationResult); + } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/messages.properties b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/messages.properties index b4ea5fa..33b1294 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/messages.properties +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/messages.properties @@ -152,7 +152,10 @@ 208 = Array constants can only be used in initializers 209 = Syntax error on keyword "{0}"; {1} expected 210 = Syntax error on keyword "{0}", no accurate correction available -211 = Parse error "{0}" + +211 = Parser error "{0}" +212 = Parser warning "{0}" +213 = Keyword 'var' is deprecated. Please use 'public' 'private' or 'protected' modifier for field declarations. 220 = Unmatched bracket 221 = The primitive type {0} of {1} does not have a field {2} diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java index 30ed629..ecfed39 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java @@ -1315,7 +1315,7 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { case TokenNameCOLON : // : (15.24) return ":"; //$NON-NLS-1$ - case TokenNameCOLON_COLON : // : (15.24) + case TokenNamePAAMAYIM_NEKUDOTAYIM : // : (15.24) return "::"; //$NON-NLS-1$ case TokenNameEQUAL_EQUAL : // == (15.20, 15.20.1, 15.20.2, 15.20.3) -- 1.7.1 From fcadbe263fb8b5b695872a15fc5b3cd95c652a2c Mon Sep 17 00:00:00 2001 From: khartlage Date: Mon, 8 Mar 2004 22:30:30 +0000 Subject: [PATCH 04/16] misc parser changes --- .../core/tests/util/AbstractCompilerTest.java | 226 ++- .../php/test/DualParseSyntaxErrorTest.java | 117 +- .../phpeclipse/tests/parser/PHPManualTestCase.java | 48 +- .../phpeclipse/tests/parser/PHPParserTestCase.java | 58 +- .../phpdt/core/compiler/ITerminalSymbols.java | 26 +- .../phpdt/internal/compiler/parser/Parser.java | 1609 +++++++++++-------- .../phpdt/internal/compiler/parser/Scanner.java | 366 ++++-- .../internal/compiler/problem/ProblemReporter.java | 2 +- .../phpdt/internal/formatter/CodeFormatter.java | 1717 ++++++++++---------- .../ui/text/template/DeclarationEngine.java | 2 +- .../phpeclipse/builder/IdentifierIndexManager.java | 3 +- .../obfuscator/ObfuscatorPass1Exporter.java | 2 +- .../phpeditor/php/PHPCompletionProcessor.java | 6 +- 13 files changed, 2423 insertions(+), 1759 deletions(-) diff --git a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpdt/core/tests/util/AbstractCompilerTest.java b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpdt/core/tests/util/AbstractCompilerTest.java index 5ea14a5..031d81e 100644 --- a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpdt/core/tests/util/AbstractCompilerTest.java +++ b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpdt/core/tests/util/AbstractCompilerTest.java @@ -10,84 +10,212 @@ *******************************************************************************/ package net.sourceforge.phpdt.core.tests.util; +import java.io.PrintWriter; +import java.io.StringWriter; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; +import java.util.Locale; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import net.sourceforge.phpdt.core.compiler.IProblem; +import net.sourceforge.phpdt.internal.compiler.CompilationResult; +import net.sourceforge.phpdt.internal.compiler.DefaultErrorHandlingPolicies; +import net.sourceforge.phpdt.internal.compiler.batch.CompilationUnit; +import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit; +import net.sourceforge.phpdt.internal.compiler.parser.UnitParser; +import net.sourceforge.phpdt.internal.compiler.problem.DefaultProblem; +import net.sourceforge.phpdt.internal.compiler.problem.DefaultProblemFactory; +import net.sourceforge.phpdt.internal.compiler.problem.ProblemReporter; +import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration; //import net.sourceforge.phpdt.core.tests.junit.extension.TestCase; //import net.sourceforge.phpdt.internal.compiler.impl.CompilerOptions; public class AbstractCompilerTest extends TestCase { - public static final String COMPLIANCE_1_3 = "1.3"; - public static final String COMPLIANCE_1_4 = "1.4"; - public static final String COMPLIANCE_1_5 = "1.5"; - - public static final int F_1_3 = 0x1; - public static final int F_1_4 = 0x2; - public static final int F_1_5 = 0x4; +// public static final String COMPLIANCE_1_3 = "1.3"; +// public static final String COMPLIANCE_1_4 = "1.4"; +// public static final String COMPLIANCE_1_5 = "1.5"; +// +// public static final int F_1_3 = 0x1; +// public static final int F_1_4 = 0x2; +// public static final int F_1_5 = 0x4; private static int possibleComplianceLevels = -1; protected String complianceLevel; + public void checkParsePHP( + char[] source, + String expectedSyntaxErrorDiagnosis) { +// String testName) { - /* - * Returns the possible compliance levels this VM instance can run. - */ - public static int getPossibleComplianceLevels() { - if (possibleComplianceLevels == -1) { - String compliance = System.getProperty("compliance"); - if (compliance != null) { - if (COMPLIANCE_1_3.equals(compliance)) { - possibleComplianceLevels = F_1_3; - } else if (COMPLIANCE_1_4.equals(compliance)) { - possibleComplianceLevels = F_1_4; - } else if (COMPLIANCE_1_5.equals(compliance)) { - possibleComplianceLevels = F_1_5; - } else { - System.out.println("Invalid compliance specified (" + compliance + ")"); - System.out.println("Use one of " + COMPLIANCE_1_3 + ", " + COMPLIANCE_1_4 + ", " + COMPLIANCE_1_5); - System.out.println("Defaulting to all possible compliances"); + UnitParser parser = + new UnitParser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + //new CompilerOptions(getCompilerOptions()), + new DefaultProblemFactory(Locale.getDefault()))); + + ICompilationUnit sourceUnit = new CompilationUnit(source, "", null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult, true); +// if (computedUnit.types != null) { +// for (int i = computedUnit.types.size(); --i >= 0;){ +// ((TypeDeclaration)computedUnit.types.get(i)).parseMethod(parser, computedUnit); +// } +// } + + StringBuffer buffer = new StringBuffer(100); + if (compilationResult.hasProblems() || compilationResult.hasTasks()) { + IProblem[] problems = compilationResult.getAllProblems(); + int count = problems.length; + int problemCount = 0; + char[] unitSource = compilationResult.compilationUnit.getContents(); + for (int i = 0; i < count; i++) { + if (problems[i] != null) { + if (problemCount == 0) + buffer.append("----------\n"); + problemCount++; + buffer.append(problemCount + (problems[i].isError() ? ". ERROR" : ". WARNING")); + buffer.append(" in " + new String(problems[i].getOriginatingFileName()).replace('/', '\\')); + try { + buffer.append(((DefaultProblem)problems[i]).errorReportSource(unitSource)); + buffer.append("\n"); + buffer.append(problems[i].getMessage()); + buffer.append("\n"); + } catch (Exception e) { + StringWriter stringWriter = new StringWriter(); + e.printStackTrace(new PrintWriter(stringWriter)); + buffer.append(stringWriter.getBuffer()); + } + buffer.append("----------\n"); } } - if (possibleComplianceLevels == -1) { - possibleComplianceLevels = F_1_3; - String specVersion = System.getProperty("java.specification.version"); - boolean canRun1_4 = !"1.0".equals(specVersion) && !"1.1".equals(specVersion) && !"1.2".equals(specVersion) && !"1.3".equals(specVersion); - if (canRun1_4) { - possibleComplianceLevels |= F_1_4; - } - boolean canRun1_5 = canRun1_4 && !"1.4".equals(specVersion); - if (canRun1_5) { - possibleComplianceLevels |= F_1_5; + } + String computedSyntaxErrorDiagnosis = buffer.toString(); + if(!expectedSyntaxErrorDiagnosis.equals(computedSyntaxErrorDiagnosis)) { + System.out.println(Util.displayString(computedSyntaxErrorDiagnosis)); + } + assertEquals( + "Invalid syntax error diagnosis", + expectedSyntaxErrorDiagnosis, + computedSyntaxErrorDiagnosis); + } + public void checkParseHTML( + char[] source, + String expectedSyntaxErrorDiagnosis) { +// String testName) { + + UnitParser parser = + new UnitParser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + //new CompilerOptions(getCompilerOptions()), + new DefaultProblemFactory(Locale.getDefault()))); + + ICompilationUnit sourceUnit = new CompilationUnit(source, "", null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult, false); +// if (computedUnit.types != null) { +// for (int i = computedUnit.types.size(); --i >= 0;){ +// ((TypeDeclaration)computedUnit.types.get(i)).parseMethod(parser, computedUnit); +// } +// } + + StringBuffer buffer = new StringBuffer(100); + if (compilationResult.hasProblems() || compilationResult.hasTasks()) { + IProblem[] problems = compilationResult.getAllProblems(); + int count = problems.length; + int problemCount = 0; + char[] unitSource = compilationResult.compilationUnit.getContents(); + for (int i = 0; i < count; i++) { + if (problems[i] != null) { + if (problemCount == 0) + buffer.append("----------\n"); + problemCount++; + buffer.append(problemCount + (problems[i].isError() ? ". ERROR" : ". WARNING")); + buffer.append(" in " + new String(problems[i].getOriginatingFileName()).replace('/', '\\')); + try { + buffer.append(((DefaultProblem)problems[i]).errorReportSource(unitSource)); + buffer.append("\n"); + buffer.append(problems[i].getMessage()); + buffer.append("\n"); + } catch (Exception e) { + StringWriter stringWriter = new StringWriter(); + e.printStackTrace(new PrintWriter(stringWriter)); + buffer.append(stringWriter.getBuffer()); + } + buffer.append("----------\n"); } } } - return possibleComplianceLevels; + String computedSyntaxErrorDiagnosis = buffer.toString(); + if(!expectedSyntaxErrorDiagnosis.equals(computedSyntaxErrorDiagnosis)) { + System.out.println(Util.displayString(computedSyntaxErrorDiagnosis)); + } + assertEquals( + "Invalid syntax error diagnosis", + expectedSyntaxErrorDiagnosis, + computedSyntaxErrorDiagnosis); } + /* + * Returns the possible compliance levels this VM instance can run. + */ +// public static int getPossibleComplianceLevels() { +// if (possibleComplianceLevels == -1) { +// String compliance = System.getProperty("compliance"); +// if (compliance != null) { +// if (COMPLIANCE_1_3.equals(compliance)) { +// possibleComplianceLevels = F_1_3; +// } else if (COMPLIANCE_1_4.equals(compliance)) { +// possibleComplianceLevels = F_1_4; +// } else if (COMPLIANCE_1_5.equals(compliance)) { +// possibleComplianceLevels = F_1_5; +// } else { +// System.out.println("Invalid compliance specified (" + compliance + ")"); +// System.out.println("Use one of " + COMPLIANCE_1_3 + ", " + COMPLIANCE_1_4 + ", " + COMPLIANCE_1_5); +// System.out.println("Defaulting to all possible compliances"); +// } +// } +// if (possibleComplianceLevels == -1) { +// possibleComplianceLevels = F_1_3; +// String specVersion = System.getProperty("java.specification.version"); +// boolean canRun1_4 = !"1.0".equals(specVersion) && !"1.1".equals(specVersion) && !"1.2".equals(specVersion) && !"1.3".equals(specVersion); +// if (canRun1_4) { +// possibleComplianceLevels |= F_1_4; +// } +// boolean canRun1_5 = canRun1_4 && !"1.4".equals(specVersion); +// if (canRun1_5) { +// possibleComplianceLevels |= F_1_5; +// } +// } +// } +// return possibleComplianceLevels; +// } /* * Returns a test suite including the tests defined by the given classes for all possible complianceLevels * and using the given setup class (CompilerTestSetup or a subclass) */ - public static Test suite(String suiteName, Class setupClass, ArrayList testClasses) { - TestSuite all = new TestSuite(suiteName); - int complianceLevels = AbstractCompilerTest.getPossibleComplianceLevels(); - if ((complianceLevels & AbstractCompilerTest.F_1_3) != 0) { - all.addTest(suiteForComplianceLevel(COMPLIANCE_1_3, setupClass, testClasses)); - } - if ((complianceLevels & AbstractCompilerTest.F_1_4) != 0) { - all.addTest(suiteForComplianceLevel(COMPLIANCE_1_4, setupClass, testClasses)); - } - if ((complianceLevels & AbstractCompilerTest.F_1_5) != 0) { - all.addTest(suiteForComplianceLevel(COMPLIANCE_1_5, setupClass, testClasses)); - } - return all; - } +// public static Test suite(String suiteName, Class setupClass, ArrayList testClasses) { +// TestSuite all = new TestSuite(suiteName); +// int complianceLevels = AbstractCompilerTest.getPossibleComplianceLevels(); +// if ((complianceLevels & AbstractCompilerTest.F_1_3) != 0) { +// all.addTest(suiteForComplianceLevel(COMPLIANCE_1_3, setupClass, testClasses)); +// } +// if ((complianceLevels & AbstractCompilerTest.F_1_4) != 0) { +// all.addTest(suiteForComplianceLevel(COMPLIANCE_1_4, setupClass, testClasses)); +// } +// if ((complianceLevels & AbstractCompilerTest.F_1_5) != 0) { +// all.addTest(suiteForComplianceLevel(COMPLIANCE_1_5, setupClass, testClasses)); +// } +// return all; +// } /* * Returns a test suite including the tests defined by the given classes for the given complianceLevel diff --git a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/phpeditor/php/test/DualParseSyntaxErrorTest.java b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/phpeditor/php/test/DualParseSyntaxErrorTest.java index 09830f3..76d4a10 100644 --- a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/phpeditor/php/test/DualParseSyntaxErrorTest.java +++ b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/phpeditor/php/test/DualParseSyntaxErrorTest.java @@ -35,66 +35,10 @@ public class DualParseSyntaxErrorTest extends AbstractCompilerTest { public DualParseSyntaxErrorTest(String testName){ super(testName); } - public void checkParse( - char[] source, - String expectedSyntaxErrorDiagnosis) { -// String testName) { - - UnitParser parser = - new UnitParser( - new ProblemReporter( - DefaultErrorHandlingPolicies.proceedWithAllProblems(), - //new CompilerOptions(getCompilerOptions()), - new DefaultProblemFactory(Locale.getDefault()))); - - ICompilationUnit sourceUnit = new CompilationUnit(source, "", null); - CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); - - CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult, true); -// if (computedUnit.types != null) { -// for (int i = computedUnit.types.size(); --i >= 0;){ -// ((TypeDeclaration)computedUnit.types.get(i)).parseMethod(parser, computedUnit); -// } -// } - - StringBuffer buffer = new StringBuffer(100); - if (compilationResult.hasProblems() || compilationResult.hasTasks()) { - IProblem[] problems = compilationResult.getAllProblems(); - int count = problems.length; - int problemCount = 0; - char[] unitSource = compilationResult.compilationUnit.getContents(); - for (int i = 0; i < count; i++) { - if (problems[i] != null) { - if (problemCount == 0) - buffer.append("----------\n"); - problemCount++; - buffer.append(problemCount + (problems[i].isError() ? ". ERROR" : ". WARNING")); - buffer.append(" in " + new String(problems[i].getOriginatingFileName()).replace('/', '\\')); - try { - buffer.append(((DefaultProblem)problems[i]).errorReportSource(unitSource)); - buffer.append("\n"); - buffer.append(problems[i].getMessage()); - buffer.append("\n"); - } catch (Exception e) { - StringWriter stringWriter = new StringWriter(); - e.printStackTrace(new PrintWriter(stringWriter)); - buffer.append(stringWriter.getBuffer()); - } - buffer.append("----------\n"); - } - } - } - String computedSyntaxErrorDiagnosis = buffer.toString(); - if(!expectedSyntaxErrorDiagnosis.equals(computedSyntaxErrorDiagnosis)) { - System.out.println(Util.displayString(computedSyntaxErrorDiagnosis)); - } - assertEquals( - "Invalid syntax error diagnosis", - expectedSyntaxErrorDiagnosis, - computedSyntaxErrorDiagnosis); - } + public void test01() { String s = + "$login =1; " + "final class test {\n" + "\n" + "private function f1() {\n" + @@ -110,7 +54,7 @@ public class DualParseSyntaxErrorTest extends AbstractCompilerTest { ""; String testName = ""; - checkParse( + checkParsePHP( s.toCharArray(), expectedSyntaxErrorDiagnosis); // testName); @@ -127,12 +71,42 @@ public class DualParseSyntaxErrorTest extends AbstractCompilerTest { ""; String testName = ""; - checkParse( + checkParsePHP( + s.toCharArray(), + expectedSyntaxErrorDiagnosis); +// testName); + } + public void test03() { + String s = + "$chars = ( isset($HTTP_GET_VARS['chars']) ) ? intval($HTTP_GET_VARS['chars']) : 200;"; + String expectedSyntaxErrorDiagnosis = + ""; + + checkParsePHP( + s.toCharArray(), + expectedSyntaxErrorDiagnosis); +// testName); +} + public void test96() { + String s = "$str = <<foo = 'Foo';\n" + + " $this->bar = array('Bar1', 'Bar2', 'Bar3');\n" + " }\n" + + "}\n" + "\n" + "$foo = new foo();\n" + "$name = 'MyName';\n" + "\n" + + "echo <<foo.\n" + + "Now, I am printing some {$foo->bar[1]}.\n" + + "This should print a capital 'A': \\x41\n" + "EOT;\n"; + String expectedSyntaxErrorDiagnosis = + ""; + + checkParsePHP( s.toCharArray(), expectedSyntaxErrorDiagnosis); // testName); } - public void test97() { String s = "class momo { \n"+ @@ -144,19 +118,20 @@ public class DualParseSyntaxErrorTest extends AbstractCompilerTest { String expectedSyntaxErrorDiagnosis = ""; - checkParse( + checkParsePHP( s.toCharArray(), expectedSyntaxErrorDiagnosis); // testName); } public void test98() { String s = + "return(array());"+ "if(!$result = mysql_query($sql)) return(array());\n"; String expectedSyntaxErrorDiagnosis = ""; - checkParse( + checkParsePHP( s.toCharArray(), expectedSyntaxErrorDiagnosis); // testName); @@ -172,9 +147,19 @@ public class DualParseSyntaxErrorTest extends AbstractCompilerTest { "} \n"; String expectedSyntaxErrorDiagnosis = - ""; - - checkParse( + "----------\n" + + "1. ERROR in (at line 1)\n" + + " murks; \n" + + " ^^^^^\n" + + "Parser error \"\'public\' \'private\' or \'protected\' modifier expected for field declarations.\"\n" + + "----------\n" + + "2. ERROR in (at line 1)\n" + + " } \n" + + " ^\n" + + "Parser error \"Too many closing \'}\'; end-of-file not reached.\"\n" + + "----------\n"; + + checkParsePHP( s.toCharArray(), expectedSyntaxErrorDiagnosis); // testName); diff --git a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPManualTestCase.java b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPManualTestCase.java index 56d3697..fb231ff 100644 --- a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPManualTestCase.java +++ b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPManualTestCase.java @@ -5,14 +5,13 @@ package net.sourceforge.phpeclipse.tests.parser; * under the terms of the Common Public License v1.0 which accompanies this * distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html ******************************************************************************/ -import junit.framework.TestCase; -import net.sourceforge.phpdt.internal.compiler.parser.Parser; +import net.sourceforge.phpdt.core.tests.util.AbstractCompilerTest; import net.sourceforge.phpdt.internal.compiler.parser.Scanner; /** * Tests the php parser */ -public class PHPManualTestCase extends TestCase { - Parser parser; +public class PHPManualTestCase extends AbstractCompilerTest { +// Parser parser; public PHPManualTestCase(String name) { super(name); } @@ -87,8 +86,8 @@ public class PHPManualTestCase extends TestCase { + " echo \"
\\n\";\n" + "}\n" + "\n" + "// ...because you can simply type\n" + "if ($show_separators) {\n" + " echo \"
\\n\";\n" + "}"); - checkPHP("echo gettype((bool) \"\"); // bool(false)\n" - + "echo gettype((bool) 1); // bool(true)\n" + checkPHP( // "echo gettype((bool) \"\"); // bool(false)\n" + "echo gettype((bool) 1); // bool(true)\n" + "echo gettype((bool) -2); // bool(true)\n" + "echo gettype((bool) \"foo\"); // bool(true)\n" + "echo gettype((bool) 2.3e5); // bool(true)\n" @@ -124,17 +123,7 @@ public class PHPManualTestCase extends TestCase { + "echo 'This will not expand: \\n a newline';\n" + "\n" + "// Outputs: Variables do not $expand $either\n" + "echo 'Variables do not $expand $either';\n"); - checkPHP("$str = <<foo = 'Foo';\n" - + " $this->bar = array('Bar1', 'Bar2', 'Bar3');\n" + " }\n" - + "}\n" + "\n" + "$foo = new foo();\n" + "$name = 'MyName';\n" + "\n" - + "echo <<foo.\n" - + "Now, I am printing some {$foo->bar[1]}.\n" - + "This should print a capital 'A': \\x41\n" + "EOT;\n"); + checkPHP("echo \"This works: \" . $arr['foo'][3];"); checkPHP("echo \"\\$foo==$foo; type is \" . gettype ($foo) . \"
\\n\";"); checkPHP("$arr = array(\"foo\" => \"bar\", 12 => true);\n" + "\n" @@ -217,19 +206,22 @@ public class PHPManualTestCase extends TestCase { System.out.println("\n------------------------------------"); System.out.println(strEval); } - parser.phpParserTester(strEval, 1); - } - private void checkHTML(String strEval) { - if (Scanner.DEBUG) { - System.out.println("\n------------------------------------"); - System.out.println(strEval); - } - parser.parse(strEval); + checkParsePHP( + strEval.toCharArray(), + ""); +// parser.phpParserTester(strEval, 1); } +// private void checkHTML(String strEval) { +// if (Scanner.DEBUG) { +// System.out.println("\n------------------------------------"); +// System.out.println(strEval); +// } +// parser.parse(strEval); +// } /** * The JUnit setup method */ - protected void setUp() { - parser = new Parser(null); - } +// protected void setUp() { +// parser = new Parser(null); +// } } diff --git a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPParserTestCase.java b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPParserTestCase.java index f0c034a..d7759ea 100644 --- a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPParserTestCase.java +++ b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPParserTestCase.java @@ -5,14 +5,14 @@ package net.sourceforge.phpeclipse.tests.parser; * under the terms of the Common Public License v1.0 which accompanies this * distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html ******************************************************************************/ -import junit.framework.TestCase; +import net.sourceforge.phpdt.core.tests.util.AbstractCompilerTest; import net.sourceforge.phpdt.internal.compiler.parser.Parser; import net.sourceforge.phpdt.internal.compiler.parser.Scanner; /** * Tests the php parser */ -public class PHPParserTestCase extends TestCase { - Parser parser; +public class PHPParserTestCase extends AbstractCompilerTest { +// Parser parser; public PHPParserTestCase(String name) { super(name); } @@ -20,6 +20,11 @@ public class PHPParserTestCase extends TestCase { * Test the PHP Parser with different PHP snippets */ public void testPHPParser() { + checkHTML(""); + checkPHP("if ($topic<1) { $topic = 1;}"); + checkPHP("$this->result_field_names[$result_id][] = odbc_field_name($result_id, $i);"); + checkPHP("$db->sql_query($sql);"); + checkPHP("$val = $$add;"); // checkPHP("if(!$result = mysql_query($sql)) return(array());"); checkPHP("class test { function &fetchRow($result, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum=null) \n{ \n } \n }"); // Bugs item #690938 @@ -51,7 +56,7 @@ public class PHPParserTestCase extends TestCase { checkPHP("@$connect_function($dbhost, $user, $pw);"); checkPHP("$conn = @$connect_function($dbhost, $user, $pw);"); checkPHP("global ${$objectname}; "); - checkPHP("class DB_mssql extends DB_common { var $connection; var $phptype, $dbsyntax; } "); + // checkPHP("class DB_mssql extends DB_common { var $connection; var $phptype, $dbsyntax; } "); checkPHP("unset($this->blockvariables[$block][$varname]);"); checkPHP("new IT_Error(\"The block '$block' was not found in the template.\", __FILE__, __LINE__);"); checkPHP("for ($i=156, $j=0; $i<512; $i++, $j++) $v_checksum += ord(substr($v_binary_data_last,$j,1));"); @@ -62,8 +67,8 @@ public class PHPParserTestCase extends TestCase { checkPHP("function validateAndParseResponse($code, &$arguments) { }"); checkPHP("$options = Console_Getopt::getopt($argv, \"h?v:e:p:d:\");"); checkPHP("$this->container = new $container_class($container_options);"); - checkPHP("class Cmd extends PEAR { var $arrSetting = array(); }"); - checkPHP("class Cmd extends PEAR { var $arrSetting = array(), $i=10; }"); + // checkPHP("class Cmd extends PEAR { var $arrSetting = array(); }"); + // checkPHP("class Cmd extends PEAR { var $arrSetting = array(), $i=10; }"); checkPHP("if (isset($test)) { } elseif (isset($lang)) { }"); checkPHP("require_once(\"mainfile.php\"); "); checkPHP("if (eregi(\"footer.php\",$PHP_SELF)) {\n" @@ -100,31 +105,44 @@ public class PHPParserTestCase extends TestCase { checkPHP("do {$array[] = array(\"$myrow[uid]\" => \"$myrow[uname]\"); } while($myrow = mysql_fetch_array($result));"); checkPHP("$ol = new Overlib();"); checkPHP("$risultato = mysql_query($sql) or\n die(mysql_error());"); - checkHTML("\n\n\n\n "); - checkHTML(""); - checkHTML(""); - checkHTML(" foo "); - checkHTML(" "); - checkHTML(""); +// checkHTML("\n\n\n\n "); +// checkHTML(""); +// checkHTML(""); +// checkHTML(" foo "); +// checkHTML(" "); +// checkHTML(""); } private void checkPHP(String strEval) { if (Scanner.DEBUG) { System.out.println("\n------------------------------------"); System.out.println(strEval); } - parser.phpParserTester(strEval, 1); + checkParsePHP( + strEval.toCharArray(), + ""); +// parser.phpParserTester(strEval, 1); } private void checkHTML(String strEval) { if (Scanner.DEBUG) { System.out.println("\n------------------------------------"); System.out.println(strEval); } - parser.parse(strEval); - } - /** - * The JUnit setup method - */ - protected void setUp() { - parser = new Parser(null); + checkParseHTML( + strEval.toCharArray(), + ""); +// parser.phpParserTester(strEval, 1); } +// private void checkHTML(String strEval) { +// if (Scanner.DEBUG) { +// System.out.println("\n------------------------------------"); +// System.out.println(strEval); +// } +// parser.parse(strEval); +// } +// /** +// * The JUnit setup method +// */ +// protected void setUp() { +// parser = new Parser(null); +// } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java index cc27c47..62feaeb 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java @@ -79,8 +79,13 @@ public interface ITerminalSymbols { final static int TokenNameQUESTION = 62; final static int TokenNamePAAMAYIM_NEKUDOTAYIM = 63; final static int TokenNameAT = 64; + + final static int TokenNameand = 65; + final static int TokenNameor = 66; + final static int TokenNamexor = 67; - final static int TokenNameDOLLAR_LBRACE = 127; + final static int TokenNameDOLLAR = 126; +// final static int TokenNameDOLLAR_LBRACE = 127; final static int TokenNameLPAREN = 128; final static int TokenNameRPAREN = 129; final static int TokenNameLBRACE = 130; @@ -108,9 +113,19 @@ public interface ITerminalSymbols { final static int TokenNameRIGHT_SHIFT = 156; final static int TokenNameEQUAL_EQUAL_EQUAL = 157; final static int TokenNameNOT_EQUAL_EQUAL = 158; - final static int TokenNameOR = 159; - final static int TokenNameHEREDOC = 160; + + final static int TokenNameOR = 160; + final static int TokenNameHEREDOC = 161; + final static int TokenNameintCAST = 174; + final static int TokenNameboolCAST = 175; + final static int TokenNamedoubleCAST = 176; + final static int TokenNamestringCAST = 177; + final static int TokenNamearrayCAST = 178; + final static int TokenNameobjectCAST = 179; + final static int TokenNameunsetCAST = 180; + + public final static int TokenNameKEYWORD = 1000; public final static int TokenNameif = 1001; public final static int TokenNameelseif = 1002; @@ -158,7 +173,7 @@ public interface ITerminalSymbols { // public final static int TokenNamenull = 1044; // public final static int TokenNamefalse = 1045; // public final static int TokenNametrue = 1046; - public final static int TokenNamethis = 1047; +// public final static int TokenNamethis = 1047; // public final static int TokenNameabstract = 1050; public final static int TokenNamecatch = 1051; @@ -173,7 +188,8 @@ public interface ITerminalSymbols { public final static int TokenNamesuper = 1060; public final static int TokenNamethrow = 1061; - public final static int TokenNameconst = 1063; + public final static int TokenNameconst = 1062; + public final static int TokenNameclone = 1063; public final static int TokenNamedeclare = 1064; public final static int TokenNameenddeclare = 1065; public final static int TokenNameeval = 1065; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java index f389faa..2a0e2c1 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java @@ -1,6 +1,6 @@ /********************************************************************** Copyright (c) 2002 Klaus Hartlage - www.eclipseproject.de - All rights reserved. This program and the accompanying materials + All rights reserved. This program and the accompanying material are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html @@ -62,7 +62,7 @@ public class Parser //extends PHPParserSuperclass private String stringValue; /** Contains the current expression. */ // private StringBuffer expression; - private boolean phpMode; + //private boolean phpMode; protected int modifiers; protected int modifiersSourceStart; protected Parser() { @@ -554,78 +554,78 @@ public class Parser //extends PHPParserSuperclass // } catch (CoreException e) { // } // } - public void phpParserTester(String s, int rowCount) { - this.str = s; - if (s == null) { - if (phpList.size() != 0) { - this.str = ((PHPString) phpList.get(currentPHPString++)).getPHPString(); - } - } - this.token = TokenNameEOF; - // this.chIndx = 0; - // this.rowCount = rowCount; - // this.columnCount = 0; - this.phpEnd = false; - this.phpMode = true; - scanner.setSource(s.toCharArray()); - scanner.setPHPMode(true); - getNextToken(); - do { - try { - if (token != TokenNameEOF && token != TokenNameERROR) { - statementList(); - } - if (token != TokenNameEOF) { - if (token == TokenNameERROR) { - throwSyntaxError("Scanner error (Found unknown token: " - + scanner.toStringAction(token) + ")"); - } - if (token == TokenNameRPAREN) { - throwSyntaxError("Too many closing ')'; end-of-file not reached."); - } - if (token == TokenNameRBRACE) { - throwSyntaxError("Too many closing '}'; end-of-file not reached."); - } - if (token == TokenNameRBRACKET) { - throwSyntaxError("Too many closing ']'; end-of-file not reached."); - } - if (token == TokenNameLPAREN) { - throwSyntaxError("Read character '('; end-of-file not reached."); - } - if (token == TokenNameLBRACE) { - throwSyntaxError("Read character '{'; end-of-file not reached."); - } - if (token == TokenNameLBRACKET) { - throwSyntaxError("Read character '['; end-of-file not reached."); - } - throwSyntaxError("End-of-file not reached."); - } - return; - } catch (SyntaxError err) { - if (s != null) { - throw err; - } else { - // setMarker(err.getMessage(), err.getLine(), ERROR); - // setMarker(err.getMessage(), - // scanner.getCurrentTokenStartPosition(), - // scanner.getCurrentTokenEndPosition(), ERROR); - } - // if an error occured, - // try to find keywords 'class' or 'function' - // to parse the rest of the string - while (token != TokenNameEOF && token != TokenNameERROR) { - if (token == TokenNameabstract || token == TokenNamefinal - || token == TokenNameclass || token == TokenNamefunction) { - break; - } - getNextToken(); - } - if (token == TokenNameEOF || token == TokenNameERROR) { - return; - } - } - } while (true); - } +// public void phpParserTester(String s, int rowCount) { +// this.str = s; +// if (s == null) { +// if (phpList.size() != 0) { +// this.str = ((PHPString) phpList.get(currentPHPString++)).getPHPString(); +// } +// } +// this.token = TokenNameEOF; +// // this.chIndx = 0; +// // this.rowCount = rowCount; +// // this.columnCount = 0; +// this.phpEnd = false; +// this.phpMode = true; +// scanner.setSource(s.toCharArray()); +// scanner.setPHPMode(true); +// getNextToken(); +// do { +// try { +// if (token != TokenNameEOF && token != TokenNameERROR) { +// statementList(); +// } +// if (token != TokenNameEOF) { +// if (token == TokenNameERROR) { +// throwSyntaxError("Scanner error (Found unknown token: " +// + scanner.toStringAction(token) + ")"); +// } +// if (token == TokenNameRPAREN) { +// throwSyntaxError("Too many closing ')'; end-of-file not reached."); +// } +// if (token == TokenNameRBRACE) { +// throwSyntaxError("Too many closing '}'; end-of-file not reached."); +// } +// if (token == TokenNameRBRACKET) { +// throwSyntaxError("Too many closing ']'; end-of-file not reached."); +// } +// if (token == TokenNameLPAREN) { +// throwSyntaxError("Read character '('; end-of-file not reached."); +// } +// if (token == TokenNameLBRACE) { +// throwSyntaxError("Read character '{'; end-of-file not reached."); +// } +// if (token == TokenNameLBRACKET) { +// throwSyntaxError("Read character '['; end-of-file not reached."); +// } +// throwSyntaxError("End-of-file not reached."); +// } +// return; +// } catch (SyntaxError err) { +// if (s != null) { +// throw err; +// } else { +// // setMarker(err.getMessage(), err.getLine(), ERROR); +// // setMarker(err.getMessage(), +// // scanner.getCurrentTokenStartPosition(), +// // scanner.getCurrentTokenEndPosition(), ERROR); +// } +// // if an error occured, +// // try to find keywords 'class' or 'function' +// // to parse the rest of the string +// while (token != TokenNameEOF && token != TokenNameERROR) { +// if (token == TokenNameabstract || token == TokenNamefinal +// || token == TokenNameclass || token == TokenNamefunction) { +// break; +// } +// getNextToken(); +// } +// if (token == TokenNameEOF || token == TokenNameERROR) { +// return; +// } +// } +// } while (true); +// } public void init(String s) { this.str = s; this.token = TokenNameEOF; @@ -633,7 +633,7 @@ public class Parser //extends PHPParserSuperclass // this.rowCount = 1; // this.columnCount = 0; this.phpEnd = false; - this.phpMode = false; +// this.phpMode = false; /* scanner initialization */ scanner.setSource(s.toCharArray()); scanner.setPHPMode(false); @@ -647,7 +647,7 @@ public class Parser //extends PHPParserSuperclass // this.rowCount = 1; // this.columnCount = 0; this.phpEnd = false; - this.phpMode = phpMode; +// this.phpMode = phpMode; scanner.setPHPMode(phpMode); } /** @@ -746,7 +746,7 @@ public class Parser //extends PHPParserSuperclass // return outlineInfo; // } private boolean isVariable() { - return token == TokenNameVariable || token == TokenNamethis; + return token == TokenNameVariable; // || token == TokenNamethis; } // private void parseDeclarations(PHPOutlineInfo outlineInfo, // OutlineableWithChildren current, boolean goBack) { @@ -949,49 +949,51 @@ public class Parser //extends PHPParserSuperclass // TokenNamenew) { // char[] ident = scanner.getCurrentIdentifierSource(); // String keyword = new String(ident); - if (token == TokenNameAT) { - getNextToken(); - if (token != TokenNamerequire && token != TokenNamerequire_once - && token != TokenNameinclude && token != TokenNameinclude_once - && token != TokenNameIdentifier && token != TokenNameVariable - && token != TokenNamethis && token != TokenNameStringInterpolated) { - throwSyntaxError("identifier expected after '@'."); - } - } - if (token == TokenNameinclude || token == TokenNameinclude_once) { - getNextToken(); - if (token == TokenNameLPAREN) { - expr(); - if (token == TokenNameSEMICOLON) { - getNextToken(); - } else { - if (previousToken != TokenNameAT && token != TokenNameStopPHP) { - throwSyntaxError("';' expected after 'include' or 'include_once'."); - } - // getNextToken(); - } - } else { - concatenationExpression(); - } - return; - } else if (token == TokenNamerequire || token == TokenNamerequire_once) { - getNextToken(); - //constant(); - if (token == TokenNameLPAREN) { - expr(); - if (token == TokenNameSEMICOLON) { - getNextToken(); - } else { - if (previousToken != TokenNameAT && token != TokenNameStopPHP) { - throwSyntaxError("';' expected after 'require' or 'require_once'."); - } - // getNextToken(); - } - } else { - concatenationExpression(); - } - return; - } else if (token == TokenNameif) { + // if (token == TokenNameAT) { + // getNextToken(); + // if (token != TokenNamerequire && token != TokenNamerequire_once + // && token != TokenNameinclude && token != TokenNameinclude_once + // && token != TokenNameIdentifier && token != TokenNameVariable + // && token != TokenNameStringInterpolated) { + // throwSyntaxError("identifier expected after '@'."); + // } + // } + // if (token == TokenNameinclude || token == TokenNameinclude_once) { + // getNextToken(); + // if (token == TokenNameLPAREN) { + // expr(); + // if (token == TokenNameSEMICOLON) { + // getNextToken(); + // } else { + // if (previousToken != TokenNameAT && token != TokenNameStopPHP) { + // throwSyntaxError("';' expected after 'include' or 'include_once'."); + // } + // // getNextToken(); + // } + // } else { + // concatenationExpression(); + // } + // return; + // } else if (token == TokenNamerequire || token == TokenNamerequire_once) + // { + // getNextToken(); + // //constant(); + // if (token == TokenNameLPAREN) { + // expr(); + // if (token == TokenNameSEMICOLON) { + // getNextToken(); + // } else { + // if (previousToken != TokenNameAT && token != TokenNameStopPHP) { + // throwSyntaxError("';' expected after 'require' or 'require_once'."); + // } + // // getNextToken(); + // } + // } else { + // concatenationExpression(); + // } + // return; + // } else + if (token == TokenNameif) { getNextToken(); if (token == TokenNameLPAREN) { getNextToken(); @@ -1179,19 +1181,31 @@ public class Parser //extends PHPParserSuperclass // getNextToken(); // } // return; - } else if (token == TokenNameglobal || token == TokenNamestatic) { + } else if (token == TokenNameglobal) { getNextToken(); - variableList(); + global_var_list(); if (token == TokenNameSEMICOLON) { getNextToken(); } else { if (token != TokenNameStopPHP) { - throwSyntaxError("';' expected after 'global' or 'static' statement."); + throwSyntaxError("';' expected after 'global' statement."); } getNextToken(); } return; - } else if (token == TokenNameunset) { + } else if (token == TokenNamestatic) { + getNextToken(); + static_var_list(); + if (token == TokenNameSEMICOLON) { + getNextToken(); + } else { + if (token != TokenNameStopPHP) { + throwSyntaxError("';' expected after 'static' statement."); + } + getNextToken(); + } + return; + }else if (token == TokenNameunset) { getNextToken(); if (token == TokenNameLPAREN) { getNextToken(); @@ -1314,6 +1328,61 @@ public class Parser //extends PHPParserSuperclass } } } + private void global_var_list() { + // global_var_list: + // global_var_list ',' global_var + //| global_var + while (true) { + global_var(); + if (token != TokenNameCOMMA) { + break; + } + getNextToken(); + } + } + private void global_var() { + //global_var: + // T_VARIABLE + //| '$' r_variable + //| '$' '{' expr '}' + if (token == TokenNameVariable) { + getNextToken(); + } else if (token == TokenNameDOLLAR) { + getNextToken(); + if (token == TokenNameLPAREN) { + getNextToken(); + expr(); + if (token != TokenNameLPAREN) { + throwSyntaxError("')' expected in global variable."); + } + getNextToken(); + } else { + r_variable(); + } + } + } + private void static_var_list() { + //static_var_list: + // static_var_list ',' T_VARIABLE + //| static_var_list ',' T_VARIABLE '=' static_scalar + //| T_VARIABLE + //| T_VARIABLE '=' static_scalar + while (true) { + if (token == TokenNameVariable) { + getNextToken(); + if (token == TokenNameEQUAL) { + getNextToken(); + static_scalar(); + } + if (token != TokenNameCOMMA) { + break; + } + getNextToken(); + } else { + break; + } + } + } private void unset_variables() { // unset_variables: // unset_variable @@ -1634,10 +1703,11 @@ public class Parser //extends PHPParserSuperclass static_scalar(); } } else { - if (token == TokenNamethis) { - throwSyntaxError("'$this' not allowed after keyword 'public' 'protected' 'private' 'var'."); - } - throwSyntaxError("Variable expected keyword 'public' 'protected' 'private' 'var'."); + // if (token == TokenNamethis) { + // throwSyntaxError("'$this' not allowed after keyword 'public' + // 'protected' 'private' 'var'."); + // } + throwSyntaxError("Variable expected after keyword 'public' 'protected' 'private' 'var'."); } if (token != TokenNameCOMMA) { break; @@ -1738,9 +1808,10 @@ public class Parser //extends PHPParserSuperclass } return; } - if (token == TokenNamethis) { - throwSyntaxError("Reserved word '$this' not allowed in parameter declaration."); - } + // if (token == TokenNamethis) { + // throwSyntaxError("Reserved word '$this' not allowed in parameter + // declaration."); + // } } private void labeledStatementList() { if (token != TokenNamecase && token != TokenNamedefault) { @@ -2044,29 +2115,85 @@ public class Parser //extends PHPParserSuperclass } while (true); } private void expr() { - //todo: find a better way to get the expression - // expression = new StringBuffer(); - // for (int i = chIndx; i < str.length(); i++) { - // if (str.charAt(i) == ';') { - // break; - // } - // expression.append(str.charAt(i)); - // } - // if (token == TokenNameSTRING_CONSTANT || token == - // TokenNameINTERPOLATED_STRING) { - // getNextToken(); - // } else { - logicalinclusiveorExpression(); - // while (token != TokenNameSEMICOLON) { - // getNextToken(); - // // } + // r_variable + // | expr_without_variable + // if (token!=TokenNameEOF) { + if (Scanner.TRACE) { + System.out.println("TRACE: expr()"); + } + expr_without_variable(true); // } } - private void expr_without_variable() { - // String ident; - char[] ident; - boolean castFlag = false; - boolean arrayFlag = false; + private void expr_without_variable(boolean only_variable) { + // internal_functions_in_yacc + // | T_CLONE expr + // | T_PRINT expr + // | '(' expr ')' + // | '@' expr + // | '+' expr + // | '-' expr + // | '!' expr + // | '~' expr + // | T_INC rw_variable + // | T_DEC rw_variable + // | T_INT_CAST expr + // | T_DOUBLE_CAST expr + // | T_STRING_CAST expr + // | T_ARRAY_CAST expr + // | T_OBJECT_CAST expr + // | T_BOOL_CAST expr + // | T_UNSET_CAST expr + // | T_EXIT exit_expr + // | scalar + // | T_ARRAY '(' array_pair_list ')' + // | '`' encaps_list '`' + // | T_LIST '(' assignment_list ')' '=' expr + // | T_NEW class_name_reference ctor_arguments + // | variable '=' expr + // | variable '=' '&' variable + // | variable '=' '&' T_NEW class_name_reference ctor_arguments + // | variable T_PLUS_EQUAL expr + // | variable T_MINUS_EQUAL expr + // | variable T_MUL_EQUAL expr + // | variable T_DIV_EQUAL expr + // | variable T_CONCAT_EQUAL expr + // | variable T_MOD_EQUAL expr + // | variable T_AND_EQUAL expr + // | variable T_OR_EQUAL expr + // | variable T_XOR_EQUAL expr + // | variable T_SL_EQUAL expr + // | variable T_SR_EQUAL expr + // | rw_variable T_INC + // | rw_variable T_DEC + // | expr T_BOOLEAN_OR expr + // | expr T_BOOLEAN_AND expr + // | expr T_LOGICAL_OR expr + // | expr T_LOGICAL_AND expr + // | expr T_LOGICAL_XOR expr + // | expr '|' expr + // | expr '&' expr + // | expr '^' expr + // | expr '.' expr + // | expr '+' expr + // | expr '-' expr + // | expr '*' expr + // | expr '/' expr + // | expr '%' expr + // | expr T_SL expr + // | expr T_SR expr + // | expr T_IS_IDENTICAL expr + // | expr T_IS_NOT_IDENTICAL expr + // | expr T_IS_EQUAL expr + // | expr T_IS_NOT_EQUAL expr + // | expr '<' expr + // | expr T_IS_SMALLER_OR_EQUAL expr + // | expr '>' expr + // | expr T_IS_GREATER_OR_EQUAL expr + // | expr T_INSTANCEOF class_name_reference + // | expr '?' expr ':' expr + if (Scanner.TRACE) { + System.out.println("TRACE: expr_without_variable() PART 1"); + } switch (token) { case TokenNameisset : case TokenNameempty : @@ -2077,125 +2204,74 @@ public class Parser //extends PHPParserSuperclass case TokenNamerequire_once : internal_functions_in_yacc(); break; - case TokenNamenew : - getNextToken(); - expr(); - break; - // - // case TokenNamenull : - // getNextToken(); - // break; - // case TokenNamefalse : - // getNextToken(); - // break; - // case TokenNametrue : - // getNextToken(); - // break; - case TokenNameStringConstant : - getNextToken(); - break; - case TokenNameHEREDOC : - case TokenNameStringInterpolated : - case TokenNameStringLiteral : - getNextToken(); - break; + // | '(' expr ')' case TokenNameLPAREN : getNextToken(); - if (token == TokenNameIdentifier) { - // check if identifier is a type: - // ident = identifier; - ident = scanner.getCurrentIdentifierSource(); - String str = new String(ident).toLowerCase(); - for (int i = 0; i < PHP_TYPES.length; i++) { - if (PHP_TYPES[i].equals(str)) { - castFlag = true; - if (PHP_TYPES[i].equals("array")) { - arrayFlag = true; - } - break; - } - } - } - if (castFlag) { - getNextToken(); - if (arrayFlag && token == TokenNameLPAREN) { - getNextToken(); - if (token == TokenNameRPAREN) { - getNextToken(); - } else { - expr(); - if (token != TokenNameRPAREN) { - throwSyntaxError(") expected after 'array('."); - } - } - } - if (token != TokenNameRPAREN) { - throwSyntaxError(") expected after cast-type '" + str + "'."); - } + expr(); + if (token == TokenNameRPAREN) { getNextToken(); - expr(); - break; } else { - expr(); + throwSyntaxError("')' expected in expression."); } - if (token != TokenNameRPAREN) { - throwSyntaxError(") expected in postfix-expression."); - } - getNextToken(); break; - case TokenNameDoubleLiteral : - getNextToken(); - break; - case TokenNameIntegerLiteral : - getNextToken(); - break; - case TokenNameDOLLAR_LBRACE : + // | T_CLONE expr + // | T_PRINT expr + // | '@' expr + // | '+' expr + // | '-' expr + // | '!' expr + // | '~' expr + // | T_INT_CAST expr + // | T_DOUBLE_CAST expr + // | T_STRING_CAST expr + // | T_ARRAY_CAST expr + // | T_OBJECT_CAST expr + // | T_BOOL_CAST expr + // | T_UNSET_CAST expr + case TokenNameclone : + case TokenNameprint : + case TokenNameAT : + case TokenNamePLUS : + case TokenNameMINUS : + case TokenNameNOT : + case TokenNameTWIDDLE : + case TokenNameintCAST : + case TokenNamedoubleCAST : + case TokenNamestringCAST : + case TokenNamearrayCAST : + case TokenNameobjectCAST : + case TokenNameboolCAST : + case TokenNameunsetCAST : getNextToken(); expr(); - if (token != TokenNameRBRACE) { - throwSyntaxError("'}' expected after indirect variable token '${'."); - } - getNextToken(); break; - case TokenNameVariable : - case TokenNamethis : - ident = scanner.getCurrentIdentifierSource(); + case TokenNameexit : getNextToken(); - if (token == TokenNameLBRACE) { - getNextToken(); - expr(); - if (token != TokenNameRBRACE) { - throwSyntaxError("'}' expected after variable '" - + new String(ident) + "' in variable-expression."); - } - getNextToken(); - } else if (token == TokenNameLPAREN) { - getNextToken(); - if (token != TokenNameRPAREN) { - expressionList(); - if (token != TokenNameRPAREN) { - throwSyntaxError("')' expected after variable '" - + new String(ident) + "' in postfix-expression."); - } - } - getNextToken(); - } + exit_expr(); break; - case TokenNameIdentifier : - ident = scanner.getCurrentIdentifierSource(); + // scalar: + // T_STRING + //| T_STRING_VARNAME + //| class_constant + //| '"' encaps_list '"' + //| '\'' encaps_list '\'' + //| T_START_HEREDOC encaps_list T_END_HEREDOC + // | '`' encaps_list '`' + // | common_scalar + case TokenNameIntegerLiteral : + case TokenNameDoubleLiteral : + case TokenNameStringLiteral : + case TokenNameStringConstant : + case TokenNameStringInterpolated : + case TokenNameFILE : + case TokenNameLINE : + case TokenNameCLASS_C : + case TokenNameMETHOD_C : + case TokenNameFUNC_C : + common_scalar(); + break; + case TokenNameHEREDOC : getNextToken(); - if (token == TokenNameLPAREN) { - getNextToken(); - if (token != TokenNameRPAREN) { - expressionList(); - if (token != TokenNameRPAREN) { - throwSyntaxError("')' expected after identifier '" - + new String(ident) + "' in postfix-expression." - + "(Found token: " + scanner.toStringAction(token) + ")"); - } - } - getNextToken(); - } break; case TokenNamearray : // T_ARRAY '(' array_pair_list ')' @@ -2217,178 +2293,285 @@ public class Parser //extends PHPParserSuperclass + "(Found token: " + scanner.toStringAction(token) + ")"); } break; - case TokenNameprint : - getNextToken(); - expr(); - break; - case TokenNameexit : - getNextToken(); - exit_expr(); - break; case TokenNamelist : + // | T_LIST '(' assignment_list ')' '=' expr getNextToken(); if (token == TokenNameLPAREN) { getNextToken(); - if (token == TokenNameCOMMA) { - getNextToken(); - } - expressionList(); + assignment_list(); if (token != TokenNameRPAREN) { throwSyntaxError("')' expected after 'list' keyword."); } getNextToken(); - // if (token == TokenNameSET) { - // getNextToken(); - // logicalinclusiveorExpression(); - // } + if (token != TokenNameEQUAL) { + throwSyntaxError("'=' expected after 'list' keyword."); + } + getNextToken(); + expr(); } else { throwSyntaxError("'(' expected after 'list' keyword."); } break; - // case TokenNameexit : - // getNextToken(); - // if (token != TokenNameSEMICOLON) { - // exitStatus(); - // } - // if (token == TokenNameSEMICOLON) { - // getNextToken(); - // } else { - // if (token != TokenNameStopPHP) { - // throwSyntaxError("';' expected after 'exit' expression."); - // } - // getNextToken(); - // } - // break; - // case TokenNamedie : - // getNextToken(); - // if (token != TokenNameSEMICOLON) { - // exitStatus(); - // } - // if (token == TokenNameSEMICOLON) { - // getNextToken(); - // } else { - // if (token != TokenNameStopPHP) { - // throwSyntaxError("';' expected after 'die' expression."); - // } - // } - // break; - // case TokenNamearray : - // getNextToken(); - // if (token == TokenNameARGOPEN) { - // getNextToken(); - // if (token == TokenNameCOMMA) { - // getNextToken(); - // } - // expressionList(); - // if (token != TokenNameARGCLOSE) { - // throwSyntaxError("')' expected after 'list' keyword."); - // } - // getNextToken(); - // if (token == TokenNameSET) { - // getNextToken(); - // logicalinclusiveorExpression(); - // } - // } else { - // throwSyntaxError("'(' expected after 'list' keyword."); - // } - // break; + case TokenNamenew : + // | T_NEW class_name_reference ctor_arguments + getNextToken(); + class_name_reference(); + ctor_arguments(); + break; + // | T_INC rw_variable + // | T_DEC rw_variable + case TokenNamePLUS_PLUS : + case TokenNameMINUS_MINUS : + getNextToken(); + rw_variable(); + break; + // | variable '=' expr + // | variable '=' '&' variable + // | variable '=' '&' T_NEW class_name_reference ctor_arguments + // | variable T_PLUS_EQUAL expr + // | variable T_MINUS_EQUAL expr + // | variable T_MUL_EQUAL expr + // | variable T_DIV_EQUAL expr + // | variable T_CONCAT_EQUAL expr + // | variable T_MOD_EQUAL expr + // | variable T_AND_EQUAL expr + // | variable T_OR_EQUAL expr + // | variable T_XOR_EQUAL expr + // | variable T_SL_EQUAL expr + // | variable T_SR_EQUAL expr + // | rw_variable T_INC + // | rw_variable T_DEC + case TokenNameIdentifier : + case TokenNameVariable : + case TokenNameDOLLAR : + variable(); + switch (token) { + case TokenNameEQUAL : + getNextToken(); + if (token == TokenNameAND) { + getNextToken(); + if (token == TokenNamenew) { + getNextToken(); + throwSyntaxError("not yet implemented (= & new)"); + // class_name_reference(); + // ctor_arguments(); + } else { + variable(); + } + } else { + expr(); + } + break; + case TokenNamePLUS_EQUAL : + case TokenNameMINUS_EQUAL : + case TokenNameMULTIPLY_EQUAL : + case TokenNameDIVIDE_EQUAL : + case TokenNameDOT_EQUAL : + case TokenNameREMAINDER_EQUAL : + case TokenNameAND_EQUAL : + case TokenNameOR_EQUAL : + case TokenNameXOR_EQUAL : + case TokenNameRIGHT_SHIFT_EQUAL : + case TokenNameLEFT_SHIFT_EQUAL : + getNextToken(); + expr(); + break; + case TokenNamePLUS_PLUS : + case TokenNameMINUS_MINUS : + getNextToken(); + break; + default : + if (!only_variable) { + throwSyntaxError("Variable expression not allowed (found token '" + + scanner.toStringAction(token) + "')."); + } + } + break; + default : + if (token != TokenNameStopPHP) { + throwSyntaxError("Error in expression (found token '" + + scanner.toStringAction(token) + "')."); + } + return; } - boolean while_flag = true; - do { + if (Scanner.TRACE) { + System.out.println("TRACE: expr_without_variable() PART 2"); + } + // | expr T_BOOLEAN_OR expr + // | expr T_BOOLEAN_AND expr + // | expr T_LOGICAL_OR expr + // | expr T_LOGICAL_AND expr + // | expr T_LOGICAL_XOR expr + // | expr '|' expr + // | expr '&' expr + // | expr '^' expr + // | expr '.' expr + // | expr '+' expr + // | expr '-' expr + // | expr '*' expr + // | expr '/' expr + // | expr '%' expr + // | expr T_SL expr + // | expr T_SR expr + // | expr T_IS_IDENTICAL expr + // | expr T_IS_NOT_IDENTICAL expr + // | expr T_IS_EQUAL expr + // | expr T_IS_NOT_EQUAL expr + // | expr '<' expr + // | expr T_IS_SMALLER_OR_EQUAL expr + // | expr '>' expr + // | expr T_IS_GREATER_OR_EQUAL expr + while (true) { switch (token) { - case TokenNameLBRACKET : + case TokenNameOR_OR : + case TokenNameAND_AND : + case TokenNameand : + case TokenNameor : + case TokenNamexor : + case TokenNameAND : + case TokenNameOR : + case TokenNameXOR : + case TokenNameDOT : + case TokenNamePLUS : + case TokenNameMINUS : + case TokenNameMULTIPLY : + case TokenNameDIVIDE : + case TokenNameREMAINDER : + case TokenNameLEFT_SHIFT : + case TokenNameRIGHT_SHIFT : + case TokenNameEQUAL_EQUAL_EQUAL : + case TokenNameNOT_EQUAL_EQUAL : + case TokenNameEQUAL_EQUAL : + case TokenNameNOT_EQUAL : + case TokenNameLESS : + case TokenNameLESS_EQUAL : + case TokenNameGREATER : + case TokenNameGREATER_EQUAL : getNextToken(); expr(); - if (token != TokenNameRBRACKET) { - throwSyntaxError("] expected in postfix-expression."); - } + break; + // | expr T_INSTANCEOF class_name_reference + // | expr '?' expr ':' expr + case TokenNameinstanceof : getNextToken(); + throwSyntaxError("not yet implemented (class_name_reference)"); + // class_name_reference(); break; - case TokenNamePAAMAYIM_NEKUDOTAYIM : - // :: - case TokenNameMINUS_GREATER : - // -> + case TokenNameQUESTION : getNextToken(); - if (token > TokenNameKEYWORD) { - ident = scanner.getCurrentIdentifierSource(); - // setMarker( - // "Avoid using keyword '" - // + new String(ident) - // + "' as variable name.", - // rowCount, - // PHPParser.INFO); - // setMarker( - // "Avoid using keyword '" + new String(ident) + "' as - // variable name.", - // scanner.getCurrentTokenStartPosition(), - // scanner.getCurrentTokenEndPosition(), - // INFO); - } - switch (token) { - case TokenNameVariable : - ident = scanner.getCurrentIdentifierSource(); - getNextToken(); - // if (token == TokenNameARGOPEN) { - // getNextToken(); - // expressionList(); - // if (token != TokenNameARGCLOSE) { - // throwSyntaxError(") expected after variable '" + - // ident + "'."); - // } - // getNextToken(); - // } - break; - case TokenNameIdentifier : - //ident = scanner.getCurrentIdentifierSource(); - getNextToken(); - break; - case TokenNameLBRACE : - getNextToken(); - expr(); - if (token != TokenNameRBRACE) { - throwSyntaxError("} expected in postfix-expression."); - } - getNextToken(); - break; - default : - throwSyntaxError("Syntax error after '->' token."); - } - while (token == TokenNameLBRACKET || token == TokenNameLPAREN - || token == TokenNameLBRACE) { - if (token == TokenNameLBRACKET) { - getNextToken(); - expressionList(); - if (token != TokenNameRBRACKET) { - throwSyntaxError("] expected after '->'."); - } - getNextToken(); - } else if (token == TokenNameLPAREN) { - getNextToken(); - expressionList(); - if (token != TokenNameRPAREN) { - throwSyntaxError(") expected after '->'."); - } - getNextToken(); - } else if (token == TokenNameLBRACE) { - getNextToken(); - expr(); - if (token != TokenNameRBRACE) { - throwSyntaxError("} expected after '->'."); - } - getNextToken(); - } + expr(); + if (token == TokenNameCOLON) { + getNextToken(); + expr(); } break; - case TokenNamePLUS_PLUS : + default : + return; + } + } + } + private void class_name_reference() { + // class_name_reference: + // T_STRING + //| dynamic_class_name_reference + if (Scanner.TRACE) { + System.out.println("TRACE: class_name_reference()"); + } + if (token == TokenNameIdentifier) { + getNextToken(); + } else { + dynamic_class_name_reference(); + } + } + private void dynamic_class_name_reference() { + //dynamic_class_name_reference: + // base_variable T_OBJECT_OPERATOR object_property + // dynamic_class_name_variable_properties + //| base_variable + if (Scanner.TRACE) { + System.out.println("TRACE: dynamic_class_name_reference()"); + } + base_variable(); + if (token == TokenNameMINUS_GREATER) { + getNextToken(); + object_property(); + dynamic_class_name_variable_properties(); + } + } + private void dynamic_class_name_variable_properties() { + // dynamic_class_name_variable_properties: + // dynamic_class_name_variable_properties + // dynamic_class_name_variable_property + // | /* empty */ + if (Scanner.TRACE) { + System.out.println("TRACE: dynamic_class_name_variable_properties()"); + } + while (token == TokenNameMINUS_GREATER) { + dynamic_class_name_variable_property(); + } + } + private void dynamic_class_name_variable_property() { + // dynamic_class_name_variable_property: + // T_OBJECT_OPERATOR object_property + if (Scanner.TRACE) { + System.out.println("TRACE: dynamic_class_name_variable_property()"); + } + if (token == TokenNameMINUS_GREATER) { + getNextToken(); + object_property(); + } + } + private void ctor_arguments() { + // ctor_arguments: + // /* empty */ + //| '(' function_call_parameter_list ')' + if (token == TokenNameLPAREN) { + getNextToken(); + if (token == TokenNameRPAREN) { + getNextToken(); + return; + } + non_empty_function_call_parameter_list(); + if (token != TokenNameRPAREN) { + throwSyntaxError("')' expected in ctor_arguments."); + } + getNextToken(); + } + } + private void assignment_list() { + // assignment_list: + // assignment_list ',' assignment_list_element + //| assignment_list_element + while (true) { + assignment_list_element(); + if (token != TokenNameCOMMA) { + break; + } + getNextToken(); + } + } + private void assignment_list_element() { + //assignment_list_element: + // variable + //| T_LIST '(' assignment_list ')' + //| /* empty */ + if (token == TokenNameVariable || token == TokenNameDOLLAR) { + variable(); + } else { + if (token == TokenNamelist) { + getNextToken(); + if (token == TokenNameLPAREN) { getNextToken(); - break; - case TokenNameMINUS_MINUS : + assignment_list(); + if (token != TokenNameRPAREN) { + throwSyntaxError("')' expected after 'list' keyword."); + } getNextToken(); - break; - default : - while_flag = false; + } else { + throwSyntaxError("'(' expected after 'list' keyword."); + } } - } while (while_flag); + } } private void array_pair_list() { // array_pair_list: @@ -2433,309 +2616,392 @@ public class Parser //extends PHPParserSuperclass } } } - private void unaryExpression() { - switch (token) { - case TokenNamePLUS_PLUS : - getNextToken(); - unaryExpression(); - break; - case TokenNameMINUS_MINUS : - getNextToken(); - unaryExpression(); - break; - // '@' '&' '*' '+' '-' '~' '!' - case TokenNameAT : - getNextToken(); - if (token == TokenNameinclude || token == TokenNameinclude_once - || token == TokenNamerequire || token == TokenNamerequire_once) { - statement(TokenNameAT); - } else { - expr_without_variable(); // castExpression(); - } - break; - case TokenNameAND : - getNextToken(); - castExpression(); - break; - case TokenNameMULTIPLY : - getNextToken(); - castExpression(); - break; - case TokenNamePLUS : - getNextToken(); - castExpression(); - break; - case TokenNameMINUS : - getNextToken(); - castExpression(); - break; - case TokenNameTWIDDLE : - getNextToken(); - castExpression(); - break; - case TokenNameNOT : - getNextToken(); - castExpression(); - break; - default : - expr_without_variable(); +// private void variableList() { +// do { +// variable(); +// if (token == TokenNameCOMMA) { +// getNextToken(); +// } else { +// break; +// } +// } while (true); +// } + private void variable_without_objects() { + // variable_without_objects: + // reference_variable + // | simple_indirect_reference reference_variable + if (Scanner.TRACE) { + System.out.println("TRACE: variable_without_objects()"); } - } - private void castExpression() { - // if (token == TokenNameARGOPEN) { - // getNextToken(); - // typeName(); - // if (token != TokenNameARGCLOSE) { - // throwSyntaxError(") expected after cast-expression."); - // } - // getNextToken(); - // } - unaryExpression(); - } - private void assignExpression() { - castExpression(); - if (token == TokenNameEQUAL) { // = - getNextToken(); - logicalinclusiveorExpression(); - } else if (token == TokenNameDOT_EQUAL) { // .= - getNextToken(); - logicalinclusiveorExpression(); - } else if (token == TokenNameEQUAL_GREATER) { // => - getNextToken(); - logicalinclusiveorExpression(); - } else if (token == TokenNamePLUS_EQUAL) { // += - getNextToken(); - logicalinclusiveorExpression(); - } else if (token == TokenNameMINUS_EQUAL) { // -= - getNextToken(); - logicalinclusiveorExpression(); - } else if (token == TokenNameMULTIPLY_EQUAL) { // *= - getNextToken(); - logicalinclusiveorExpression(); - } else if (token == TokenNameDIVIDE_EQUAL) { // *= + while (token == TokenNameDOLLAR) { getNextToken(); - logicalinclusiveorExpression(); - } else if (token == TokenNameREMAINDER_EQUAL) { // %= - getNextToken(); - logicalinclusiveorExpression(); - } else if (token == TokenNameAND_EQUAL) { // &= - getNextToken(); - logicalinclusiveorExpression(); - } else if (token == TokenNameOR_EQUAL) { // |= - getNextToken(); - logicalinclusiveorExpression(); - } else if (token == TokenNameXOR_EQUAL) { // ^= - getNextToken(); - logicalinclusiveorExpression(); - } else if (token == TokenNameLEFT_SHIFT_EQUAL) { // <<= - getNextToken(); - logicalinclusiveorExpression(); - } else if (token == TokenNameRIGHT_SHIFT_EQUAL) { // >>= - getNextToken(); - logicalinclusiveorExpression(); - } else if (token == TokenNameTWIDDLE_EQUAL) { // ~= - getNextToken(); - logicalinclusiveorExpression(); } - } - private void multiplicativeExpression() { - do { - assignExpression(); - if (token != TokenNameMULTIPLY && token != TokenNameDIVIDE - && token != TokenNameREMAINDER) { - return; - } + reference_variable(); + } + private void function_call() { + // function_call: + // T_STRING '(' function_call_parameter_list ')' + //| class_constant '(' function_call_parameter_list ')' + //| static_member '(' function_call_parameter_list ')' + //| variable_without_objects '(' function_call_parameter_list ')' + if (Scanner.TRACE) { + System.out.println("TRACE: function_call()"); + } + if (token == TokenNameIdentifier) { getNextToken(); - } while (true); - } - private void concatenationExpression() { - do { - multiplicativeExpression(); - if (token != TokenNameDOT) { - return; + switch (token) { + case TokenNamePAAMAYIM_NEKUDOTAYIM : + // static member: + getNextToken(); + if (token == TokenNameIdentifier) { + // class _constant + getNextToken(); + } else { + // static member: + variable_without_objects(); + } + break; } + } else { + variable_without_objects(); + } + if (token != TokenNameLPAREN) { + // TODO is this ok ? + return; + // throwSyntaxError("'(' expected in function call."); + } + getNextToken(); + if (token == TokenNameRPAREN) { getNextToken(); - } while (true); + return; + } + non_empty_function_call_parameter_list(); + if (token != TokenNameRPAREN) { + throwSyntaxError("')' expected in function call."); + } + getNextToken(); } - private void additiveExpression() { - do { - concatenationExpression(); - if (token != TokenNamePLUS && token != TokenNameMINUS) { - return; + // private void function_call_parameter_list() { + // function_call_parameter_list: + // non_empty_function_call_parameter_list { $$ = $1; } + // | /* empty */ + // } + private void non_empty_function_call_parameter_list() { + //non_empty_function_call_parameter_list: + // expr_without_variable + // | variable + // | '&' w_variable + // | non_empty_function_call_parameter_list ',' expr_without_variable + // | non_empty_function_call_parameter_list ',' variable + // | non_empty_function_call_parameter_list ',' '&' w_variable + if (Scanner.TRACE) { + System.out.println("TRACE: non_empty_function_call_parameter_list()"); + } + while (true) { + if (token == TokenNameAND) { + getNextToken(); + w_variable(); + } else { +// if (token == TokenNameIdentifier || token == TokenNameVariable +// || token == TokenNameDOLLAR) { +// variable(); +// } else { + expr_without_variable(true); +// } } - getNextToken(); - } while (true); - } - private void shiftExpression() { - do { - additiveExpression(); - if (token != TokenNameLEFT_SHIFT && token != TokenNameRIGHT_SHIFT) { - return; + if (token != TokenNameCOMMA) { + break; } getNextToken(); - } while (true); + } } - private void relationalExpression() { - do { - shiftExpression(); - if (token != TokenNameLESS && token != TokenNameGREATER - && token != TokenNameLESS_EQUAL && token != TokenNameGREATER_EQUAL) { - return; - } + private void fully_qualified_class_name() { + if (token == TokenNameIdentifier) { getNextToken(); - } while (true); + } else { + throwSyntaxError("Class name expected."); + } } - private void identicalExpression() { - do { - relationalExpression(); - if (token != TokenNameEQUAL_EQUAL_EQUAL - && token != TokenNameNOT_EQUAL_EQUAL) { - return; - } + private void static_member() { + // static_member: + // fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM + // variable_without_objects + if (Scanner.TRACE) { + System.out.println("TRACE: static_member()"); + } + fully_qualified_class_name(); + if (token != TokenNamePAAMAYIM_NEKUDOTAYIM) { + throwSyntaxError("'::' expected after class name (static_member)."); + } + getNextToken(); + variable_without_objects(); + } + private void base_variable_with_function_calls() { + // base_variable_with_function_calls: + // base_variable + //| function_call + boolean functionCall = false; + if (Scanner.TRACE) { + System.out.println("TRACE: base_variable_with_function_calls()"); + } + if (token == TokenNameIdentifier) { + functionCall = true; + } else if (token == TokenNameVariable) { + int tempToken = token; + int tempPosition = scanner.currentPosition; getNextToken(); - } while (true); + if (token == TokenNameLPAREN) { + functionCall = true; + } + token = tempToken; + scanner.currentPosition = tempPosition; + scanner.phpMode = true; + } + if (functionCall) { + function_call(); + } else { + base_variable(); + } } - private void equalityExpression() { - do { - identicalExpression(); - if (token != TokenNameEQUAL_EQUAL && token != TokenNameNOT_EQUAL) { - return; + private void base_variable() { + // base_variable: + // reference_variable + // | simple_indirect_reference reference_variable + // | static_member + if (Scanner.TRACE) { + System.out.println("TRACE: base_variable()"); + } + if (token == TokenNameIdentifier) { + static_member(); + } else { + while (token == TokenNameDOLLAR) { + getNextToken(); } - getNextToken(); - } while (true); + reference_variable(); + } } - private void ternaryExpression() { - equalityExpression(); - if (token == TokenNameQUESTION) { - getNextToken(); - expr(); - if (token == TokenNameCOLON) { + // private void simple_indirect_reference() { + // // simple_indirect_reference: + // // '$' + // //| simple_indirect_reference '$' + // } + private void reference_variable() { + // reference_variable: + // reference_variable '[' dim_offset ']' + // | reference_variable '{' expr '}' + // | compound_variable + if (Scanner.TRACE) { + System.out.println("TRACE: reference_variable()"); + } + compound_variable(); + while (true) { + if (token == TokenNameLBRACE) { getNextToken(); expr(); + if (token != TokenNameRBRACE) { + throwSyntaxError("'}' expected in reference variable."); + } + getNextToken(); + } else if (token == TokenNameLBRACKET) { + getNextToken(); + if (token != TokenNameRBRACKET) { + expr(); + // dim_offset(); + if (token != TokenNameRBRACKET) { + throwSyntaxError("']' expected in reference variable."); + } + } + getNextToken(); } else { - throwSyntaxError("':' expected in ternary operator '? :'."); + break; } } } - private void andExpression() { - do { - ternaryExpression(); - if (token != TokenNameAND) { - return; - } - getNextToken(); - } while (true); - } - private void exclusiveorExpression() { - do { - andExpression(); - if (token != TokenNameXOR) { - return; - } - getNextToken(); - } while (true); - } - private void inclusiveorExpression() { - do { - exclusiveorExpression(); - if (token != TokenNameOR) { - return; - } - getNextToken(); - } while (true); - } - private void booleanandExpression() { - do { - inclusiveorExpression(); - if (token != TokenNameAND_AND) { - return; - } - getNextToken(); - } while (true); - } - private void booleanorExpression() { - do { - booleanandExpression(); - if (token != TokenNameOR_OR) { - return; - } + private void compound_variable() { + // compound_variable: + // T_VARIABLE + // | '$' '{' expr '}' + if (Scanner.TRACE) { + System.out.println("TRACE: compound_variable()"); + } + if (token == TokenNameVariable) { getNextToken(); - } while (true); - } - private void logicalandExpression() { - do { - booleanorExpression(); - if (token != TokenNameAND) { - return; + } else { + // because of simple_indirect_reference + while (token == TokenNameDOLLAR) { + getNextToken(); } - getNextToken(); - } while (true); - } - private void logicalexclusiveorExpression() { - do { - logicalandExpression(); - if (token != TokenNameXOR) { - return; + if (token != TokenNameLBRACE) { + throwSyntaxError("'{' expected after compound variable token '$'."); } getNextToken(); - } while (true); - } - private void logicalinclusiveorExpression() { - do { - logicalexclusiveorExpression(); - if (token != TokenNameOR) { - return; + expr(); + if (token != TokenNameRBRACE) { + throwSyntaxError("'}' expected after compound variable token '$'."); } getNextToken(); - } while (true); + } } - // public void assignmentExpression() { - // if (token == TokenNameVARIABLE) { - // getNextToken(); - // if (token == TokenNameSET) { - // getNextToken(); - // logicalinclusiveorExpression(); - // } - // } else { - // logicalinclusiveorExpression(); - // } + // private void dim_offset() { + // // dim_offset: + // // /* empty */ + // // | expr + // expr(); // } - private void variableList() { - do { - variable(); - if (token == TokenNameCOMMA) { + private void object_property() { + // object_property: + // object_dim_list + //| variable_without_objects + if (Scanner.TRACE) { + System.out.println("TRACE: object_property()"); + } + if (token == TokenNameVariable || token == TokenNameDOLLAR) { + variable_without_objects(); + } else { + object_dim_list(); + } + } + private void object_dim_list() { + //object_dim_list: + // object_dim_list '[' dim_offset ']' + //| object_dim_list '{' expr '}' + //| variable_name + if (Scanner.TRACE) { + System.out.println("TRACE: object_dim_list()"); + } + variable_name(); + while (true) { + if (token == TokenNameLBRACE) { + getNextToken(); + expr(); + if (token != TokenNameRBRACE) { + throwSyntaxError("'}' expected in object_dim_list."); + } + getNextToken(); + } else if (token == TokenNameLBRACKET) { + getNextToken(); + if (token == TokenNameRBRACKET) { + getNextToken(); + continue; + } + expr(); + if (token != TokenNameRBRACKET) { + throwSyntaxError("']' expected in object_dim_list."); + } getNextToken(); } else { break; } - } while (true); + } } - private void variable() { - if (token == TokenNameDOLLAR_LBRACE) { + private void variable_name() { + //variable_name: + // T_STRING + //| '{' expr '}' + if (Scanner.TRACE) { + System.out.println("TRACE: variable_name()"); + } + if (token == TokenNameIdentifier) { + getNextToken(); + } else { + if (token != TokenNameLBRACE) { + throwSyntaxError("'{' expected in variable name."); + } getNextToken(); expr(); - ; if (token != TokenNameRBRACE) { - throwSyntaxError("'}' expected after indirect variable token '${'."); + throwSyntaxError("'}' expected in variable name."); } + } + } + private void r_variable() { + variable(); + } + private void w_variable() { + variable(); + } + private void rw_variable() { + variable(); + } + private void variable() { + // variable: + // base_variable_with_function_calls T_OBJECT_OPERATOR + // object_property method_or_not variable_properties + // | base_variable_with_function_calls + base_variable_with_function_calls(); + if (token == TokenNameMINUS_GREATER) { + getNextToken(); + object_property(); + method_or_not(); + variable_properties(); + } + // if (token == TokenNameDOLLAR_LBRACE) { + // getNextToken(); + // expr(); + // ; + // if (token != TokenNameRBRACE) { + // throwSyntaxError("'}' expected after indirect variable token '${'."); + // } + // getNextToken(); + // } else { + // if (token == TokenNameVariable) { + // getNextToken(); + // if (token == TokenNameLBRACKET) { + // getNextToken(); + // expr(); + // if (token != TokenNameRBRACKET) { + // throwSyntaxError("']' expected in variable-list."); + // } + // getNextToken(); + // } else if (token == TokenNameEQUAL) { + // getNextToken(); + // static_scalar(); + // } + // } else { + // throwSyntaxError("$-variable expected in variable-list."); + // } + // } + } + private void variable_properties() { + // variable_properties: + // variable_properties variable_property + // | /* empty */ + while (token == TokenNameMINUS_GREATER) { + variable_property(); + } + } + private void variable_property() { + // variable_property: + // T_OBJECT_OPERATOR object_property method_or_not + if (Scanner.TRACE) { + System.out.println("TRACE: variable_property()"); + } + if (token == TokenNameMINUS_GREATER) { getNextToken(); + object_property(); + method_or_not(); } else { - if (token == TokenNameVariable) { + throwSyntaxError("'->' expected in variable_property."); + } + } + private void method_or_not() { + // method_or_not: + // '(' function_call_parameter_list ')' + // | /* empty */ + if (Scanner.TRACE) { + System.out.println("TRACE: method_or_not()"); + } + if (token == TokenNameLPAREN) { + getNextToken(); + if (token == TokenNameRPAREN) { getNextToken(); - if (token == TokenNameLBRACKET) { - getNextToken(); - expr(); - if (token != TokenNameRBRACKET) { - throwSyntaxError("']' expected in variable-list."); - } - getNextToken(); - } else if (token == TokenNameEQUAL) { - getNextToken(); - static_scalar(); - } - } else { - throwSyntaxError("$-variable expected in variable-list."); + return; + } + non_empty_function_call_parameter_list(); + if (token != TokenNameRPAREN) { + throwSyntaxError("')' expected in method_or_not."); } + getNextToken(); } } private void exit_expr() { @@ -2878,6 +3144,17 @@ public class Parser //extends PHPParserSuperclass } return false; } + private void scalar() { + // scalar: + // T_STRING + //| T_STRING_VARNAME + //| class_constant + //| common_scalar + //| '"' encaps_list '"' + //| '\'' encaps_list '\'' + //| T_START_HEREDOC encaps_list T_END_HEREDOC + throwSyntaxError("Not yet implemented (scalar)."); + } private void static_scalar() { // static_scalar: /* compile-time evaluated scalars */ // common_scalar diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java index bef873a..041fd95 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java @@ -131,6 +131,7 @@ public class Scanner implements IScanner, ITerminalSymbols { public char[][] taskTags = null; public char[][] taskPriorities = null; public static final boolean DEBUG = false; + public static final boolean TRACE = false; public Scanner() { this(false, false); } @@ -675,6 +676,133 @@ public class Scanner implements IScanner, ITerminalSymbols { return false; } } + public int getCastOrParen() { + int tempPosition = currentPosition; + char tempCharacter = currentCharacter; + int tempToken = TokenNameLPAREN; + boolean found = false; + StringBuffer buf = new StringBuffer(); + try { + do { + currentCharacter = source[currentPosition++]; + } while (currentCharacter == ' ' || currentCharacter == '\t'); + while ((currentCharacter >= 'a' && currentCharacter <= 'z') + || (currentCharacter >= 'A' && currentCharacter <= 'Z')) { + buf.append(currentCharacter); + currentCharacter = source[currentPosition++]; + } + if (buf.length() >= 3 && buf.length() <= 7) { + char[] data = buf.toString().toCharArray(); + int index = 0; + switch (data.length) { + case 3 : + // int + if ((data[index] == 'i') && (data[++index] == 'n') + && (data[++index] == 't')) { + found = true; + tempToken = TokenNameintCAST; + } + break; + case 4 : + // bool real + if ((data[index] == 'b') && (data[++index] == 'o') + && (data[++index] == 'o') && (data[++index] == 'l')) { + found = true; + tempToken = TokenNameboolCAST; + } else { + index = 0; + if ((data[index] == 'r') && (data[++index] == 'e') + && (data[++index] == 'a') && (data[++index] == 'l')) { + found = true; + tempToken = TokenNamedoubleCAST; + } + } + break; + case 5 : + // array unset float + if ((data[index] == 'a') && (data[++index] == 'r') + && (data[++index] == 'r') && (data[++index] == 'a') + && (data[++index] == 'y')) { + found = true; + tempToken = TokenNamearrayCAST; + } else { + index = 0; + if ((data[index] == 'u') && (data[++index] == 'n') + && (data[++index] == 's') && (data[++index] == 'e') + && (data[++index] == 't')) { + found = true; + tempToken = TokenNameunsetCAST; + } else { + index = 0; + if ((data[index] == 'f') && (data[++index] == 'l') + && (data[++index] == 'o') && (data[++index] == 'a') + && (data[++index] == 't')) { + found = true; + tempToken = TokenNamedoubleCAST; + } + } + } + break; + case 6 : + // object string double + if ((data[index] == 'o') && (data[++index] == 'b') + && (data[++index] == 'j') && (data[++index] == 'e') + && (data[++index] == 'c') && (data[++index] == 't')) { + found = true; + tempToken = TokenNameobjectCAST; + } else { + index = 0; + if ((data[index] == 's') && (data[++index] == 't') + && (data[++index] == 'r') && (data[++index] == 'i') + && (data[++index] == 'n') && (data[++index] == 'g')) { + found = true; + tempToken = TokenNamestringCAST; + } else { + index = 0; + if ((data[index] == 'd') && (data[++index] == 'o') + && (data[++index] == 'u') && (data[++index] == 'b') + && (data[++index] == 'l') && (data[++index] == 'e')) { + found = true; + tempToken = TokenNamedoubleCAST; + } + } + } + break; + case 7 : + // boolean integer + if ((data[index] == 'b') && (data[++index] == 'o') + && (data[++index] == 'o') && (data[++index] == 'l') + && (data[++index] == 'e') && (data[++index] == 'a') + && (data[++index] == 'n')) { + found = true; + tempToken = TokenNameboolCAST; + } else { + index = 0; + if ((data[index] == 'i') && (data[++index] == 'n') + && (data[++index] == 't') && (data[++index] == 'e') + && (data[++index] == 'g') && (data[++index] == 'e') + && (data[++index] == 'r')) { + found = true; + tempToken = TokenNameintCAST; + } + } + break; + } + if (found) { + while (currentCharacter == ' ' || currentCharacter == '\t') { + currentCharacter = source[currentPosition++]; + } + if (currentCharacter == ')') { + return tempToken; + } + } + } + } catch (IndexOutOfBoundsException e) { + } + currentCharacter = tempCharacter; + currentPosition = tempPosition; + return TokenNameLPAREN; + } public int getNextToken() throws InvalidInputException { int htmlPosition = currentPosition; try { @@ -781,7 +909,7 @@ public class Scanner implements IScanner, ITerminalSymbols { // ---------Identify the next token------------- switch (currentCharacter) { case '(' : - return TokenNameLPAREN; + return getCastOrParen(); case ')' : return TokenNameRPAREN; case '{' : @@ -797,6 +925,8 @@ public class Scanner implements IScanner, ITerminalSymbols { case ',' : return TokenNameCOMMA; case '.' : + if (getNextChar('=')) + return TokenNameDOT_EQUAL; if (getNextCharAsDigit()) return scanNumber(true); return TokenNameDOT; @@ -842,56 +972,66 @@ public class Scanner implements IScanner, ITerminalSymbols { return TokenNameREMAINDER; case '<' : { - int test; - if ((test = getNextChar('=', '<')) == 0) - return TokenNameLESS_EQUAL; - if (test > 0) { - if (getNextChar('=')) - return TokenNameLEFT_SHIFT_EQUAL; - if (getNextChar('<')) { - int heredocStart = currentPosition; - int heredocLength = 0; - currentCharacter = source[currentPosition++]; - if (isPHPIdentifierStart(currentCharacter)) { - currentCharacter = source[currentPosition++]; - } else { - return TokenNameERROR; - } - while (isPHPIdentifierPart(currentCharacter)) { + int oldPosition = currentPosition; + try { + currentCharacter = source[currentPosition++]; + } catch (IndexOutOfBoundsException e) { + currentPosition = oldPosition; + return TokenNameLESS; + } + switch (currentCharacter) { + case '=' : + return TokenNameLESS_EQUAL; + case '>' : + return TokenNameNOT_EQUAL; + case '<' : + if (getNextChar('=')) + return TokenNameLEFT_SHIFT_EQUAL; + if (getNextChar('<')) { + int heredocStart = currentPosition; + int heredocLength = 0; currentCharacter = source[currentPosition++]; - } - heredocLength = currentPosition - heredocStart - 1; - // heredoc end-tag determination - boolean endTag = true; - char ch; - do { - ch = source[currentPosition++]; - if (ch == '\r' || ch == '\n') { - if (recordLineSeparator) { - pushLineSeparator(); - } else { - currentLine = null; - } - for (int i = 0; i < heredocLength; i++) { - if (source[currentPosition + i] != source[heredocStart - + i]) { - endTag = false; - break; + if (isPHPIdentifierStart(currentCharacter)) { + currentCharacter = source[currentPosition++]; + } else { + return TokenNameERROR; + } + while (isPHPIdentifierPart(currentCharacter)) { + currentCharacter = source[currentPosition++]; + } + heredocLength = currentPosition - heredocStart - 1; + // heredoc end-tag determination + boolean endTag = true; + char ch; + do { + ch = source[currentPosition++]; + if (ch == '\r' || ch == '\n') { + if (recordLineSeparator) { + pushLineSeparator(); + } else { + currentLine = null; + } + for (int i = 0; i < heredocLength; i++) { + if (source[currentPosition + i] != source[heredocStart + + i]) { + endTag = false; + break; + } + } + if (endTag) { + currentPosition += heredocLength - 1; + currentCharacter = source[currentPosition++]; + break; // do...while loop + } else { + endTag = true; } } - if (endTag) { - currentPosition += heredocLength - 1; - currentCharacter = source[currentPosition++]; - break; // do...while loop - } else { - endTag = true; - } - } - } while (true); - return TokenNameHEREDOC; - } - return TokenNameLEFT_SHIFT; + } while (true); + return TokenNameHEREDOC; + } + return TokenNameLEFT_SHIFT; } + currentPosition = oldPosition; return TokenNameLESS; } case '>' : @@ -1330,9 +1470,12 @@ public class Scanner implements IScanner, ITerminalSymbols { case '#' : case '/' : { + char startChar = currentCharacter; + if (getNextChar('=')) { + return TokenNameDIVIDE_EQUAL; + } int test; - if ((currentCharacter == '#') - || (test = getNextChar('/', '*')) == 0) { + if ((startChar == '#') || (test = getNextChar('/', '*')) == 0) { //line comment int endPositionForLineComment = 0; try { //get the next char @@ -1546,8 +1689,6 @@ public class Scanner implements IScanner, ITerminalSymbols { } break; } - if (getNextChar('=')) - return TokenNameDIVIDE_EQUAL; return TokenNameDIVIDE; } case '\u001a' : @@ -1558,13 +1699,20 @@ public class Scanner implements IScanner, ITerminalSymbols { throw new InvalidInputException("Ctrl-Z"); //$NON-NLS-1$ default : if (currentCharacter == '$') { - while ((currentCharacter = source[currentPosition++]) == '$') { + int oldPosition = currentPosition; + try { + currentCharacter = source[currentPosition++]; + + if (isPHPIdentifierStart(currentCharacter)) { + return scanIdentifierOrKeyword(true); + } else { + currentPosition = oldPosition; + return TokenNameDOLLAR; + } + } catch (IndexOutOfBoundsException e) { + currentPosition = oldPosition; + return TokenNameDOLLAR; } - if (currentCharacter == '{') - return TokenNameDOLLAR_LBRACE; - if (isPHPIdentifierStart(currentCharacter)) - return scanIdentifierOrKeyword(true); - return TokenNameERROR; } if (isPHPIdentifierStart(currentCharacter)) return scanIdentifierOrKeyword(false); @@ -2508,9 +2656,9 @@ public class Scanner implements IScanner, ITerminalSymbols { while (getNextCharAsJavaIdentifierPart()) { }; if (isVariable) { - if (new String(getCurrentTokenSource()).equals("$this")) { - return TokenNamethis; - } + // if (new String(getCurrentTokenSource()).equals("$this")) { + // return TokenNamethis; + // } return TokenNameVariable; } int index, length; @@ -2600,7 +2748,7 @@ public class Scanner implements IScanner, ITerminalSymbols { case 3 : //and if ((data[++index] == 'n') && (data[++index] == 'd')) { - return TokenNameAND; + return TokenNameand; } else { return TokenNameIdentifier; } @@ -2635,7 +2783,7 @@ public class Scanner implements IScanner, ITerminalSymbols { return TokenNameIdentifier; } case 'c' : - //case catch class const continue + //case catch class clone const continue switch (length) { case 4 : if ((data[++index] == 'a') && (data[++index] == 's') @@ -2647,10 +2795,16 @@ public class Scanner implements IScanner, ITerminalSymbols { if ((data[++index] == 'a') && (data[++index] == 't') && (data[++index] == 'c') && (data[++index] == 'h')) return TokenNamecatch; - if ((data[index] == 'l') && (data[++index] == 'a') + index = 0; + if ((data[++index] == 'l') && (data[++index] == 'a') && (data[++index] == 's') && (data[++index] == 's')) return TokenNameclass; - if ((data[index] == 'o') && (data[++index] == 'n') + index = 0; + if ((data[++index] == 'l') && (data[++index] == 'o') + && (data[++index] == 'n') && (data[++index] == 'e')) + return TokenNameclone; + index = 0; + if ((data[++index] == 'o') && (data[++index] == 'n') && (data[++index] == 's') && (data[++index] == 't')) return TokenNameconst; else @@ -2793,9 +2947,9 @@ public class Scanner implements IScanner, ITerminalSymbols { else return TokenNameIdentifier; case 5 : -// if ((data[++index] == 'a') && (data[++index] == 'l') -// && (data[++index] == 's') && (data[++index] == 'e')) -// return TokenNamefalse; + // if ((data[++index] == 'a') && (data[++index] == 'l') + // && (data[++index] == 's') && (data[++index] == 'e')) + // return TokenNamefalse; if ((data[++index] == 'i') && (data[++index] == 'n') && (data[++index] == 'a') && (data[++index] == 'l')) return TokenNamefinal; @@ -2912,12 +3066,12 @@ public class Scanner implements IScanner, ITerminalSymbols { return TokenNamenew; else return TokenNameIdentifier; -// case 4 : -// if ((data[++index] == 'u') && (data[++index] == 'l') -// && (data[++index] == 'l')) -// return TokenNamenull; -// else -// return TokenNameIdentifier; + // case 4 : + // if ((data[++index] == 'u') && (data[++index] == 'l') + // && (data[++index] == 'l')) + // return TokenNamenull; + // else + // return TokenNameIdentifier; default : return TokenNameIdentifier; } @@ -2925,7 +3079,7 @@ public class Scanner implements IScanner, ITerminalSymbols { // or old_function if (length == 2) { if (data[++index] == 'r') { - return TokenNameOR; + return TokenNameor; } } // if (length == 12) { @@ -3029,12 +3183,12 @@ public class Scanner implements IScanner, ITerminalSymbols { return TokenNametry; else return TokenNameIdentifier; -// case 4 : -// if ((data[++index] == 'r') && (data[++index] == 'u') -// && (data[++index] == 'e')) -// return TokenNametrue; -// else -// return TokenNameIdentifier; + // case 4 : + // if ((data[++index] == 'r') && (data[++index] == 'u') + // && (data[++index] == 'e')) + // return TokenNametrue; + // else + // return TokenNameIdentifier; case 5 : if ((data[++index] == 'h') && (data[++index] == 'r') && (data[++index] == 'o') && (data[++index] == 'w')) @@ -3095,7 +3249,7 @@ public class Scanner implements IScanner, ITerminalSymbols { switch (length) { case 3 : if ((data[++index] == 'o') && (data[++index] == 'r')) - return TokenNameXOR; + return TokenNamexor; else return TokenNameIdentifier; default : @@ -3325,6 +3479,8 @@ public class Scanner implements IScanner, ITerminalSymbols { return "Variable(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ case TokenNameabstract : return "abstract"; //$NON-NLS-1$ + case TokenNameand : + return "AND"; //$NON-NLS-1$ case TokenNamearray : return "array"; //$NON-NLS-1$ case TokenNameas : @@ -3335,6 +3491,12 @@ public class Scanner implements IScanner, ITerminalSymbols { return "case"; //$NON-NLS-1$ case TokenNameclass : return "class"; //$NON-NLS-1$ + case TokenNameclone : + //$NON-NLS-1$ + return "clone"; + case TokenNameconst : + //$NON-NLS-1$ + return "const"; case TokenNamecontinue : return "continue"; //$NON-NLS-1$ case TokenNamedefault : @@ -3361,8 +3523,8 @@ public class Scanner implements IScanner, ITerminalSymbols { return "endwhile"; //$NON-NLS-1$ case TokenNameextends : return "extends"; //$NON-NLS-1$ -// case TokenNamefalse : -// return "false"; //$NON-NLS-1$ + // case TokenNamefalse : + // return "false"; //$NON-NLS-1$ case TokenNamefinal : return "final"; //$NON-NLS-1$ case TokenNamefor : @@ -3383,12 +3545,16 @@ public class Scanner implements IScanner, ITerminalSymbols { return "include_once"; //$NON-NLS-1$ case TokenNameinterface : return "interface"; //$NON-NLS-1$ + case TokenNameisset : + return "isset"; //$NON-NLS-1$ case TokenNamelist : return "list"; //$NON-NLS-1$ case TokenNamenew : return "new"; //$NON-NLS-1$ -// case TokenNamenull : -// return "null"; //$NON-NLS-1$ + // case TokenNamenull : + // return "null"; //$NON-NLS-1$ + case TokenNameor : + return "OR"; //$NON-NLS-1$ case TokenNameprint : return "print"; //$NON-NLS-1$ case TokenNameprivate : @@ -3407,16 +3573,18 @@ public class Scanner implements IScanner, ITerminalSymbols { return "static"; //$NON-NLS-1$ case TokenNameswitch : return "switch"; //$NON-NLS-1$ -// case TokenNametrue : -// return "true"; //$NON-NLS-1$ + // case TokenNametrue : + // return "true"; //$NON-NLS-1$ case TokenNameunset : return "unset"; //$NON-NLS-1$ case TokenNamevar : return "var"; //$NON-NLS-1$ case TokenNamewhile : return "while"; //$NON-NLS-1$ - case TokenNamethis : - return "$this"; //$NON-NLS-1$ + case TokenNamexor : + return "XOR"; //$NON-NLS-1$ + // case TokenNamethis : + // return "$this"; //$NON-NLS-1$ case TokenNameIntegerLiteral : return "Integer(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ case TokenNameDoubleLiteral : @@ -3468,6 +3636,8 @@ public class Scanner implements IScanner, ITerminalSymbols { return "^="; //$NON-NLS-1$ case TokenNameREMAINDER_EQUAL : return "%="; //$NON-NLS-1$ + case TokenNameDOT_EQUAL : + return ".="; //$NON-NLS-1$ case TokenNameLEFT_SHIFT_EQUAL : return "<<="; //$NON-NLS-1$ case TokenNameRIGHT_SHIFT_EQUAL : @@ -3530,8 +3700,10 @@ public class Scanner implements IScanner, ITerminalSymbols { return "="; //$NON-NLS-1$ case TokenNameAT : return "@"; - case TokenNameDOLLAR_LBRACE : - return "${"; + case TokenNameDOLLAR : + return "$"; + // case TokenNameDOLLAR_LBRACE : + // return "${"; case TokenNameEOF : return "EOF"; //$NON-NLS-1$ case TokenNameWHITESPACE : @@ -3553,7 +3725,17 @@ public class Scanner implements IScanner, ITerminalSymbols { case TokenNameMETHOD_C : return "__METHOD__"; //$NON-NLS-1$ case TokenNameFUNC_C : - return "__FUNCTION__"; //$NON-NLS-1$ + return "__FUNCTION__"; //$NON-NLS-1 + case TokenNameboolCAST : + return "( bool )"; //$NON-NLS-1$ + case TokenNameintCAST : + return "( int )"; //$NON-NLS-1$ + case TokenNamedoubleCAST : + return "( double )"; //$NON-NLS-1$ + case TokenNameobjectCAST : + return "( object )"; //$NON-NLS-1$ + case TokenNamestringCAST : + return "( string )"; //$NON-NLS-1$ default : return "not-a-token(" + (new Integer(act)) + ") " + new String(getCurrentTokenSource()); //$NON-NLS-1$ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java index 7e1acce..3b07fa2 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/problem/ProblemReporter.java @@ -2697,7 +2697,7 @@ public class ProblemReporter extends ProblemHandler implements ProblemReasons { // case Scanner.TokenNamestrictfp: // case Scanner.TokenNamesynchronized: case Scanner.TokenNametry : - case Scanner.TokenNamethis : +// case Scanner.TokenNamethis : // case Scanner.TokenNametrue : case Scanner.TokenNamethrow : // case Scanner.TokenNamethrows: diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java index ecfed39..e48c07c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java @@ -9,14 +9,12 @@ * IBM Corporation - initial API and implementation ******************************************************************************/ package net.sourceforge.phpdt.internal.formatter; - import java.io.BufferedReader; import java.io.IOException; import java.io.StringReader; import java.util.Hashtable; import java.util.Locale; import java.util.Map; - import net.sourceforge.phpdt.core.ICodeFormatter; import net.sourceforge.phpdt.core.compiler.CharOperation; import net.sourceforge.phpdt.core.compiler.ITerminalSymbols; @@ -25,104 +23,85 @@ import net.sourceforge.phpdt.internal.compiler.ConfigurableOption; import net.sourceforge.phpdt.internal.compiler.parser.Scanner; import net.sourceforge.phpdt.internal.formatter.impl.FormatterOptions; import net.sourceforge.phpdt.internal.formatter.impl.SplitLine; - -/**

How to format a piece of code ?

- *
  • Create an instance of CodeFormatter - *
  • Use the method void format(aString) - * on this instance to format aString. - * It will return the formatted string.
-*/ +/** + *

How to format a piece of code ?

+ *
    + *
  • Create an instance of CodeFormatter + *
  • Use the method void format(aString) on this instance to + * format aString. It will return the formatted string. + *
+ */ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { - public FormatterOptions options; - - /** + /** * Represents a block in the constructions stack. */ public static final int BLOCK = ITerminalSymbols.TokenNameLBRACE; - - /** - * Represents a block following a control statement in the constructions stack. + /** + * Represents a block following a control statement in the constructions + * stack. */ public static final int NONINDENT_BLOCK = -100; - - /** + /** * Contains the formatted output. */ StringBuffer formattedSource; - - /** - * Contains the current line.
+ /** + * Contains the current line.
* Will be dumped at the next "newline" */ StringBuffer currentLineBuffer; - - /** + /** * Used during the formatting to get each token. */ Scanner scanner; - - /** - * Contains the tokens responsible for the current indentation level - * and the blocks not closed yet. + /** + * Contains the tokens responsible for the current indentation level and the + * blocks not closed yet. */ private int[] constructions; - - /** + /** * Index in the constructions array. */ private int constructionsCount; - - /** - * Level of indentation of the current token (number of tab char put in front of it). + /** + * Level of indentation of the current token (number of tab char put in front + * of it). */ private int indentationLevel; - - /** + /** * Regular level of indentation of all the lines */ private int initialIndentationLevel; - - /** + /** * Used to split a line. */ Scanner splitScanner; - - /** - * To remember the offset between the beginning of the line and the - * beginning of the comment. + /** + * To remember the offset between the beginning of the line and the beginning + * of the comment. */ int currentCommentOffset; int currentLineIndentationLevel; int maxLineSize = 30; private boolean containsOpenCloseBraces; private int indentationLevelForOpenCloseBraces; - /** * Collections of positions to map */ private int[] positionsToMap; - /** * Collections of mapped positions */ private int[] mappedPositions; - private int indexToMap; - private int indexInMap; - private int globalDelta; - private int lineDelta; - private int splitDelta; - private int beginningOfLineIndex; - private int multipleLineCommentCounter; - - /** + /** * Creates a new instance of Code Formatter using the given settings. * * @deprecated backport 1.0 internal functionality @@ -130,47 +109,42 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { public CodeFormatter(ConfigurableOption[] settings) { this(convertConfigurableOptions(settings)); } - - /** - * Creates a new instance of Code Formatter using the FormattingOptions object - * given as argument + /** + * Creates a new instance of Code Formatter using the FormattingOptions + * object given as argument + * * @deprecated Use CodeFormatter(ConfigurableOption[]) instead */ public CodeFormatter() { this((Map) null); } - /** + /** * Creates a new instance of Code Formatter using the given settings. */ public CodeFormatter(Map settings) { - // initialize internal state constructionsCount = 0; constructions = new int[10]; currentLineIndentationLevel = indentationLevel = initialIndentationLevel; currentCommentOffset = -1; - // initialize primary and secondary scanners - scanner = new Scanner(true /*comment*/ - , true /*whitespace*/ - , false /*nls*/ - , false /*assert*/ + scanner = new Scanner(true /* comment */ + , true /* whitespace */ + , false /* nls */ + , false /* assert */ ); // regular scanner for forming lines scanner.recordLineSeparator = true; - // to remind of the position of the beginning of the line. - splitScanner = new Scanner(true /*comment*/ - , true /*whitespace*/ - , false /*nls*/ - , false /*assert*/ + splitScanner = new Scanner(true /* comment */ + , true /* whitespace */ + , false /* nls */ + , false /* assert */ ); // secondary scanner to split long lines formed by primary scanning - // initialize current line buffer currentLineBuffer = new StringBuffer(); this.options = new FormatterOptions(settings); } - /** * Returns true if a lineSeparator has to be inserted before operator * false otherwise. @@ -185,52 +159,51 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { return true; } } - - /** - * @deprecated backport 1.0 internal functionality - */ + /** + * @deprecated backport 1.0 internal functionality + */ private static Map convertConfigurableOptions(ConfigurableOption[] settings) { Hashtable options = new Hashtable(10); - for (int i = 0; i < settings.length; i++) { if (settings[i].getComponentName().equals(CodeFormatter.class.getName())) { String optionName = settings[i].getOptionName(); int valueIndex = settings[i].getCurrentValueIndex(); - if (optionName.equals("newline.openingBrace")) { //$NON-NLS-1$ - options.put("net.sourceforge.phpdt.core.formatter.newline.openingBrace", valueIndex == 0 ? "insert" : "do not insert"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + options.put( + "net.sourceforge.phpdt.core.formatter.newline.openingBrace", + valueIndex == 0 ? "insert" : "do not insert"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } else if (optionName.equals("newline.controlStatement")) { //$NON-NLS-1$ - options.put("net.sourceforge.phpdt.core.formatter.newline.controlStatement", valueIndex == 0 ? "insert" : "do not insert"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + options.put( + "net.sourceforge.phpdt.core.formatter.newline.controlStatement", + valueIndex == 0 ? "insert" : "do not insert"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } else if (optionName.equals("newline.clearAll")) { //$NON-NLS-1$ - options.put("net.sourceforge.phpdt.core.formatter.newline.clearAll", valueIndex == 0 ? "clear all" : "preserve one"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + options.put("net.sourceforge.phpdt.core.formatter.newline.clearAll", + valueIndex == 0 ? "clear all" : "preserve one"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } else if (optionName.equals("newline.elseIf")) { //$NON-NLS-1$ - options.put("net.sourceforge.phpdt.core.formatter.newline.elseIf", valueIndex == 0 ? "do not insert" : "insert"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + options.put("net.sourceforge.phpdt.core.formatter.newline.elseIf", + valueIndex == 0 ? "do not insert" : "insert"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } else if (optionName.equals("newline.emptyBlock")) { //$NON-NLS-1$ - options.put("net.sourceforge.phpdt.core.formatter.newline.emptyBlock", valueIndex == 0 ? "insert" : "do not insert"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + options.put( + "net.sourceforge.phpdt.core.formatter.newline.emptyBlock", + valueIndex == 0 ? "insert" : "do not insert"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } else if (optionName.equals("lineSplit")) { //$NON-NLS-1$ - options.put("net.sourceforge.phpdt.core.formatter.lineSplit", String.valueOf(valueIndex)); //$NON-NLS-1$ //$NON-NLS-2$ - + options.put("net.sourceforge.phpdt.core.formatter.lineSplit", String + .valueOf(valueIndex)); //$NON-NLS-1$ //$NON-NLS-2$ } else if (optionName.equals("style.assignment")) { //$NON-NLS-1$ - options.put("net.sourceforge.phpdt.core.formatter.style.assignment", valueIndex == 0 ? "compact" : "normal"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + options.put("net.sourceforge.phpdt.core.formatter.style.assignment", + valueIndex == 0 ? "compact" : "normal"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } else if (optionName.equals("tabulation.char")) { //$NON-NLS-1$ - options.put("net.sourceforge.phpdt.core.formatter.tabulation.char", valueIndex == 0 ? "tab" : "space"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + options.put("net.sourceforge.phpdt.core.formatter.tabulation.char", + valueIndex == 0 ? "tab" : "space"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } else if (optionName.equals("tabulation.size")) { //$NON-NLS-1$ - options.put("net.sourceforge.phpdt.core.formatter.tabulation.size", String.valueOf(valueIndex)); //$NON-NLS-1$ //$NON-NLS-2$ + options.put("net.sourceforge.phpdt.core.formatter.tabulation.size", + String.valueOf(valueIndex)); //$NON-NLS-1$ //$NON-NLS-2$ } } } - return options; } - - /** + /** * Returns the end of the source code. */ private final String copyRemainingSource() { @@ -243,9 +216,9 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } return (bufr.toString()); } - /** - * Inserts tabCount tab character or their equivalent number of spaces. + * Inserts tabCount tab character or their equivalent number + * of spaces. */ private void dumpTab(int tabCount) { if (options.indentWithTab) { @@ -260,7 +233,6 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } } } - /** * Dumps currentLineBuffer into the formatted string. */ @@ -270,14 +242,17 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { beginningOfLineIndex = formattedSource.length(); if (containsOpenCloseBraces) { containsOpenCloseBraces = false; - outputLine(currentString, false, indentationLevelForOpenCloseBraces, 0, -1, null, 0); + outputLine(currentString, false, indentationLevelForOpenCloseBraces, 0, + -1, null, 0); indentationLevelForOpenCloseBraces = currentLineIndentationLevel; } else { - outputLine(currentString, false, currentLineIndentationLevel, 0, -1, null, 0); + outputLine(currentString, false, currentLineIndentationLevel, 0, -1, + null, 0); } int scannerSourceLength = scanner.source.length; if (scannerSourceLength > 2) { - if (scanner.source[scannerSourceLength - 1] == '\n' && scanner.source[scannerSourceLength - 2] == '\r') { + if (scanner.source[scannerSourceLength - 1] == '\n' + && scanner.source[scannerSourceLength - 2] == '\r') { formattedSource.append(options.lineSeparatorSequence); increaseGlobalDelta(options.lineSeparatorSequence.length - 2); } else if (scanner.source[scannerSourceLength - 1] == '\n') { @@ -290,8 +265,7 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } updateMappedPositions(scanner.startPosition); } - - /** + /** * Formats the input string. */ private void format() { @@ -300,7 +274,6 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { int previousCompilableToken = 0; int indentationOffset = 0; int newLinesInWhitespace = 0; - // number of new lines in the previous whitespace token // (used to leave blank lines before comments) int pendingNewLines = 0; @@ -315,36 +288,32 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { boolean inThrowsClause = false; boolean inClassOrInterfaceHeader = false; int dollarBraceCount = 0; - - // openBracketCount is used to count the number of open brackets not closed yet. + // openBracketCount is used to count the number of open brackets not closed + // yet. int openBracketCount = 0; int unarySignModifier = 0; - - // openParenthesis[0] is used to count the parenthesis not belonging to a condition + // openParenthesis[0] is used to count the parenthesis not belonging to a + // condition // (eg foo();). parenthesis in for (...) are count elsewhere in the array. int openParenthesisCount = 1; int[] openParenthesis = new int[10]; - - // tokenBeforeColon is used to know what token goes along with the current : + // tokenBeforeColon is used to know what token goes along with the current + // : // it can be case or ? int tokenBeforeColonCount = 0; int[] tokenBeforeColon = new int[10]; - constructionsCount = 0; // initializes the constructions count. - // contains DO if in a DO..WHILE statement, UNITIALIZED otherwise. int nlicsToken = 0; - - // fix for 1FF17XY: LFCOM:ALL - Format problem on not matching } and else + // fix for 1FF17XY: LFCOM:ALL - Format problem on not matching } and else boolean specialElse = false; - // OPTION (IndentationLevel): initial indentation level may be non-zero. currentLineIndentationLevel += constructionsCount; - - // An InvalidInputException exception might cause the termination of this loop. + // An InvalidInputException exception might cause the termination of this + // loop. try { while (true) { - // Get the next token. Catch invalid input and output it + // Get the next token. Catch invalid input and output it // with minimal formatting, also catch end of input and // exit the loop. try { @@ -352,11 +321,10 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { if (Scanner.DEBUG) { int currentEndPosition = scanner.getCurrentTokenEndPosition(); int currentStartPosition = scanner.getCurrentTokenStartPosition(); - - System.out.print(currentStartPosition + "," + currentEndPosition + ": "); + System.out.print(currentStartPosition + "," + currentEndPosition + + ": "); System.out.println(scanner.toStringAction(token)); } - // Patch for line comment // See PR http://dev.eclipse.org/bugs/show_bug.cgi?id=23096 if (token == ITerminalSymbols.TokenNameCOMMENT_LINE) { @@ -380,28 +348,30 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } if (token == Scanner.TokenNameEOF) break; - - /* ## MODIFYING the indentation level before generating new lines - and indentation in the output string - */ - - // Removes all the indentations made by statements not followed by a block - // except if the current token is ELSE, CATCH or if we are in a switch/case + /* + * ## MODIFYING the indentation level before generating new lines and + * indentation in the output string + */ + // Removes all the indentations made by statements not followed by a + // block + // except if the current token is ELSE, CATCH or if we are in a + // switch/case if (clearNonBlockIndents && (token != Scanner.TokenNameWHITESPACE)) { switch (token) { case TokenNameelse : - if (constructionsCount > 0 && constructions[constructionsCount - 1] == TokenNameelse) { + if (constructionsCount > 0 + && constructions[constructionsCount - 1] == TokenNameelse) { pendingNewLines = 1; specialElse = true; } indentationLevel += popInclusiveUntil(TokenNameif); break; - // case TokenNamecatch : - // indentationLevel += popInclusiveUntil(TokenNamecatch); - // break; - // case TokenNamefinally : - // indentationLevel += popInclusiveUntil(TokenNamecatch); - // break; + // case TokenNamecatch : + // indentationLevel += popInclusiveUntil(TokenNamecatch); + // break; + // case TokenNamefinally : + // indentationLevel += popInclusiveUntil(TokenNamecatch); + // break; case TokenNamewhile : if (nlicsToken == TokenNamedo) { indentationLevel += pop(TokenNamedo); @@ -409,9 +379,9 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } default : indentationLevel += popExclusiveUntilBlockOrCase(); - // clear until a CASE, DEFAULT or BLOCK is encountered. - // Thus, the indentationLevel is correctly cleared either - // in a switch/case statement or in any other situation. + // clear until a CASE, DEFAULT or BLOCK is encountered. + // Thus, the indentationLevel is correctly cleared either + // in a switch/case statement or in any other situation. } clearNonBlockIndents = false; } @@ -423,15 +393,16 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { // if (token == Scanner.TokenNamethrows) { // inThrowsClause = true; // } - if ((token == Scanner.TokenNameclass // || token == Scanner.TokenNameinterface - ) - && previousToken != Scanner.TokenNameDOT) { + if ((token == Scanner.TokenNameclass // || token == + // Scanner.TokenNameinterface + ) && previousToken != Scanner.TokenNameDOT) { inClassOrInterfaceHeader = true; } - - /* ## APPEND newlines and indentations to the output string - */ - // Do not add a new line between ELSE and IF, if the option elseIfOnSameLine is true. + /* + * ## APPEND newlines and indentations to the output string + */ + // Do not add a new line between ELSE and IF, if the option + // elseIfOnSameLine is true. // Fix for 1ETLWPZ: IVJCOM:ALL - incorrect "else if" formatting // if (pendingNewlineAfterParen // && previousCompilableToken == TokenNameelse @@ -447,30 +418,32 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { // Add a newline & indent to the formatted source string if // a for/if-else/while statement was scanned and there is no block // following it. - pendingNewlineAfterParen = - pendingNewlineAfterParen || (previousCompilableToken == TokenNameRPAREN && token == TokenNameLBRACE); + pendingNewlineAfterParen = pendingNewlineAfterParen + || (previousCompilableToken == TokenNameRPAREN && token == TokenNameLBRACE); if (pendingNewlineAfterParen && token != Scanner.TokenNameWHITESPACE) { pendingNewlineAfterParen = false; - // Do to add a newline & indent sequence if the current token is an - // open brace or a period or if the current token is a semi-colon and the + // open brace or a period or if the current token is a semi-colon and + // the // previous token is a close paren. // add a new line if a parenthesis belonging to a for() statement // has been closed and the current token is not an opening brace if (token != TokenNameLBRACE - && !isComment(token) // to avoid adding new line between else and a comment - && token != TokenNameDOT - && !(previousCompilableToken == TokenNameRPAREN && token == TokenNameSEMICOLON)) { + && !isComment(token) + // to avoid adding new line between else and a comment + && token != TokenNameDOT + && !(previousCompilableToken == TokenNameRPAREN && token == TokenNameSEMICOLON)) { newLine(1); currentLineIndentationLevel = indentationLevel; pendingNewLines = 0; pendingSpace = false; } else { - if (token == TokenNameLBRACE && options.newLineBeforeOpeningBraceMode) { + if (token == TokenNameLBRACE + && options.newLineBeforeOpeningBraceMode) { newLine(1); if (constructionsCount > 0 - && constructions[constructionsCount - 1] != BLOCK - && constructions[constructionsCount - 1] != NONINDENT_BLOCK) { + && constructions[constructionsCount - 1] != BLOCK + && constructions[constructionsCount - 1] != NONINDENT_BLOCK) { currentLineIndentationLevel = indentationLevel - 1; } else { currentLineIndentationLevel = indentationLevel; @@ -480,10 +453,9 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } } } - if (token == TokenNameLBRACE - && options.newLineBeforeOpeningBraceMode - && constructionsCount > 0 - && constructions[constructionsCount - 1] == TokenNamedo) { + if (token == TokenNameLBRACE && options.newLineBeforeOpeningBraceMode + && constructionsCount > 0 + && constructions[constructionsCount - 1] == TokenNamedo) { newLine(1); currentLineIndentationLevel = indentationLevel - 1; pendingNewLines = 0; @@ -512,59 +484,63 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { // Add pending new lines to the formatted source string. // Note: pending new lines are not added if the current token // is a single line comment or whitespace. - // if the comment is between parenthesis, there is no blank line preservation + // if the comment is between parenthesis, there is no blank line + // preservation // (if it's a one-line comment, a blank line is added after it). if (((pendingNewLines > 0 && (!isComment(token))) - || (newLinesInWhitespace > 0 && (openParenthesisCount <= 1 && isComment(token))) - || (previousCompilableToken == TokenNameLBRACE && token == TokenNameRBRACE)) - && token != Scanner.TokenNameWHITESPACE) { - + || (newLinesInWhitespace > 0 && (openParenthesisCount <= 1 && isComment(token))) || (previousCompilableToken == TokenNameLBRACE && token == TokenNameRBRACE)) + && token != Scanner.TokenNameWHITESPACE) { // Do not add newline & indent between an adjoining close brace and - // close paren. Anonymous inner classes may use this form. - boolean closeBraceAndCloseParen = previousToken == TokenNameRBRACE && token == TokenNameRPAREN; - + // close paren. Anonymous inner classes may use this form. + boolean closeBraceAndCloseParen = previousToken == TokenNameRBRACE + && token == TokenNameRPAREN; // OPTION (NewLineInCompoundStatement): do not add newline & indent // between close brace and else, (do) while, catch, and finally if // newlineInCompoundStatement is true. - boolean nlicsOption = - previousToken == TokenNameRBRACE + boolean nlicsOption = previousToken == TokenNameRBRACE && !options.newlineInControlStatementMode && (token == TokenNameelse || (token == TokenNamewhile && nlicsToken == TokenNamedo)); // || token == TokenNamecatch // || token == TokenNamefinally); - - // Do not add a newline & indent between a close brace and semi-colon. - boolean semiColonAndCloseBrace = previousToken == TokenNameRBRACE && token == TokenNameSEMICOLON; - - // Do not add a new line & indent between a multiline comment and a opening brace - boolean commentAndOpenBrace = previousToken == Scanner.TokenNameCOMMENT_BLOCK && token == TokenNameLBRACE; - - // Do not add a newline & indent between a close brace and a colon (in array assignments, for example). - boolean commaAndCloseBrace = previousToken == TokenNameRBRACE && token == TokenNameCOMMA; - + // Do not add a newline & indent between a close brace and + // semi-colon. + boolean semiColonAndCloseBrace = previousToken == TokenNameRBRACE + && token == TokenNameSEMICOLON; + // Do not add a new line & indent between a multiline comment and a + // opening brace + boolean commentAndOpenBrace = previousToken == Scanner.TokenNameCOMMENT_BLOCK + && token == TokenNameLBRACE; + // Do not add a newline & indent between a close brace and a colon + // (in array assignments, for example). + boolean commaAndCloseBrace = previousToken == TokenNameRBRACE + && token == TokenNameCOMMA; // Add a newline and indent, if appropriate. if (specialElse - || (!commentAndOpenBrace && !closeBraceAndCloseParen && !nlicsOption && !semiColonAndCloseBrace && !commaAndCloseBrace)) { - + || (!commentAndOpenBrace && !closeBraceAndCloseParen + && !nlicsOption && !semiColonAndCloseBrace && !commaAndCloseBrace)) { // if clearAllBlankLinesMode=false, leaves the blank lines // inserted by the user // if clearAllBlankLinesMode=true, removes all of then // and insert only blank lines required by the formatting. if (!options.clearAllBlankLinesMode) { // (isComment(token)) - pendingNewLines = (pendingNewLines < newLinesInWhitespace) ? newLinesInWhitespace : pendingNewLines; + pendingNewLines = (pendingNewLines < newLinesInWhitespace) + ? newLinesInWhitespace + : pendingNewLines; pendingNewLines = (pendingNewLines > 2) ? 2 : pendingNewLines; } - if (previousCompilableToken == TokenNameLBRACE && token == TokenNameRBRACE) { + if (previousCompilableToken == TokenNameLBRACE + && token == TokenNameRBRACE) { containsOpenCloseBraces = true; indentationLevelForOpenCloseBraces = currentLineIndentationLevel; if (isComment(previousToken)) { newLine(pendingNewLines); } else { - /* if (!(constructionsCount > 1 - && constructions[constructionsCount-1] == NONINDENT_BLOCK - && (constructions[constructionsCount-2] == TokenNamefor - || constructions[constructionsCount-2] == TokenNamewhile))) {*/ + /* + * if (!(constructionsCount > 1 && + * constructions[constructionsCount-1] == NONINDENT_BLOCK && + * (constructions[constructionsCount-2] == TokenNamefor + */ if (options.newLineInEmptyBlockMode) { if (inArrayAssignment) { newLine(1); // array assigment with an empty block @@ -575,17 +551,16 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { // } } } else { - // see PR 1FKKC3U: LFCOM:WINNT - Format problem with a comment before the ';' - if (!((previousToken == Scanner.TokenNameCOMMENT_BLOCK || previousToken == Scanner.TokenNameCOMMENT_PHPDOC) - && token == TokenNameSEMICOLON)) { + // see PR 1FKKC3U: LFCOM:WINNT - Format problem with a comment + // before the ';' + if (!((previousToken == Scanner.TokenNameCOMMENT_BLOCK || previousToken == Scanner.TokenNameCOMMENT_PHPDOC) && token == TokenNameSEMICOLON)) { newLine(pendingNewLines); } } if (((previousCompilableToken == TokenNameSEMICOLON) - || (previousCompilableToken == TokenNameLBRACE) - || (previousCompilableToken == TokenNameRBRACE) - || (isComment(previousToken))) - && (token == TokenNameRBRACE)) { + || (previousCompilableToken == TokenNameLBRACE) + || (previousCompilableToken == TokenNameRBRACE) || (isComment(previousToken))) + && (token == TokenNameRBRACE)) { indentationOffset = -1; indentationLevel += popExclusiveUntilBlock(); } @@ -593,7 +568,8 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { // PR 1FI5IPO currentLineIndentationLevel++; } else { - currentLineIndentationLevel = indentationLevel + indentationOffset; + currentLineIndentationLevel = indentationLevel + + indentationOffset; } pendingSpace = false; indentationOffset = 0; @@ -601,15 +577,14 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { pendingNewLines = 0; newLinesInWhitespace = 0; specialElse = false; - if (nlicsToken == TokenNamedo && token == TokenNamewhile) { nlicsToken = 0; } } switch (token) { - case TokenNameDOLLAR_LBRACE : - dollarBraceCount++; - break; + // case TokenNameDOLLAR : + // dollarBraceCount++; + // break; case TokenNameelse : // case TokenNamefinally : expectingOpenBrace = true; @@ -619,24 +594,18 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { case TokenNamecase : case TokenNamedefault : if (tokenBeforeColonCount == tokenBeforeColon.length) { - System.arraycopy( - tokenBeforeColon, - 0, - (tokenBeforeColon = new int[tokenBeforeColonCount * 2]), - 0, - tokenBeforeColonCount); + System.arraycopy(tokenBeforeColon, 0, + (tokenBeforeColon = new int[tokenBeforeColonCount * 2]), 0, + tokenBeforeColonCount); } tokenBeforeColon[tokenBeforeColonCount++] = TokenNamecase; indentationLevel += pushControlStatement(TokenNamecase); break; case TokenNameQUESTION : if (tokenBeforeColonCount == tokenBeforeColon.length) { - System.arraycopy( - tokenBeforeColon, - 0, - (tokenBeforeColon = new int[tokenBeforeColonCount * 2]), - 0, - tokenBeforeColonCount); + System.arraycopy(tokenBeforeColon, 0, + (tokenBeforeColon = new int[tokenBeforeColonCount * 2]), 0, + tokenBeforeColonCount); } tokenBeforeColon[tokenBeforeColonCount++] = token; break; @@ -645,23 +614,24 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { case TokenNameif : case TokenNamewhile : if (openParenthesisCount == openParenthesis.length) { - System.arraycopy(openParenthesis, 0, (openParenthesis = new int[openParenthesisCount * 2]), 0, openParenthesisCount); + System.arraycopy(openParenthesis, 0, + (openParenthesis = new int[openParenthesisCount * 2]), 0, + openParenthesisCount); } openParenthesis[openParenthesisCount++] = 0; expectingOpenBrace = true; - indentationLevel += pushControlStatement(token); break; - // case TokenNametry : - // pendingNewlineAfterParen = true; - // case TokenNamecatch : - // // several CATCH statements can be contiguous. - // // a CATCH is encountered pop until first CATCH (if a CATCH follows a TRY it works the same way, - // // as CATCH and TRY are the same token in the stack). - // expectingOpenBrace = true; - // indentationLevel += pushControlStatement(TokenNamecatch); - // break; - + // case TokenNametry : + // pendingNewlineAfterParen = true; + // case TokenNamecatch : + // // several CATCH statements can be contiguous. + // // a CATCH is encountered pop until first CATCH (if a CATCH + // follows a TRY it works the same way, + // // as CATCH and TRY are the same token in the stack). + // expectingOpenBrace = true; + // indentationLevel += pushControlStatement(TokenNamecatch); + // break; case TokenNamedo : expectingOpenBrace = true; indentationLevel += pushControlStatement(token); @@ -678,14 +648,13 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { // compliment (eg: !), semi-colon, open brace, close brace, // super, or this. if (previousCompilableToken != TokenNameLBRACKET - && previousToken != TokenNameIdentifier - && previousToken != 0 - && previousToken != TokenNameNOT - && previousToken != TokenNameLPAREN - && previousToken != TokenNameTWIDDLE - && previousToken != TokenNameSEMICOLON - && previousToken != TokenNameLBRACE - && previousToken != TokenNameRBRACE) { + && previousToken != TokenNameIdentifier && previousToken != 0 + && previousToken != TokenNameNOT + && previousToken != TokenNameLPAREN + && previousToken != TokenNameTWIDDLE + && previousToken != TokenNameSEMICOLON + && previousToken != TokenNameLBRACE + && previousToken != TokenNameRBRACE) { // && previousToken != TokenNamesuper // && previousToken != TokenNamethis) { space(); @@ -697,16 +666,16 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { openParenthesis[openParenthesisCount - 1]++; else openParenthesis[0]++; - pendingSpace = false; - //S } + //S } break; case TokenNameRPAREN : - // Decrease the parenthesis count // if there is no more unclosed parenthesis, - // a new line and indent may be append (depending on the next token). - if ((openParenthesisCount > 1) && (openParenthesis[openParenthesisCount - 1] > 0)) { + // a new line and indent may be append (depending on the next + // token). + if ((openParenthesisCount > 1) + && (openParenthesis[openParenthesisCount - 1] > 0)) { openParenthesis[openParenthesisCount - 1]--; if (openParenthesis[openParenthesisCount - 1] <= 0) { pendingNewlineAfterParen = true; @@ -719,7 +688,11 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { pendingSpace = false; break; case TokenNameLBRACE : - if ((previousCompilableToken == TokenNameRBRACKET) || (previousCompilableToken == TokenNameEQUAL)) { + if (previousCompilableToken == TokenNameDOLLAR) { + dollarBraceCount++; + } + if ((previousCompilableToken == TokenNameRBRACKET) + || (previousCompilableToken == TokenNameEQUAL)) { // if (previousCompilableToken == TokenNameRBRACKET) { inArrayAssignment = true; inAssignment = false; @@ -747,23 +720,23 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } else { pendingNewLines = 1; indentationLevel += popInclusiveUntilBlock(); - if (previousCompilableToken == TokenNameRPAREN) { - // fix for 1FGDDV6: LFCOM:WIN98 - Weird splitting on message expression + // fix for 1FGDDV6: LFCOM:WIN98 - Weird splitting on message + // expression currentLineBuffer.append(options.lineSeparatorSequence); increaseLineDelta(options.lineSeparatorSequence.length); } if (constructionsCount > 0) { switch (constructions[constructionsCount - 1]) { case TokenNamefor : - //indentationLevel += popExclusiveUntilBlock(); - //break; + //indentationLevel += popExclusiveUntilBlock(); + //break; case TokenNameswitch : case TokenNameif : case TokenNameelse : - // case TokenNametry : - // case TokenNamecatch : - // case TokenNamefinally : + // case TokenNametry : + // case TokenNamecatch : + // case TokenNamefinally : case TokenNamewhile : case TokenNamedo : // case TokenNamesynchronized : @@ -780,7 +753,8 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { break; case TokenNameRBRACKET : openBracketCount -= (openBracketCount > 0) ? 1 : 0; - // if there is no left bracket to close, the right bracket is ignored. + // if there is no left bracket to close, the right bracket is + // ignored. pendingSpace = false; break; case TokenNameCOMMA : @@ -788,11 +762,12 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { pendingSpace = false; break; case TokenNameSEMICOLON : - // Do not generate line terminators in the definition of // the for statement. - // if not in this case, jump a line and reduce indentation after the brace - // if the block it closes belongs to a conditional statement (if, while, do...). + // if not in this case, jump a line and reduce indentation after + // the brace + // if the block it closes belongs to a conditional statement (if, + // while, do...). if (openParenthesisCount <= 1) { pendingNewLines = 1; if (expectingOpenBrace) { @@ -805,21 +780,21 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { break; case TokenNamePLUS_PLUS : case TokenNameMINUS_MINUS : - // Do not put a space between a post-increment/decrement // and the identifier being modified. - if (previousToken == TokenNameIdentifier || previousToken == TokenNameRBRACKET) { + if (previousToken == TokenNameIdentifier + || previousToken == TokenNameRBRACKET) { pendingSpace = false; } break; - case TokenNamePLUS : // previously ADDITION + case TokenNamePLUS : + // previously ADDITION case TokenNameMINUS : - // Handle the unary operators plus and minus via a flag if (!isLiteralToken(previousToken) - && previousToken != TokenNameIdentifier - && previousToken != TokenNameRPAREN - && previousToken != TokenNameRBRACKET) { + && previousToken != TokenNameIdentifier + && previousToken != TokenNameRPAREN + && previousToken != TokenNameRBRACKET) { unarySignModifier = 1; } break; @@ -848,7 +823,6 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { pendingNewLines = 1; break; case Scanner.TokenNameWHITESPACE : - // Count the number of line terminators in the whitespace so // line spacing can be preserved near comments. char[] source = scanner.source; @@ -870,30 +844,29 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } increaseLineDelta(scanner.startPosition - scanner.currentPosition); break; - // case TokenNameHTML : - // // Add the next token to the formatted source string. - // // outputCurrentToken(token); - // int startPosition = scanner.startPosition; - // flushBuffer(); - // for (int i = startPosition, max = scanner.currentPosition; i < max; i++) { - // char currentCharacter = scanner.source[i]; - // updateMappedPositions(i); - // currentLineBuffer.append(currentCharacter); - // } - // break; + // case TokenNameHTML : + // // Add the next token to the formatted source string. + // // outputCurrentToken(token); + // int startPosition = scanner.startPosition; + // flushBuffer(); + // for (int i = startPosition, max = scanner.currentPosition; i < + // max; i++) { + // char currentCharacter = scanner.source[i]; + // updateMappedPositions(i); + // currentLineBuffer.append(currentCharacter); + // } + // break; default : if ((token == TokenNameIdentifier) || isLiteralToken(token)) { // || token == TokenNamesuper // || token == TokenNamethis) { - // Do not put a space between a unary operator // (eg: ++, --, +, -) and the identifier being modified. if (previousToken == TokenNamePLUS_PLUS - || previousToken == TokenNameMINUS_MINUS - || (previousToken == TokenNameMINUS_GREATER && - options.compactDereferencingMode) // -> - || (previousToken == TokenNamePLUS && unarySignModifier > 0) - || (previousToken == TokenNameMINUS && unarySignModifier > 0)) { + || previousToken == TokenNameMINUS_MINUS + || (previousToken == TokenNameMINUS_GREATER && options.compactDereferencingMode) // -> + || (previousToken == TokenNamePLUS && unarySignModifier > 0) + || (previousToken == TokenNameMINUS && unarySignModifier > 0)) { pendingSpace = false; } unarySignModifier = 0; @@ -902,35 +875,33 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } // Do not output whitespace tokens. if (token != Scanner.TokenNameWHITESPACE) { - - /* Add pending space to the formatted source string. - Do not output a space under the following circumstances: - 1) this is the first pass - 2) previous token is an open paren - 3) previous token is a period - 4) previous token is the logical compliment (eg: !) - 5) previous token is the bitwise compliment (eg: ~) - 6) previous token is the open bracket (eg: [) - 7) in an assignment statement, if the previous token is an - open brace or the current token is a close brace - 8) previous token is a single line comment - 9) current token is a '->' - */ - if (token == TokenNameMINUS_GREATER && - options.compactDereferencingMode) pendingSpace = false; - - boolean openAndCloseBrace = previousCompilableToken == TokenNameLBRACE && token == TokenNameRBRACE; - + /* + * Add pending space to the formatted source string. Do not output a + * space under the following circumstances: 1) this is the first pass 2) + * previous token is an open paren 3) previous token is a period 4) + * previous token is the logical compliment (eg: !) 5) previous token + * is the bitwise compliment (eg: ~) 6) previous token is the open + * bracket (eg: [) 7) in an assignment statement, if the previous + * token is an open brace or the current token is a close brace 8) + * previous token is a single line comment 9) current token is a '->' + */ + if (token == TokenNameMINUS_GREATER + && options.compactDereferencingMode) + pendingSpace = false; + boolean openAndCloseBrace = previousCompilableToken == TokenNameLBRACE + && token == TokenNameRBRACE; if (pendingSpace - && insertSpaceAfter(previousToken) - && !(inAssignment && (previousToken == TokenNameLBRACE || token == TokenNameRBRACE)) - && previousToken != Scanner.TokenNameCOMMENT_LINE) { - if ((!(options.compactAssignmentMode && token == TokenNameEQUAL)) && !openAndCloseBrace) + && insertSpaceAfter(previousToken) + && !(inAssignment && (previousToken == TokenNameLBRACE || token == TokenNameRBRACE)) + && previousToken != Scanner.TokenNameCOMMENT_LINE) { + if ((!(options.compactAssignmentMode && token == TokenNameEQUAL)) + && !openAndCloseBrace) space(); } // Add the next token to the formatted source string. outputCurrentToken(token); - if (token == Scanner.TokenNameCOMMENT_LINE && openParenthesisCount > 1) { + if (token == Scanner.TokenNameCOMMENT_LINE + && openParenthesisCount > 1) { pendingNewLines = 0; currentLineBuffer.append(options.lineSeparatorSequence); increaseLineDelta(options.lineSeparatorSequence.length); @@ -941,8 +912,8 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { if (token != Scanner.TokenNameWHITESPACE) { previousToken = token; if (token != Scanner.TokenNameCOMMENT_BLOCK - && token != Scanner.TokenNameCOMMENT_LINE - && token != Scanner.TokenNameCOMMENT_PHPDOC) { + && token != Scanner.TokenNameCOMMENT_LINE + && token != Scanner.TokenNameCOMMENT_PHPDOC) { previousCompilableToken = token; } } @@ -956,10 +927,10 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { // dump the last token of the source in the formatted output. } } - - /** - * Formats the char array sourceString, - * and returns a string containing the formatted version. + /** + * Formats the char array sourceString, and returns a string + * containing the formatted version. + * * @return the formatted ouput. */ public String formatSourceString(String sourceString) { @@ -969,32 +940,37 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { format(); return formattedSource.toString(); } - - /** - * Formats the char array sourceString, - * and returns a string containing the formatted version. - * @param string the string to format - * @param indentationLevel the initial indentation level + /** + * Formats the char array sourceString, and returns a string + * containing the formatted version. + * + * @param string + * the string to format + * @param indentationLevel + * the initial indentation level * @return the formatted ouput. */ public String format(String string, int indentationLevel) { return format(string, indentationLevel, (int[]) null); } - - /** - * Formats the char array sourceString, - * and returns a string containing the formatted version. - * The positions array is modified to contain the mapped positions. - * @param string the string to format - * @param indentationLevel the initial indentation level - * @param positions the array of positions to map + /** + * Formats the char array sourceString, and returns a string + * containing the formatted version. The positions array is modified to + * contain the mapped positions. + * + * @param string + * the string to format + * @param indentationLevel + * the initial indentation level + * @param positions + * the array of positions to map * @return the formatted ouput. */ public String format(String string, int indentationLevel, int[] positions) { return this.format(string, indentationLevel, positions, null); } - - public String format(String string, int indentationLevel, int[] positions, String lineSeparator) { + public String format(String string, int indentationLevel, int[] positions, + String lineSeparator) { if (lineSeparator != null) { this.options.setLineSeparator(lineSeparator); } @@ -1010,31 +986,32 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { return this.formatSourceString(string); } } - /** - * Formats the char array sourceString, - * and returns a string containing the formatted version. The initial indentation level is 0. - * @param string the string to format + /** + * Formats the char array sourceString, and returns a string + * containing the formatted version. The initial indentation level is 0. + * + * @param string + * the string to format * @return the formatted ouput. */ public String format(String string) { return this.format(string, 0, (int[]) null); } - - /** - * Formats a given source string, starting indenting it at a particular - * depth and using the given options + /** + * Formats a given source string, starting indenting it at a particular depth + * and using the given options * * @deprecated backport 1.0 internal functionality */ - public static String format(String sourceString, int initialIndentationLevel, ConfigurableOption[] options) { + public static String format(String sourceString, int initialIndentationLevel, + ConfigurableOption[] options) { CodeFormatter formatter = new CodeFormatter(options); formatter.setInitialIndentationLevel(initialIndentationLevel); return formatter.formatSourceString(sourceString); } - /** - * Returns the number of characters and tab char between the beginning of the line - * and the beginning of the comment. + * Returns the number of characters and tab char between the beginning of the + * line and the beginning of the comment. */ private int getCurrentCommentOffset() { int linePtr = scanner.linePtr; @@ -1045,7 +1022,6 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { int beginningOfLine = scanner.lineEnds[linePtr]; int currentStartPosition = scanner.startPosition; char[] source = scanner.source; - // find the position of the beginning of the line containing the comment while (beginningOfLine > currentStartPosition) { if (linePtr > 0) { @@ -1073,44 +1049,60 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } return offset; } - /** - * Returns an array of descriptions for the configurable options. - * The descriptions may be changed and passed back to a different - * compiler. + * Returns an array of descriptions for the configurable options. The + * descriptions may be changed and passed back to a different compiler. * * @deprecated backport 1.0 internal functionality */ public static ConfigurableOption[] getDefaultOptions(Locale locale) { String componentName = CodeFormatter.class.getName(); FormatterOptions options = new FormatterOptions(); - return new ConfigurableOption[] { new ConfigurableOption(componentName, "newline.openingBrace", locale, options.newLineBeforeOpeningBraceMode ? 0 : 1), //$NON-NLS-1$ - new ConfigurableOption(componentName, "newline.controlStatement", locale, options.newlineInControlStatementMode ? 0 : 1), //$NON-NLS-1$ - new ConfigurableOption(componentName, "newline.clearAll", locale, options.clearAllBlankLinesMode ? 0 : 1), //$NON-NLS-1$ - // new ConfigurableOption(componentName, "newline.elseIf", locale, options.compactElseIfMode ? 0 : 1), //$NON-NLS-1$ - new ConfigurableOption(componentName, "newline.emptyBlock", locale, options.newLineInEmptyBlockMode ? 0 : 1), //$NON-NLS-1$ - new ConfigurableOption(componentName, "line.split", locale, options.maxLineLength), //$NON-NLS-1$ - new ConfigurableOption(componentName, "style.compactAssignment", locale, options.compactAssignmentMode ? 0 : 1), //$NON-NLS-1$ - new ConfigurableOption(componentName, "tabulation.char", locale, options.indentWithTab ? 0 : 1), //$NON-NLS-1$ - new ConfigurableOption(componentName, "tabulation.size", locale, options.tabSize) //$NON-NLS-1$ + return new ConfigurableOption[]{ + new ConfigurableOption(componentName, "newline.openingBrace", locale, + options.newLineBeforeOpeningBraceMode ? 0 : 1), + //$NON-NLS-1$ + new ConfigurableOption(componentName, "newline.controlStatement", + locale, options.newlineInControlStatementMode ? 0 : 1), + //$NON-NLS-1$ + new ConfigurableOption(componentName, "newline.clearAll", locale, + options.clearAllBlankLinesMode ? 0 : 1), + //$NON-NLS-1$ + // new ConfigurableOption(componentName, "newline.elseIf", locale, + // options.compactElseIfMode ? 0 : 1), //$NON-NLS-1$ + new ConfigurableOption(componentName, "newline.emptyBlock", locale, + options.newLineInEmptyBlockMode ? 0 : 1), + //$NON-NLS-1$ + new ConfigurableOption(componentName, "line.split", locale, + options.maxLineLength), + //$NON-NLS-1$ + new ConfigurableOption(componentName, "style.compactAssignment", + locale, options.compactAssignmentMode ? 0 : 1), + //$NON-NLS-1$ + new ConfigurableOption(componentName, "tabulation.char", locale, + options.indentWithTab ? 0 : 1), + //$NON-NLS-1$ + new ConfigurableOption(componentName, "tabulation.size", locale, + options.tabSize) //$NON-NLS-1$ }; } - /** - * Returns the array of mapped positions. - * Returns null is no positions have been set. + * Returns the array of mapped positions. Returns null is no positions have + * been set. + * * @return int[] * @deprecated There is no need to retrieve the mapped positions anymore. */ public int[] getMappedPositions() { return mappedPositions; } - /** - * Returns the priority of the token given as argument
+ * Returns the priority of the token given as argument
* The most prioritary the token is, the smallest the return value is. + * * @return the priority of token - * @param token the token of which the priority is requested + * @param token + * the token of which the priority is requested */ private static int getTokenPriority(int token) { switch (token) { @@ -1118,88 +1110,119 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { // case TokenNameimplements : // case TokenNamethrows : return 10; - case TokenNameSEMICOLON : // ; + case TokenNameSEMICOLON : + // ; return 20; - case TokenNameCOMMA : // , + case TokenNameCOMMA : + // , return 25; - case TokenNameEQUAL : // = + case TokenNameEQUAL : + // = return 30; - case TokenNameAND_AND : // && - case TokenNameOR_OR : // || + case TokenNameAND_AND : + // && + case TokenNameOR_OR : + // || return 40; - case TokenNameQUESTION : // ? - case TokenNameCOLON : // : + case TokenNameQUESTION : + // ? + case TokenNameCOLON : + // : return 50; // it's better cutting on ?: than on ; - case TokenNameEQUAL_EQUAL : // == - case TokenNameEQUAL_EQUAL_EQUAL : // === - case TokenNameNOT_EQUAL : // != - case TokenNameNOT_EQUAL_EQUAL : // != + case TokenNameEQUAL_EQUAL : + // == + case TokenNameEQUAL_EQUAL_EQUAL : + // === + case TokenNameNOT_EQUAL : + // != + case TokenNameNOT_EQUAL_EQUAL : + // != return 60; - case TokenNameLESS : // < - case TokenNameLESS_EQUAL : // <= - case TokenNameGREATER : // > - case TokenNameGREATER_EQUAL : // >= + case TokenNameLESS : + // < + case TokenNameLESS_EQUAL : + // <= + case TokenNameGREATER : + // > + case TokenNameGREATER_EQUAL : + // >= // case TokenNameinstanceof : // instanceof return 70; - case TokenNamePLUS : // + - case TokenNameMINUS : // - + case TokenNamePLUS : + // + + case TokenNameMINUS : + // - return 80; - case TokenNameMULTIPLY : // * - case TokenNameDIVIDE : // / - case TokenNameREMAINDER : // % + case TokenNameMULTIPLY : + // * + case TokenNameDIVIDE : + // / + case TokenNameREMAINDER : + // % return 90; - case TokenNameLEFT_SHIFT : // << - case TokenNameRIGHT_SHIFT : // >> - // case TokenNameUNSIGNED_RIGHT_SHIFT : // >>> + case TokenNameLEFT_SHIFT : + // << + case TokenNameRIGHT_SHIFT : + // >> + // case TokenNameUNSIGNED_RIGHT_SHIFT : // >>> return 100; - case TokenNameAND : // & - case TokenNameOR : // | - case TokenNameXOR : // ^ + case TokenNameAND : + // & + case TokenNameOR : + // | + case TokenNameXOR : + // ^ return 110; - case TokenNameMULTIPLY_EQUAL : // *= - case TokenNameDIVIDE_EQUAL : // /= - case TokenNameREMAINDER_EQUAL : // %= - case TokenNamePLUS_EQUAL : // += - case TokenNameMINUS_EQUAL : // -= - case TokenNameLEFT_SHIFT_EQUAL : // <<= - case TokenNameRIGHT_SHIFT_EQUAL : // >>= - // case TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL : // >>>= - case TokenNameAND_EQUAL : // &= - case TokenNameXOR_EQUAL : // ^= - case TokenNameOR_EQUAL : // |= + case TokenNameMULTIPLY_EQUAL : + // *= + case TokenNameDIVIDE_EQUAL : + // /= + case TokenNameREMAINDER_EQUAL : + // %= + case TokenNamePLUS_EQUAL : + // += + case TokenNameMINUS_EQUAL : + // -= + case TokenNameLEFT_SHIFT_EQUAL : + // <<= + case TokenNameRIGHT_SHIFT_EQUAL : + // >>= + // case TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL : // >>>= + case TokenNameAND_EQUAL : + // &= + case TokenNameXOR_EQUAL : + // ^= + case TokenNameOR_EQUAL : + // |= return 120; - case TokenNameDOT : // . + case TokenNameDOT : + // . return 130; default : return Integer.MAX_VALUE; } } - /** - * Handles the exception raised when an invalid token is encountered. - * Returns true if the exception has been handled, false otherwise. + * Handles the exception raised when an invalid token is encountered. Returns + * true if the exception has been handled, false otherwise. */ private boolean handleInvalidToken(Exception e) { if (e.getMessage().equals(Scanner.INVALID_CHARACTER_CONSTANT) - || e.getMessage().equals(Scanner.INVALID_CHAR_IN_STRING) - || e.getMessage().equals(Scanner.INVALID_ESCAPE)) { + || e.getMessage().equals(Scanner.INVALID_CHAR_IN_STRING) + || e.getMessage().equals(Scanner.INVALID_ESCAPE)) { return true; } return false; } - private final void increaseGlobalDelta(int offset) { globalDelta += offset; } - private final void increaseLineDelta(int offset) { lineDelta += offset; } - private final void increaseSplitDelta(int offset) { splitDelta += offset; } - /** * Returns true if a space has to be inserted after operator * false otherwise. @@ -1210,7 +1233,8 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { case TokenNameNOT : case TokenNameTWIDDLE : case TokenNameDOT : - case 0 : // no token + case 0 : + // no token case TokenNameLBRACKET : case Scanner.TokenNameCOMMENT_LINE : return false; @@ -1218,12 +1242,11 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { return true; } } - /** * Returns true if a space has to be inserted before operator - * false otherwise.
- * Cannot be static as it uses the code formatter options - * (to know if the compact assignment mode is on). + * false otherwise.
+ * Cannot be static as it uses the code formatter options (to know if the + * compact assignment mode is on). */ private boolean insertSpaceBefore(int token) { switch (token) { @@ -1233,40 +1256,41 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { return false; } } - private static boolean isComment(int token) { - boolean result = - token == Scanner.TokenNameCOMMENT_BLOCK || token == Scanner.TokenNameCOMMENT_LINE || token == Scanner.TokenNameCOMMENT_PHPDOC; + boolean result = token == Scanner.TokenNameCOMMENT_BLOCK + || token == Scanner.TokenNameCOMMENT_LINE + || token == Scanner.TokenNameCOMMENT_PHPDOC; return result; } - private static boolean isLiteralToken(int token) { boolean result = token == TokenNameIntegerLiteral - // || token == TokenNameLongLiteral - // || token == TokenNameFloatingPointLiteral - || token == TokenNameDoubleLiteral - // || token == TokenNameCharacterLiteral - || token == TokenNameStringLiteral; + // || token == TokenNameLongLiteral + // || token == TokenNameFloatingPointLiteral + || token == TokenNameDoubleLiteral + // || token == TokenNameCharacterLiteral + || token == TokenNameStringLiteral; return result; } - /** * If the length of oneLineBuffer exceeds maxLineLength, * it is split and the result is dumped in formattedSource - * @param newLineCount the number of new lines to append + * + * @param newLineCount + * the number of new lines to append */ private void newLine(int newLineCount) { - // format current line splitDelta = 0; beginningOfLineIndex = formattedSource.length(); String currentLine = currentLineBuffer.toString(); if (containsOpenCloseBraces) { containsOpenCloseBraces = false; - outputLine(currentLine, false, indentationLevelForOpenCloseBraces, 0, -1, null, 0); + outputLine(currentLine, false, indentationLevelForOpenCloseBraces, 0, -1, + null, 0); indentationLevelForOpenCloseBraces = currentLineIndentationLevel; } else { - outputLine(currentLine, false, currentLineIndentationLevel, 0, -1, null, 0); + outputLine(currentLine, false, currentLineIndentationLevel, 0, -1, null, + 0); } // dump line break(s) for (int i = 0; i < newLineCount; i++) { @@ -1275,158 +1299,152 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } // reset formatter for next line int currentLength = currentLine.length(); - currentLineBuffer = new StringBuffer(currentLength > maxLineSize ? maxLineSize = currentLength : maxLineSize); - + currentLineBuffer = new StringBuffer(currentLength > maxLineSize + ? maxLineSize = currentLength + : maxLineSize); increaseGlobalDelta(splitDelta); increaseGlobalDelta(lineDelta); lineDelta = 0; currentLineIndentationLevel = initialIndentationLevel; } - private String operatorString(int operator) { switch (operator) { case TokenNameextends : return "extends"; //$NON-NLS-1$ - - // case TokenNameimplements : - // return "implements"; //$NON-NLS-1$ - // - // case TokenNamethrows : - // return "throws"; //$NON-NLS-1$ - - case TokenNameSEMICOLON : // ; + // case TokenNameimplements : + // return "implements"; //$NON-NLS-1$ + // + // case TokenNamethrows : + // return "throws"; //$NON-NLS-1$ + case TokenNameSEMICOLON : + // ; return ";"; //$NON-NLS-1$ - - case TokenNameCOMMA : // , + case TokenNameCOMMA : + // , return ","; //$NON-NLS-1$ - - case TokenNameEQUAL : // = + case TokenNameEQUAL : + // = return "="; //$NON-NLS-1$ - - case TokenNameAND_AND : // && (15.22) + case TokenNameAND_AND : + // && (15.22) return "&&"; //$NON-NLS-1$ - - case TokenNameOR_OR : // || (15.23) + case TokenNameOR_OR : + // || (15.23) return "||"; //$NON-NLS-1$ - - case TokenNameQUESTION : // ? (15.24) + case TokenNameQUESTION : + // ? (15.24) return "?"; //$NON-NLS-1$ - - case TokenNameCOLON : // : (15.24) + case TokenNameCOLON : + // : (15.24) return ":"; //$NON-NLS-1$ - - case TokenNamePAAMAYIM_NEKUDOTAYIM : // : (15.24) + case TokenNamePAAMAYIM_NEKUDOTAYIM : + // : (15.24) return "::"; //$NON-NLS-1$ - - case TokenNameEQUAL_EQUAL : // == (15.20, 15.20.1, 15.20.2, 15.20.3) + case TokenNameEQUAL_EQUAL : + // == (15.20, 15.20.1, 15.20.2, 15.20.3) return "=="; //$NON-NLS-1$ - - case TokenNameEQUAL_EQUAL_EQUAL : // == (15.20, 15.20.1, 15.20.2, 15.20.3) + case TokenNameEQUAL_EQUAL_EQUAL : + // == (15.20, 15.20.1, 15.20.2, 15.20.3) return "==="; //$NON-NLS-1$ - - case TokenNameEQUAL_GREATER : // -= (15.25.2) + case TokenNameEQUAL_GREATER : + // -= (15.25.2) return "=>"; //$NON-NLS-1$ - - case TokenNameNOT_EQUAL : // != (15.20, 15.20.1, 15.20.2, 15.20.3) + case TokenNameNOT_EQUAL : + // != (15.20, 15.20.1, 15.20.2, 15.20.3) return "!="; //$NON-NLS-1$ - - case TokenNameNOT_EQUAL_EQUAL : // != (15.20, 15.20.1, 15.20.2, 15.20.3) - return "!=="; //$NON-NLS-1$ - - case TokenNameLESS : // < (15.19.1) + case TokenNameNOT_EQUAL_EQUAL : + // != (15.20, 15.20.1, 15.20.2, 15.20.3) + return "!=="; //$NON-NLS-1$ + case TokenNameLESS : + // < (15.19.1) return "<"; //$NON-NLS-1$ - - case TokenNameLESS_EQUAL : // <= (15.19.1) + case TokenNameLESS_EQUAL : + // <= (15.19.1) return "<="; //$NON-NLS-1$ - - case TokenNameGREATER : // > (15.19.1) + case TokenNameGREATER : + // > (15.19.1) return ">"; //$NON-NLS-1$ - - case TokenNameGREATER_EQUAL : // >= (15.19.1) + case TokenNameGREATER_EQUAL : + // >= (15.19.1) return ">="; //$NON-NLS-1$ - - // case TokenNameinstanceof : // instanceof - // return "instanceof"; //$NON-NLS-1$ - - case TokenNamePLUS : // + (15.17, 15.17.2) + // case TokenNameinstanceof : // instanceof + // return "instanceof"; //$NON-NLS-1$ + case TokenNamePLUS : + // + (15.17, 15.17.2) return "+"; //$NON-NLS-1$ - - case TokenNameMINUS : // - (15.17.2) + case TokenNameMINUS : + // - (15.17.2) return "-"; //$NON-NLS-1$ - - case TokenNameMULTIPLY : // * (15.16.1) + case TokenNameMULTIPLY : + // * (15.16.1) return "*"; //$NON-NLS-1$ - - case TokenNameDIVIDE : // / (15.16.2) + case TokenNameDIVIDE : + // / (15.16.2) return "/"; //$NON-NLS-1$ - - case TokenNameREMAINDER : // % (15.16.3) + case TokenNameREMAINDER : + // % (15.16.3) return "%"; //$NON-NLS-1$ - - case TokenNameLEFT_SHIFT : // << (15.18) + case TokenNameLEFT_SHIFT : + // << (15.18) return "<<"; //$NON-NLS-1$ - - case TokenNameRIGHT_SHIFT : // >> (15.18) + case TokenNameRIGHT_SHIFT : + // >> (15.18) return ">>"; //$NON-NLS-1$ - - // case TokenNameUNSIGNED_RIGHT_SHIFT : // >>> (15.18) - // return ">>>"; //$NON-NLS-1$ - - case TokenNameAND : // & (15.21, 15.21.1, 15.21.2) + // case TokenNameUNSIGNED_RIGHT_SHIFT : // >>> (15.18) + // return ">>>"; //$NON-NLS-1$ + case TokenNameAND : + // & (15.21, 15.21.1, 15.21.2) return "&"; //$NON-NLS-1$ - - case TokenNameOR : // | (15.21, 15.21.1, 15.21.2) + case TokenNameOR : + // | (15.21, 15.21.1, 15.21.2) return "|"; //$NON-NLS-1$ - - case TokenNameXOR : // ^ (15.21, 15.21.1, 15.21.2) + case TokenNameXOR : + // ^ (15.21, 15.21.1, 15.21.2) return "^"; //$NON-NLS-1$ - - case TokenNameMULTIPLY_EQUAL : // *= (15.25.2) + case TokenNameMULTIPLY_EQUAL : + // *= (15.25.2) return "*="; //$NON-NLS-1$ - - case TokenNameDIVIDE_EQUAL : // /= (15.25.2) + case TokenNameDIVIDE_EQUAL : + // /= (15.25.2) return "/="; //$NON-NLS-1$ - - case TokenNameREMAINDER_EQUAL : // %= (15.25.2) + case TokenNameREMAINDER_EQUAL : + // %= (15.25.2) return "%="; //$NON-NLS-1$ - - case TokenNamePLUS_EQUAL : // += (15.25.2) + case TokenNamePLUS_EQUAL : + // += (15.25.2) return "+="; //$NON-NLS-1$ - - case TokenNameMINUS_EQUAL : // -= (15.25.2) + case TokenNameMINUS_EQUAL : + // -= (15.25.2) return "-="; //$NON-NLS-1$ - - case TokenNameMINUS_GREATER : // -= (15.25.2) + case TokenNameMINUS_GREATER : + // -= (15.25.2) return "->"; //$NON-NLS-1$ - - case TokenNameLEFT_SHIFT_EQUAL : // <<= (15.25.2) + case TokenNameLEFT_SHIFT_EQUAL : + // <<= (15.25.2) return "<<="; //$NON-NLS-1$ - - case TokenNameRIGHT_SHIFT_EQUAL : // >>= (15.25.2) + case TokenNameRIGHT_SHIFT_EQUAL : + // >>= (15.25.2) return ">>="; //$NON-NLS-1$ - - // case TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL : // >>>= (15.25.2) - // return ">>>="; //$NON-NLS-1$ - - case TokenNameAND_EQUAL : // &= (15.25.2) + // case TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL : // >>>= (15.25.2) + // return ">>>="; //$NON-NLS-1$ + case TokenNameAND_EQUAL : + // &= (15.25.2) return "&="; //$NON-NLS-1$ - - case TokenNameXOR_EQUAL : // ^= (15.25.2) + case TokenNameXOR_EQUAL : + // ^= (15.25.2) return "^="; //$NON-NLS-1$ - - case TokenNameOR_EQUAL : // |= (15.25.2) + case TokenNameOR_EQUAL : + // |= (15.25.2) return "|="; //$NON-NLS-1$ - - case TokenNameDOT : // . + case TokenNameDOT : + // . return "."; //$NON-NLS-1$ - default : return ""; //$NON-NLS-1$ } } - - /** - * Appends stringToOutput to the formatted output.
+ /** + * Appends stringToOutput to the formatted output.
* If it contains \n, append a LINE_SEPARATOR and indent after it. */ private void output(String stringToOutput) { @@ -1438,15 +1456,14 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } } } - - /** - * Appends token to the formatted output.
- * If it contains \n, append a LINE_SEPARATOR and indent after it. + /** + * Appends token to the formatted output.
+ * If it contains \n, append a LINE_SEPARATOR and indent + * after it. */ private void outputCurrentToken(int token) { char[] source = scanner.source; int startPosition = scanner.startPosition; - switch (token) { case Scanner.TokenNameCOMMENT_PHPDOC : case Scanner.TokenNameCOMMENT_BLOCK : @@ -1486,7 +1503,8 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { endOfLine = true; } if (endOfLine) { - // we remove a maximum of currentCommentOffset characters (tabs are converted to space numbers). + // we remove a maximum of currentCommentOffset characters (tabs + // are converted to space numbers). beginningOfLineSpaces += options.tabSize; if (beginningOfLineSpaces > currentCommentOffset) { currentLineBuffer.append(currentCharacter); @@ -1506,7 +1524,8 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { endOfLine = true; } if (endOfLine) { - // we remove a maximum of currentCommentOffset characters (tabs are converted to space numbers). + // we remove a maximum of currentCommentOffset characters (tabs + // are converted to space numbers). beginningOfLineSpaces++; if (beginningOfLineSpaces > currentCommentOffset) { currentLineBuffer.append(currentCharacter); @@ -1542,30 +1561,29 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } } } - /** * Outputs currentString:
- *
  • If its length is < maxLineLength, output - *
  • Otherwise it is split.
- * @param currentString string to output - * @param preIndented whether the string to output was pre-indented - * @param depth number of indentation to put in front of currentString - * @param operator value of the operator belonging to currentString. + *
    + *
  • If its length is < maxLineLength, output + *
  • Otherwise it is split. + *
+ * + * @param currentString + * string to output + * @param preIndented + * whether the string to output was pre-indented + * @param depth + * number of indentation to put in front of currentString + * @param operator + * value of the operator belonging to currentString. */ - private void outputLine( - String currentString, - boolean preIndented, - int depth, - int operator, - int substringIndex, - int[] startSubstringIndexes, - int offsetInGlobalLine) { - + private void outputLine(String currentString, boolean preIndented, int depth, + int operator, int substringIndex, int[] startSubstringIndexes, + int offsetInGlobalLine) { boolean emptyFirstSubString = false; String operatorString = operatorString(operator); boolean placeOperatorBehind = !breakLineBeforeOperator(operator); boolean placeOperatorAhead = !placeOperatorBehind; - // dump prefix operator? if (placeOperatorAhead) { if (!preIndented) { @@ -1579,9 +1597,8 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } formattedSource.append(operatorString); increaseSplitDelta(operatorString.length()); - if (insertSpaceAfter(operator) // && operator != TokenNameimplements - && operator != TokenNameextends) { + && operator != TokenNameextends) { // && operator != TokenNamethrows) { formattedSource.append(' '); increaseSplitDelta(1); @@ -1590,10 +1607,10 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } SplitLine splitLine = null; if (options.maxLineLength == 0 - || getLength(currentString, depth) < options.maxLineLength - || (splitLine = split(currentString, offsetInGlobalLine)) == null) { - - // depending on the type of operator, outputs new line before of after dumping it + || getLength(currentString, depth) < options.maxLineLength + || (splitLine = split(currentString, offsetInGlobalLine)) == null) { + // depending on the type of operator, outputs new line before of after + // dumping it // indent before postfix operator // indent also when the line cannot be split if (operator == TokenNameextends) { @@ -1610,12 +1627,13 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { int max = currentString.length(); if (multipleLineCommentCounter != 0) { try { - BufferedReader reader = new BufferedReader(new StringReader(currentString)); + BufferedReader reader = new BufferedReader(new StringReader( + currentString)); String line = reader.readLine(); while (line != null) { - updateMappedPositionsWhileSplitting( - beginningOfLineIndex, - beginningOfLineIndex + line.length() + options.lineSeparatorSequence.length); + updateMappedPositionsWhileSplitting(beginningOfLineIndex, + beginningOfLineIndex + line.length() + + options.lineSeparatorSequence.length); formattedSource.append(line); beginningOfLineIndex = beginningOfLineIndex + line.length(); if ((line = reader.readLine()) != null) { @@ -1629,7 +1647,8 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { e.printStackTrace(); } } else { - updateMappedPositionsWhileSplitting(beginningOfLineIndex, beginningOfLineIndex + max); + updateMappedPositionsWhileSplitting(beginningOfLineIndex, + beginningOfLineIndex + max); for (int i = 0; i < max; i++) { char currentChar = currentString.charAt(i); switch (currentChar) { @@ -1637,11 +1656,12 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { break; case '\n' : if (i != max - 1) { - // fix for 1FFYL5C: LFCOM:ALL - Incorrect indentation when split with a comment inside a condition + // fix for 1FFYL5C: LFCOM:ALL - Incorrect indentation when + // split with a comment inside a condition // a substring cannot end with a lineSeparatorSequence, - // except if it has been added by format() after a one-line comment + // except if it has been added by format() after a one-line + // comment formattedSource.append(options.lineSeparatorSequence); - // 1FGDDV6: LFCOM:WIN98 - Weird splitting on message expression dumpTab(depth - 1); } @@ -1654,13 +1674,15 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { // update positions inside the mappedPositions table if (substringIndex != -1) { if (multipleLineCommentCounter == 0) { - int startPosition = beginningOfLineIndex + startSubstringIndexes[substringIndex]; - updateMappedPositionsWhileSplitting(startPosition, startPosition + max); + int startPosition = beginningOfLineIndex + + startSubstringIndexes[substringIndex]; + updateMappedPositionsWhileSplitting(startPosition, startPosition + + max); } - // compute the splitDelta resulting with the operator and blank removal if (substringIndex + 1 != startSubstringIndexes.length) { - increaseSplitDelta(startSubstringIndexes[substringIndex] + max - startSubstringIndexes[substringIndex + 1]); + increaseSplitDelta(startSubstringIndexes[substringIndex] + max + - startSubstringIndexes[substringIndex + 1]); } } // dump postfix operator? @@ -1680,7 +1702,8 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } // fix for 1FG0BA3: LFCOM:WIN98 - Weird splitting on interfaces // extends has to stand alone on a line when currentString has been split. - if (options.maxLineLength != 0 && splitLine != null && (operator == TokenNameextends)) { + if (options.maxLineLength != 0 && splitLine != null + && (operator == TokenNameextends)) { // || operator == TokenNameimplements // || operator == TokenNamethrows)) { formattedSource.append(options.lineSeparatorSequence); @@ -1697,33 +1720,31 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { // perform actual splitting String result[] = splitLine.substrings; int[] splitOperators = splitLine.operators; - if (result[0].length() == 0) { // when the substring 0 is null, the substring 1 is correctly indented. depth--; emptyFirstSubString = true; } - // the operator going in front of the result[0] string is the operator parameter + // the operator going in front of the result[0] string is the operator + // parameter for (int i = 0, max = result.length; i < max; i++) { // the new depth is the current one if this is the first substring, // the current one + 1 otherwise. - // if the substring is a comment, use the current indentation Level instead of the depth + // if the substring is a comment, use the current indentation Level + // instead of the depth // (-1 because the ouputline increases depth). - // (fix for 1FFC72R: LFCOM:ALL - Incorrect line split in presence of line comments) + // (fix for 1FFC72R: LFCOM:ALL - Incorrect line split in presence of line + // comments) String currentResult = result[i]; - if (currentResult.length() != 0 || splitOperators[i] != 0) { - int newDepth = (currentResult.startsWith("/*") //$NON-NLS-1$ - || currentResult.startsWith("//")) //$NON-NLS-1$ - ? indentationLevel - 1 : depth; - outputLine( - currentResult, - i == 0 || (i == 1 && emptyFirstSubString) ? preIndented : false, - i == 0 ? newDepth : newDepth + 1, - splitOperators[i], - i, - splitLine.startSubstringsIndexes, - currentString.indexOf(currentResult)); + int newDepth = (currentResult.startsWith("/*") //$NON-NLS-1$ + || currentResult.startsWith("//")) //$NON-NLS-1$ + ? indentationLevel - 1 : depth; + outputLine(currentResult, i == 0 || (i == 1 && emptyFirstSubString) + ? preIndented + : false, i == 0 ? newDepth : newDepth + 1, splitOperators[i], i, + splitLine.startSubstringsIndexes, currentString + .indexOf(currentResult)); if (i != max - 1) { formattedSource.append(options.lineSeparatorSequence); increaseSplitDelta(options.lineSeparatorSequence.length); @@ -1735,7 +1756,6 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { String lastOperatorString = operatorString(lastOperator); formattedSource.append(options.lineSeparatorSequence); increaseSplitDelta(options.lineSeparatorSequence.length); - if (breakLineBeforeOperator(lastOperator)) { dumpTab(depth + 1); if (lastOperator != 0) { @@ -1745,9 +1765,9 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } formattedSource.append(lastOperatorString); increaseSplitDelta(lastOperatorString.length()); - - if (insertSpaceAfter(lastOperator) // && lastOperator != TokenNameimplements - && lastOperator != TokenNameextends) { + if (insertSpaceAfter(lastOperator) // && lastOperator != + // TokenNameimplements + && lastOperator != TokenNameextends) { // && lastOperator != TokenNamethrows) { formattedSource.append(' '); increaseSplitDelta(1); @@ -1764,37 +1784,39 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { //increaseSplitDelta(operatorString.length()); } } - /** * Pops the top statement of the stack if it is token */ private int pop(int token) { int delta = 0; - if ((constructionsCount > 0) && (constructions[constructionsCount - 1] == token)) { + if ((constructionsCount > 0) + && (constructions[constructionsCount - 1] == token)) { delta--; constructionsCount--; } return delta; } - /** - * Pops the top statement of the stack if it is a BLOCK or a NONINDENT_BLOCK. + * Pops the top statement of the stack if it is a BLOCK or a + * NONINDENT_BLOCK. */ private int popBlock() { int delta = 0; if ((constructionsCount > 0) - && ((constructions[constructionsCount - 1] == BLOCK) || (constructions[constructionsCount - 1] == NONINDENT_BLOCK))) { + && ((constructions[constructionsCount - 1] == BLOCK) || (constructions[constructionsCount - 1] == NONINDENT_BLOCK))) { if (constructions[constructionsCount - 1] == BLOCK) delta--; constructionsCount--; } return delta; } - /** - * Pops elements until the stack is empty or the top element is token.
+ * Pops elements until the stack is empty or the top element is token. + *
* Does not remove token from the stack. - * @param token the token to be left as the top of the stack + * + * @param token + * the token to be left as the top of the stack */ private int popExclusiveUntil(int token) { int delta = 0; @@ -1806,43 +1828,44 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } return delta; } - /** - * Pops elements until the stack is empty or the top element is - * a BLOCK or a NONINDENT_BLOCK.
+ * Pops elements until the stack is empty or the top element is a BLOCK + * or a NONINDENT_BLOCK.
* Does not remove it from the stack. */ private int popExclusiveUntilBlock() { int startCount = constructionsCount; int delta = 0; - for (int i = startCount - 1; i >= 0 && constructions[i] != BLOCK && constructions[i] != NONINDENT_BLOCK; i--) { + for (int i = startCount - 1; i >= 0 && constructions[i] != BLOCK + && constructions[i] != NONINDENT_BLOCK; i--) { constructionsCount--; delta--; } return delta; } - /** - * Pops elements until the stack is empty or the top element is - * a BLOCK, a NONINDENT_BLOCK or a CASE.
+ * Pops elements until the stack is empty or the top element is a BLOCK, + * a NONINDENT_BLOCK or a CASE.
* Does not remove it from the stack. */ private int popExclusiveUntilBlockOrCase() { int startCount = constructionsCount; int delta = 0; - for (int i = startCount - 1; - i >= 0 && constructions[i] != BLOCK && constructions[i] != NONINDENT_BLOCK && constructions[i] != TokenNamecase; - i--) { + for (int i = startCount - 1; i >= 0 && constructions[i] != BLOCK + && constructions[i] != NONINDENT_BLOCK + && constructions[i] != TokenNamecase; i--) { constructionsCount--; delta--; } return delta; } - /** - * Pops elements until the stack is empty or the top element is token.
+ * Pops elements until the stack is empty or the top element is token. + *
* Removes token from the stack too. - * @param token the token to remove from the stack + * + * @param token + * the token to remove from the stack */ private int popInclusiveUntil(int token) { int startCount = constructionsCount; @@ -1859,16 +1882,16 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } return delta; } - /** - * Pops elements until the stack is empty or the top element is - * a BLOCK or a NONINDENT_BLOCK.
+ * Pops elements until the stack is empty or the top element is a BLOCK + * or a NONINDENT_BLOCK.
* Does not remove it from the stack. */ private int popInclusiveUntilBlock() { int startCount = constructionsCount; int delta = 0; - for (int i = startCount - 1; i >= 0 && (constructions[i] != BLOCK && constructions[i] != NONINDENT_BLOCK); i--) { + for (int i = startCount - 1; i >= 0 + && (constructions[i] != BLOCK && constructions[i] != NONINDENT_BLOCK); i--) { delta--; constructionsCount--; } @@ -1879,22 +1902,22 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } return delta; } - - /** - * Pushes a block in the stack.
- * Pushes a BLOCK if the stack is empty or if the top element is a BLOCK, - * pushes NONINDENT_BLOCK otherwise. - * Creates a new bigger array if the current one is full. + /** + * Pushes a block in the stack.
+ * Pushes a BLOCK if the stack is empty or if the top element + * is a BLOCK, pushes NONINDENT_BLOCK + * otherwise. Creates a new bigger array if the current one is full. */ private int pushBlock() { int delta = 0; if (constructionsCount == constructions.length) - System.arraycopy(constructions, 0, (constructions = new int[constructionsCount * 2]), 0, constructionsCount); - + System.arraycopy(constructions, 0, + (constructions = new int[constructionsCount * 2]), 0, + constructionsCount); if ((constructionsCount == 0) - || (constructions[constructionsCount - 1] == BLOCK) - || (constructions[constructionsCount - 1] == NONINDENT_BLOCK) - || (constructions[constructionsCount - 1] == TokenNamecase)) { + || (constructions[constructionsCount - 1] == BLOCK) + || (constructions[constructionsCount - 1] == NONINDENT_BLOCK) + || (constructions[constructionsCount - 1] == TokenNamecase)) { delta++; constructions[constructionsCount++] = BLOCK; } else { @@ -1902,33 +1925,33 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } return delta; } - - /** + /** * Pushes token.
* Creates a new bigger array if the current one is full. */ private int pushControlStatement(int token) { if (constructionsCount == constructions.length) - System.arraycopy(constructions, 0, (constructions = new int[constructionsCount * 2]), 0, constructionsCount); + System.arraycopy(constructions, 0, + (constructions = new int[constructionsCount * 2]), 0, + constructionsCount); constructions[constructionsCount++] = token; return 1; } - private static boolean separateFirstArgumentOn(int currentToken) { - //return (currentToken == TokenNameCOMMA || currentToken == TokenNameSEMICOLON); - return currentToken != TokenNameif - && currentToken != TokenNameLPAREN - && currentToken != TokenNameNOT - && currentToken != TokenNamewhile - && currentToken != TokenNamefor - && currentToken != TokenNameswitch; + //return (currentToken == TokenNameCOMMA || currentToken == + // TokenNameSEMICOLON); + return currentToken != TokenNameif && currentToken != TokenNameLPAREN + && currentToken != TokenNameNOT && currentToken != TokenNamewhile + && currentToken != TokenNamefor && currentToken != TokenNameswitch; } - /** - * Set the positions to map. The mapped positions should be retrieved using the - * getMappedPositions() method. - * @param positions int[] - * @deprecated Set the positions to map using the format(String, int, int[]) method. + * Set the positions to map. The mapped positions should be retrieved using + * the getMappedPositions() method. + * + * @param positions + * int[] + * @deprecated Set the positions to map using the format(String, int, int[]) + * method. * * @see #getMappedPositions() */ @@ -1938,37 +1961,36 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { globalDelta = 0; mappedPositions = new int[positions.length]; } - - /** + /** * Appends a space character to the current line buffer. */ private void space() { currentLineBuffer.append(' '); increaseLineDelta(1); } - /** - * Splits stringToSplit on the top level token
- * If there are several identical token at the same level, - * the string is cut into many pieces. - * @return an object containing the operator and all the substrings - * or null if the string cannot be split + * Splits stringToSplit on the top level token
+ * If there are several identical token at the same level, the string is cut + * into many pieces. + * + * @return an object containing the operator and all the substrings or null + * if the string cannot be split */ public SplitLine split(String stringToSplit) { return split(stringToSplit, 0); } - /** - * Splits stringToSplit on the top level token
- * If there are several identical token at the same level, - * the string is cut into many pieces. - * @return an object containing the operator and all the substrings - * or null if the string cannot be split + * Splits stringToSplit on the top level token
+ * If there are several identical token at the same level, the string is cut + * into many pieces. + * + * @return an object containing the operator and all the substrings or null + * if the string cannot be split */ public SplitLine split(String stringToSplit, int offsetInGlobalLine) { /* * See http://dev.eclipse.org/bugs/show_bug.cgi?id=12540 and - * http://dev.eclipse.org/bugs/show_bug.cgi?id=14387 + * http://dev.eclipse.org/bugs/show_bug.cgi?id=14387 */ if (stringToSplit.indexOf("//$NON-NLS") != -1) { //$NON-NLS-1$ return null; @@ -1978,7 +2000,6 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { int splitTokenType = 0; int splitTokenDepth = Integer.MAX_VALUE; int splitTokenPriority = Integer.MAX_VALUE; - int[] substringsStartPositions = new int[10]; // contains the start position of substrings int[] substringsEndPositions = new int[10]; @@ -2001,7 +2022,6 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { int previousToken = -1; // to remember the previous token. splitScanner.setSource(stringToSplit.toCharArray()); - try { // start the loop while (true) { @@ -2012,9 +2032,10 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { currentToken = splitScanner.getNextToken(); if (Scanner.DEBUG) { int currentEndPosition = splitScanner.getCurrentTokenEndPosition(); - int currentStartPosition = splitScanner.getCurrentTokenStartPosition(); - - System.out.print(currentStartPosition + "," + currentEndPosition + ": "); + int currentStartPosition = splitScanner + .getCurrentTokenStartPosition(); + System.out.print(currentStartPosition + "," + currentEndPosition + + ": "); System.out.println(scanner.toStringAction(currentToken)); } } catch (InvalidInputException e) { @@ -2025,7 +2046,6 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } if (currentToken == TokenNameEOF) break; - if (firstTokenOnLine == -1) { firstTokenOnLine = currentToken; } @@ -2033,21 +2053,23 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { case TokenNameRBRACE : case TokenNameRPAREN : if (openParenthesisPositionCount > 0) { - if (openParenthesisPositionCount == 1 && lastOpenParenthesisPosition < openParenthesisPosition[0]) { + if (openParenthesisPositionCount == 1 + && lastOpenParenthesisPosition < openParenthesisPosition[0]) { lastOpenParenthesisPosition = openParenthesisPosition[0]; - } else if ( - (splitTokenDepth == Integer.MAX_VALUE) + } else if ((splitTokenDepth == Integer.MAX_VALUE) || (splitTokenDepth > openParenthesisPositionCount && openParenthesisPositionCount == 1)) { splitTokenType = 0; splitTokenDepth = openParenthesisPositionCount; splitTokenPriority = Integer.MAX_VALUE; substringsStartPositions[0] = 0; - // better token means the whole line until now is the first substring + // better token means the whole line until now is the first + // substring substringsCount = 1; // resets the count of substrings substringsEndPositions[0] = openParenthesisPosition[0]; // substring ends on operator start position = openParenthesisPosition[0]; - // the string mustn't be cut before the closing parenthesis but after the opening one. + // the string mustn't be cut before the closing parenthesis but + // after the opening one. splitOperatorsCount = 1; // resets the count of split operators splitOperators[0] = 0; } @@ -2057,23 +2079,27 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { case TokenNameLBRACE : case TokenNameLPAREN : if (openParenthesisPositionCount == openParenthesisPosition.length) { - System.arraycopy( - openParenthesisPosition, - 0, - (openParenthesisPosition = new int[openParenthesisPositionCount * 2]), - 0, - openParenthesisPositionCount); + System + .arraycopy( + openParenthesisPosition, + 0, + (openParenthesisPosition = new int[openParenthesisPositionCount * 2]), + 0, openParenthesisPositionCount); } openParenthesisPosition[openParenthesisPositionCount++] = splitScanner.currentPosition; - if (currentToken == TokenNameLPAREN && previousToken == TokenNameRPAREN) { + if (currentToken == TokenNameLPAREN + && previousToken == TokenNameRPAREN) { openParenthesisPosition[openParenthesisPositionCount - 1] = splitScanner.startPosition; } break; - case TokenNameSEMICOLON : // ; - case TokenNameCOMMA : // , - case TokenNameEQUAL : // = + case TokenNameSEMICOLON : + // ; + case TokenNameCOMMA : + // , + case TokenNameEQUAL : + // = if (openParenthesisPositionCount < splitTokenDepth - || (openParenthesisPositionCount == splitTokenDepth && splitTokenPriority > getTokenPriority(currentToken))) { + || (openParenthesisPositionCount == splitTokenDepth && splitTokenPriority > getTokenPriority(currentToken))) { // the current token is better than the one we currently have // (in level or in priority if same level) // reset the substringsCount @@ -2081,11 +2107,11 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { splitTokenType = currentToken; splitTokenPriority = getTokenPriority(currentToken); substringsStartPositions[0] = 0; - // better token means the whole line until now is the first substring - - if (separateFirstArgumentOn(firstTokenOnLine) && openParenthesisPositionCount > 0) { + // better token means the whole line until now is the first + // substring + if (separateFirstArgumentOn(firstTokenOnLine) + && openParenthesisPositionCount > 0) { substringsCount = 2; // resets the count of substrings - substringsEndPositions[0] = openParenthesisPosition[splitTokenDepth - 1]; substringsStartPositions[1] = openParenthesisPosition[splitTokenDepth - 1]; substringsEndPositions[1] = splitScanner.startPosition; @@ -2096,7 +2122,6 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { // next substring will start from operator end } else { substringsCount = 1; // resets the count of substrings - substringsEndPositions[0] = splitScanner.startPosition; // substring ends on operator start position = splitScanner.currentPosition; @@ -2106,30 +2131,30 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } } else { if ((openParenthesisPositionCount == splitTokenDepth && splitTokenPriority == getTokenPriority(currentToken)) - && splitTokenType != TokenNameEQUAL - && currentToken != TokenNameEQUAL) { - // fix for 1FG0BCN: LFCOM:WIN98 - Missing one indentation after split + && splitTokenType != TokenNameEQUAL + && currentToken != TokenNameEQUAL) { + // fix for 1FG0BCN: LFCOM:WIN98 - Missing one indentation after + // split // take only the 1st = into account. // if another token with the same priority is found, // push the start position of the substring and // push the token into the stack. // create a new array object if the current one is full. if (substringsCount == substringsStartPositions.length) { - System.arraycopy( - substringsStartPositions, - 0, - (substringsStartPositions = new int[substringsCount * 2]), - 0, - substringsCount); - System.arraycopy( - substringsEndPositions, - 0, - (substringsEndPositions = new int[substringsCount * 2]), - 0, - substringsCount); + System + .arraycopy( + substringsStartPositions, + 0, + (substringsStartPositions = new int[substringsCount * 2]), + 0, substringsCount); + System.arraycopy(substringsEndPositions, 0, + (substringsEndPositions = new int[substringsCount * 2]), + 0, substringsCount); } if (splitOperatorsCount == splitOperators.length) { - System.arraycopy(splitOperators, 0, (splitOperators = new int[splitOperatorsCount * 2]), 0, splitOperatorsCount); + System.arraycopy(splitOperators, 0, + (splitOperators = new int[splitOperatorsCount * 2]), 0, + splitOperatorsCount); } substringsStartPositions[substringsCount] = position; substringsEndPositions[substringsCount++] = splitScanner.startPosition; @@ -2140,57 +2165,89 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } } break; - - case TokenNameCOLON : // : (15.24) - // see 1FK7C5R, we only split on a colon, when it is associated with a question-mark. - // indeed it might appear also behind a case statement, and we do not to break at this point. - if ((splitOperatorsCount == 0) || splitOperators[splitOperatorsCount - 1] != TokenNameQUESTION) { + case TokenNameCOLON : + // : (15.24) + // see 1FK7C5R, we only split on a colon, when it is associated + // with a question-mark. + // indeed it might appear also behind a case statement, and we do + // not to break at this point. + if ((splitOperatorsCount == 0) + || splitOperators[splitOperatorsCount - 1] != TokenNameQUESTION) { break; } case TokenNameextends : - // case TokenNameimplements : - // case TokenNamethrows : - - case TokenNameDOT : // . - case TokenNameMULTIPLY : // * (15.16.1) - case TokenNameDIVIDE : // / (15.16.2) - case TokenNameREMAINDER : // % (15.16.3) - case TokenNamePLUS : // + (15.17, 15.17.2) - case TokenNameMINUS : // - (15.17.2) - case TokenNameLEFT_SHIFT : // << (15.18) - case TokenNameRIGHT_SHIFT : // >> (15.18) - // case TokenNameUNSIGNED_RIGHT_SHIFT : // >>> (15.18) - case TokenNameLESS : // < (15.19.1) - case TokenNameLESS_EQUAL : // <= (15.19.1) - case TokenNameGREATER : // > (15.19.1) - case TokenNameGREATER_EQUAL : // >= (15.19.1) - // case TokenNameinstanceof : // instanceof - case TokenNameEQUAL_EQUAL : // == (15.20, 15.20.1, 15.20.2, 15.20.3) - case TokenNameEQUAL_EQUAL_EQUAL : // == (15.20, 15.20.1, 15.20.2, 15.20.3) - case TokenNameNOT_EQUAL : // != (15.20, 15.20.1, 15.20.2, 15.20.3) - case TokenNameNOT_EQUAL_EQUAL : // != (15.20, 15.20.1, 15.20.2, 15.20.3) - case TokenNameAND : // & (15.21, 15.21.1, 15.21.2) - case TokenNameOR : // | (15.21, 15.21.1, 15.21.2) - case TokenNameXOR : // ^ (15.21, 15.21.1, 15.21.2) - case TokenNameAND_AND : // && (15.22) - case TokenNameOR_OR : // || (15.23) - case TokenNameQUESTION : // ? (15.24) - case TokenNameMULTIPLY_EQUAL : // *= (15.25.2) - case TokenNameDIVIDE_EQUAL : // /= (15.25.2) - case TokenNameREMAINDER_EQUAL : // %= (15.25.2) - case TokenNamePLUS_EQUAL : // += (15.25.2) - case TokenNameMINUS_EQUAL : // -= (15.25.2) - case TokenNameLEFT_SHIFT_EQUAL : // <<= (15.25.2) - case TokenNameRIGHT_SHIFT_EQUAL : // >>= (15.25.2) - // case TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL : // >>>= (15.25.2) - case TokenNameAND_EQUAL : // &= (15.25.2) - case TokenNameXOR_EQUAL : // ^= (15.25.2) - case TokenNameOR_EQUAL : // |= (15.25.2) - - if ((openParenthesisPositionCount < splitTokenDepth - || (openParenthesisPositionCount == splitTokenDepth && splitTokenPriority > getTokenPriority(currentToken))) - && !((currentToken == TokenNamePLUS || currentToken == TokenNameMINUS) - && (previousToken == TokenNameLBRACE || previousToken == TokenNameLBRACKET || splitScanner.startPosition == 0))) { + // case TokenNameimplements : + // case TokenNamethrows : + case TokenNameDOT : + // . + case TokenNameMULTIPLY : + // * (15.16.1) + case TokenNameDIVIDE : + // / (15.16.2) + case TokenNameREMAINDER : + // % (15.16.3) + case TokenNamePLUS : + // + (15.17, 15.17.2) + case TokenNameMINUS : + // - (15.17.2) + case TokenNameLEFT_SHIFT : + // << (15.18) + case TokenNameRIGHT_SHIFT : + // >> (15.18) + // case TokenNameUNSIGNED_RIGHT_SHIFT : // >>> (15.18) + case TokenNameLESS : + // < (15.19.1) + case TokenNameLESS_EQUAL : + // <= (15.19.1) + case TokenNameGREATER : + // > (15.19.1) + case TokenNameGREATER_EQUAL : + // >= (15.19.1) + // case TokenNameinstanceof : // instanceof + case TokenNameEQUAL_EQUAL : + // == (15.20, 15.20.1, 15.20.2, 15.20.3) + case TokenNameEQUAL_EQUAL_EQUAL : + // == (15.20, 15.20.1, 15.20.2, 15.20.3) + case TokenNameNOT_EQUAL : + // != (15.20, 15.20.1, 15.20.2, 15.20.3) + case TokenNameNOT_EQUAL_EQUAL : + // != (15.20, 15.20.1, 15.20.2, 15.20.3) + case TokenNameAND : + // & (15.21, 15.21.1, 15.21.2) + case TokenNameOR : + // | (15.21, 15.21.1, 15.21.2) + case TokenNameXOR : + // ^ (15.21, 15.21.1, 15.21.2) + case TokenNameAND_AND : + // && (15.22) + case TokenNameOR_OR : + // || (15.23) + case TokenNameQUESTION : + // ? (15.24) + case TokenNameMULTIPLY_EQUAL : + // *= (15.25.2) + case TokenNameDIVIDE_EQUAL : + // /= (15.25.2) + case TokenNameREMAINDER_EQUAL : + // %= (15.25.2) + case TokenNamePLUS_EQUAL : + // += (15.25.2) + case TokenNameMINUS_EQUAL : + // -= (15.25.2) + case TokenNameLEFT_SHIFT_EQUAL : + // <<= (15.25.2) + case TokenNameRIGHT_SHIFT_EQUAL : + // >>= (15.25.2) + // case TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL : // >>>= (15.25.2) + case TokenNameAND_EQUAL : + // &= (15.25.2) + case TokenNameXOR_EQUAL : + // ^= (15.25.2) + case TokenNameOR_EQUAL : + // |= (15.25.2) + if ((openParenthesisPositionCount < splitTokenDepth || (openParenthesisPositionCount == splitTokenDepth && splitTokenPriority > getTokenPriority(currentToken))) + && !((currentToken == TokenNamePLUS || currentToken == TokenNameMINUS) && (previousToken == TokenNameLBRACE + || previousToken == TokenNameLBRACKET || splitScanner.startPosition == 0))) { // the current token is better than the one we currently have // (in level or in priority if same level) // reset the substringsCount @@ -2198,11 +2255,11 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { splitTokenType = currentToken; splitTokenPriority = getTokenPriority(currentToken); substringsStartPositions[0] = 0; - // better token means the whole line until now is the first substring - - if (separateFirstArgumentOn(firstTokenOnLine) && openParenthesisPositionCount > 0) { + // better token means the whole line until now is the first + // substring + if (separateFirstArgumentOn(firstTokenOnLine) + && openParenthesisPositionCount > 0) { substringsCount = 2; // resets the count of substrings - substringsEndPositions[0] = openParenthesisPosition[splitTokenDepth - 1]; substringsStartPositions[1] = openParenthesisPosition[splitTokenDepth - 1]; substringsEndPositions[1] = splitScanner.startPosition; @@ -2214,39 +2271,38 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { // next substring will start from operator end } else { substringsCount = 1; // resets the count of substrings - substringsEndPositions[0] = splitScanner.startPosition; // substring ends on operator start position = splitScanner.currentPosition; // next substring will start from operator end splitOperatorsCount = 2; // resets the count of split operators splitOperators[0] = 0; - // nothing for first operand since operator will be inserted in front of the second operand + // nothing for first operand since operator will be inserted in + // front of the second operand splitOperators[1] = currentToken; - } } else { - if (openParenthesisPositionCount == splitTokenDepth && splitTokenPriority == getTokenPriority(currentToken)) { + if (openParenthesisPositionCount == splitTokenDepth + && splitTokenPriority == getTokenPriority(currentToken)) { // if another token with the same priority is found, // push the start position of the substring and // push the token into the stack. // create a new array object if the current one is full. if (substringsCount == substringsStartPositions.length) { - System.arraycopy( - substringsStartPositions, - 0, - (substringsStartPositions = new int[substringsCount * 2]), - 0, - substringsCount); - System.arraycopy( - substringsEndPositions, - 0, - (substringsEndPositions = new int[substringsCount * 2]), - 0, - substringsCount); + System + .arraycopy( + substringsStartPositions, + 0, + (substringsStartPositions = new int[substringsCount * 2]), + 0, substringsCount); + System.arraycopy(substringsEndPositions, 0, + (substringsEndPositions = new int[substringsCount * 2]), + 0, substringsCount); } if (splitOperatorsCount == splitOperators.length) { - System.arraycopy(splitOperators, 0, (splitOperators = new int[splitOperatorsCount * 2]), 0, splitOperatorsCount); + System.arraycopy(splitOperators, 0, + (splitOperators = new int[splitOperatorsCount * 2]), 0, + splitOperatorsCount); } substringsStartPositions[substringsCount] = position; substringsEndPositions[substringsCount++] = splitScanner.startPosition; @@ -2271,32 +2327,30 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { // if the string cannot be split, return null. if (splitOperatorsCount == 0) return null; - // ## SPECIAL CASES BEGIN - if (((splitOperatorsCount == 2 - && splitOperators[1] == TokenNameDOT - && splitTokenDepth == 0 - && lastOpenParenthesisPosition > -1) - || (splitOperatorsCount > 2 - && splitOperators[1] == TokenNameDOT - && splitTokenDepth == 0 - && lastOpenParenthesisPosition > -1 - && lastOpenParenthesisPosition <= options.maxLineLength) - || (separateFirstArgumentOn(firstTokenOnLine) && splitTokenDepth > 0 && lastOpenParenthesisPosition > -1)) - && (lastOpenParenthesisPosition < splitScanner.source.length && splitScanner.source[lastOpenParenthesisPosition] != ')')) { - // fix for 1FH4J2H: LFCOM:WINNT - Formatter - Empty parenthesis should not be broken on two lines + if (((splitOperatorsCount == 2 && splitOperators[1] == TokenNameDOT + && splitTokenDepth == 0 && lastOpenParenthesisPosition > -1) + || (splitOperatorsCount > 2 && splitOperators[1] == TokenNameDOT + && splitTokenDepth == 0 && lastOpenParenthesisPosition > -1 && lastOpenParenthesisPosition <= options.maxLineLength) || (separateFirstArgumentOn(firstTokenOnLine) + && splitTokenDepth > 0 && lastOpenParenthesisPosition > -1)) + && (lastOpenParenthesisPosition < splitScanner.source.length && splitScanner.source[lastOpenParenthesisPosition] != ')')) { + // fix for 1FH4J2H: LFCOM:WINNT - Formatter - Empty parenthesis should + // not be broken on two lines // only one split on a top level . - // or more than one split on . and substring before open parenthesis fits one line. + // or more than one split on . and substring before open parenthesis fits + // one line. // or split inside parenthesis and first token is not a for/while/if - SplitLine sl = split(stringToSplit.substring(lastOpenParenthesisPosition), lastOpenParenthesisPosition); + SplitLine sl = split( + stringToSplit.substring(lastOpenParenthesisPosition), + lastOpenParenthesisPosition); if (sl == null || sl.operators[0] != TokenNameCOMMA) { - // trim() is used to remove the extra blanks at the end of the substring. See PR 1FGYPI1 - return new SplitLine( - new int[] { 0, 0 }, - new String[] { + // trim() is used to remove the extra blanks at the end of the + // substring. See PR 1FGYPI1 + return new SplitLine(new int[]{0, 0}, new String[]{ stringToSplit.substring(0, lastOpenParenthesisPosition).trim(), - stringToSplit.substring(lastOpenParenthesisPosition)}, - new int[] { offsetInGlobalLine, lastOpenParenthesisPosition + offsetInGlobalLine }); + stringToSplit.substring(lastOpenParenthesisPosition)}, new int[]{ + offsetInGlobalLine, + lastOpenParenthesisPosition + offsetInGlobalLine}); } else { // right substring can be split and is split on comma // copy substrings and operators @@ -2307,23 +2361,26 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { int[] startIndexes = new int[subStringsLength]; int operatorsLength = sl.operators.length + 1 - startIndex; int[] operators = new int[operatorsLength]; - result[0] = stringToSplit.substring(0, lastOpenParenthesisPosition); operators[0] = 0; - - System.arraycopy(sl.startSubstringsIndexes, startIndex, startIndexes, 1, subStringsLength - 1); + System.arraycopy(sl.startSubstringsIndexes, startIndex, startIndexes, + 1, subStringsLength - 1); for (int i = subStringsLength - 1; i >= 0; i--) { startIndexes[i] += offsetInGlobalLine; } - System.arraycopy(sl.substrings, startIndex, result, 1, subStringsLength - 1); - System.arraycopy(sl.operators, startIndex, operators, 1, operatorsLength - 1); - + System.arraycopy(sl.substrings, startIndex, result, 1, + subStringsLength - 1); + System.arraycopy(sl.operators, startIndex, operators, 1, + operatorsLength - 1); return new SplitLine(operators, result, startIndexes); } } - // if the last token is a comment and the substring before the comment fits on a line, + // if the last token is a comment and the substring before the comment fits + // on a line, // split before the comment and return the result. - if (lastCommentStartPosition > -1 && lastCommentStartPosition < options.maxLineLength && splitTokenPriority > 50) { + if (lastCommentStartPosition > -1 + && lastCommentStartPosition < options.maxLineLength + && splitTokenPriority > 50) { int end = lastCommentStartPosition; int start = lastCommentStartPosition; if (stringToSplit.charAt(end - 1) == ' ') { @@ -2332,31 +2389,31 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { if (start != end && stringToSplit.charAt(start) == ' ') { start++; } - return new SplitLine( - new int[] { 0, 0 }, - new String[] { stringToSplit.substring(0, end), stringToSplit.substring(start)}, - new int[] { 0, start }); + return new SplitLine(new int[]{0, 0}, new String[]{ + stringToSplit.substring(0, end), stringToSplit.substring(start)}, + new int[]{0, start}); } if (position != stringToSplit.length()) { if (substringsCount == substringsStartPositions.length) { - System.arraycopy( - substringsStartPositions, - 0, - (substringsStartPositions = new int[substringsCount * 2]), - 0, - substringsCount); - System.arraycopy(substringsEndPositions, 0, (substringsEndPositions = new int[substringsCount * 2]), 0, substringsCount); + System.arraycopy(substringsStartPositions, 0, + (substringsStartPositions = new int[substringsCount * 2]), 0, + substringsCount); + System.arraycopy(substringsEndPositions, 0, + (substringsEndPositions = new int[substringsCount * 2]), 0, + substringsCount); } // avoid empty extra substring, e.g. line terminated with a semi-colon substringsStartPositions[substringsCount] = position; substringsEndPositions[substringsCount++] = stringToSplit.length(); } if (splitOperatorsCount == splitOperators.length) { - System.arraycopy(splitOperators, 0, (splitOperators = new int[splitOperatorsCount * 2]), 0, splitOperatorsCount); + System.arraycopy(splitOperators, 0, + (splitOperators = new int[splitOperatorsCount * 2]), 0, + splitOperatorsCount); } splitOperators[splitOperatorsCount] = 0; - - // the last element of the stack is the position of the end of StringToSPlit + // the last element of the stack is the position of the end of + // StringToSPlit // +1 because the substring method excludes the last character String[] result = new String[substringsCount]; for (int i = 0; i < substringsCount; i++) { @@ -2373,29 +2430,41 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { substringsStartPositions[i] += offsetInGlobalLine; } if (splitOperatorsCount > substringsCount) { - System.arraycopy(substringsStartPositions, 0, (substringsStartPositions = new int[splitOperatorsCount]), 0, substringsCount); - System.arraycopy(substringsEndPositions, 0, (substringsEndPositions = new int[splitOperatorsCount]), 0, substringsCount); + System.arraycopy(substringsStartPositions, 0, + (substringsStartPositions = new int[splitOperatorsCount]), 0, + substringsCount); + System.arraycopy(substringsEndPositions, 0, + (substringsEndPositions = new int[splitOperatorsCount]), 0, + substringsCount); for (int i = substringsCount; i < splitOperatorsCount; i++) { substringsStartPositions[i] = position; substringsEndPositions[i] = position; } - System.arraycopy(splitOperators, 0, (splitOperators = new int[splitOperatorsCount]), 0, splitOperatorsCount); + System.arraycopy(splitOperators, 0, + (splitOperators = new int[splitOperatorsCount]), 0, + splitOperatorsCount); } else { - System.arraycopy(substringsStartPositions, 0, (substringsStartPositions = new int[substringsCount]), 0, substringsCount); - System.arraycopy(substringsEndPositions, 0, (substringsEndPositions = new int[substringsCount]), 0, substringsCount); - System.arraycopy(splitOperators, 0, (splitOperators = new int[substringsCount]), 0, substringsCount); + System.arraycopy(substringsStartPositions, 0, + (substringsStartPositions = new int[substringsCount]), 0, + substringsCount); + System.arraycopy(substringsEndPositions, 0, + (substringsEndPositions = new int[substringsCount]), 0, + substringsCount); + System.arraycopy(splitOperators, 0, + (splitOperators = new int[substringsCount]), 0, substringsCount); } - SplitLine splitLine = new SplitLine(splitOperators, result, substringsStartPositions); + SplitLine splitLine = new SplitLine(splitOperators, result, + substringsStartPositions); return splitLine; } - private void updateMappedPositions(int startPosition) { if (positionsToMap == null) { return; } char[] source = scanner.source; int sourceLength = source.length; - while (indexToMap < positionsToMap.length && positionsToMap[indexToMap] <= startPosition) { + while (indexToMap < positionsToMap.length + && positionsToMap[indexToMap] <= startPosition) { int posToMap = positionsToMap[indexToMap]; if (posToMap < 0 || posToMap >= sourceLength) { // protection against out of bounds position @@ -2417,20 +2486,17 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { indexToMap++; } } - - private void updateMappedPositionsWhileSplitting(int startPosition, int endPosition) { + private void updateMappedPositionsWhileSplitting(int startPosition, + int endPosition) { if (mappedPositions == null || mappedPositions.length == indexInMap) return; - while (indexInMap < mappedPositions.length - && startPosition <= mappedPositions[indexInMap] - && mappedPositions[indexInMap] < endPosition - && indexInMap < indexToMap) { + && startPosition <= mappedPositions[indexInMap] + && mappedPositions[indexInMap] < endPosition && indexInMap < indexToMap) { mappedPositions[indexInMap] += splitDelta; indexInMap++; } } - private int getLength(String s, int tabDepth) { int length = 0; for (int i = 0; i < tabDepth; i++) { @@ -2448,13 +2514,14 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } return length; } - - /** - * Sets the initial indentation level - * @param indentationLevel new indentation level - * - * @deprecated - */ + /** + * Sets the initial indentation level + * + * @param indentationLevel + * new indentation level + * + * @deprecated + */ public void setInitialIndentationLevel(int newIndentationLevel) { this.initialIndentationLevel = currentLineIndentationLevel = indentationLevel = newIndentationLevel; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/DeclarationEngine.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/DeclarationEngine.java index 91ce5e7..f3f9132 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/DeclarationEngine.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/template/DeclarationEngine.java @@ -124,7 +124,7 @@ public class DeclarationEngine { continue; // for loop } break; - case ITerminalSymbols.TokenNamethis : + case ITerminalSymbols.TokenNameVariable : if (type != PHPIdentifierLocation.METHOD && type != PHPIdentifierLocation.VARIABLE) { continue; // for loop } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java index 056edbe..fbabccb 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java @@ -172,8 +172,7 @@ public class IdentifierIndexManager { } } } - } else if ((fToken == TokenNameLBRACE) - || (fToken == TokenNameDOLLAR_LBRACE)) { + } else if (fToken == TokenNameLBRACE) { getNextToken(); counter++; } else if (fToken == TokenNameRBRACE) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/obfuscator/ObfuscatorPass1Exporter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/obfuscator/ObfuscatorPass1Exporter.java index dcd9a6e..ab2d8f9 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/obfuscator/ObfuscatorPass1Exporter.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/obfuscator/ObfuscatorPass1Exporter.java @@ -142,7 +142,7 @@ public class ObfuscatorPass1Exporter implements ITerminalSymbols { } getNextToken(); - } else if ((fToken == TokenNameLBRACE) || (fToken == TokenNameDOLLAR_LBRACE)) { + } else if (fToken == TokenNameLBRACE) { getNextToken(); counter++; } else if (fToken == TokenNameRBRACE) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCompletionProcessor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCompletionProcessor.java index b0ba0b8..de0473e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCompletionProcessor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/php/PHPCompletionProcessor.java @@ -224,8 +224,8 @@ public class PHPCompletionProcessor implements IContentAssistProcessor { case ITerminalSymbols.TokenNameMINUS_GREATER : // dereferencing operator '->' found lastSignificantToken = ITerminalSymbols.TokenNameMINUS_GREATER; - if (beforeLastToken == ITerminalSymbols.TokenNamethis) { - lastSignificantToken = ITerminalSymbols.TokenNamethis; + if (beforeLastToken == ITerminalSymbols.TokenNameVariable) { + lastSignificantToken = ITerminalSymbols.TokenNameVariable; } break; case ITerminalSymbols.TokenNamenew : @@ -270,7 +270,7 @@ public class PHPCompletionProcessor implements IContentAssistProcessor { int lastSignificantToken = getLastToken(viewer, offset, context); boolean useClassMembers = (lastSignificantToken == ITerminalSymbols.TokenNameMINUS_GREATER) || - (lastSignificantToken == ITerminalSymbols.TokenNamethis) || + (lastSignificantToken == ITerminalSymbols.TokenNameVariable) || (lastSignificantToken == ITerminalSymbols.TokenNamenew); boolean emptyPrefix = prefix == null || prefix.equals(""); -- 1.7.1 From 89ec47da99aac77201eb11be31ad8f6b6c2e4f4a Mon Sep 17 00:00:00 2001 From: khartlage Date: Mon, 22 Mar 2004 21:11:35 +0000 Subject: [PATCH 05/16] misc changes in the internal builder --- .../sourceforge/phpdt/core/IJavaModelMarker.java | 9 +- .../src/net/sourceforge/phpdt/core/JavaCore.java | 6440 +++++++++++--------- .../net/sourceforge/phpdt/core/ToolFactory.java | 7 +- .../phpdt/core/compiler/ITerminalSymbols.java | 2 +- .../phpdt/internal/compiler/parser/Parser.java | 151 +- .../phpdt/internal/compiler/parser/Scanner.java | 6 +- .../phpdt/internal/core/ClasspathEntry.java | 12 +- .../core/CompilationUnitProblemFinder.java | 4 +- .../core/CopyResourceElementsOperation.java | 6 +- .../phpdt/internal/core/DeltaProcessor.java | 6 +- .../phpdt/internal/core/JavaModelManager.java | 46 +- .../phpdt/internal/core/JavaModelStatus.java | 16 +- .../phpdt/internal/core/JavaProject.java | 28 +- .../phpdt/internal/core/NameLookup.java | 4 +- .../phpdt/internal/core/PackageFragmentRoot.java | 4 +- .../net/sourceforge/phpdt/internal/core/Util.java | 8 +- .../phpdt/internal/core/WorkingCopy.java | 4 +- .../core/builder/AbstractImageBuilder.java | 10 +- .../internal/core/builder/BatchImageBuilder.java | 6 +- .../core/builder/IncrementalImageBuilder.java | 290 +- .../internal/core/builder/NameEnvironment.java | 6 +- .../phpdt/internal/core/builder/PHPBuilder.java | 16 +- .../phpdt/internal/core/builder/State.java | 485 +- .../phpdt/internal/core/jdom/DOMBuilder.java | 4 +- .../phpdt/internal/core/jdom/SimpleDOMBuilder.java | 4 +- .../ui/actions/WorkbenchRunnableAdapter.java | 4 +- .../preferences/CodeFormatterPreferencePage.java | 48 +- .../ui/preferences/PHPEditorPreferencePage.java | 4 +- .../phpdt/internal/ui/util/PHPProjectSelector.java | 4 +- .../src/net/sourceforge/phpdt/ui/JavaUI.java | 4 +- .../ui/StandardJavaElementContentProvider.java | 6 +- .../phpdt/ui/wizards/NewContainerWizardPage.java | 8 +- .../src/net/sourceforge/phpeclipse/PHPCore.java | 3780 ------------ .../sourceforge/phpeclipse/PHPeclipsePlugin.java | 461 +- .../phpeclipse/phpeditor/JavaMarkerAnnotation.java | 13 +- .../phpeclipse/phpeditor/JavaOutlinePage.java | 8 +- .../phpeditor/JavaSelectMarkerRulerAction.java | 2 - .../phpeclipse/phpeditor/PHPDocumentProvider.java | 4 +- .../phpeclipse/phpeditor/PHPEditor.java | 4 +- .../phpeditor/PHPSourceViewerConfiguration.java | 5 +- .../phpeclipse/phpeditor/PHPUnitEditor.java | 4 +- .../resourcesview/ResourceAdapterFactory.java | 10 +- .../wizards/NewProjectCreationWizard.java | 4 +- .../phpeclipse/wizards/TempnewPHPProject.java | 4 +- 44 files changed, 4356 insertions(+), 7595 deletions(-) delete mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPCore.java diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelMarker.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelMarker.java index 22cce48..e31c253 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelMarker.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/IJavaModelMarker.java @@ -10,7 +10,6 @@ *******************************************************************************/ package net.sourceforge.phpdt.core; -import net.sourceforge.phpeclipse.PHPCore; /** * Markers used by the Java model. @@ -26,7 +25,7 @@ public interface IJavaModelMarker { * This can be used to recognize those markers in the workspace that flag problems * detected by the Java tooling during compilation. */ - public static final String JAVA_MODEL_PROBLEM_MARKER = PHPCore.PLUGIN_ID + ".problem"; //$NON-NLS-1$ + public static final String JAVA_MODEL_PROBLEM_MARKER = JavaCore.PLUGIN_ID + ".problem"; //$NON-NLS-1$ /** @@ -35,7 +34,7 @@ public interface IJavaModelMarker { * problems detected by the Java tooling (such as a problem * detected by the outliner, or a problem detected during a code completion) */ - public static final String TRANSIENT_PROBLEM = PHPCore.PLUGIN_ID + ".transient_problem"; //$NON-NLS-1$ + public static final String TRANSIENT_PROBLEM = JavaCore.PLUGIN_ID + ".transient_problem"; //$NON-NLS-1$ /** * Java model task marker type (value "org.eclipse.jdt.core.task"). @@ -45,7 +44,7 @@ public interface IJavaModelMarker { * option "org.eclipse.jdt.core.compiler.taskTag". * @since 2.1 */ - public static final String TASK_MARKER = PHPCore.PLUGIN_ID + ".task"; //$NON-NLS-1$ + public static final String TASK_MARKER = JavaCore.PLUGIN_ID + ".task"; //$NON-NLS-1$ /** @@ -81,7 +80,7 @@ public interface IJavaModelMarker { * This can be used to recognize those markers in the workspace that flag problems * detected by the Java tooling during classpath setting. */ - public static final String BUILDPATH_PROBLEM_MARKER = PHPCore.PLUGIN_ID + ".buildpath_problem"; //$NON-NLS-1$ + public static final String BUILDPATH_PROBLEM_MARKER = JavaCore.PLUGIN_ID + ".buildpath_problem"; //$NON-NLS-1$ /** * Classpath file format marker attribute (value "classpathFileFormat"). diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java index 6e8531b..440e421 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/JavaCore.java @@ -1,55 +1,29 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * IBM Corporation - added the following constants: - * COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE - * COMPILER_PB_STATIC_ACCESS_RECEIVER - * COMPILER_TASK_TAGS - * CORE_CIRCULAR_CLASSPATH - * CORE_INCOMPLETE_CLASSPATH - * IBM Corporation - added run(IWorkspaceRunnable, IProgressMonitor) - * IBM Corporation - added exclusion patterns to source classpath entries - * IBM Corporation - added specific output location to source classpath entries - * IBM Corporation - added the following constants: - * CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER - * CLEAN - * IBM Corporation - added getClasspathContainerInitializer(String) - * IBM Corporation - added the following constants: - * CODEASSIST_ARGUMENT_PREFIXES - * CODEASSIST_ARGUMENT_SUFFIXES - * CODEASSIST_FIELD_PREFIXES - * CODEASSIST_FIELD_SUFFIXES - * CODEASSIST_LOCAL_PREFIXES - * CODEASSIST_LOCAL_SUFFIXES - * CODEASSIST_STATIC_FIELD_PREFIXES - * CODEASSIST_STATIC_FIELD_SUFFIXES - * COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION - *******************************************************************************/ package net.sourceforge.phpdt.core; +import java.io.File; +import java.util.ArrayList; import java.util.Collection; import java.util.Enumeration; import java.util.HashSet; import java.util.Hashtable; +import java.util.List; import java.util.Map; import net.sourceforge.phpdt.internal.core.BatchOperation; import net.sourceforge.phpdt.internal.core.BufferManager; +import net.sourceforge.phpdt.internal.core.ClasspathEntry; import net.sourceforge.phpdt.internal.core.JavaModel; import net.sourceforge.phpdt.internal.core.JavaModelManager; import net.sourceforge.phpdt.internal.core.Region; +import net.sourceforge.phpdt.internal.corext.Assert; +import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IMarkerDelta; import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceChangeEvent; import org.eclipse.core.resources.IWorkspace; @@ -58,3181 +32,3739 @@ import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExecutableExtension; -import org.eclipse.core.runtime.IPluginDescriptor; +import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Preferences; +public class JavaCore { + +// public static HashSet OptionNames = new HashSet(20); + /** + * The plug-in identifier of the Java core support + * (value "org.phpeclipse.phpdt.core"). + */ +// public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.core"; //$NON-NLS-1$ + public static final String PLUGIN_ID = PHPeclipsePlugin.PLUGIN_ID; + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String CORE_ENCODING = PLUGIN_ID + ".encoding"; //$NON-NLS-1$ + + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String FORMATTER_NEWLINE_OPENING_BRACE = PLUGIN_ID + ".formatter.newline.openingBrace"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String FORMATTER_NEWLINE_CONTROL = PLUGIN_ID + ".formatter.newline.controlStatement"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String FORMATTER_NEWLINE_ELSE_IF = PLUGIN_ID + ".formatter.newline.elseIf"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String FORMATTER_NEWLINE_EMPTY_BLOCK = PLUGIN_ID + ".formatter.newline.emptyBlock"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String FORMATTER_CLEAR_BLANK_LINES = PLUGIN_ID + ".formatter.newline.clearAll"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String FORMATTER_LINE_SPLIT = PLUGIN_ID + ".formatter.lineSplit"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String FORMATTER_COMPACT_ASSIGNMENT = PLUGIN_ID + ".formatter.style.assignment"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String FORMATTER_TAB_CHAR = PLUGIN_ID + ".formatter.tabulation.char"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String FORMATTER_TAB_SIZE = PLUGIN_ID + ".formatter.tabulation.size"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String INSERT = "insert"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String DO_NOT_INSERT = "do not insert"; //$NON-NLS-1$ + + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String PRESERVE_ONE = "preserve one"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String CLEAR_ALL = "clear all"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String NORMAL = "normal"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String COMPACT = "compact"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String TAB = "tab"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String SPACE = "space"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String ENABLED = "enabled"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String DISABLED = "disabled"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CLEAN = "clean"; //$NON-NLS-1$ + + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_TASK_TAGS = PLUGIN_ID + ".compiler.taskTags"; //$NON-NLS-1$ + + /** + * Name of the handle id attribute in a Java marker. + */ + protected static final String ATT_HANDLE_ID = + "net.sourceforge.phpdt.internal.core.JavaModelManager.handleId" ; //$NON-NLS-1$ + + // *************** Possible IDs for configurable options. ******************** + + /** + * Possible configurable option ID. + * @see #getDefaultOptions() + */ + public static final String COMPILER_LOCAL_VARIABLE_ATTR = PLUGIN_ID + ".compiler.debug.localVariable"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions() + */ + public static final String COMPILER_LINE_NUMBER_ATTR = PLUGIN_ID + ".compiler.debug.lineNumber"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_SOURCE_FILE_ATTR = PLUGIN_ID + ".compiler.debug.sourceFile"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_CODEGEN_UNUSED_LOCAL = PLUGIN_ID + ".compiler.codegen.unusedLocal"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_CODEGEN_TARGET_PLATFORM = PLUGIN_ID + ".compiler.codegen.targetPlatform"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_PB_UNREACHABLE_CODE = PLUGIN_ID + ".compiler.problem.unreachableCode"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_PB_INVALID_IMPORT = PLUGIN_ID + ".compiler.problem.invalidImport"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD = PLUGIN_ID + ".compiler.problem.overridingPackageDefaultMethod"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME = PLUGIN_ID + ".compiler.problem.methodWithConstructorName"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_PB_DEPRECATION = PLUGIN_ID + ".compiler.problem.deprecation"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE = PLUGIN_ID + ".compiler.problem.deprecationInDeprecatedCode"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_PB_HIDDEN_CATCH_BLOCK = PLUGIN_ID + ".compiler.problem.hiddenCatchBlock"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_PB_UNUSED_LOCAL = PLUGIN_ID + ".compiler.problem.unusedLocal"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_PB_UNUSED_PARAMETER = PLUGIN_ID + ".compiler.problem.unusedParameter"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT = PLUGIN_ID + ".compiler.problem.unusedParameterWhenImplementingAbstract"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE = PLUGIN_ID + ".compiler.problem.unusedParameterWhenOverridingConcrete"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String COMPILER_PB_UNUSED_IMPORT = PLUGIN_ID + ".compiler.problem.unusedImport"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String COMPILER_PB_SYNTHETIC_ACCESS_EMULATION = PLUGIN_ID + ".compiler.problem.syntheticAccessEmulation"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String COMPILER_PB_NON_NLS_STRING_LITERAL = PLUGIN_ID + ".compiler.problem.nonExternalizedStringLiteral"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String COMPILER_PB_ASSERT_IDENTIFIER = PLUGIN_ID + ".compiler.problem.assertIdentifier"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_PB_STATIC_ACCESS_RECEIVER = PLUGIN_ID + ".compiler.problem.staticAccessReceiver"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_PB_NO_EFFECT_ASSIGNMENT = PLUGIN_ID + ".compiler.problem.noEffectAssignment"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD = PLUGIN_ID + ".compiler.problem.incompatibleNonInheritedInterfaceMethod"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_PB_UNUSED_PRIVATE_MEMBER = PLUGIN_ID + ".compiler.problem.unusedPrivateMember"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION = PLUGIN_ID + ".compiler.problem.noImplicitStringConversion"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String COMPILER_PB_MAX_PER_UNIT = PLUGIN_ID + ".compiler.maxProblemPerUnit"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String COMPILER_SOURCE = PLUGIN_ID + ".compiler.source"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String COMPILER_COMPLIANCE = PLUGIN_ID + ".compiler.compliance"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_TASK_PRIORITIES = PLUGIN_ID + ".compiler.taskPriorities"; //$NON-NLS-1$ + /** + * Possible configurable option value for COMPILER_TASK_PRIORITIES. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_TASK_PRIORITY_HIGH = "HIGH"; //$NON-NLS-1$ + /** + * Possible configurable option value for COMPILER_TASK_PRIORITIES. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_TASK_PRIORITY_LOW = "LOW"; //$NON-NLS-1$ + /** + * Possible configurable option value for COMPILER_TASK_PRIORITIES. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String COMPILER_TASK_PRIORITY_NORMAL = "NORMAL"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + */ + public static final String CORE_JAVA_BUILD_ORDER = PLUGIN_ID + ".computeJavaBuildOrder"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String CORE_JAVA_BUILD_RESOURCE_COPY_FILTER = PLUGIN_ID + ".builder.resourceCopyExclusionFilter"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CORE_JAVA_BUILD_DUPLICATE_RESOURCE = PLUGIN_ID + ".builder.duplicateResourceTask"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER = PLUGIN_ID + ".builder.cleanOutputFolder"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CORE_INCOMPLETE_CLASSPATH = PLUGIN_ID + ".incompleteClasspath"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CORE_CIRCULAR_CLASSPATH = PLUGIN_ID + ".circularClasspath"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String CORE_JAVA_BUILD_INVALID_CLASSPATH = PLUGIN_ID + ".builder.invalidClasspath"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS = PLUGIN_ID + ".classpath.exclusionPatterns"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS = PLUGIN_ID + ".classpath.multipleOutputLocations"; //$NON-NLS-1$ + /** + * Default task tag + * @since 2.1 + */ + public static final String DEFAULT_TASK_TAG = "TODO"; //$NON-NLS-1$ + /** + * Default task priority + * @since 2.1 + */ + public static final String DEFAULT_TASK_PRIORITY = "NORMAL"; //$NON-NLS-1$ + /** + * Possible configurable option ID + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String FORMATTER_SPACE_CASTEXPRESSION = PLUGIN_ID + ".formatter.space.castexpression"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String CODEASSIST_VISIBILITY_CHECK = PLUGIN_ID + ".codeComplete.visibilityCheck"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String CODEASSIST_IMPLICIT_QUALIFICATION = PLUGIN_ID + ".codeComplete.forceImplicitQualification"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CODEASSIST_FIELD_PREFIXES = PLUGIN_ID + ".codeComplete.fieldPrefixes"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CODEASSIST_STATIC_FIELD_PREFIXES = PLUGIN_ID + ".codeComplete.staticFieldPrefixes"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CODEASSIST_LOCAL_PREFIXES = PLUGIN_ID + ".codeComplete.localPrefixes"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CODEASSIST_ARGUMENT_PREFIXES = PLUGIN_ID + ".codeComplete.argumentPrefixes"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CODEASSIST_FIELD_SUFFIXES = PLUGIN_ID + ".codeComplete.fieldSuffixes"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CODEASSIST_STATIC_FIELD_SUFFIXES = PLUGIN_ID + ".codeComplete.staticFieldSuffixes"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CODEASSIST_LOCAL_SUFFIXES = PLUGIN_ID + ".codeComplete.localSuffixes"; //$NON-NLS-1$ + /** + * Possible configurable option ID. + * @see #getDefaultOptions + * @since 2.1 + */ + public static final String CODEASSIST_ARGUMENT_SUFFIXES = PLUGIN_ID + ".codeComplete.argumentSuffixes"; //$NON-NLS-1$ + + // *************** Possible values for configurable options. ******************** + + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String GENERATE = "generate"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String DO_NOT_GENERATE = "do not generate"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String PRESERVE = "preserve"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String OPTIMIZE_OUT = "optimize out"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String VERSION_1_1 = "1.1"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String VERSION_1_2 = "1.2"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String VERSION_1_3 = "1.3"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String VERSION_1_4 = "1.4"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + public static final String ABORT = "abort"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String ERROR = "error"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String WARNING = "warning"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String IGNORE = "ignore"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + */ + public static final String COMPUTE = "compute"; //$NON-NLS-1$ + /** + * Possible configurable option value. + * @see #getDefaultOptions + * @since 2.0 + */ + + + /** + * Returns a table of all known configurable options with their default values. + * These options allow to configure the behaviour of the underlying components. + * The client may safely use the result as a template that they can modify and + * then pass to setOptions. + * + * Helper constants have been defined on JavaCore for each of the option ID and + * their possible constant values. + * + * Note: more options might be added in further releases. + *
+   * RECOGNIZED OPTIONS:
+   * COMPILER / Generating Local Variable Debug Attribute
+   *    When generated, this attribute will enable local variable names 
+   *    to be displayed in debugger, only in place where variables are 
+   *    definitely assigned (.class file is then bigger)
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.debug.localVariable"
+   *     - possible values:   { "generate", "do not generate" }
+   *     - default:           "generate"
+   *
+   * COMPILER / Generating Line Number Debug Attribute 
+   *    When generated, this attribute will enable source code highlighting in debugger 
+   *    (.class file is then bigger).
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.debug.lineNumber"
+   *     - possible values:   { "generate", "do not generate" }
+   *     - default:           "generate"
+   *    
+   * COMPILER / Generating Source Debug Attribute 
+   *    When generated, this attribute will enable the debugger to present the 
+   *    corresponding source code.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.debug.sourceFile"
+   *     - possible values:   { "generate", "do not generate" }
+   *     - default:           "generate"
+   *    
+   * COMPILER / Preserving Unused Local Variables
+   *    Unless requested to preserve unused local variables (i.e. never read), the 
+   *    compiler will optimize them out, potentially altering debugging
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.codegen.unusedLocal"
+   *     - possible values:   { "preserve", "optimize out" }
+   *     - default:           "preserve"
+   * 
+   * COMPILER / Defining Target Java Platform
+   *    For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
+   *    Note that "1.4" target require to toggle compliance mode to "1.4" too.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.codegen.targetPlatform"
+   *     - possible values:   { "1.1", "1.2", "1.3", "1.4" }
+   *     - default:           "1.1"
+   *
+   * COMPILER / Reporting Unreachable Code
+   *    Unreachable code can optionally be reported as an error, warning or simply 
+   *    ignored. The bytecode generation will always optimized it out.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unreachableCode"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "error"
+   *
+   * COMPILER / Reporting Invalid Import
+   *    An import statement that cannot be resolved might optionally be reported 
+   *    as an error, as a warning or ignored.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.invalidImport"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "error"
+   *
+   * COMPILER / Reporting Attempt to Override Package-Default Method
+   *    A package default method is not visible in a different package, and thus 
+   *    cannot be overridden. When enabling this option, the compiler will signal 
+   *    such scenarii either as an error or a warning.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.overridingPackageDefaultMethod"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "warning"
+   *
+   * COMPILER / Reporting Method With Constructor Name
+   *    Naming a method with a constructor name is generally considered poor 
+   *    style programming. When enabling this option, the compiler will signal such 
+   *    scenarii either as an error or a warning.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.methodWithConstructorName"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "warning"
+   *
+   * COMPILER / Reporting Deprecation
+   *    When enabled, the compiler will signal use of deprecated API either as an 
+   *    error or a warning.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.deprecation"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "warning"
+   *
+   * COMPILER / Reporting Deprecation Inside Deprecated Code
+   *    When enabled, the compiler will signal use of deprecated API inside deprecated code.
+   *    The severity of the problem is controlled with option "org.phpeclipse.phpdt.core.compiler.problem.deprecation".
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.deprecationInDeprecatedCode"
+   *     - possible values:   { "enabled", "disabled" }
+   *     - default:           "disabled"
+   *
+   * COMPILER / Reporting Hidden Catch Block
+   *    Locally to a try statement, some catch blocks may hide others , e.g.
+   *      try {  throw new java.io.CharConversionException();
+   *      } catch (java.io.CharConversionException e) {
+   *      } catch (java.io.IOException e) {}. 
+   *    When enabling this option, the compiler will issue an error or a warning for hidden 
+   *    catch blocks corresponding to checked exceptions
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.hiddenCatchBlock"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "warning"
+   *
+   * COMPILER / Reporting Unused Local
+   *    When enabled, the compiler will issue an error or a warning for unused local 
+   *    variables (i.e. variables never read from)
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unusedLocal"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "ignore"
+   *
+   * COMPILER / Reporting Unused Parameter
+   *    When enabled, the compiler will issue an error or a warning for unused method 
+   *    parameters (i.e. parameters never read from)
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unusedParameter"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "ignore"
+   *
+   * COMPILER / Reporting Unused Import
+   *    When enabled, the compiler will issue an error or a warning for unused import 
+   *    reference 
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unusedImport"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "warning"
+   *
+   * COMPILER / Reporting Synthetic Access Emulation
+   *    When enabled, the compiler will issue an error or a warning whenever it emulates 
+   *    access to a non-accessible member of an enclosing type. Such access can have
+   *    performance implications.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.syntheticAccessEmulation"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "ignore"
+   *
+   * COMPILER / Reporting Non-Externalized String Literal
+   *    When enabled, the compiler will issue an error or a warning for non externalized 
+   *    String literal (i.e. non tagged with //$NON-NLS-$). 
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.nonExternalizedStringLiteral"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "ignore"
+   * 
+   * COMPILER / Reporting Usage of 'assert' Identifier
+   *    When enabled, the compiler will issue an error or a warning whenever 'assert' is 
+   *    used as an identifier (reserved keyword in 1.4)
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.assertIdentifier"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "ignore"
+   * 
+   * COMPILER / Reporting Usage of expression receiver on static invocation/field access
+   *    When enabled, the compiler will issue an error or a warning whenever a static field
+   *    or method is accessed with an expression receiver.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.staticAccessReceiver"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "warning"
+   * 
+   * COMPILER / Reporting Assignment with no effect
+   *    When enabled, the compiler will issue an error or a warning whenever an assignment
+   *    has no effect (e.g 'x = x').
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.noEffectAssignment"
+   *     - possible values:   { "error", "warning", "ignore" }
+   *     - default:           "warning"
+   * 
+   * COMPILER / Setting Source Compatibility Mode
+   *    Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
+   *    reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
+   *   level should be set to "1.4" and the compliance mode should be "1.4".
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.source"
+   *     - possible values:   { "1.3", "1.4" }
+   *     - default:           "1.3"
+   * 
+   * COMPILER / Setting Compliance Level
+   *    Select the compliance level for the compiler. In "1.3" mode, source and target settings
+   *    should not go beyond "1.3" level.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.compliance"
+   *     - possible values:   { "1.3", "1.4" }
+   *     - default:           "1.3"
+   * 
+   * COMPILER / Maximum number of problems reported per compilation unit
+   *    Specify the maximum number of problems reported on each compilation unit.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.maxProblemPerUnit"
+   *     - possible values:	"" where  is zero or a positive integer (if zero then all problems are reported).
+   *     - default:           "100"
+   * 
+   * COMPILER / Define the Automatic Task Tags
+   *    When the tag is non empty, the compiler will issue a task marker whenever it encounters
+   *    one of the corresponding tag inside any comment in Java source code.
+   *    Generated task messages will include the tag, and range until the next line separator or comment ending, and will be trimmed.
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.taskTags"
+   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+   *     - default:           ""
+   * COMPILER / Define the Automatic Task Priorities
+   *    In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
+   *    of the task markers issued by the compiler.
+   *    If the default is specified, the priority of each task marker is "NORMAL".
+   *     - option id:         "org.phpeclipse.phpdt.core.compiler.taskPriorities"
+   *     - possible values:   { "[,]*" } where  is one of "HIGH", "NORMAL" or "LOW"
+   *     - default:           ""
+   * 
+   * BUILDER / Specifying Filters for Resource Copying Control
+   *    Allow to specify some filters to control the resource copy process.
+   *     - option id:         "org.phpeclipse.phpdt.core.builder.resourceCopyExclusionFilter"
+   *     - possible values:   { "[,]* } where  is a file name pattern (* and ? wild-cards allowed)
+   *       or the name of a folder which ends with '/'
+   *     - default:           ""
+   * 
+   * BUILDER / Abort if Invalid Classpath
+   *    Allow to toggle the builder to abort if the classpath is invalid
+   *     - option id:         "org.phpeclipse.phpdt.core.builder.invalidClasspath"
+   *     - possible values:   { "abort", "ignore" }
+   *     - default:           "ignore"
+   * 
+   * BUILDER / Cleaning Output Folder(s)
+   *    Indicate whether the JavaBuilder is allowed to clean the output folders
+   *    when performing full build operations.
+   *     - option id:         "org.phpeclipse.phpdt.core.builder.cleanOutputFolder"
+   *     - possible values:   { "clean", "ignore" }
+   *     - default:           "clean"
+   * 
+   * JAVACORE / Computing Project Build Order
+   *    Indicate whether JavaCore should enforce the project build order to be based on
+   *    the classpath prerequisite chain. When requesting to compute, this takes over
+   *    the platform default order (based on project references).
+   *     - option id:         "org.phpeclipse.phpdt.core.computeJavaBuildOrder"
+   *     - possible values:   { "compute", "ignore" }
+   *     - default:           "ignore"	 
+   * 
+   * JAVACORE / Specify Default Source Encoding Format
+   *    Get the encoding format for compiled sources. This setting is read-only, it is equivalent
+   *    to 'ResourcesPlugin.getEncoding()'.
+   *     - option id:         "org.phpeclipse.phpdt.core.encoding"
+   *     - possible values:   { any of the supported encoding name}.
+   *     - default:           
+   * 
+   * JAVACORE / Reporting Incomplete Classpath
+   *    An entry on the classpath doesn't exist or is not visible (e.g. a referenced project is closed).
+   *     - option id:         "org.phpeclipse.phpdt.core.incompleteClasspath"
+   *     - possible values:   { "error", "warning"}
+   *     - default:           "error"
+   * 
+   * JAVACORE / Reporting Classpath Cycle
+   *    A project is involved in a cycle.
+   *     - option id:         "org.phpeclipse.phpdt.core.circularClasspath"
+   *     - possible values:   { "error", "warning" }
+   *     - default:           "error"
+   * 
+   *	FORMATTER / Inserting New Line Before Opening Brace
+   *    When Insert, a new line is inserted before an opening brace, otherwise nothing
+   *    is inserted
+   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.openingBrace"
+   *     - possible values:   { "insert", "do not insert" }
+   *     - default:           "do not insert"
+   * 
+   *	FORMATTER / Inserting New Line Inside Control Statement
+   *    When Insert, a new line is inserted between } and following else, catch, finally
+   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.controlStatement"
+   *     - possible values:   { "insert", "do not insert" }
+   *     - default:           "do not insert"
+   * 
+   *	FORMATTER / Clearing Blank Lines
+   *    When Clear all, all blank lines are removed. When Preserve one, only one is kept
+   *    and all others removed.
+   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.clearAll"
+   *     - possible values:   { "clear all", "preserve one" }
+   *     - default:           "preserve one"
+   * 
+   *	FORMATTER / Inserting New Line Between Else/If 
+   *    When Insert, a blank line is inserted between an else and an if when they are 
+   *    contiguous. When choosing to not insert, else-if will be kept on the same
+   *    line when possible.
+   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.elseIf"
+   *     - possible values:   { "insert", "do not insert" }
+   *     - default:           "do not insert"
+   * 
+   *	FORMATTER / Inserting New Line In Empty Block
+   *    When insert, a line break is inserted between contiguous { and }, if } is not followed
+   *    by a keyword.
+   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.emptyBlock"
+   *     - possible values:   { "insert", "do not insert" }
+   *     - default:           "insert"
+   * 
+   *	FORMATTER / Splitting Lines Exceeding Length
+   *    Enable splitting of long lines (exceeding the configurable length). Length of 0 will
+   *    disable line splitting
+   *     - option id:         "org.phpeclipse.phpdt.core.formatter.lineSplit"
+   *     - possible values:	"", where n is zero or a positive integer
+   *     - default:           "80"
+   * 
+   *	FORMATTER / Compacting Assignment
+   *    Assignments can be formatted asymmetrically, e.g. 'int x= 2;', when Normal, a space
+   *    is inserted before the assignment operator
+   *     - option id:         "org.phpeclipse.phpdt.core.formatter.style.assignment"
+   *     - possible values:   { "compact", "normal" }
+   *     - default:           "normal"
+   * 
+   *	FORMATTER / Defining Indentation Character
+   *    Either choose to indent with tab characters or spaces
+   *     - option id:         "org.phpeclipse.phpdt.core.formatter.tabulation.char"
+   *     - possible values:   { "tab", "space" }
+   *     - default:           "tab"
+   * 
+   *	FORMATTER / Defining Space Indentation Length
+   *    When using spaces, set the amount of space characters to use for each 
+   *    indentation mark.
+   *     - option id:         "org.phpeclipse.phpdt.core.formatter.tabulation.size"
+   *     - possible values:	"", where n is a positive integer
+   *     - default:           "4"
+   * 
+   *	CODEASSIST / Activate Visibility Sensitive Completion
+   *    When active, completion doesn't show that you can not see
+   *    (e.g. you can not see private methods of a super class).
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.visibilityCheck"
+   *     - possible values:   { "enabled", "disabled" }
+   *     - default:           "disabled"
+   * 
+   *	CODEASSIST / Automatic Qualification of Implicit Members
+   *    When active, completion automatically qualifies completion on implicit
+   *    field references and message expressions.
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.forceImplicitQualification"
+   *     - possible values:   { "enabled", "disabled" }
+   *     - default:           "disabled"
+   * 
+   *  CODEASSIST / Define the Prefixes for Field Name
+   *    When the prefixes is non empty, completion for field name will begin with
+   *    one of the proposed prefixes.
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.fieldPrefixes"
+   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+   *     - default:           ""
+   * 
+   *  CODEASSIST / Define the Prefixes for Static Field Name
+   *    When the prefixes is non empty, completion for static field name will begin with
+   *    one of the proposed prefixes.
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.staticFieldPrefixes"
+   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+   *     - default:           ""
+   * 
+   *  CODEASSIST / Define the Prefixes for Local Variable Name
+   *    When the prefixes is non empty, completion for local variable name will begin with
+   *    one of the proposed prefixes.
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.localPrefixes"
+   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+   *     - default:           ""
+   * 
+   *  CODEASSIST / Define the Prefixes for Argument Name
+   *    When the prefixes is non empty, completion for argument name will begin with
+   *    one of the proposed prefixes.
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.argumentPrefixes"
+   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+   *     - default:           ""
+   * 
+   *  CODEASSIST / Define the Suffixes for Field Name
+   *    When the suffixes is non empty, completion for field name will end with
+   *    one of the proposed suffixes.
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.fieldSuffixes"
+   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+   *     - default:           ""
+   * 
+   *  CODEASSIST / Define the Suffixes for Static Field Name
+   *    When the suffixes is non empty, completion for static field name will end with
+   *    one of the proposed suffixes.
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.staticFieldSuffixes"
+   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+   *     - default:           ""
+   * 
+   *  CODEASSIST / Define the Suffixes for Local Variable Name
+   *    When the suffixes is non empty, completion for local variable name will end with
+   *    one of the proposed suffixes.
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.localSuffixes"
+   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+   *     - default:           ""
+   * 
+   *  CODEASSIST / Define the Suffixes for Argument Name
+   *    When the suffixes is non empty, completion for argument name will end with
+   *    one of the proposed suffixes.
+   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.argumentSuffixes"
+   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+   *     - default:           ""
+   * 
+ * + * @return a mutable table containing the default settings of all known options + * (key type: String; value type: String) + * @see #setOptions + */ +// public static Hashtable getDefaultOptions() { +// +// Hashtable defaultOptions = new Hashtable(10); +// +// // see #initializeDefaultPluginPreferences() for changing default settings +// Preferences preferences = getPlugin().getPluginPreferences(); +// HashSet optionNames = OptionNames; +// +// // get preferences set to their default +// String[] defaultPropertyNames = preferences.defaultPropertyNames(); +// for (int i = 0; i < defaultPropertyNames.length; i++) { +// String propertyName = defaultPropertyNames[i]; +// if (optionNames.contains(propertyName)) { +// defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); +// } +// } +// // get preferences not set to their default +// String[] propertyNames = preferences.propertyNames(); +// for (int i = 0; i < propertyNames.length; i++) { +// String propertyName = propertyNames[i]; +// if (optionNames.contains(propertyName)) { +// defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); +// } +// } +// // get encoding through resource plugin +// defaultOptions.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); +// +// return defaultOptions; +// } + /** + * Helper method for returning one option value only. Equivalent to (String)JavaCore.getOptions().get(optionName) + * Note that it may answer null if this option does not exist. + *

+ * For a complete description of the configurable options, see getDefaultOptions. + *

+ * + * @param optionName the name of an option + * @return the String value of a given option + * @see JavaCore#getDefaultOptions + * @since 2.0 + */ +// public static String getOption(String optionName) { +// +// if (CORE_ENCODING.equals(optionName)) { +// return ResourcesPlugin.getEncoding(); +// } +// if (OptionNames.contains(optionName)) { +// Preferences preferences = getPlugin().getPluginPreferences(); +// return preferences.getString(optionName).trim(); +// } +// return null; +// } + + /** + * Returns the table of the current options. Initially, all options have their default values, + * and this method returns a table that includes all known options. + *

+ * For a complete description of the configurable options, see getDefaultOptions. + *

+ * + * @return table of current settings of all options + * (key type: String; value type: String) + * @see JavaCore#getDefaultOptions + */ +// public static Hashtable getOptions() { +// +// Hashtable options = new Hashtable(10); +// +// // see #initializeDefaultPluginPreferences() for changing default settings +// Plugin plugin = getPlugin(); +// if (plugin != null) { +// Preferences preferences = getPlugin().getPluginPreferences(); +// HashSet optionNames = OptionNames; +// +// // get preferences set to their default +// String[] defaultPropertyNames = preferences.defaultPropertyNames(); +// for (int i = 0; i < defaultPropertyNames.length; i++) { +// String propertyName = defaultPropertyNames[i]; +// if (optionNames.contains(propertyName)) { +// options.put(propertyName, preferences.getDefaultString(propertyName)); +// } +// } +// // get preferences not set to their default +// String[] propertyNames = preferences.propertyNames(); +// for (int i = 0; i < propertyNames.length; i++) { +// String propertyName = propertyNames[i]; +// if (optionNames.contains(propertyName)) { +// options.put(propertyName, preferences.getString(propertyName).trim()); +// } +// } +// // get encoding through resource plugin +// options.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); +// } +// return options; +// } + /** + * Sets the current table of options. All and only the options explicitly included in the given table + * are remembered; all previous option settings are forgotten, including ones not explicitly + * mentioned. + *

+ * For a complete description of the configurable options, see getDefaultOptions. + *

+ * + * @param newOptions the new options (key type: String; value type: String), + * or null to reset all options to their default values + * @see JavaCore#getDefaultOptions + */ +// public static void setOptions(Hashtable newOptions) { +// +// // see #initializeDefaultPluginPreferences() for changing default settings +// Preferences preferences = getPlugin().getPluginPreferences(); +// +// if (newOptions == null) { +// newOptions = getDefaultOptions(); +// } +// Enumeration keys = newOptions.keys(); +// while (keys.hasMoreElements()) { +// String key = (String) keys.nextElement(); +// if (!OptionNames.contains(key)) +// continue; // unrecognized option +// if (key.equals(CORE_ENCODING)) +// continue; // skipped, contributed by resource prefs +// String value = (String) newOptions.get(key); +// preferences.setValue(key, value); +// } +// +// // persist options +// getPlugin().savePluginPreferences(); +// } + public static IProject[] getPHPProjects() { + List phpProjectsList = new ArrayList(); + IProject[] workspaceProjects = PHPeclipsePlugin.getWorkspace().getRoot().getProjects(); + + for (int i = 0; i < workspaceProjects.length; i++) { + IProject iProject = workspaceProjects[i]; + if (isPHPProject(iProject)) + phpProjectsList.add(iProject); + } + + IProject[] phpProjects = new IProject[phpProjectsList.size()]; + return (IProject[]) phpProjectsList.toArray(phpProjects); + } + +// public static PHPProject getPHPProject(String name) { +// IProject aProject = PHPeclipsePlugin.getWorkspace().getRoot().getProject(name); +// if (isPHPProject(aProject)) { +// PHPProject thePHPProject = new PHPProject(); +// thePHPProject.setProject(aProject); +// return thePHPProject; +// } +// return null; +// } + + public static boolean isPHPProject(IProject aProject) { + try { + return aProject.hasNature(PHPeclipsePlugin.PHP_NATURE_ID); + } catch (CoreException e) { + } + + return false; + } + +// public static PHPFile create(IFile aFile) { +// if (PHPFile.EXTENSION.equalsIgnoreCase(aFile.getFileExtension())) +// return new PHPFile(aFile); +// if (PHPFile.EXTENSION1.equalsIgnoreCase(aFile.getFileExtension())) +// return new PHPFile(aFile); +// if (PHPFile.EXTENSION2.equalsIgnoreCase(aFile.getFileExtension())) +// return new PHPFile(aFile); +// if (PHPFile.EXTENSION3.equalsIgnoreCase(aFile.getFileExtension())) +// return new PHPFile(aFile); +// if (PHPFile.EXTENSION4.equalsIgnoreCase(aFile.getFileExtension())) +// return new PHPFile(aFile); +// if (PHPFile.EXTENSION5.equalsIgnoreCase(aFile.getFileExtension())) +// return new PHPFile(aFile); +// +// return null; +// } + +// public static PHPProject create(IProject aProject) { +// +// try { +// if (aProject.hasNature(PHPeclipsePlugin.PHP_NATURE_ID)) { +// PHPProject project = new PHPProject(); +// project.setProject(aProject); +// return project; +// } +// } catch (CoreException e) { +// System.err.println("Exception occurred in PHPCore#create(IProject): " + e.toString()); +// } +// +// return null; +// } + + public static void addPHPNature(IProject project, IProgressMonitor monitor) throws CoreException { + if (!project.hasNature(PHPeclipsePlugin.PHP_NATURE_ID)) { + IProjectDescription description = project.getDescription(); + String[] prevNatures = description.getNatureIds(); + String[] newNatures = new String[prevNatures.length + 1]; + System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length); + newNatures[prevNatures.length] = PHPeclipsePlugin.PHP_NATURE_ID; + description.setNatureIds(newNatures); + project.setDescription(description, monitor); + } + } + + /** + * Returns the single instance of the PHP core plug-in runtime class. + * + * @return the single instance of the PHP core plug-in runtime class + */ + public static Plugin getPlugin() { + return PHPeclipsePlugin.getDefault(); + } + + /** + * Initializes the default preferences settings for this plug-in. + */ + + /** + * Runs the given action as an atomic Java model operation. + *

+ * After running a method that modifies Java elements, + * registered listeners receive after-the-fact notification of + * what just transpired, in the form of a element changed event. + * This method allows clients to call a number of + * methods that modify java elements and only have element + * changed event notifications reported at the end of the entire + * batch. + *

+ *

+ * If this method is called outside the dynamic scope of another such + * call, this method runs the action and then reports a single + * element changed event describing the net effect of all changes + * done to java elements by the action. + *

+ *

+ * If this method is called in the dynamic scope of another such + * call, this method simply runs the action. + *

+ * + * @param action the action to perform + * @param monitor a progress monitor, or null if progress + * reporting and cancellation are not desired + * @exception CoreException if the operation failed. + * @since 2.1 + */ + public static void run(IWorkspaceRunnable action, IProgressMonitor monitor) throws CoreException { + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + if (workspace.isTreeLocked()) { + new BatchOperation(action).run(monitor); + } else { + // use IWorkspace.run(...) to ensure that a build will be done in autobuild mode + workspace.run(new BatchOperation(action), monitor); + } + } + +/** + * Adds the given listener for changes to Java elements. + * Has no effect if an identical listener is already registered. + * + * This listener will only be notified during the POST_CHANGE resource change notification + * and any reconcile operation (POST_RECONCILE). + * For finer control of the notification, use addElementChangedListener(IElementChangedListener,int), + * which allows to specify a different eventMask. + * + * @see ElementChangedEvent + * @param listener the listener + */ +public static void addElementChangedListener(IElementChangedListener listener) { + addElementChangedListener(listener, ElementChangedEvent.POST_CHANGE | ElementChangedEvent.POST_RECONCILE); +} /** - * The plug-in runtime class for the Java model plug-in containing the core - * (UI-free) support for Java projects. + * Adds the given listener for changes to Java elements. + * Has no effect if an identical listener is already registered. + * After completion of this method, the given listener will be registered for exactly + * the specified events. If they were previously registered for other events, they + * will be deregistered. *

- * Like all plug-in runtime classes (subclasses of Plugin), this - * class is automatically instantiated by the platform when the plug-in gets - * activated. Clients must not attempt to instantiate plug-in runtime classes - * directly. + * Once registered, a listener starts receiving notification of changes to + * java elements in the model. The listener continues to receive + * notifications until it is replaced or removed. *

*

- * The single instance of this class can be accessed from any plug-in declaring - * the Java model plug-in as a prerequisite via - * JavaCore.getJavaCore(). The Java model plug-in will be activated - * automatically if not already active. + * Listeners can listen for several types of event as defined in ElementChangeEvent. + * Clients are free to register for any number of event types however if they register + * for more than one, it is their responsibility to ensure they correctly handle the + * case where the same java element change shows up in multiple notifications. + * Clients are guaranteed to receive only the events for which they are registered. *

+ * + * @param listener the listener + * @param eventMask the bit-wise OR of all event types of interest to the listener + * @see IElementChangedListener + * @see ElementChangedEvent + * @see #removeElementChangedListener(IElementChangedListener) + * @since 2.0 */ -public final class JavaCore extends Plugin implements IExecutableExtension { - - private static Plugin JAVA_CORE_PLUGIN = null; - /** - * The plug-in identifier of the Java core support - * (value "org.eclipse.jdt.core"). - */ - public static final String PLUGIN_ID = "org.eclipse.jdt.core" ; //$NON-NLS-1$ - - /** - * The identifier for the Java builder - * (value "org.eclipse.jdt.core.javabuilder"). - */ - public static final String BUILDER_ID = PLUGIN_ID + ".javabuilder" ; //$NON-NLS-1$ - - /** - * The identifier for the Java model - * (value "org.eclipse.jdt.core.javamodel"). - */ - public static final String MODEL_ID = PLUGIN_ID + ".javamodel" ; //$NON-NLS-1$ - - /** - * The identifier for the Java nature - * (value "org.eclipse.jdt.core.javanature"). - * The presence of this nature on a project indicates that it is - * Java-capable. - * - * @see org.eclipse.core.resources.IProject#hasNature(java.lang.String) - */ - public static final String NATURE_ID = PLUGIN_ID + ".javanature" ; //$NON-NLS-1$ - - /** - * Name of the handle id attribute in a Java marker. - */ - protected static final String ATT_HANDLE_ID = - "org.eclipse.jdt.internal.core.JavaModelManager.handleId" ; //$NON-NLS-1$ - - // *************** Possible IDs for configurable options. ******************** - - /** - * Possible configurable option ID. - * @see #getDefaultOptions() - */ - public static final String COMPILER_LOCAL_VARIABLE_ATTR = PLUGIN_ID + ".compiler.debug.localVariable"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions() - */ - public static final String COMPILER_LINE_NUMBER_ATTR = PLUGIN_ID + ".compiler.debug.lineNumber"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_SOURCE_FILE_ATTR = PLUGIN_ID + ".compiler.debug.sourceFile"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_CODEGEN_UNUSED_LOCAL = PLUGIN_ID + ".compiler.codegen.unusedLocal"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_CODEGEN_TARGET_PLATFORM = PLUGIN_ID + ".compiler.codegen.targetPlatform"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_UNREACHABLE_CODE = PLUGIN_ID + ".compiler.problem.unreachableCode"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_INVALID_IMPORT = PLUGIN_ID + ".compiler.problem.invalidImport"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD = PLUGIN_ID + ".compiler.problem.overridingPackageDefaultMethod"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME = PLUGIN_ID + ".compiler.problem.methodWithConstructorName"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_DEPRECATION = PLUGIN_ID + ".compiler.problem.deprecation"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE = PLUGIN_ID + ".compiler.problem.deprecationInDeprecatedCode"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_HIDDEN_CATCH_BLOCK = PLUGIN_ID + ".compiler.problem.hiddenCatchBlock"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_UNUSED_LOCAL = PLUGIN_ID + ".compiler.problem.unusedLocal"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_UNUSED_PARAMETER = PLUGIN_ID + ".compiler.problem.unusedParameter"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT = PLUGIN_ID + ".compiler.problem.unusedParameterWhenImplementingAbstract"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE = PLUGIN_ID + ".compiler.problem.unusedParameterWhenOverridingConcrete"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_PB_UNUSED_IMPORT = PLUGIN_ID + ".compiler.problem.unusedImport"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_SYNTHETIC_ACCESS_EMULATION = PLUGIN_ID + ".compiler.problem.syntheticAccessEmulation"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_PB_NON_NLS_STRING_LITERAL = PLUGIN_ID + ".compiler.problem.nonExternalizedStringLiteral"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_PB_ASSERT_IDENTIFIER = PLUGIN_ID + ".compiler.problem.assertIdentifier"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_STATIC_ACCESS_RECEIVER = PLUGIN_ID + ".compiler.problem.staticAccessReceiver"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_NO_EFFECT_ASSIGNMENT = PLUGIN_ID + ".compiler.problem.noEffectAssignment"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD = PLUGIN_ID + ".compiler.problem.incompatibleNonInheritedInterfaceMethod"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_UNUSED_PRIVATE_MEMBER = PLUGIN_ID + ".compiler.problem.unusedPrivateMember"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION = PLUGIN_ID + ".compiler.problem.noImplicitStringConversion"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_PB_MAX_PER_UNIT = PLUGIN_ID + ".compiler.maxProblemPerUnit"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_SOURCE = PLUGIN_ID + ".compiler.source"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_COMPLIANCE = PLUGIN_ID + ".compiler.compliance"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_PRIORITIES = PLUGIN_ID + ".compiler.taskPriorities"; //$NON-NLS-1$ - /** - * Possible configurable option value for COMPILER_TASK_PRIORITIES. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_PRIORITY_HIGH = "HIGH"; //$NON-NLS-1$ - /** - * Possible configurable option value for COMPILER_TASK_PRIORITIES. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_PRIORITY_LOW = "LOW"; //$NON-NLS-1$ - /** - * Possible configurable option value for COMPILER_TASK_PRIORITIES. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_PRIORITY_NORMAL = "NORMAL"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_TAGS = PLUGIN_ID + ".compiler.taskTags"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String CORE_JAVA_BUILD_ORDER = PLUGIN_ID + ".computeJavaBuildOrder"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CORE_JAVA_BUILD_RESOURCE_COPY_FILTER = PLUGIN_ID + ".builder.resourceCopyExclusionFilter"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_JAVA_BUILD_DUPLICATE_RESOURCE = PLUGIN_ID + ".builder.duplicateResourceTask"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER = PLUGIN_ID + ".builder.cleanOutputFolder"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_INCOMPLETE_CLASSPATH = PLUGIN_ID + ".incompleteClasspath"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_CIRCULAR_CLASSPATH = PLUGIN_ID + ".circularClasspath"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CORE_JAVA_BUILD_INVALID_CLASSPATH = PLUGIN_ID + ".builder.invalidClasspath"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CORE_ENCODING = PLUGIN_ID + ".encoding"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS = PLUGIN_ID + ".classpath.exclusionPatterns"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS = PLUGIN_ID + ".classpath.multipleOutputLocations"; //$NON-NLS-1$ - /** - * Default task tag - * @since 2.1 - */ - public static final String DEFAULT_TASK_TAG = "TODO"; //$NON-NLS-1$ - /** - * Default task priority - * @since 2.1 - */ - public static final String DEFAULT_TASK_PRIORITY = "NORMAL"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_NEWLINE_OPENING_BRACE = PLUGIN_ID + ".formatter.newline.openingBrace"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_NEWLINE_CONTROL = PLUGIN_ID + ".formatter.newline.controlStatement"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_NEWLINE_ELSE_IF = PLUGIN_ID + ".formatter.newline.elseIf"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_NEWLINE_EMPTY_BLOCK = PLUGIN_ID + ".formatter.newline.emptyBlock"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_CLEAR_BLANK_LINES = PLUGIN_ID + ".formatter.newline.clearAll"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_LINE_SPLIT = PLUGIN_ID + ".formatter.lineSplit"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_COMPACT_ASSIGNMENT = PLUGIN_ID + ".formatter.style.assignment"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_TAB_CHAR = PLUGIN_ID + ".formatter.tabulation.char"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_TAB_SIZE = PLUGIN_ID + ".formatter.tabulation.size"; //$NON-NLS-1$ - /** - * Possible configurable option ID - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String FORMATTER_SPACE_CASTEXPRESSION = PLUGIN_ID + ".formatter.space.castexpression"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CODEASSIST_VISIBILITY_CHECK = PLUGIN_ID + ".codeComplete.visibilityCheck"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CODEASSIST_IMPLICIT_QUALIFICATION = PLUGIN_ID + ".codeComplete.forceImplicitQualification"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_FIELD_PREFIXES = PLUGIN_ID + ".codeComplete.fieldPrefixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_STATIC_FIELD_PREFIXES = PLUGIN_ID + ".codeComplete.staticFieldPrefixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_LOCAL_PREFIXES = PLUGIN_ID + ".codeComplete.localPrefixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_ARGUMENT_PREFIXES = PLUGIN_ID + ".codeComplete.argumentPrefixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_FIELD_SUFFIXES = PLUGIN_ID + ".codeComplete.fieldSuffixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_STATIC_FIELD_SUFFIXES = PLUGIN_ID + ".codeComplete.staticFieldSuffixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_LOCAL_SUFFIXES = PLUGIN_ID + ".codeComplete.localSuffixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_ARGUMENT_SUFFIXES = PLUGIN_ID + ".codeComplete.argumentSuffixes"; //$NON-NLS-1$ - - // *************** Possible values for configurable options. ******************** - - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String GENERATE = "generate"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String DO_NOT_GENERATE = "do not generate"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String PRESERVE = "preserve"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String OPTIMIZE_OUT = "optimize out"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String VERSION_1_1 = "1.1"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String VERSION_1_2 = "1.2"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String VERSION_1_3 = "1.3"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String VERSION_1_4 = "1.4"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String ABORT = "abort"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String ERROR = "error"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String WARNING = "warning"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String IGNORE = "ignore"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String COMPUTE = "compute"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String INSERT = "insert"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String DO_NOT_INSERT = "do not insert"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String PRESERVE_ONE = "preserve one"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CLEAR_ALL = "clear all"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String NORMAL = "normal"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPACT = "compact"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String TAB = "tab"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String SPACE = "space"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String ENABLED = "enabled"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String DISABLED = "disabled"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CLEAN = "clean"; //$NON-NLS-1$ - - /** - * Creates the Java core plug-in. - * @since 2.1 - */ - public JavaCore(IPluginDescriptor pluginDescriptor) { - super(pluginDescriptor); - JAVA_CORE_PLUGIN = this; - } +public static void addElementChangedListener(IElementChangedListener listener, int eventMask) { + JavaModelManager.getJavaModelManager().addElementChangedListener(listener, eventMask); +} - /** - * Adds the given listener for changes to Java elements. - * Has no effect if an identical listener is already registered. - * - * This listener will only be notified during the POST_CHANGE resource change notification - * and any reconcile operation (POST_RECONCILE). - * For finer control of the notification, use addElementChangedListener(IElementChangedListener,int), - * which allows to specify a different eventMask. - * - * @see ElementChangedEvent - * @param listener the listener - */ - public static void addElementChangedListener(IElementChangedListener listener) { - addElementChangedListener(listener, ElementChangedEvent.POST_CHANGE | ElementChangedEvent.POST_RECONCILE); - } - - /** - * Adds the given listener for changes to Java elements. - * Has no effect if an identical listener is already registered. - * After completion of this method, the given listener will be registered for exactly - * the specified events. If they were previously registered for other events, they - * will be deregistered. - *

- * Once registered, a listener starts receiving notification of changes to - * java elements in the model. The listener continues to receive - * notifications until it is replaced or removed. - *

- *

- * Listeners can listen for several types of event as defined in ElementChangeEvent. - * Clients are free to register for any number of event types however if they register - * for more than one, it is their responsibility to ensure they correctly handle the - * case where the same java element change shows up in multiple notifications. - * Clients are guaranteed to receive only the events for which they are registered. - *

- * - * @param listener the listener - * @param eventMask the bit-wise OR of all event types of interest to the listener - * @see IElementChangedListener - * @see ElementChangedEvent - * @see #removeElementChangedListener(IElementChangedListener) - * @since 2.0 - */ - public static void addElementChangedListener(IElementChangedListener listener, int eventMask) { - JavaModelManager.getJavaModelManager().addElementChangedListener(listener, eventMask); - } - - /** - * Configures the given marker attribute map for the given Java element. - * Used for markers, which denote a Java element rather than a resource. - * - * @param attributes the mutable marker attribute map (key type: String, - * value type: String) - * @param element the Java element for which the marker needs to be configured - */ - public static void addJavaElementMarkerAttributes( - Map attributes, - IJavaElement element) { -// if (element instanceof IMember) -// element = ((IMember) element).getClassFile(); - if (attributes != null && element != null) - attributes.put(ATT_HANDLE_ID, element.getHandleIdentifier()); - } +/** + * Configures the given marker attribute map for the given Java element. + * Used for markers, which denote a Java element rather than a resource. + * + * @param attributes the mutable marker attribute map (key type: String, + * value type: String) + * @param element the Java element for which the marker needs to be configured + */ +public static void addJavaElementMarkerAttributes( + Map attributes, + IJavaElement element) { +// if (element instanceof IMember) +// element = ((IMember) element).getClassFile(); + if (attributes != null && element != null) + attributes.put(ATT_HANDLE_ID, element.getHandleIdentifier()); +} - /** - * Configures the given marker for the given Java element. - * Used for markers, which denote a Java element rather than a resource. - * - * @param marker the marker to be configured - * @param element the Java element for which the marker needs to be configured - * @exception CoreException if the IMarker.setAttribute on the marker fails - */ - public void configureJavaElementMarker(IMarker marker, IJavaElement element) - throws CoreException { -// if (element instanceof IMember) -// element = ((IMember) element).getClassFile(); - if (marker != null && element != null) - marker.setAttribute(ATT_HANDLE_ID, element.getHandleIdentifier()); - } +/** + * Configures the given marker for the given Java element. + * Used for markers, which denote a Java element rather than a resource. + * + * @param marker the marker to be configured + * @param element the Java element for which the marker needs to be configured + * @exception CoreException if the IMarker.setAttribute on the marker fails + */ +public void configureJavaElementMarker(IMarker marker, IJavaElement element) + throws CoreException { +// if (element instanceof IMember) +// element = ((IMember) element).getClassFile(); + if (marker != null && element != null) + marker.setAttribute(ATT_HANDLE_ID, element.getHandleIdentifier()); +} - /** - * Returns the Java model element corresponding to the given handle identifier - * generated by IJavaElement.getHandleIdentifier(), or - * null if unable to create the associated element. - */ - public static IJavaElement create(String handleIdentifier) { - if (handleIdentifier == null) { - return null; - } - try { - return JavaModelManager.getJavaModelManager().getHandleFromMemento(handleIdentifier); - } catch (JavaModelException e) { - return null; - } - } - /** - * Returns the Java element corresponding to the given file, or - * null if unable to associate the given file - * with a Java element. - * - *

The file must be one of:

    - *
  • a .java file - the element returned is the corresponding ICompilationUnit
  • - *
  • a .class file - the element returned is the corresponding IClassFile
  • - *
  • a .jar file - the element returned is the corresponding IPackageFragmentRoot
  • - *
- *

- * Creating a Java element has the side effect of creating and opening all of the - * element's parents if they are not yet open. - * - * @param the given file - * @return the Java element corresponding to the given file, or - * null if unable to associate the given file - * with a Java element - */ - public static IJavaElement create(IFile file) { - return JavaModelManager.create(file, null); - } - /** - * Returns the package fragment or package fragment root corresponding to the given folder, or - * null if unable to associate the given folder with a Java element. - *

- * Note that a package fragment root is returned rather than a default package. - *

- * Creating a Java element has the side effect of creating and opening all of the - * element's parents if they are not yet open. - * - * @param the given folder - * @return the package fragment or package fragment root corresponding to the given folder, or - * null if unable to associate the given folder with a Java element - */ - public static IJavaElement create(IFolder folder) { - return JavaModelManager.create(folder, null); - } - /** - * Returns the Java project corresponding to the given project. - *

- * Creating a Java Project has the side effect of creating and opening all of the - * project's parents if they are not yet open. - *

- * Note that no check is done at this time on the existence or the java nature of this project. - * - * @param project the given project - * @return the Java project corresponding to the given project, null if the given project is null - */ - public static IJavaProject create(IProject project) { - if (project == null) { - return null; - } - JavaModel javaModel = JavaModelManager.getJavaModelManager().getJavaModel(); - return javaModel.getJavaProject(project); +/** + * Returns the Java model element corresponding to the given handle identifier + * generated by IJavaElement.getHandleIdentifier(), or + * null if unable to create the associated element. + */ +public static IJavaElement create(String handleIdentifier) { + if (handleIdentifier == null) { + return null; } - /** - * Returns the Java element corresponding to the given resource, or - * null if unable to associate the given resource - * with a Java element. - *

- * The resource must be one of:

    - *
  • a project - the element returned is the corresponding IJavaProject
  • - *
  • a .java file - the element returned is the corresponding ICompilationUnit
  • - *
  • a .class file - the element returned is the corresponding IClassFile
  • - *
  • a .jar file - the element returned is the corresponding IPackageFragmentRoot
  • - *
  • a folder - the element returned is the corresponding IPackageFragmentRoot - * or IPackageFragment
  • - *
  • the workspace root resource - the element returned is the IJavaModel
  • - *
- *

- * Creating a Java element has the side effect of creating and opening all of the - * element's parents if they are not yet open. - * - * @param resource the given resource - * @return the Java element corresponding to the given resource, or - * null if unable to associate the given resource - * with a Java element - */ - public static IJavaElement create(IResource resource) { - return JavaModelManager.create(resource, null); + try { + return JavaModelManager.getJavaModelManager().getHandleFromMemento(handleIdentifier); + } catch (JavaModelException e) { + return null; } - /** - * Returns the Java model. - * - * @param root the given root - * @return the Java model, or null if the root is null - */ - public static IJavaModel create(IWorkspaceRoot root) { - if (root == null) { - return null; - } - return JavaModelManager.getJavaModelManager().getJavaModel(); +} +/** + * Returns the Java element corresponding to the given file, or + * null if unable to associate the given file + * with a Java element. + * + *

The file must be one of:

    + *
  • a .java file - the element returned is the corresponding ICompilationUnit
  • + *
  • a .class file - the element returned is the corresponding IClassFile
  • + *
  • a .jar file - the element returned is the corresponding IPackageFragmentRoot
  • + *
+ *

+ * Creating a Java element has the side effect of creating and opening all of the + * element's parents if they are not yet open. + * + * @param the given file + * @return the Java element corresponding to the given file, or + * null if unable to associate the given file + * with a Java element + */ +public static IJavaElement create(IFile file) { + return JavaModelManager.create(file, null); +} +/** + * Returns the package fragment or package fragment root corresponding to the given folder, or + * null if unable to associate the given folder with a Java element. + *

+ * Note that a package fragment root is returned rather than a default package. + *

+ * Creating a Java element has the side effect of creating and opening all of the + * element's parents if they are not yet open. + * + * @param the given folder + * @return the package fragment or package fragment root corresponding to the given folder, or + * null if unable to associate the given folder with a Java element + */ +public static IJavaElement create(IFolder folder) { + return JavaModelManager.create(folder, null); +} +/** + * Returns the Java project corresponding to the given project. + *

+ * Creating a Java Project has the side effect of creating and opening all of the + * project's parents if they are not yet open. + *

+ * Note that no check is done at this time on the existence or the java nature of this project. + * + * @param project the given project + * @return the Java project corresponding to the given project, null if the given project is null + */ +public static IJavaProject create(IProject project) { + if (project == null) { + return null; } - /** - * Creates and returns a class file element for - * the given .class file. Returns null if unable - * to recognize the class file. - * - * @param file the given .class file - * @return a class file element for the given .class file, or null if unable - * to recognize the class file - */ -// public static IClassFile createClassFileFrom(IFile file) { -// return JavaModelManager.createClassFileFrom(file, null); -// } - /** - * Creates and returns a compilation unit element for - * the given .java file. Returns null if unable - * to recognize the compilation unit. - * - * @param file the given .java file - * @return a compilation unit element for the given .java file, or null if unable - * to recognize the compilation unit - */ - public static ICompilationUnit createCompilationUnitFrom(IFile file) { - return JavaModelManager.createCompilationUnitFrom(file, null); + JavaModel javaModel = JavaModelManager.getJavaModelManager().getJavaModel(); + return javaModel.getJavaProject(project); +} +/** + * Returns the Java element corresponding to the given resource, or + * null if unable to associate the given resource + * with a Java element. + *

+ * The resource must be one of:

    + *
  • a project - the element returned is the corresponding IJavaProject
  • + *
  • a .java file - the element returned is the corresponding ICompilationUnit
  • + *
  • a .class file - the element returned is the corresponding IClassFile
  • + *
  • a .jar file - the element returned is the corresponding IPackageFragmentRoot
  • + *
  • a folder - the element returned is the corresponding IPackageFragmentRoot + * or IPackageFragment
  • + *
  • the workspace root resource - the element returned is the IJavaModel
  • + *
+ *

+ * Creating a Java element has the side effect of creating and opening all of the + * element's parents if they are not yet open. + * + * @param resource the given resource + * @return the Java element corresponding to the given resource, or + * null if unable to associate the given resource + * with a Java element + */ +public static IJavaElement create(IResource resource) { + return JavaModelManager.create(resource, null); +} +/** + * Returns the Java model. + * + * @param root the given root + * @return the Java model, or null if the root is null + */ +public static IJavaModel create(IWorkspaceRoot root) { + if (root == null) { + return null; } - /** - * Creates and returns a handle for the given JAR file. - * The Java model associated with the JAR's project may be - * created as a side effect. - * - * @param file the given JAR file - * @return a handle for the given JAR file, or null if unable to create a JAR package fragment root. - * (for example, if the JAR file represents a non-Java resource) - */ -// public static IPackageFragmentRoot createJarPackageFragmentRootFrom(IFile file) { -// return JavaModelManager.createJarPackageFragmentRootFrom(file, null); -// } - - /** - * Answers the project specific value for a given classpath container. - * In case this container path could not be resolved, then will answer null. - * Both the container path and the project context are supposed to be non-null. - *

- * The containerPath is a formed by a first ID segment followed with extra segments, which can be - * used as additional hints for resolution. If no container was ever recorded for this container path - * onto this project (using setClasspathContainer, then a - * ClasspathContainerInitializer will be activated if any was registered for this container - * ID onto the extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * There is no assumption that the returned container must answer the exact same containerPath - * when requested IClasspathContainer#getPath. - * Indeed, the containerPath is just an indication for resolving it to an actual container object. - *

- * Classpath container values are persisted locally to the workspace, but - * are not preserved from a session to another. It is thus highly recommended to register a - * ClasspathContainerInitializer for each referenced container - * (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer"). - *

- * @param containerPath the name of the container, which needs to be resolved - * @param project a specific project in which the container is being resolved - * @return the corresponding classpath container or null if unable to find one. - * - * @exception JavaModelException if an exception occurred while resolving the container, or if the resolved container - * contains illegal entries (contains CPE_CONTAINER entries or null entries). - * - * @see ClasspathContainerInitializer - * @see IClasspathContainer - * @see #setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor) - * @since 2.0 - */ -// public static IClasspathContainer getClasspathContainer(final IPath containerPath, final IJavaProject project) throws JavaModelException { -// -// IClasspathContainer container = JavaModelManager.containerGet(project, containerPath); -// if (container == JavaModelManager.ContainerInitializationInProgress) return null; // break cycle -// -// if (container == null){ -// final ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(containerPath.segment(0)); -// if (initializer != null){ -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPContainer INIT - triggering initialization of: ["+project.getElementName()+"] " + containerPath + " using initializer: "+ initializer); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ -// new Exception("FAKE exception for dumping current CPContainer (["+project.getElementName()+"] "+ containerPath+ ")INIT invocation stack trace").printStackTrace(); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ -// } -// JavaModelManager.containerPut(project, containerPath, JavaModelManager.ContainerInitializationInProgress); // avoid initialization cycles -// boolean ok = false; -// try { -// // wrap initializer call with Safe runnable in case initializer would be causing some grief -// Platform.run(new ISafeRunnable() { -// public void handleException(Throwable exception) { -// Util.log(exception, "Exception occurred in classpath container initializer: "+initializer); //$NON-NLS-1$ -// } -// public void run() throws Exception { -// initializer.initialize(containerPath, project); -// } -// }); -// -// // retrieve value (if initialization was successful) -// container = JavaModelManager.containerGet(project, containerPath); -// if (container == JavaModelManager.ContainerInitializationInProgress) return null; // break cycle -// ok = true; -// } finally { -// if (!ok) JavaModelManager.containerPut(project, containerPath, null); // flush cache -// } -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.print("CPContainer INIT - after resolution: ["+project.getElementName()+"] " + containerPath + " --> "); //$NON-NLS-2$//$NON-NLS-1$//$NON-NLS-3$ -// if (container != null){ -// System.out.print("container: "+container.getDescription()+" {"); //$NON-NLS-2$//$NON-NLS-1$ -// IClasspathEntry[] entries = container.getClasspathEntries(); -// if (entries != null){ -// for (int i = 0; i < entries.length; i++){ -// if (i > 0) System.out.println(", ");//$NON-NLS-1$ -// System.out.println(entries[i]); -// } -// } -// System.out.println("}");//$NON-NLS-1$ -// } else { -// System.out.println("{unbound}");//$NON-NLS-1$ -// } -// } -// } else { -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPContainer INIT - no initializer found for: "+project.getElementName()+"] " + containerPath); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// } -// } -// return container; -// } - - /** - * Helper method finding the classpath container initializer registered for a given classpath container ID - * or null if none was found while iterating over the contributions to extension point to - * the extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * A containerID is the first segment of any container path, used to identify the registered container initializer. - *

- * @param String - a containerID identifying a registered initializer - * @return ClasspathContainerInitializer - the registered classpath container initializer or null if - * none was found. - * @since 2.1 - */ -// public static ClasspathContainerInitializer getClasspathContainerInitializer(String containerID){ -// -// Plugin jdtCorePlugin = JavaCore.getPlugin(); -// if (jdtCorePlugin == null) return null; + return JavaModelManager.getJavaModelManager().getJavaModel(); +} +/** + * Creates and returns a class file element for + * the given .class file. Returns null if unable + * to recognize the class file. + * + * @param file the given .class file + * @return a class file element for the given .class file, or null if unable + * to recognize the class file + */ +//public static IClassFile createClassFileFrom(IFile file) { +// return JavaModelManager.createClassFileFrom(file, null); +//} +/** + * Creates and returns a compilation unit element for + * the given .java file. Returns null if unable + * to recognize the compilation unit. + * + * @param file the given .java file + * @return a compilation unit element for the given .java file, or null if unable + * to recognize the compilation unit + */ +public static ICompilationUnit createCompilationUnitFrom(IFile file) { + return JavaModelManager.createCompilationUnitFrom(file, null); +} +/** + * Creates and returns a handle for the given JAR file. + * The Java model associated with the JAR's project may be + * created as a side effect. + * + * @param file the given JAR file + * @return a handle for the given JAR file, or null if unable to create a JAR package fragment root. + * (for example, if the JAR file represents a non-Java resource) + */ +//public static IPackageFragmentRoot createJarPackageFragmentRootFrom(IFile file) { +// return JavaModelManager.createJarPackageFragmentRootFrom(file, null); +//} + +/** + * Answers the project specific value for a given classpath container. + * In case this container path could not be resolved, then will answer null. + * Both the container path and the project context are supposed to be non-null. + *

+ * The containerPath is a formed by a first ID segment followed with extra segments, which can be + * used as additional hints for resolution. If no container was ever recorded for this container path + * onto this project (using setClasspathContainer, then a + * ClasspathContainerInitializer will be activated if any was registered for this container + * ID onto the extension point "org.eclipse.jdt.core.classpathContainerInitializer". + *

+ * There is no assumption that the returned container must answer the exact same containerPath + * when requested IClasspathContainer#getPath. + * Indeed, the containerPath is just an indication for resolving it to an actual container object. + *

+ * Classpath container values are persisted locally to the workspace, but + * are not preserved from a session to another. It is thus highly recommended to register a + * ClasspathContainerInitializer for each referenced container + * (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer"). + *

+ * @param containerPath the name of the container, which needs to be resolved + * @param project a specific project in which the container is being resolved + * @return the corresponding classpath container or null if unable to find one. + * + * @exception JavaModelException if an exception occurred while resolving the container, or if the resolved container + * contains illegal entries (contains CPE_CONTAINER entries or null entries). + * + * @see ClasspathContainerInitializer + * @see IClasspathContainer + * @see #setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor) + * @since 2.0 + */ +//public static IClasspathContainer getClasspathContainer(final IPath containerPath, final IJavaProject project) throws JavaModelException { // -// IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPCONTAINER_INITIALIZER_EXTPOINT_ID); -// if (extension != null) { -// IExtension[] extensions = extension.getExtensions(); -// for(int i = 0; i < extensions.length; i++){ -// IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); -// for(int j = 0; j < configElements.length; j++){ -// String initializerID = configElements[j].getAttribute("id"); //$NON-NLS-1$ -// if (initializerID != null && initializerID.equals(containerID)){ -// if (JavaModelManager.CP_RESOLVE_VERBOSE) { -// System.out.println("CPContainer INIT - found initializer: "+containerID +" --> " + configElements[j].getAttribute("class"));//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ -// } -// try { -// Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ -// if (execExt instanceof ClasspathContainerInitializer){ -// return (ClasspathContainerInitializer)execExt; -// } -// } catch(CoreException e) { -// } -// } -// } -// } -// } -// return null; -// } - - /** - * Returns the path held in the given classpath variable. - * Returns null if unable to bind. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * Note that classpath variables can be contributed registered initializers for, - * using the extension point "org.eclipse.jdt.core.classpathVariableInitializer". - * If an initializer is registered for a variable, its persisted value will be ignored: - * its initializer will thus get the opportunity to rebind the variable differently on - * each session. - * - * @param variableName the name of the classpath variable - * @return the path, or null if none - * @see #setClasspathVariable - */ -// public static IPath getClasspathVariable(final String variableName) { -// -// IPath variablePath = JavaModelManager.variableGet(variableName); -// if (variablePath == JavaModelManager.VariableInitializationInProgress) return null; // break cycle -// -// if (variablePath != null) { -// return variablePath; -// } +// IClasspathContainer container = JavaModelManager.containerGet(project, containerPath); +// if (container == JavaModelManager.ContainerInitializationInProgress) return null; // break cycle // -// // even if persisted value exists, initializer is given priority, only if no initializer is found the persisted value is reused -// final ClasspathVariableInitializer initializer = JavaCore.getClasspathVariableInitializer(variableName); +// if (container == null){ +// final ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(containerPath.segment(0)); // if (initializer != null){ // if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable INIT - triggering initialization of: " + variableName+ " using initializer: "+ initializer); //$NON-NLS-1$ //$NON-NLS-2$ -// new Exception("FAKE exception for dumping current CPVariable ("+variableName+ ")INIT invocation stack trace").printStackTrace(); //$NON-NLS-1$//$NON-NLS-2$ +// System.out.println("CPContainer INIT - triggering initialization of: ["+project.getElementName()+"] " + containerPath + " using initializer: "+ initializer); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ +// new Exception("FAKE exception for dumping current CPContainer (["+project.getElementName()+"] "+ containerPath+ ")INIT invocation stack trace").printStackTrace(); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ // } -// JavaModelManager.variablePut(variableName, JavaModelManager.VariableInitializationInProgress); // avoid initialization cycles +// JavaModelManager.containerPut(project, containerPath, JavaModelManager.ContainerInitializationInProgress); // avoid initialization cycles // boolean ok = false; // try { // // wrap initializer call with Safe runnable in case initializer would be causing some grief // Platform.run(new ISafeRunnable() { // public void handleException(Throwable exception) { -// Util.log(exception, "Exception occurred in classpath variable initializer: "+initializer+" while initializing variable: "+variableName); //$NON-NLS-1$ //$NON-NLS-2$ +// Util.log(exception, "Exception occurred in classpath container initializer: "+initializer); //$NON-NLS-1$ // } // public void run() throws Exception { -// initializer.initialize(variableName); +// initializer.initialize(containerPath, project); // } // }); -// variablePath = (IPath) JavaModelManager.variableGet(variableName); // initializer should have performed side-effect -// if (variablePath == JavaModelManager.VariableInitializationInProgress) return null; // break cycle (initializer did not init or reentering call) -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable INIT - after initialization: " + variableName + " --> " + variablePath); //$NON-NLS-2$//$NON-NLS-1$ -// } +// +// // retrieve value (if initialization was successful) +// container = JavaModelManager.containerGet(project, containerPath); +// if (container == JavaModelManager.ContainerInitializationInProgress) return null; // break cycle // ok = true; // } finally { -// if (!ok) JavaModelManager.variablePut(variableName, null); // flush cache +// if (!ok) JavaModelManager.containerPut(project, containerPath, null); // flush cache +// } +// if (JavaModelManager.CP_RESOLVE_VERBOSE){ +// System.out.print("CPContainer INIT - after resolution: ["+project.getElementName()+"] " + containerPath + " --> "); //$NON-NLS-2$//$NON-NLS-1$//$NON-NLS-3$ +// if (container != null){ +// System.out.print("container: "+container.getDescription()+" {"); //$NON-NLS-2$//$NON-NLS-1$ +// IClasspathEntry[] entries = container.getClasspathEntries(); +// if (entries != null){ +// for (int i = 0; i < entries.length; i++){ +// if (i > 0) System.out.println(", ");//$NON-NLS-1$ +// System.out.println(entries[i]); +// } +// } +// System.out.println("}");//$NON-NLS-1$ +// } else { +// System.out.println("{unbound}");//$NON-NLS-1$ +// } // } // } else { // if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable INIT - no initializer found for: " + variableName); //$NON-NLS-1$ +// System.out.println("CPContainer INIT - no initializer found for: "+project.getElementName()+"] " + containerPath); //$NON-NLS-1$ //$NON-NLS-2$ // } // } -// return variablePath; // } +// return container; +//} - /** - * Helper method finding the classpath variable initializer registered for a given classpath variable name - * or null if none was found while iterating over the contributions to extension point to - * the extension point "org.eclipse.jdt.core.classpathVariableInitializer". - *

- * @param the given variable - * @return ClasspathVariableInitializer - the registered classpath variable initializer or null if - * none was found. - * @since 2.1 - */ -// public static ClasspathVariableInitializer getClasspathVariableInitializer(String variable){ +/** + * Helper method finding the classpath container initializer registered for a given classpath container ID + * or null if none was found while iterating over the contributions to extension point to + * the extension point "org.eclipse.jdt.core.classpathContainerInitializer". + *

+ * A containerID is the first segment of any container path, used to identify the registered container initializer. + *

+ * @param String - a containerID identifying a registered initializer + * @return ClasspathContainerInitializer - the registered classpath container initializer or null if + * none was found. + * @since 2.1 + */ +//public static ClasspathContainerInitializer getClasspathContainerInitializer(String containerID){ // -// Plugin jdtCorePlugin = JavaCore.getPlugin(); -// if (jdtCorePlugin == null) return null; +// Plugin jdtCorePlugin = JavaCore.getPlugin(); +// if (jdtCorePlugin == null) return null; // -// IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPVARIABLE_INITIALIZER_EXTPOINT_ID); -// if (extension != null) { -// IExtension[] extensions = extension.getExtensions(); -// for(int i = 0; i < extensions.length; i++){ -// IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); -// for(int j = 0; j < configElements.length; j++){ +// IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPCONTAINER_INITIALIZER_EXTPOINT_ID); +// if (extension != null) { +// IExtension[] extensions = extension.getExtensions(); +// for(int i = 0; i < extensions.length; i++){ +// IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); +// for(int j = 0; j < configElements.length; j++){ +// String initializerID = configElements[j].getAttribute("id"); //$NON-NLS-1$ +// if (initializerID != null && initializerID.equals(containerID)){ +// if (JavaModelManager.CP_RESOLVE_VERBOSE) { +// System.out.println("CPContainer INIT - found initializer: "+containerID +" --> " + configElements[j].getAttribute("class"));//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ +// } // try { -// String varAttribute = configElements[j].getAttribute("variable"); //$NON-NLS-1$ -// if (variable.equals(varAttribute)) { -// if (JavaModelManager.CP_RESOLVE_VERBOSE) { -// System.out.println("CPVariable INIT - found initializer: "+variable+" --> " + configElements[j].getAttribute("class"));//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ -// } -// Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ -// if (execExt instanceof ClasspathVariableInitializer){ -// return (ClasspathVariableInitializer)execExt; -// } +// Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ +// if (execExt instanceof ClasspathContainerInitializer){ +// return (ClasspathContainerInitializer)execExt; // } -// } catch(CoreException e){ -// } +// } catch(CoreException e) { // } -// } -// } -// return null; -// } +// } +// } +// } +// } +// return null; +//} + +/** + * Returns the path held in the given classpath variable. + * Returns null if unable to bind. + *

+ * Classpath variable values are persisted locally to the workspace, and + * are preserved from session to session. + *

+ * Note that classpath variables can be contributed registered initializers for, + * using the extension point "org.eclipse.jdt.core.classpathVariableInitializer". + * If an initializer is registered for a variable, its persisted value will be ignored: + * its initializer will thus get the opportunity to rebind the variable differently on + * each session. + * + * @param variableName the name of the classpath variable + * @return the path, or null if none + * @see #setClasspathVariable + */ +public static IPath getClasspathVariable(final String variableName) { - /** - * Returns the names of all known classpath variables. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * - * @return the list of classpath variable names - * @see #setClasspathVariable - */ -// public static String[] getClasspathVariableNames() { -// return JavaModelManager.variableNames(); + IPath variablePath = JavaModelManager.variableGet(variableName); + if (variablePath == JavaModelManager.VariableInitializationInProgress) return null; // break cycle + + if (variablePath != null) { + return variablePath; + } + + // even if persisted value exists, initializer is given priority, only if no initializer is found the persisted value is reused +// final ClasspathVariableInitializer initializer = PHPCore.getClasspathVariableInitializer(variableName); +// if (initializer != null){ +// if (JavaModelManager.CP_RESOLVE_VERBOSE){ +// System.out.println("CPVariable INIT - triggering initialization of: " + variableName+ " using initializer: "+ initializer); //$NON-NLS-1$ //$NON-NLS-2$ +// new Exception("FAKE exception for dumping current CPVariable ("+variableName+ ")INIT invocation stack trace").printStackTrace(); //$NON-NLS-1$//$NON-NLS-2$ +// } +// JavaModelManager.variablePut(variableName, JavaModelManager.VariableInitializationInProgress); // avoid initialization cycles +// boolean ok = false; +// try { +// // wrap initializer call with Safe runnable in case initializer would be causing some grief +// Platform.run(new ISafeRunnable() { +// public void handleException(Throwable exception) { +// Util.log(exception, "Exception occurred in classpath variable initializer: "+initializer+" while initializing variable: "+variableName); //$NON-NLS-1$ //$NON-NLS-2$ +// } +// public void run() throws Exception { +// initializer.initialize(variableName); +// } +// }); +// variablePath = (IPath) JavaModelManager.variableGet(variableName); // initializer should have performed side-effect +// if (variablePath == JavaModelManager.VariableInitializationInProgress) return null; // break cycle (initializer did not init or reentering call) +// if (JavaModelManager.CP_RESOLVE_VERBOSE){ +// System.out.println("CPVariable INIT - after initialization: " + variableName + " --> " + variablePath); //$NON-NLS-2$//$NON-NLS-1$ +// } +// ok = true; +// } finally { +// if (!ok) JavaModelManager.variablePut(variableName, null); // flush cache +// } +// } else { +// if (JavaModelManager.CP_RESOLVE_VERBOSE){ +// System.out.println("CPVariable INIT - no initializer found for: " + variableName); //$NON-NLS-1$ +// } // } + return variablePath; +} - /** - * Returns a table of all known configurable options with their default values. - * These options allow to configure the behaviour of the underlying components. - * The client may safely use the result as a template that they can modify and - * then pass to setOptions. - * - * Helper constants have been defined on JavaCore for each of the option ID and - * their possible constant values. - * - * Note: more options might be added in further releases. - *

-	 * RECOGNIZED OPTIONS:
-	 * COMPILER / Generating Local Variable Debug Attribute
- 	 *    When generated, this attribute will enable local variable names 
-	 *    to be displayed in debugger, only in place where variables are 
-	 *    definitely assigned (.class file is then bigger)
-	 *     - option id:         "org.eclipse.jdt.core.compiler.debug.localVariable"
-	 *     - possible values:   { "generate", "do not generate" }
-	 *     - default:           "generate"
-	 *
-	 * COMPILER / Generating Line Number Debug Attribute 
-	 *    When generated, this attribute will enable source code highlighting in debugger 
-	 *    (.class file is then bigger).
-	 *     - option id:         "org.eclipse.jdt.core.compiler.debug.lineNumber"
-	 *     - possible values:   { "generate", "do not generate" }
-	 *     - default:           "generate"
-	 *    
-	 * COMPILER / Generating Source Debug Attribute 
-	 *    When generated, this attribute will enable the debugger to present the 
-	 *    corresponding source code.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.debug.sourceFile"
-	 *     - possible values:   { "generate", "do not generate" }
-	 *     - default:           "generate"
-	 *    
-	 * COMPILER / Preserving Unused Local Variables
-	 *    Unless requested to preserve unused local variables (that is, never read), the 
-	 *    compiler will optimize them out, potentially altering debugging
-	 *     - option id:         "org.eclipse.jdt.core.compiler.codegen.unusedLocal"
-	 *     - possible values:   { "preserve", "optimize out" }
-	 *     - default:           "preserve"
-	 * 
-	 * COMPILER / Defining Target Java Platform
-	 *    For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
-	 *    Note that "1.4" target require to toggle compliance mode to "1.4" too.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.codegen.targetPlatform"
-	 *     - possible values:   { "1.1", "1.2", "1.3", "1.4" }
-	 *     - default:           "1.1"
-	 *
-	 * COMPILER / Reporting Unreachable Code
-	 *    Unreachable code can optionally be reported as an error, warning or simply 
-	 *    ignored. The bytecode generation will always optimized it out.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.unreachableCode"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "error"
-	 *
-	 * COMPILER / Reporting Invalid Import
-	 *    An import statement that cannot be resolved might optionally be reported 
-	 *    as an error, as a warning or ignored.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.invalidImport"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "error"
-	 *
-	 * COMPILER / Reporting Attempt to Override Package-Default Method
-	 *    A package default method is not visible in a different package, and thus 
-	 *    cannot be overridden. When enabling this option, the compiler will signal 
-	 *    such scenarii either as an error or a warning.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "warning"
-	 *
-	 * COMPILER / Reporting Method With Constructor Name
-	 *    Naming a method with a constructor name is generally considered poor 
-	 *    style programming. When enabling this option, the compiler will signal such 
-	 *    scenarii either as an error or a warning.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.methodWithConstructorName"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "warning"
-	 *
-	 * COMPILER / Reporting Deprecation
-	 *    When enabled, the compiler will signal use of deprecated API either as an 
-	 *    error or a warning.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.deprecation"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "warning"
-	 *
-	 * COMPILER / Reporting Deprecation Inside Deprecated Code
-	 *    When enabled, the compiler will signal use of deprecated API inside deprecated code.
-	 *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.deprecation".
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode"
-	 *     - possible values:   { "enabled", "disabled" }
-	 *     - default:           "disabled"
-	 *
-	 * COMPILER / Reporting Hidden Catch Block
-	 *    Locally to a try statement, some catch blocks may hide others . For example,
-	 *      try {  throw new java.io.CharConversionException();
-	 *      } catch (java.io.CharConversionException e) {
-	 *      } catch (java.io.IOException e) {}. 
-	 *    When enabling this option, the compiler will issue an error or a warning for hidden 
-	 *    catch blocks corresponding to checked exceptions
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "warning"
-	 *
-	 * COMPILER / Reporting Unused Local
-	 *    When enabled, the compiler will issue an error or a warning for unused local 
-	 *    variables (that is, variables never read from)
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedLocal"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "ignore"
-	 *
-	 * COMPILER / Reporting Unused Parameter
-	 *    When enabled, the compiler will issue an error or a warning for unused method 
-	 *    parameters (that is, parameters never read from)
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameter"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "ignore"
-	 *
-	 * COMPILER / Reporting Unused Parameter if Implementing Abstract Method
-	 *    When enabled, the compiler will signal unused parameters in abstract method implementations.
-	 *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract"
-	 *     - possible values:   { "enabled", "disabled" }
-	 *     - default:           "disabled"
-	 *
-	 * COMPILER / Reporting Unused Parameter if Overriding Concrete Method
-	 *    When enabled, the compiler will signal unused parameters in methods overriding concrete ones.
-	 *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete"
-	 *     - possible values:   { "enabled", "disabled" }
-	 *     - default:           "disabled"
-	 *
-	 * COMPILER / Reporting Unused Import
-	 *    When enabled, the compiler will issue an error or a warning for unused import 
-	 *    reference 
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedImport"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "warning"
-	 *
-	 * COMPILER / Reporting Unused Private Members
-	 *    When enabled, the compiler will issue an error or a warning whenever a private 
-	 *    method or field is declared but never used within the same unit.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedPrivateMember"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "ignore"
-	 *
-	 * COMPILER / Reporting Synthetic Access Emulation
-	 *    When enabled, the compiler will issue an error or a warning whenever it emulates 
-	 *    access to a non-accessible member of an enclosing type. Such access can have
-	 *    performance implications.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "ignore"
-	 *
-	 * COMPILER / Reporting Non-Externalized String Literal
-	 *    When enabled, the compiler will issue an error or a warning for non externalized 
-	 *    String literal (that is, not tagged with //$NON-NLS-$). 
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "ignore"
-	 * 
-	 * COMPILER / Reporting Usage of 'assert' Identifier
-	 *    When enabled, the compiler will issue an error or a warning whenever 'assert' is 
-	 *    used as an identifier (reserved keyword in 1.4)
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.assertIdentifier"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "ignore"
-	 * 
-	 * COMPILER / Reporting Non-Static Reference to a Static Member
-	 *    When enabled, the compiler will issue an error or a warning whenever a static field
-	 *    or method is accessed with an expression receiver. A reference to a static member should
-	 *    be qualified with a type name.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.staticAccessReceiver"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "warning"
-	 * 
-	 * COMPILER / Reporting Assignment with no Effect
-	 *    When enabled, the compiler will issue an error or a warning whenever an assignment
-	 *    has no effect (e.g 'x = x').
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.noEffectAssignment"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "warning"
-	 * 
-	 * COMPILER / Reporting Interface Method not Compatible with non-Inherited Methods
-	 *    When enabled, the compiler will issue an error or a warning whenever an interface
-	 *    defines a method incompatible with a non-inherited Object method. Until this conflict
-	 *    is resolved, such an interface cannot be implemented, For example, 
-	 *      interface I { 
-	 *         int clone();
-	 *      } 
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "warning"
-	 * 
-	 * COMPILER / Reporting Usage of char[] Expressions in String Concatenations
-	 *    When enabled, the compiler will issue an error or a warning whenever a char[] expression
-	 *    is used in String concatenations (for example, "hello" + new char[]{'w','o','r','l','d'}).
-	 *     - option id:         "org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion"
-	 *     - possible values:   { "error", "warning", "ignore" }
-	 *     - default:           "warning"
-	 *
-	 * COMPILER / Setting Source Compatibility Mode
-	 *    Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
-	 *    reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
-	 *   level should be set to "1.4" and the compliance mode should be "1.4".
-	 *     - option id:         "org.eclipse.jdt.core.compiler.source"
-	 *     - possible values:   { "1.3", "1.4" }
-	 *     - default:           "1.3"
-	 * 
-	 * COMPILER / Setting Compliance Level
-	 *    Select the compliance level for the compiler. In "1.3" mode, source and target settings
-	 *    should not go beyond "1.3" level.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.compliance"
-	 *     - possible values:   { "1.3", "1.4" }
-	 *     - default:           "1.3"
-	 * 
-	 * COMPILER / Maximum number of problems reported per compilation unit
-	 *    Specify the maximum number of problems reported on each compilation unit.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.maxProblemPerUnit"
-	 *     - possible values:	"" where  is zero or a positive integer (if zero then all problems are reported).
-	 *     - default:           "100"
-	 * 
-	 * COMPILER / Define the Automatic Task Tags
-	 *    When the tag list is not empty, the compiler will issue a task marker whenever it encounters
-	 *    one of the corresponding tag inside any comment in Java source code.
-	 *    Generated task messages will include the tag, and range until the next line separator or comment ending.
-	 *    Note that tasks messages are trimmed.
-	 *     - option id:         "org.eclipse.jdt.core.compiler.taskTags"
-	 *     - possible values:   { "[,]*" } where  is a String without any wild-card or leading/trailing spaces 
-	 *     - default:           ""
-	 * 
-	 * COMPILER / Define the Automatic Task Priorities
-	 *    In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
-	 *    of the task markers issued by the compiler.
-	 *    If the default is specified, the priority of each task marker is "NORMAL".
-	 *     - option id:         "org.eclipse.jdt.core.compiler.taskPriorities"
-	 *     - possible values:   { "[,]*" } where  is one of "HIGH", "NORMAL" or "LOW"
-	 *     - default:           ""
-	 *
-	 * BUILDER / Specifying Filters for Resource Copying Control
-	 *    Allow to specify some filters to control the resource copy process.
-	 *     - option id:         "org.eclipse.jdt.core.builder.resourceCopyExclusionFilter"
-	 *     - possible values:   { "[,]* } where  is a file name pattern (* and ? wild-cards allowed)
-	 *       or the name of a folder which ends with '/'
-	 *     - default:           ""
-	 * 
-	 * BUILDER / Abort if Invalid Classpath
-	 *    Allow to toggle the builder to abort if the classpath is invalid
-	 *     - option id:         "org.eclipse.jdt.core.builder.invalidClasspath"
-	 *     - possible values:   { "abort", "ignore" }
-	 *     - default:           "abort"
-	 * 
-	 * BUILDER / Cleaning Output Folder(s)
-	 *    Indicate whether the JavaBuilder is allowed to clean the output folders
-	 *    when performing full build operations.
-	 *     - option id:         "org.eclipse.jdt.core.builder.cleanOutputFolder"
-	 *     - possible values:   { "clean", "ignore" }
-	 *     - default:           "clean"
-	 * 
-	 * BUILDER / Reporting Duplicate Resources
-	 *    Indicate the severity of the problem reported when more than one occurrence
-	 *    of a resource is to be copied into the output location.
-	 *     - option id:         "org.eclipse.jdt.core.builder.duplicateResourceTask"
-	 *     - possible values:   { "error", "warning" }
-	 *     - default:           "warning"
-	 * 
-	 * JAVACORE / Computing Project Build Order
-	 *    Indicate whether JavaCore should enforce the project build order to be based on
-	 *    the classpath prerequisite chain. When requesting to compute, this takes over
-	 *    the platform default order (based on project references).
-	 *     - option id:         "org.eclipse.jdt.core.computeJavaBuildOrder"
-	 *     - possible values:   { "compute", "ignore" }
-	 *     - default:           "ignore"	 
-	 * 
-	 * JAVACORE / Specify Default Source Encoding Format
-	 *    Get the encoding format for compiled sources. This setting is read-only, it is equivalent
-	 *    to 'ResourcesPlugin.getEncoding()'.
-	 *     - option id:         "org.eclipse.jdt.core.encoding"
-	 *     - possible values:   { any of the supported encoding name}.
-	 *     - default:           
-	 * 
-	 * JAVACORE / Reporting Incomplete Classpath
-	 *    Indicate the severity of the problem reported when an entry on the classpath does not exist, 
-	 *    is not legite or is not visible (for example, a referenced project is closed).
-	 *     - option id:         "org.eclipse.jdt.core.incompleteClasspath"
-	 *     - possible values:   { "error", "warning"}
-	 *     - default:           "error"
-	 * 
-	 * JAVACORE / Reporting Classpath Cycle
-	 *    Indicate the severity of the problem reported when a project is involved in a cycle.
-	 *     - option id:         "org.eclipse.jdt.core.circularClasspath"
-	 *     - possible values:   { "error", "warning" }
-	 *     - default:           "error"
-	 * 
-	 * JAVACORE / Enabling Usage of Classpath Exclusion Patterns
-	 *    When disabled, no entry on a project classpath can be associated with
-	 *    an exclusion pattern.
-	 *     - option id:         "org.eclipse.jdt.core.classpath.exclusionPatterns"
-	 *     - possible values:   { "enabled", "disabled" }
-	 *     - default:           "enabled"
-	 * 
-	 * JAVACORE / Enabling Usage of Classpath Multiple Output Locations
-	 *    When disabled, no entry on a project classpath can be associated with
-	 *    a specific output location, preventing thus usage of multiple output locations.
-	 *     - option id:         "org.eclipse.jdt.core.classpath.multipleOutputLocations"
-	 *     - possible values:   { "enabled", "disabled" }
-	 *     - default:           "enabled"
-	 * 
-	 *	FORMATTER / Inserting New Line Before Opening Brace
-	 *    When Insert, a new line is inserted before an opening brace, otherwise nothing
-	 *    is inserted
-	 *     - option id:         "org.eclipse.jdt.core.formatter.newline.openingBrace"
-	 *     - possible values:   { "insert", "do not insert" }
-	 *     - default:           "do not insert"
-	 * 
-	 *	FORMATTER / Inserting New Line Inside Control Statement
-	 *    When Insert, a new line is inserted between } and following else, catch, finally
-	 *     - option id:         "org.eclipse.jdt.core.formatter.newline.controlStatement"
-	 *     - possible values:   { "insert", "do not insert" }
-	 *     - default:           "do not insert"
-	 * 
-	 *	FORMATTER / Clearing Blank Lines
-	 *    When Clear all, all blank lines are removed. When Preserve one, only one is kept
-	 *    and all others removed.
-	 *     - option id:         "org.eclipse.jdt.core.formatter.newline.clearAll"
-	 *     - possible values:   { "clear all", "preserve one" }
-	 *     - default:           "preserve one"
-	 * 
-	 *	FORMATTER / Inserting New Line Between Else/If 
-	 *    When Insert, a blank line is inserted between an else and an if when they are 
-	 *    contiguous. When choosing to not insert, else-if will be kept on the same
-	 *    line when possible.
-	 *     - option id:         "org.eclipse.jdt.core.formatter.newline.elseIf"
-	 *     - possible values:   { "insert", "do not insert" }
-	 *     - default:           "do not insert"
-	 * 
-	 *	FORMATTER / Inserting New Line In Empty Block
-	 *    When insert, a line break is inserted between contiguous { and }, if } is not followed
-	 *    by a keyword.
-	 *     - option id:         "org.eclipse.jdt.core.formatter.newline.emptyBlock"
-	 *     - possible values:   { "insert", "do not insert" }
-	 *     - default:           "insert"
-	 * 
-	 *	FORMATTER / Splitting Lines Exceeding Length
-	 *    Enable splitting of long lines (exceeding the configurable length). Length of 0 will
-	 *    disable line splitting
-	 *     - option id:         "org.eclipse.jdt.core.formatter.lineSplit"
-	 *     - possible values:	"", where n is zero or a positive integer
-	 *     - default:           "80"
-	 * 
-	 *	FORMATTER / Compacting Assignment
-	 *    Assignments can be formatted asymmetrically, for example 'int x= 2;', when Normal, a space
-	 *    is inserted before the assignment operator
-	 *     - option id:         "org.eclipse.jdt.core.formatter.style.assignment"
-	 *     - possible values:   { "compact", "normal" }
-	 *     - default:           "normal"
-	 * 
-	 *	FORMATTER / Defining Indentation Character
-	 *    Either choose to indent with tab characters or spaces
-	 *     - option id:         "org.eclipse.jdt.core.formatter.tabulation.char"
-	 *     - possible values:   { "tab", "space" }
-	 *     - default:           "tab"
-	 * 
-	 *	FORMATTER / Defining Space Indentation Length
-	 *    When using spaces, set the amount of space characters to use for each 
-	 *    indentation mark.
-	 *     - option id:         "org.eclipse.jdt.core.formatter.tabulation.size"
-	 *     - possible values:	"", where n is a positive integer
-	 *     - default:           "4"
-	 * 
-	 *	FORMATTER / Inserting space in cast expression
-	 *    When Insert, a space is added between the type and the expression in a cast expression.
-	 *     - option id:         "org.eclipse.jdt.core.formatter.space.castexpression"
-	 *     - possible values:   { "insert", "do not insert" }
-	 *     - default:           "insert"
-	 * 
-	 *	CODEASSIST / Activate Visibility Sensitive Completion
-	 *    When active, completion doesn't show that you can not see
-	 *    (for example, you can not see private methods of a super class).
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.visibilityCheck"
-	 *     - possible values:   { "enabled", "disabled" }
-	 *     - default:           "disabled"
-	 * 
-	 *	CODEASSIST / Automatic Qualification of Implicit Members
-	 *    When active, completion automatically qualifies completion on implicit
-	 *    field references and message expressions.
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.forceImplicitQualification"
-	 *     - possible values:   { "enabled", "disabled" }
-	 *     - default:           "disabled"
-	 * 
-	 *  CODEASSIST / Define the Prefixes for Field Name
-	 *    When the prefixes is non empty, completion for field name will begin with
-	 *    one of the proposed prefixes.
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.fieldPrefixes"
-	 *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-	 *     - default:           ""
-	 * 
-	 *  CODEASSIST / Define the Prefixes for Static Field Name
-	 *    When the prefixes is non empty, completion for static field name will begin with
-	 *    one of the proposed prefixes.
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.staticFieldPrefixes"
-	 *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-	 *     - default:           ""
-	 * 
-	 *  CODEASSIST / Define the Prefixes for Local Variable Name
-	 *    When the prefixes is non empty, completion for local variable name will begin with
-	 *    one of the proposed prefixes.
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.localPrefixes"
-	 *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-	 *     - default:           ""
-	 * 
-	 *  CODEASSIST / Define the Prefixes for Argument Name
-	 *    When the prefixes is non empty, completion for argument name will begin with
-	 *    one of the proposed prefixes.
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.argumentPrefixes"
-	 *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-	 *     - default:           ""
-	 * 
-	 *  CODEASSIST / Define the Suffixes for Field Name
-	 *    When the suffixes is non empty, completion for field name will end with
-	 *    one of the proposed suffixes.
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.fieldSuffixes"
-	 *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-	 *     - default:           ""
-	 * 
-	 *  CODEASSIST / Define the Suffixes for Static Field Name
-	 *    When the suffixes is non empty, completion for static field name will end with
-	 *    one of the proposed suffixes.
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.staticFieldSuffixes"
-	 *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-	 *     - default:           ""
-	 * 
-	 *  CODEASSIST / Define the Suffixes for Local Variable Name
-	 *    When the suffixes is non empty, completion for local variable name will end with
-	 *    one of the proposed suffixes.
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.localSuffixes"
-	 *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-	 *     - default:           ""
-	 * 
-	 *  CODEASSIST / Define the Suffixes for Argument Name
-	 *    When the suffixes is non empty, completion for argument name will end with
-	 *    one of the proposed suffixes.
-	 *     - option id:         "org.eclipse.jdt.core.codeComplete.argumentSuffixes"
-	 *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-	 *     - default:           ""
-	 * 
- * - * @return a mutable table containing the default settings of all known options - * (key type: String; value type: String) - * @see #setOptions - */ - public static Hashtable getDefaultOptions(){ +/** + * Helper method finding the classpath variable initializer registered for a given classpath variable name + * or null if none was found while iterating over the contributions to extension point to + * the extension point "org.eclipse.jdt.core.classpathVariableInitializer". + *

+ * @param the given variable + * @return ClasspathVariableInitializer - the registered classpath variable initializer or null if + * none was found. + * @since 2.1 + */ +public static ClasspathVariableInitializer getClasspathVariableInitializer(String variable){ + + Plugin jdtCorePlugin = JavaCore.getPlugin(); + if (jdtCorePlugin == null) return null; + +// IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPVARIABLE_INITIALIZER_EXTPOINT_ID); +// if (extension != null) { +// IExtension[] extensions = extension.getExtensions(); +// for(int i = 0; i < extensions.length; i++){ +// IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); +// for(int j = 0; j < configElements.length; j++){ +// try { +// String varAttribute = configElements[j].getAttribute("variable"); //$NON-NLS-1$ +// if (variable.equals(varAttribute)) { +// if (JavaModelManager.CP_RESOLVE_VERBOSE) { +// System.out.println("CPVariable INIT - found initializer: "+variable+" --> " + configElements[j].getAttribute("class"));//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ +// } +// Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ +// if (execExt instanceof ClasspathVariableInitializer){ +// return (ClasspathVariableInitializer)execExt; +// } +// } +// } catch(CoreException e){ +// } +// } +// } +// } + return null; +} - Hashtable defaultOptions = new Hashtable(10); +/** + * Returns the names of all known classpath variables. + *

+ * Classpath variable values are persisted locally to the workspace, and + * are preserved from session to session. + *

+ * + * @return the list of classpath variable names + * @see #setClasspathVariable + */ +//public static String[] getClasspathVariableNames() { +// return JavaModelManager.variableNames(); +//} - // see #initializeDefaultPluginPreferences() for changing default settings +/** + * Returns a table of all known configurable options with their default values. + * These options allow to configure the behaviour of the underlying components. + * The client may safely use the result as a template that they can modify and + * then pass to setOptions. + * + * Helper constants have been defined on JavaCore for each of the option ID and + * their possible constant values. + * + * Note: more options might be added in further releases. + *

+ * RECOGNIZED OPTIONS:
+ * COMPILER / Generating Local Variable Debug Attribute
+ *    When generated, this attribute will enable local variable names 
+ *    to be displayed in debugger, only in place where variables are 
+ *    definitely assigned (.class file is then bigger)
+ *     - option id:         "org.eclipse.jdt.core.compiler.debug.localVariable"
+ *     - possible values:   { "generate", "do not generate" }
+ *     - default:           "generate"
+ *
+ * COMPILER / Generating Line Number Debug Attribute 
+ *    When generated, this attribute will enable source code highlighting in debugger 
+ *    (.class file is then bigger).
+ *     - option id:         "org.eclipse.jdt.core.compiler.debug.lineNumber"
+ *     - possible values:   { "generate", "do not generate" }
+ *     - default:           "generate"
+ *    
+ * COMPILER / Generating Source Debug Attribute 
+ *    When generated, this attribute will enable the debugger to present the 
+ *    corresponding source code.
+ *     - option id:         "org.eclipse.jdt.core.compiler.debug.sourceFile"
+ *     - possible values:   { "generate", "do not generate" }
+ *     - default:           "generate"
+ *    
+ * COMPILER / Preserving Unused Local Variables
+ *    Unless requested to preserve unused local variables (that is, never read), the 
+ *    compiler will optimize them out, potentially altering debugging
+ *     - option id:         "org.eclipse.jdt.core.compiler.codegen.unusedLocal"
+ *     - possible values:   { "preserve", "optimize out" }
+ *     - default:           "preserve"
+ * 
+ * COMPILER / Defining Target Java Platform
+ *    For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
+ *    Note that "1.4" target require to toggle compliance mode to "1.4" too.
+ *     - option id:         "org.eclipse.jdt.core.compiler.codegen.targetPlatform"
+ *     - possible values:   { "1.1", "1.2", "1.3", "1.4" }
+ *     - default:           "1.1"
+ *
+ * COMPILER / Reporting Unreachable Code
+ *    Unreachable code can optionally be reported as an error, warning or simply 
+ *    ignored. The bytecode generation will always optimized it out.
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.unreachableCode"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "error"
+ *
+ * COMPILER / Reporting Invalid Import
+ *    An import statement that cannot be resolved might optionally be reported 
+ *    as an error, as a warning or ignored.
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.invalidImport"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "error"
+ *
+ * COMPILER / Reporting Attempt to Override Package-Default Method
+ *    A package default method is not visible in a different package, and thus 
+ *    cannot be overridden. When enabling this option, the compiler will signal 
+ *    such scenarii either as an error or a warning.
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "warning"
+ *
+ * COMPILER / Reporting Method With Constructor Name
+ *    Naming a method with a constructor name is generally considered poor 
+ *    style programming. When enabling this option, the compiler will signal such 
+ *    scenarii either as an error or a warning.
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.methodWithConstructorName"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "warning"
+ *
+ * COMPILER / Reporting Deprecation
+ *    When enabled, the compiler will signal use of deprecated API either as an 
+ *    error or a warning.
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.deprecation"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "warning"
+ *
+ * COMPILER / Reporting Deprecation Inside Deprecated Code
+ *    When enabled, the compiler will signal use of deprecated API inside deprecated code.
+ *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.deprecation".
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode"
+ *     - possible values:   { "enabled", "disabled" }
+ *     - default:           "disabled"
+ *
+ * COMPILER / Reporting Hidden Catch Block
+ *    Locally to a try statement, some catch blocks may hide others . For example,
+ *      try {  throw new java.io.CharConversionException();
+ *      } catch (java.io.CharConversionException e) {
+ *      } catch (java.io.IOException e) {}. 
+ *    When enabling this option, the compiler will issue an error or a warning for hidden 
+ *    catch blocks corresponding to checked exceptions
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "warning"
+ *
+ * COMPILER / Reporting Unused Local
+ *    When enabled, the compiler will issue an error or a warning for unused local 
+ *    variables (that is, variables never read from)
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedLocal"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "ignore"
+ *
+ * COMPILER / Reporting Unused Parameter
+ *    When enabled, the compiler will issue an error or a warning for unused method 
+ *    parameters (that is, parameters never read from)
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameter"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "ignore"
+ *
+ * COMPILER / Reporting Unused Parameter if Implementing Abstract Method
+ *    When enabled, the compiler will signal unused parameters in abstract method implementations.
+ *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract"
+ *     - possible values:   { "enabled", "disabled" }
+ *     - default:           "disabled"
+ *
+ * COMPILER / Reporting Unused Parameter if Overriding Concrete Method
+ *    When enabled, the compiler will signal unused parameters in methods overriding concrete ones.
+ *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete"
+ *     - possible values:   { "enabled", "disabled" }
+ *     - default:           "disabled"
+ *
+ * COMPILER / Reporting Unused Import
+ *    When enabled, the compiler will issue an error or a warning for unused import 
+ *    reference 
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedImport"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "warning"
+ *
+ * COMPILER / Reporting Unused Private Members
+ *    When enabled, the compiler will issue an error or a warning whenever a private 
+ *    method or field is declared but never used within the same unit.
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedPrivateMember"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "ignore"
+ *
+ * COMPILER / Reporting Synthetic Access Emulation
+ *    When enabled, the compiler will issue an error or a warning whenever it emulates 
+ *    access to a non-accessible member of an enclosing type. Such access can have
+ *    performance implications.
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "ignore"
+ *
+ * COMPILER / Reporting Non-Externalized String Literal
+ *    When enabled, the compiler will issue an error or a warning for non externalized 
+ *    String literal (that is, not tagged with //$NON-NLS-$). 
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "ignore"
+ * 
+ * COMPILER / Reporting Usage of 'assert' Identifier
+ *    When enabled, the compiler will issue an error or a warning whenever 'assert' is 
+ *    used as an identifier (reserved keyword in 1.4)
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.assertIdentifier"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "ignore"
+ * 
+ * COMPILER / Reporting Non-Static Reference to a Static Member
+ *    When enabled, the compiler will issue an error or a warning whenever a static field
+ *    or method is accessed with an expression receiver. A reference to a static member should
+ *    be qualified with a type name.
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.staticAccessReceiver"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "warning"
+ * 
+ * COMPILER / Reporting Assignment with no Effect
+ *    When enabled, the compiler will issue an error or a warning whenever an assignment
+ *    has no effect (e.g 'x = x').
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.noEffectAssignment"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "warning"
+ * 
+ * COMPILER / Reporting Interface Method not Compatible with non-Inherited Methods
+ *    When enabled, the compiler will issue an error or a warning whenever an interface
+ *    defines a method incompatible with a non-inherited Object method. Until this conflict
+ *    is resolved, such an interface cannot be implemented, For example, 
+ *      interface I { 
+ *         int clone();
+ *      } 
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "warning"
+ * 
+ * COMPILER / Reporting Usage of char[] Expressions in String Concatenations
+ *    When enabled, the compiler will issue an error or a warning whenever a char[] expression
+ *    is used in String concatenations (for example, "hello" + new char[]{'w','o','r','l','d'}).
+ *     - option id:         "org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion"
+ *     - possible values:   { "error", "warning", "ignore" }
+ *     - default:           "warning"
+ *
+ * COMPILER / Setting Source Compatibility Mode
+ *    Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
+ *    reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
+ *   level should be set to "1.4" and the compliance mode should be "1.4".
+ *     - option id:         "org.eclipse.jdt.core.compiler.source"
+ *     - possible values:   { "1.3", "1.4" }
+ *     - default:           "1.3"
+ * 
+ * COMPILER / Setting Compliance Level
+ *    Select the compliance level for the compiler. In "1.3" mode, source and target settings
+ *    should not go beyond "1.3" level.
+ *     - option id:         "org.eclipse.jdt.core.compiler.compliance"
+ *     - possible values:   { "1.3", "1.4" }
+ *     - default:           "1.3"
+ * 
+ * COMPILER / Maximum number of problems reported per compilation unit
+ *    Specify the maximum number of problems reported on each compilation unit.
+ *     - option id:         "org.eclipse.jdt.core.compiler.maxProblemPerUnit"
+ *     - possible values:	"" where  is zero or a positive integer (if zero then all problems are reported).
+ *     - default:           "100"
+ * 
+ * COMPILER / Define the Automatic Task Tags
+ *    When the tag list is not empty, the compiler will issue a task marker whenever it encounters
+ *    one of the corresponding tag inside any comment in Java source code.
+ *    Generated task messages will include the tag, and range until the next line separator or comment ending.
+ *    Note that tasks messages are trimmed.
+ *     - option id:         "org.eclipse.jdt.core.compiler.taskTags"
+ *     - possible values:   { "[,]*" } where  is a String without any wild-card or leading/trailing spaces 
+ *     - default:           ""
+ * 
+ * COMPILER / Define the Automatic Task Priorities
+ *    In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
+ *    of the task markers issued by the compiler.
+ *    If the default is specified, the priority of each task marker is "NORMAL".
+ *     - option id:         "org.eclipse.jdt.core.compiler.taskPriorities"
+ *     - possible values:   { "[,]*" } where  is one of "HIGH", "NORMAL" or "LOW"
+ *     - default:           ""
+ *
+ * BUILDER / Specifying Filters for Resource Copying Control
+ *    Allow to specify some filters to control the resource copy process.
+ *     - option id:         "org.eclipse.jdt.core.builder.resourceCopyExclusionFilter"
+ *     - possible values:   { "[,]* } where  is a file name pattern (* and ? wild-cards allowed)
+ *       or the name of a folder which ends with '/'
+ *     - default:           ""
+ * 
+ * BUILDER / Abort if Invalid Classpath
+ *    Allow to toggle the builder to abort if the classpath is invalid
+ *     - option id:         "org.eclipse.jdt.core.builder.invalidClasspath"
+ *     - possible values:   { "abort", "ignore" }
+ *     - default:           "abort"
+ * 
+ * BUILDER / Cleaning Output Folder(s)
+ *    Indicate whether the JavaBuilder is allowed to clean the output folders
+ *    when performing full build operations.
+ *     - option id:         "org.eclipse.jdt.core.builder.cleanOutputFolder"
+ *     - possible values:   { "clean", "ignore" }
+ *     - default:           "clean"
+ * 
+ * BUILDER / Reporting Duplicate Resources
+ *    Indicate the severity of the problem reported when more than one occurrence
+ *    of a resource is to be copied into the output location.
+ *     - option id:         "org.eclipse.jdt.core.builder.duplicateResourceTask"
+ *     - possible values:   { "error", "warning" }
+ *     - default:           "warning"
+ * 
+ * JAVACORE / Computing Project Build Order
+ *    Indicate whether JavaCore should enforce the project build order to be based on
+ *    the classpath prerequisite chain. When requesting to compute, this takes over
+ *    the platform default order (based on project references).
+ *     - option id:         "org.eclipse.jdt.core.computeJavaBuildOrder"
+ *     - possible values:   { "compute", "ignore" }
+ *     - default:           "ignore"	 
+ * 
+ * JAVACORE / Specify Default Source Encoding Format
+ *    Get the encoding format for compiled sources. This setting is read-only, it is equivalent
+ *    to 'ResourcesPlugin.getEncoding()'.
+ *     - option id:         "org.eclipse.jdt.core.encoding"
+ *     - possible values:   { any of the supported encoding name}.
+ *     - default:           
+ * 
+ * JAVACORE / Reporting Incomplete Classpath
+ *    Indicate the severity of the problem reported when an entry on the classpath does not exist, 
+ *    is not legite or is not visible (for example, a referenced project is closed).
+ *     - option id:         "org.eclipse.jdt.core.incompleteClasspath"
+ *     - possible values:   { "error", "warning"}
+ *     - default:           "error"
+ * 
+ * JAVACORE / Reporting Classpath Cycle
+ *    Indicate the severity of the problem reported when a project is involved in a cycle.
+ *     - option id:         "org.eclipse.jdt.core.circularClasspath"
+ *     - possible values:   { "error", "warning" }
+ *     - default:           "error"
+ * 
+ * JAVACORE / Enabling Usage of Classpath Exclusion Patterns
+ *    When disabled, no entry on a project classpath can be associated with
+ *    an exclusion pattern.
+ *     - option id:         "org.eclipse.jdt.core.classpath.exclusionPatterns"
+ *     - possible values:   { "enabled", "disabled" }
+ *     - default:           "enabled"
+ * 
+ * JAVACORE / Enabling Usage of Classpath Multiple Output Locations
+ *    When disabled, no entry on a project classpath can be associated with
+ *    a specific output location, preventing thus usage of multiple output locations.
+ *     - option id:         "org.eclipse.jdt.core.classpath.multipleOutputLocations"
+ *     - possible values:   { "enabled", "disabled" }
+ *     - default:           "enabled"
+ * 
+ *	FORMATTER / Inserting New Line Before Opening Brace
+ *    When Insert, a new line is inserted before an opening brace, otherwise nothing
+ *    is inserted
+ *     - option id:         "org.eclipse.jdt.core.formatter.newline.openingBrace"
+ *     - possible values:   { "insert", "do not insert" }
+ *     - default:           "do not insert"
+ * 
+ *	FORMATTER / Inserting New Line Inside Control Statement
+ *    When Insert, a new line is inserted between } and following else, catch, finally
+ *     - option id:         "org.eclipse.jdt.core.formatter.newline.controlStatement"
+ *     - possible values:   { "insert", "do not insert" }
+ *     - default:           "do not insert"
+ * 
+ *	FORMATTER / Clearing Blank Lines
+ *    When Clear all, all blank lines are removed. When Preserve one, only one is kept
+ *    and all others removed.
+ *     - option id:         "org.eclipse.jdt.core.formatter.newline.clearAll"
+ *     - possible values:   { "clear all", "preserve one" }
+ *     - default:           "preserve one"
+ * 
+ *	FORMATTER / Inserting New Line Between Else/If 
+ *    When Insert, a blank line is inserted between an else and an if when they are 
+ *    contiguous. When choosing to not insert, else-if will be kept on the same
+ *    line when possible.
+ *     - option id:         "org.eclipse.jdt.core.formatter.newline.elseIf"
+ *     - possible values:   { "insert", "do not insert" }
+ *     - default:           "do not insert"
+ * 
+ *	FORMATTER / Inserting New Line In Empty Block
+ *    When insert, a line break is inserted between contiguous { and }, if } is not followed
+ *    by a keyword.
+ *     - option id:         "org.eclipse.jdt.core.formatter.newline.emptyBlock"
+ *     - possible values:   { "insert", "do not insert" }
+ *     - default:           "insert"
+ * 
+ *	FORMATTER / Splitting Lines Exceeding Length
+ *    Enable splitting of long lines (exceeding the configurable length). Length of 0 will
+ *    disable line splitting
+ *     - option id:         "org.eclipse.jdt.core.formatter.lineSplit"
+ *     - possible values:	"", where n is zero or a positive integer
+ *     - default:           "80"
+ * 
+ *	FORMATTER / Compacting Assignment
+ *    Assignments can be formatted asymmetrically, for example 'int x= 2;', when Normal, a space
+ *    is inserted before the assignment operator
+ *     - option id:         "org.eclipse.jdt.core.formatter.style.assignment"
+ *     - possible values:   { "compact", "normal" }
+ *     - default:           "normal"
+ * 
+ *	FORMATTER / Defining Indentation Character
+ *    Either choose to indent with tab characters or spaces
+ *     - option id:         "org.eclipse.jdt.core.formatter.tabulation.char"
+ *     - possible values:   { "tab", "space" }
+ *     - default:           "tab"
+ * 
+ *	FORMATTER / Defining Space Indentation Length
+ *    When using spaces, set the amount of space characters to use for each 
+ *    indentation mark.
+ *     - option id:         "org.eclipse.jdt.core.formatter.tabulation.size"
+ *     - possible values:	"", where n is a positive integer
+ *     - default:           "4"
+ * 
+ *	FORMATTER / Inserting space in cast expression
+ *    When Insert, a space is added between the type and the expression in a cast expression.
+ *     - option id:         "org.eclipse.jdt.core.formatter.space.castexpression"
+ *     - possible values:   { "insert", "do not insert" }
+ *     - default:           "insert"
+ * 
+ *	CODEASSIST / Activate Visibility Sensitive Completion
+ *    When active, completion doesn't show that you can not see
+ *    (for example, you can not see private methods of a super class).
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.visibilityCheck"
+ *     - possible values:   { "enabled", "disabled" }
+ *     - default:           "disabled"
+ * 
+ *	CODEASSIST / Automatic Qualification of Implicit Members
+ *    When active, completion automatically qualifies completion on implicit
+ *    field references and message expressions.
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.forceImplicitQualification"
+ *     - possible values:   { "enabled", "disabled" }
+ *     - default:           "disabled"
+ * 
+ *  CODEASSIST / Define the Prefixes for Field Name
+ *    When the prefixes is non empty, completion for field name will begin with
+ *    one of the proposed prefixes.
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.fieldPrefixes"
+ *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+ *     - default:           ""
+ * 
+ *  CODEASSIST / Define the Prefixes for Static Field Name
+ *    When the prefixes is non empty, completion for static field name will begin with
+ *    one of the proposed prefixes.
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.staticFieldPrefixes"
+ *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+ *     - default:           ""
+ * 
+ *  CODEASSIST / Define the Prefixes for Local Variable Name
+ *    When the prefixes is non empty, completion for local variable name will begin with
+ *    one of the proposed prefixes.
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.localPrefixes"
+ *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+ *     - default:           ""
+ * 
+ *  CODEASSIST / Define the Prefixes for Argument Name
+ *    When the prefixes is non empty, completion for argument name will begin with
+ *    one of the proposed prefixes.
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.argumentPrefixes"
+ *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+ *     - default:           ""
+ * 
+ *  CODEASSIST / Define the Suffixes for Field Name
+ *    When the suffixes is non empty, completion for field name will end with
+ *    one of the proposed suffixes.
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.fieldSuffixes"
+ *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+ *     - default:           ""
+ * 
+ *  CODEASSIST / Define the Suffixes for Static Field Name
+ *    When the suffixes is non empty, completion for static field name will end with
+ *    one of the proposed suffixes.
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.staticFieldSuffixes"
+ *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+ *     - default:           ""
+ * 
+ *  CODEASSIST / Define the Suffixes for Local Variable Name
+ *    When the suffixes is non empty, completion for local variable name will end with
+ *    one of the proposed suffixes.
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.localSuffixes"
+ *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+ *     - default:           ""
+ * 
+ *  CODEASSIST / Define the Suffixes for Argument Name
+ *    When the suffixes is non empty, completion for argument name will end with
+ *    one of the proposed suffixes.
+ *     - option id:         "org.eclipse.jdt.core.codeComplete.argumentSuffixes"
+ *     - possible values:   { "[,]*" } where  is a String without any wild-card 
+ *     - default:           ""
+ * 
+ * + * @return a mutable table containing the default settings of all known options + * (key type: String; value type: String) + * @see #setOptions + */ +public static Hashtable getDefaultOptions(){ + + Hashtable defaultOptions = new Hashtable(10); + + // see #initializeDefaultPluginPreferences() for changing default settings + Preferences preferences = getPlugin().getPluginPreferences(); + HashSet optionNames = JavaModelManager.OptionNames; + + // get preferences set to their default + String[] defaultPropertyNames = preferences.defaultPropertyNames(); + for (int i = 0; i < defaultPropertyNames.length; i++){ + String propertyName = defaultPropertyNames[i]; + if (optionNames.contains(propertyName)) { + defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); + } + } + // get preferences not set to their default + String[] propertyNames = preferences.propertyNames(); + for (int i = 0; i < propertyNames.length; i++){ + String propertyName = propertyNames[i]; + if (optionNames.contains(propertyName)) { + defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); + } + } + // get encoding through resource plugin + defaultOptions.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); + + return defaultOptions; +} + +/** + * Returns the single instance of the Java core plug-in runtime class. + * Equivalent to (JavaCore) getPlugin(). + * + * @return the single instance of the Java core plug-in runtime class + */ +public static PHPeclipsePlugin getJavaCore() { + return (PHPeclipsePlugin) getPlugin(); +} + +/** + * Helper method for returning one option value only. Equivalent to (String)JavaCore.getOptions().get(optionName) + * Note that it may answer null if this option does not exist. + *

+ * For a complete description of the configurable options, see getDefaultOptions. + *

+ * + * @param optionName the name of an option + * @return the String value of a given option + * @see JavaCore#getDefaultOptions + * @since 2.0 + */ +public static String getOption(String optionName) { + + if (CORE_ENCODING.equals(optionName)){ + return ResourcesPlugin.getEncoding(); + } + if (JavaModelManager.OptionNames.contains(optionName)){ Preferences preferences = getPlugin().getPluginPreferences(); - HashSet optionNames = JavaModelManager.OptionNames; + return preferences.getString(optionName).trim(); + } + return null; +} + +/** + * Returns the table of the current options. Initially, all options have their default values, + * and this method returns a table that includes all known options. + *

+ * For a complete description of the configurable options, see getDefaultOptions. + *

+ * + * @return table of current settings of all options + * (key type: String; value type: String) + * @see JavaCore#getDefaultOptions + */ +public static Hashtable getOptions() { + Hashtable options = new Hashtable(10); + + // see #initializeDefaultPluginPreferences() for changing default settings + Plugin plugin = getPlugin(); + if (plugin != null) { + Preferences preferences = getPlugin().getPluginPreferences(); + HashSet optionNames = JavaModelManager.OptionNames; + // get preferences set to their default String[] defaultPropertyNames = preferences.defaultPropertyNames(); for (int i = 0; i < defaultPropertyNames.length; i++){ String propertyName = defaultPropertyNames[i]; - if (optionNames.contains(propertyName)) { - defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); + if (optionNames.contains(propertyName)){ + options.put(propertyName, preferences.getDefaultString(propertyName)); } } // get preferences not set to their default String[] propertyNames = preferences.propertyNames(); for (int i = 0; i < propertyNames.length; i++){ String propertyName = propertyNames[i]; - if (optionNames.contains(propertyName)) { - defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); + if (optionNames.contains(propertyName)){ + options.put(propertyName, preferences.getString(propertyName).trim()); } } // get encoding through resource plugin - defaultOptions.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); - - return defaultOptions; + options.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); } - - /** - * Returns the single instance of the Java core plug-in runtime class. - * Equivalent to (JavaCore) getPlugin(). - * - * @return the single instance of the Java core plug-in runtime class - */ - public static JavaCore getJavaCore() { - return (JavaCore) getPlugin(); - } - - /** - * Helper method for returning one option value only. Equivalent to (String)JavaCore.getOptions().get(optionName) - * Note that it may answer null if this option does not exist. - *

- * For a complete description of the configurable options, see getDefaultOptions. - *

- * - * @param optionName the name of an option - * @return the String value of a given option - * @see JavaCore#getDefaultOptions - * @since 2.0 - */ - public static String getOption(String optionName) { + return options; +} - if (CORE_ENCODING.equals(optionName)){ - return ResourcesPlugin.getEncoding(); - } - if (JavaModelManager.OptionNames.contains(optionName)){ - Preferences preferences = getPlugin().getPluginPreferences(); - return preferences.getString(optionName).trim(); - } +/** + * This is a helper method, which returns the resolved classpath entry denoted + * by a given entry (if it is a variable entry). It is obtained by resolving the variable + * reference in the first segment. Returns null if unable to resolve using + * the following algorithm: + *
    + *
  • if variable segment cannot be resolved, returns null
  • + *
  • finds a project, JAR or binary folder in the workspace at the resolved path location
  • + *
  • if none finds an external JAR file or folder outside the workspace at the resolved path location
  • + *
  • if none returns null
  • + *
+ *

+ * Variable source attachment path and root path are also resolved and recorded in the resulting classpath entry. + *

+ * NOTE: This helper method does not handle classpath containers, for which should rather be used + * JavaCore#getClasspathContainer(IPath, IJavaProject). + *

+ * + * @param entry the given variable entry + * @return the resolved library or project classpath entry, or null + * if the given variable entry could not be resolved to a valid classpath entry + */ +public static IClasspathEntry getResolvedClasspathEntry(IClasspathEntry entry) { + + if (entry.getEntryKind() != IClasspathEntry.CPE_VARIABLE) + return entry; + + IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); + IPath resolvedPath = JavaCore.getResolvedVariablePath(entry.getPath()); + if (resolvedPath == null) return null; - } - /** - * Returns the table of the current options. Initially, all options have their default values, - * and this method returns a table that includes all known options. - *

- * For a complete description of the configurable options, see getDefaultOptions. - *

- * - * @return table of current settings of all options - * (key type: String; value type: String) - * @see JavaCore#getDefaultOptions - */ - public static Hashtable getOptions() { - - Hashtable options = new Hashtable(10); - - // see #initializeDefaultPluginPreferences() for changing default settings - Plugin plugin = getPlugin(); - if (plugin != null) { - Preferences preferences = getPlugin().getPluginPreferences(); - HashSet optionNames = JavaModelManager.OptionNames; - - // get preferences set to their default - String[] defaultPropertyNames = preferences.defaultPropertyNames(); - for (int i = 0; i < defaultPropertyNames.length; i++){ - String propertyName = defaultPropertyNames[i]; - if (optionNames.contains(propertyName)){ - options.put(propertyName, preferences.getDefaultString(propertyName)); - } - } - // get preferences not set to their default - String[] propertyNames = preferences.propertyNames(); - for (int i = 0; i < propertyNames.length; i++){ - String propertyName = propertyNames[i]; - if (optionNames.contains(propertyName)){ - options.put(propertyName, preferences.getString(propertyName).trim()); - } - } - // get encoding through resource plugin - options.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); - } - return options; - } - - /** - * Returns the single instance of the Java core plug-in runtime class. - * - * @return the single instance of the Java core plug-in runtime class - */ - public static Plugin getPlugin() { - return JAVA_CORE_PLUGIN; - } - - /** - * This is a helper method, which returns the resolved classpath entry denoted - * by a given entry (if it is a variable entry). It is obtained by resolving the variable - * reference in the first segment. Returns null if unable to resolve using - * the following algorithm: - *
    - *
  • if variable segment cannot be resolved, returns null
  • - *
  • finds a project, JAR or binary folder in the workspace at the resolved path location
  • - *
  • if none finds an external JAR file or folder outside the workspace at the resolved path location
  • - *
  • if none returns null
  • - *
- *

- * Variable source attachment path and root path are also resolved and recorded in the resulting classpath entry. - *

- * NOTE: This helper method does not handle classpath containers, for which should rather be used - * JavaCore#getClasspathContainer(IPath, IJavaProject). - *

- * - * @param entry the given variable entry - * @return the resolved library or project classpath entry, or null - * if the given variable entry could not be resolved to a valid classpath entry - */ -// public static IClasspathEntry getResolvedClasspathEntry(IClasspathEntry entry) { -// -// if (entry.getEntryKind() != IClasspathEntry.CPE_VARIABLE) -// return entry; -// -// IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); -// IPath resolvedPath = JavaCore.getResolvedVariablePath(entry.getPath()); -// if (resolvedPath == null) -// return null; -// -// Object target = JavaModel.getTarget(workspaceRoot, resolvedPath, false); -// if (target == null) -// return null; -// -// // inside the workspace -// if (target instanceof IResource) { -// IResource resolvedResource = (IResource) target; -// if (resolvedResource != null) { -// switch (resolvedResource.getType()) { -// -// case IResource.PROJECT : -// // internal project -// return JavaCore.newProjectEntry(resolvedPath, entry.isExported()); -// -// case IResource.FILE : -// if (Util.isArchiveFileName(resolvedResource.getName())) { -// // internal binary archive -// return JavaCore.newLibraryEntry( -// resolvedPath, -// getResolvedVariablePath(entry.getSourceAttachmentPath()), -// getResolvedVariablePath(entry.getSourceAttachmentRootPath()), -// entry.isExported()); -// } -// break; -// -// case IResource.FOLDER : -// // internal binary folder + Object target = JavaModel.getTarget(workspaceRoot, resolvedPath, false); + if (target == null) + return null; + + // inside the workspace + if (target instanceof IResource) { + IResource resolvedResource = (IResource) target; + if (resolvedResource != null) { + switch (resolvedResource.getType()) { + + case IResource.PROJECT : + // internal project + return JavaCore.newProjectEntry(resolvedPath, entry.isExported()); + + case IResource.FILE : +// if (Util.isArchiveFileName(resolvedResource.getName())) { +// // internal binary archive // return JavaCore.newLibraryEntry( // resolvedPath, // getResolvedVariablePath(entry.getSourceAttachmentPath()), // getResolvedVariablePath(entry.getSourceAttachmentRootPath()), // entry.isExported()); -// } -// } -// } -// // outside the workspace -// if (target instanceof File) { -// File externalFile = (File) target; -// if (externalFile.isFile()) { -// String fileName = externalFile.getName().toLowerCase(); -// if (fileName.endsWith(".jar" //$NON-NLS-1$ -// ) || fileName.endsWith(".zip" //$NON-NLS-1$ -// )) { // external binary archive -// return JavaCore.newLibraryEntry( -// resolvedPath, -// getResolvedVariablePath(entry.getSourceAttachmentPath()), -// getResolvedVariablePath(entry.getSourceAttachmentRootPath()), -// entry.isExported()); -// } -// } else { // external binary folder -// if (resolvedPath.isAbsolute()){ +// } + break; + + case IResource.FOLDER : + // internal binary folder // return JavaCore.newLibraryEntry( // resolvedPath, // getResolvedVariablePath(entry.getSourceAttachmentPath()), // getResolvedVariablePath(entry.getSourceAttachmentRootPath()), // entry.isExported()); -// } + break; + } + } + } + // outside the workspace + if (target instanceof File) { + File externalFile = (File) target; + if (externalFile.isFile()) { + String fileName = externalFile.getName().toLowerCase(); +// if (fileName.endsWith(".jar" //$NON-NLS-1$ +// ) || fileName.endsWith(".zip" //$NON-NLS-1$ +// )) { // external binary archive +// return JavaCore.newLibraryEntry( +// resolvedPath, +// getResolvedVariablePath(entry.getSourceAttachmentPath()), +// getResolvedVariablePath(entry.getSourceAttachmentRootPath()), +// entry.isExported()); // } -// } -// return null; -// } + } else { // external binary folder + if (resolvedPath.isAbsolute()){ +// return JavaCore.newLibraryEntry( +// resolvedPath, +// getResolvedVariablePath(entry.getSourceAttachmentPath()), +// getResolvedVariablePath(entry.getSourceAttachmentRootPath()), +// entry.isExported()); + } + } + } + return null; +} - /** - * Resolve a variable path (helper method). - * - * @param variablePath the given variable path - * @return the resolved variable path or null if none - */ -// public static IPath getResolvedVariablePath(IPath variablePath) { -// -// if (variablePath == null) -// return null; -// int count = variablePath.segmentCount(); -// if (count == 0) -// return null; -// -// // lookup variable -// String variableName = variablePath.segment(0); -// IPath resolvedPath = JavaCore.getClasspathVariable(variableName); -// if (resolvedPath == null) -// return null; -// -// // append path suffix -// if (count > 1) { -// resolvedPath = resolvedPath.append(variablePath.removeFirstSegments(1)); -// } -// return resolvedPath; -// } +/** + * Resolve a variable path (helper method). + * + * @param variablePath the given variable path + * @return the resolved variable path or null if none + */ +public static IPath getResolvedVariablePath(IPath variablePath) { + + if (variablePath == null) + return null; + int count = variablePath.segmentCount(); + if (count == 0) + return null; + + // lookup variable + String variableName = variablePath.segment(0); + IPath resolvedPath = JavaCore.getClasspathVariable(variableName); + if (resolvedPath == null) + return null; + + // append path suffix + if (count > 1) { + resolvedPath = resolvedPath.append(variablePath.removeFirstSegments(1)); + } + return resolvedPath; +} - /** - * Answers the shared working copies currently registered for this buffer factory. - * Working copies can be shared by several clients using the same buffer factory,see - * IWorkingCopy.getSharedWorkingCopy. - * - * @param factory the given buffer factory - * @return the list of shared working copies for a given buffer factory - * @see IWorkingCopy - * @since 2.0 - */ - public static IWorkingCopy[] getSharedWorkingCopies(IBufferFactory factory){ +/** + * Answers the shared working copies currently registered for this buffer factory. + * Working copies can be shared by several clients using the same buffer factory,see + * IWorkingCopy.getSharedWorkingCopy. + * + * @param factory the given buffer factory + * @return the list of shared working copies for a given buffer factory + * @see IWorkingCopy + * @since 2.0 + */ +public static IWorkingCopy[] getSharedWorkingCopies(IBufferFactory factory){ - // if factory is null, default factory must be used - if (factory == null) factory = BufferManager.getDefaultBufferManager().getDefaultBufferFactory(); - Map sharedWorkingCopies = JavaModelManager.getJavaModelManager().sharedWorkingCopies; + // if factory is null, default factory must be used + if (factory == null) factory = BufferManager.getDefaultBufferManager().getDefaultBufferFactory(); + Map sharedWorkingCopies = JavaModelManager.getJavaModelManager().sharedWorkingCopies; - Map perFactoryWorkingCopies = (Map) sharedWorkingCopies.get(factory); - if (perFactoryWorkingCopies == null) return JavaModelManager.NoWorkingCopy; - Collection copies = perFactoryWorkingCopies.values(); - IWorkingCopy[] result = new IWorkingCopy[copies.size()]; - copies.toArray(result); - return result; - } + Map perFactoryWorkingCopies = (Map) sharedWorkingCopies.get(factory); + if (perFactoryWorkingCopies == null) return JavaModelManager.NoWorkingCopy; + Collection copies = perFactoryWorkingCopies.values(); + IWorkingCopy[] result = new IWorkingCopy[copies.size()]; + copies.toArray(result); + return result; +} - /** - * Initializes the default preferences settings for this plug-in. - */ - protected void initializeDefaultPluginPreferences() { +/** + * Initializes the default preferences settings for this plug-in. + */ +public static void initializeDefaultPluginPreferences() { - Preferences preferences = getPluginPreferences(); - HashSet optionNames = JavaModelManager.OptionNames; + Preferences preferences = PHPeclipsePlugin.getDefault().getPluginPreferences(); + HashSet optionNames = JavaModelManager.OptionNames; - // Compiler settings - preferences.setDefault(COMPILER_LOCAL_VARIABLE_ATTR, GENERATE); - optionNames.add(COMPILER_LOCAL_VARIABLE_ATTR); + // Compiler settings + preferences.setDefault(COMPILER_LOCAL_VARIABLE_ATTR, GENERATE); + optionNames.add(COMPILER_LOCAL_VARIABLE_ATTR); - preferences.setDefault(COMPILER_LINE_NUMBER_ATTR, GENERATE); - optionNames.add(COMPILER_LINE_NUMBER_ATTR); + preferences.setDefault(COMPILER_LINE_NUMBER_ATTR, GENERATE); + optionNames.add(COMPILER_LINE_NUMBER_ATTR); - preferences.setDefault(COMPILER_SOURCE_FILE_ATTR, GENERATE); - optionNames.add(COMPILER_SOURCE_FILE_ATTR); + preferences.setDefault(COMPILER_SOURCE_FILE_ATTR, GENERATE); + optionNames.add(COMPILER_SOURCE_FILE_ATTR); - preferences.setDefault(COMPILER_CODEGEN_UNUSED_LOCAL, PRESERVE); - optionNames.add(COMPILER_CODEGEN_UNUSED_LOCAL); + preferences.setDefault(COMPILER_CODEGEN_UNUSED_LOCAL, PRESERVE); + optionNames.add(COMPILER_CODEGEN_UNUSED_LOCAL); - preferences.setDefault(COMPILER_CODEGEN_TARGET_PLATFORM, VERSION_1_1); - optionNames.add(COMPILER_CODEGEN_TARGET_PLATFORM); + preferences.setDefault(COMPILER_CODEGEN_TARGET_PLATFORM, VERSION_1_1); + optionNames.add(COMPILER_CODEGEN_TARGET_PLATFORM); - preferences.setDefault(COMPILER_PB_UNREACHABLE_CODE, ERROR); - optionNames.add(COMPILER_PB_UNREACHABLE_CODE); + preferences.setDefault(COMPILER_PB_UNREACHABLE_CODE, ERROR); + optionNames.add(COMPILER_PB_UNREACHABLE_CODE); - preferences.setDefault(COMPILER_PB_INVALID_IMPORT, ERROR); - optionNames.add(COMPILER_PB_INVALID_IMPORT); + preferences.setDefault(COMPILER_PB_INVALID_IMPORT, ERROR); + optionNames.add(COMPILER_PB_INVALID_IMPORT); - preferences.setDefault(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, WARNING); - optionNames.add(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD); + preferences.setDefault(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, WARNING); + optionNames.add(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD); - preferences.setDefault(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME, WARNING); - optionNames.add(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME); + preferences.setDefault(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME, WARNING); + optionNames.add(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME); - preferences.setDefault(COMPILER_PB_DEPRECATION, WARNING); - optionNames.add(COMPILER_PB_DEPRECATION); + preferences.setDefault(COMPILER_PB_DEPRECATION, WARNING); + optionNames.add(COMPILER_PB_DEPRECATION); - preferences.setDefault(COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, DISABLED); - optionNames.add(COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE); + preferences.setDefault(COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, DISABLED); + optionNames.add(COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE); - preferences.setDefault(COMPILER_PB_HIDDEN_CATCH_BLOCK, WARNING); - optionNames.add(COMPILER_PB_HIDDEN_CATCH_BLOCK); + preferences.setDefault(COMPILER_PB_HIDDEN_CATCH_BLOCK, WARNING); + optionNames.add(COMPILER_PB_HIDDEN_CATCH_BLOCK); - preferences.setDefault(COMPILER_PB_UNUSED_LOCAL, IGNORE); - optionNames.add(COMPILER_PB_UNUSED_LOCAL); + preferences.setDefault(COMPILER_PB_UNUSED_LOCAL, IGNORE); + optionNames.add(COMPILER_PB_UNUSED_LOCAL); - preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER, IGNORE); - optionNames.add(COMPILER_PB_UNUSED_PARAMETER); + preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER, IGNORE); + optionNames.add(COMPILER_PB_UNUSED_PARAMETER); - preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT, DISABLED); - optionNames.add(COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT); + preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT, DISABLED); + optionNames.add(COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT); - preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE, DISABLED); - optionNames.add(COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE); + preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE, DISABLED); + optionNames.add(COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE); - preferences.setDefault(COMPILER_PB_UNUSED_IMPORT, WARNING); - optionNames.add(COMPILER_PB_UNUSED_IMPORT); + preferences.setDefault(COMPILER_PB_UNUSED_IMPORT, WARNING); + optionNames.add(COMPILER_PB_UNUSED_IMPORT); - preferences.setDefault(COMPILER_PB_UNUSED_PRIVATE_MEMBER, IGNORE); - optionNames.add(COMPILER_PB_UNUSED_PRIVATE_MEMBER); + preferences.setDefault(COMPILER_PB_UNUSED_PRIVATE_MEMBER, IGNORE); + optionNames.add(COMPILER_PB_UNUSED_PRIVATE_MEMBER); - preferences.setDefault(COMPILER_PB_SYNTHETIC_ACCESS_EMULATION, IGNORE); - optionNames.add(COMPILER_PB_SYNTHETIC_ACCESS_EMULATION); + preferences.setDefault(COMPILER_PB_SYNTHETIC_ACCESS_EMULATION, IGNORE); + optionNames.add(COMPILER_PB_SYNTHETIC_ACCESS_EMULATION); - preferences.setDefault(COMPILER_PB_NON_NLS_STRING_LITERAL, IGNORE); - optionNames.add(COMPILER_PB_NON_NLS_STRING_LITERAL); + preferences.setDefault(COMPILER_PB_NON_NLS_STRING_LITERAL, IGNORE); + optionNames.add(COMPILER_PB_NON_NLS_STRING_LITERAL); - preferences.setDefault(COMPILER_PB_ASSERT_IDENTIFIER, IGNORE); - optionNames.add(COMPILER_PB_ASSERT_IDENTIFIER); + preferences.setDefault(COMPILER_PB_ASSERT_IDENTIFIER, IGNORE); + optionNames.add(COMPILER_PB_ASSERT_IDENTIFIER); - preferences.setDefault(COMPILER_PB_STATIC_ACCESS_RECEIVER, WARNING); - optionNames.add(COMPILER_PB_STATIC_ACCESS_RECEIVER); + preferences.setDefault(COMPILER_PB_STATIC_ACCESS_RECEIVER, WARNING); + optionNames.add(COMPILER_PB_STATIC_ACCESS_RECEIVER); - preferences.setDefault(COMPILER_PB_NO_EFFECT_ASSIGNMENT, WARNING); - optionNames.add(COMPILER_PB_NO_EFFECT_ASSIGNMENT); + preferences.setDefault(COMPILER_PB_NO_EFFECT_ASSIGNMENT, WARNING); + optionNames.add(COMPILER_PB_NO_EFFECT_ASSIGNMENT); - preferences.setDefault(COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD, WARNING); - optionNames.add(COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD); + preferences.setDefault(COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD, WARNING); + optionNames.add(COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD); - preferences.setDefault(COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION, WARNING); - optionNames.add(COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION); + preferences.setDefault(COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION, WARNING); + optionNames.add(COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION); - preferences.setDefault(COMPILER_TASK_TAGS, DEFAULT_TASK_TAG); //$NON-NLS-1$ - optionNames.add(COMPILER_TASK_TAGS); + preferences.setDefault(COMPILER_TASK_TAGS, DEFAULT_TASK_TAG); //$NON-NLS-1$ + optionNames.add(COMPILER_TASK_TAGS); - preferences.setDefault(COMPILER_TASK_PRIORITIES, DEFAULT_TASK_PRIORITY); //$NON-NLS-1$ - optionNames.add(COMPILER_TASK_PRIORITIES); + preferences.setDefault(COMPILER_TASK_PRIORITIES, DEFAULT_TASK_PRIORITY); //$NON-NLS-1$ + optionNames.add(COMPILER_TASK_PRIORITIES); - preferences.setDefault(COMPILER_SOURCE, VERSION_1_3); - optionNames.add(COMPILER_SOURCE); + preferences.setDefault(COMPILER_SOURCE, VERSION_1_3); + optionNames.add(COMPILER_SOURCE); - preferences.setDefault(COMPILER_COMPLIANCE, VERSION_1_3); - optionNames.add(COMPILER_COMPLIANCE); + preferences.setDefault(COMPILER_COMPLIANCE, VERSION_1_3); + optionNames.add(COMPILER_COMPLIANCE); - preferences.setDefault(COMPILER_PB_MAX_PER_UNIT, "100"); //$NON-NLS-1$ - optionNames.add(COMPILER_PB_MAX_PER_UNIT); + preferences.setDefault(COMPILER_PB_MAX_PER_UNIT, "100"); //$NON-NLS-1$ + optionNames.add(COMPILER_PB_MAX_PER_UNIT); - // Builder settings - preferences.setDefault(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, ""); //$NON-NLS-1$ - optionNames.add(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER); + // Builder settings + preferences.setDefault(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, ""); //$NON-NLS-1$ + optionNames.add(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER); - preferences.setDefault(CORE_JAVA_BUILD_INVALID_CLASSPATH, ABORT); - optionNames.add(CORE_JAVA_BUILD_INVALID_CLASSPATH); + preferences.setDefault(CORE_JAVA_BUILD_INVALID_CLASSPATH, ABORT); + optionNames.add(CORE_JAVA_BUILD_INVALID_CLASSPATH); - preferences.setDefault(CORE_JAVA_BUILD_DUPLICATE_RESOURCE, WARNING); - optionNames.add(CORE_JAVA_BUILD_DUPLICATE_RESOURCE); + preferences.setDefault(CORE_JAVA_BUILD_DUPLICATE_RESOURCE, WARNING); + optionNames.add(CORE_JAVA_BUILD_DUPLICATE_RESOURCE); - preferences.setDefault(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, CLEAN); - optionNames.add(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER); + preferences.setDefault(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, CLEAN); + optionNames.add(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER); - // JavaCore settings - preferences.setDefault(CORE_JAVA_BUILD_ORDER, IGNORE); - optionNames.add(CORE_JAVA_BUILD_ORDER); + // JavaCore settings + preferences.setDefault(CORE_JAVA_BUILD_ORDER, IGNORE); + optionNames.add(CORE_JAVA_BUILD_ORDER); - preferences.setDefault(CORE_CIRCULAR_CLASSPATH, ERROR); - optionNames.add(CORE_CIRCULAR_CLASSPATH); + preferences.setDefault(CORE_CIRCULAR_CLASSPATH, ERROR); + optionNames.add(CORE_CIRCULAR_CLASSPATH); - preferences.setDefault(CORE_INCOMPLETE_CLASSPATH, ERROR); - optionNames.add(CORE_INCOMPLETE_CLASSPATH); + preferences.setDefault(CORE_INCOMPLETE_CLASSPATH, ERROR); + optionNames.add(CORE_INCOMPLETE_CLASSPATH); - preferences.setDefault(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, ENABLED); - optionNames.add(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS); + preferences.setDefault(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, ENABLED); + optionNames.add(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS); - preferences.setDefault(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS, ENABLED); - optionNames.add(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS); + preferences.setDefault(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS, ENABLED); + optionNames.add(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS); - // encoding setting comes from resource plug-in - optionNames.add(CORE_ENCODING); + // encoding setting comes from resource plug-in + optionNames.add(CORE_ENCODING); - // Formatter settings - preferences.setDefault(FORMATTER_NEWLINE_OPENING_BRACE, DO_NOT_INSERT); - optionNames.add(FORMATTER_NEWLINE_OPENING_BRACE); + // Formatter settings + preferences.setDefault(FORMATTER_NEWLINE_OPENING_BRACE, DO_NOT_INSERT); + optionNames.add(FORMATTER_NEWLINE_OPENING_BRACE); - preferences.setDefault(FORMATTER_NEWLINE_CONTROL, DO_NOT_INSERT); - optionNames.add(FORMATTER_NEWLINE_CONTROL); + preferences.setDefault(FORMATTER_NEWLINE_CONTROL, DO_NOT_INSERT); + optionNames.add(FORMATTER_NEWLINE_CONTROL); - preferences.setDefault(FORMATTER_CLEAR_BLANK_LINES, PRESERVE_ONE); - optionNames.add(FORMATTER_CLEAR_BLANK_LINES); + preferences.setDefault(FORMATTER_CLEAR_BLANK_LINES, PRESERVE_ONE); + optionNames.add(FORMATTER_CLEAR_BLANK_LINES); - preferences.setDefault(FORMATTER_NEWLINE_ELSE_IF, DO_NOT_INSERT); - optionNames.add(FORMATTER_NEWLINE_ELSE_IF); + preferences.setDefault(FORMATTER_NEWLINE_ELSE_IF, DO_NOT_INSERT); + optionNames.add(FORMATTER_NEWLINE_ELSE_IF); - preferences.setDefault(FORMATTER_NEWLINE_EMPTY_BLOCK, INSERT); - optionNames.add(FORMATTER_NEWLINE_EMPTY_BLOCK); + preferences.setDefault(FORMATTER_NEWLINE_EMPTY_BLOCK, INSERT); + optionNames.add(FORMATTER_NEWLINE_EMPTY_BLOCK); - preferences.setDefault(FORMATTER_LINE_SPLIT, "80"); //$NON-NLS-1$ - optionNames.add(FORMATTER_LINE_SPLIT); + preferences.setDefault(FORMATTER_LINE_SPLIT, "80"); //$NON-NLS-1$ + optionNames.add(FORMATTER_LINE_SPLIT); - preferences.setDefault(FORMATTER_COMPACT_ASSIGNMENT, NORMAL); - optionNames.add(FORMATTER_COMPACT_ASSIGNMENT); + preferences.setDefault(FORMATTER_COMPACT_ASSIGNMENT, NORMAL); + optionNames.add(FORMATTER_COMPACT_ASSIGNMENT); - preferences.setDefault(FORMATTER_TAB_CHAR, TAB); - optionNames.add(FORMATTER_TAB_CHAR); + preferences.setDefault(FORMATTER_TAB_CHAR, TAB); + optionNames.add(FORMATTER_TAB_CHAR); - preferences.setDefault(FORMATTER_TAB_SIZE, "4"); //$NON-NLS-1$ - optionNames.add(FORMATTER_TAB_SIZE); + preferences.setDefault(FORMATTER_TAB_SIZE, "4"); //$NON-NLS-1$ + optionNames.add(FORMATTER_TAB_SIZE); - preferences.setDefault(FORMATTER_SPACE_CASTEXPRESSION, INSERT); //$NON-NLS-1$ - optionNames.add(FORMATTER_SPACE_CASTEXPRESSION); + preferences.setDefault(FORMATTER_SPACE_CASTEXPRESSION, INSERT); //$NON-NLS-1$ + optionNames.add(FORMATTER_SPACE_CASTEXPRESSION); - // CodeAssist settings - preferences.setDefault(CODEASSIST_VISIBILITY_CHECK, DISABLED); //$NON-NLS-1$ - optionNames.add(CODEASSIST_VISIBILITY_CHECK); + // CodeAssist settings + preferences.setDefault(CODEASSIST_VISIBILITY_CHECK, DISABLED); //$NON-NLS-1$ + optionNames.add(CODEASSIST_VISIBILITY_CHECK); - preferences.setDefault(CODEASSIST_IMPLICIT_QUALIFICATION, DISABLED); //$NON-NLS-1$ - optionNames.add(CODEASSIST_IMPLICIT_QUALIFICATION); + preferences.setDefault(CODEASSIST_IMPLICIT_QUALIFICATION, DISABLED); //$NON-NLS-1$ + optionNames.add(CODEASSIST_IMPLICIT_QUALIFICATION); - preferences.setDefault(CODEASSIST_FIELD_PREFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_FIELD_PREFIXES); + preferences.setDefault(CODEASSIST_FIELD_PREFIXES, ""); //$NON-NLS-1$ + optionNames.add(CODEASSIST_FIELD_PREFIXES); - preferences.setDefault(CODEASSIST_STATIC_FIELD_PREFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_STATIC_FIELD_PREFIXES); + preferences.setDefault(CODEASSIST_STATIC_FIELD_PREFIXES, ""); //$NON-NLS-1$ + optionNames.add(CODEASSIST_STATIC_FIELD_PREFIXES); - preferences.setDefault(CODEASSIST_LOCAL_PREFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_LOCAL_PREFIXES); + preferences.setDefault(CODEASSIST_LOCAL_PREFIXES, ""); //$NON-NLS-1$ + optionNames.add(CODEASSIST_LOCAL_PREFIXES); - preferences.setDefault(CODEASSIST_ARGUMENT_PREFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_ARGUMENT_PREFIXES); + preferences.setDefault(CODEASSIST_ARGUMENT_PREFIXES, ""); //$NON-NLS-1$ + optionNames.add(CODEASSIST_ARGUMENT_PREFIXES); - preferences.setDefault(CODEASSIST_FIELD_SUFFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_FIELD_SUFFIXES); + preferences.setDefault(CODEASSIST_FIELD_SUFFIXES, ""); //$NON-NLS-1$ + optionNames.add(CODEASSIST_FIELD_SUFFIXES); - preferences.setDefault(CODEASSIST_STATIC_FIELD_SUFFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_STATIC_FIELD_SUFFIXES); + preferences.setDefault(CODEASSIST_STATIC_FIELD_SUFFIXES, ""); //$NON-NLS-1$ + optionNames.add(CODEASSIST_STATIC_FIELD_SUFFIXES); - preferences.setDefault(CODEASSIST_LOCAL_SUFFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_LOCAL_SUFFIXES); + preferences.setDefault(CODEASSIST_LOCAL_SUFFIXES, ""); //$NON-NLS-1$ + optionNames.add(CODEASSIST_LOCAL_SUFFIXES); - preferences.setDefault(CODEASSIST_ARGUMENT_SUFFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_ARGUMENT_SUFFIXES); - } + preferences.setDefault(CODEASSIST_ARGUMENT_SUFFIXES, ""); //$NON-NLS-1$ + optionNames.add(CODEASSIST_ARGUMENT_SUFFIXES); +} - /** - * Returns whether the given marker references the given Java element. - * Used for markers, which denote a Java element rather than a resource. - * - * @param element the element - * @param marker the marker - * @return true if the marker references the element, false otherwise - * @exception CoreException if the IMarker.getAttribute on the marker fails - */ - public static boolean isReferencedBy(IJavaElement element, IMarker marker) throws CoreException { +/** + * Returns whether the given marker references the given Java element. + * Used for markers, which denote a Java element rather than a resource. + * + * @param element the element + * @param marker the marker + * @return true if the marker references the element, false otherwise + * @exception CoreException if the IMarker.getAttribute on the marker fails + */ +public static boolean isReferencedBy(IJavaElement element, IMarker marker) throws CoreException { - // only match units or classfiles - if (element instanceof IMember){ - IMember member = (IMember) element; - if (member.isBinary()){ - element = null; //member.getClassFile(); - } else { - element = member.getCompilationUnit(); - } + // only match units or classfiles + if (element instanceof IMember){ + IMember member = (IMember) element; + if (member.isBinary()){ + element = null; //member.getClassFile(); + } else { + element = member.getCompilationUnit(); } - if (element == null) return false; - if (marker == null) return false; + } + if (element == null) return false; + if (marker == null) return false; - String markerHandleId = (String)marker.getAttribute(ATT_HANDLE_ID); - if (markerHandleId == null) return false; + String markerHandleId = (String)marker.getAttribute(ATT_HANDLE_ID); + if (markerHandleId == null) return false; - IJavaElement markerElement = JavaCore.create(markerHandleId); -// while (true){ - if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs. + IJavaElement markerElement = JavaCore.create(markerHandleId); +// while (true){ + if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs. - // cycle through enclosing types in case marker is associated with a classfile (15568) -// if (markerElement instanceof IClassFile){ -// IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType(); -// if (enclosingType != null){ -// markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile -// continue; -// } + // cycle through enclosing types in case marker is associated with a classfile (15568) +// if (markerElement instanceof IClassFile){ +// IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType(); +// if (enclosingType != null){ +// markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile +// continue; // } -// break; // } - return false; - } +// break; +// } + return false; +} - /** - * Returns whether the given marker delta references the given Java element. - * Used for markers deltas, which denote a Java element rather than a resource. - * - * @param element the element - * @param markerDelta the marker delta - * @return true if the marker delta references the element - * @exception CoreException if the IMarkerDelta.getAttribute on the marker delta fails - */ - public static boolean isReferencedBy(IJavaElement element, IMarkerDelta markerDelta) throws CoreException { +/** + * Returns whether the given marker delta references the given Java element. + * Used for markers deltas, which denote a Java element rather than a resource. + * + * @param element the element + * @param markerDelta the marker delta + * @return true if the marker delta references the element + * @exception CoreException if the IMarkerDelta.getAttribute on the marker delta fails + */ +public static boolean isReferencedBy(IJavaElement element, IMarkerDelta markerDelta) throws CoreException { - // only match units or classfiles - if (element instanceof IMember){ - IMember member = (IMember) element; - if (member.isBinary()){ - element = null; //member.getClassFile(); - } else { - element = member.getCompilationUnit(); - } + // only match units or classfiles + if (element instanceof IMember){ + IMember member = (IMember) element; + if (member.isBinary()){ + element = null; //member.getClassFile(); + } else { + element = member.getCompilationUnit(); } - if (element == null) return false; - if (markerDelta == null) return false; + } + if (element == null) return false; + if (markerDelta == null) return false; - String markerDeltarHandleId = (String)markerDelta.getAttribute(ATT_HANDLE_ID); - if (markerDeltarHandleId == null) return false; + String markerDeltarHandleId = (String)markerDelta.getAttribute(ATT_HANDLE_ID); + if (markerDeltarHandleId == null) return false; - IJavaElement markerElement = JavaCore.create(markerDeltarHandleId); -// while (true){ - if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs. + IJavaElement markerElement = JavaCore.create(markerDeltarHandleId); +// while (true){ + if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs. - // cycle through enclosing types in case marker is associated with a classfile (15568) -// if (markerElement instanceof IClassFile){ -// IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType(); -// if (enclosingType != null){ -// markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile -// continue; -// } + // cycle through enclosing types in case marker is associated with a classfile (15568) +// if (markerElement instanceof IClassFile){ +// IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType(); +// if (enclosingType != null){ +// markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile +// continue; // } -// break; // } - return false; - } - - /** - * Creates and returns a new classpath entry of kind CPE_CONTAINER - * for the given path. The path of the container will be used during resolution so as to map this - * container entry to a set of other classpath entries the container is acting for. - *

- * A container entry allows to express indirect references to a set of libraries, projects and variable entries, - * which can be interpreted differently for each Java project where it is used. - * A classpath container entry can be resolved using JavaCore.getResolvedClasspathContainer, - * and updated with JavaCore.classpathContainerChanged - *

- * A container is exclusively resolved by a ClasspathContainerInitializer registered onto the - * extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * A container path must be formed of at least one segment, where:

    - *
  • the first segment is a unique ID identifying the target container, there must be a container initializer registered - * onto this ID through the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
  • - *
  • the remaining segments will be passed onto the initializer, and can be used as additional - * hints during the initialization phase.
  • - *
- *

- * Example of an ClasspathContainerInitializer for a classpath container denoting a default JDK container: - * - * containerEntry = JavaCore.newContainerEntry(new Path("MyProvidedJDK/default")); - * - * - * - *

- * Note that this operation does not attempt to validate classpath containers - * or access the resources at the given paths. - *

- * The resulting entry is not exported to dependent projects. This method is equivalent to - * newContainerEntry(-,false). - *

- * @param containerPath the path identifying the container, it must be formed of two - * segments - * @return a new container classpath entry - * - * @see JavaCore#getClasspathContainer(IPath, IJavaProject) - * @see JavaCore#newContainerEntry(IPath, boolean) - * @since 2.0 - */ -// public static IClasspathEntry newContainerEntry(IPath containerPath) { -// -// return newContainerEntry(containerPath, false); +// break; // } + return false; +} - /** - * Creates and returns a new classpath entry of kind CPE_CONTAINER - * for the given path. The path of the container will be used during resolution so as to map this - * container entry to a set of other classpath entries the container is acting for. - *

- * A container entry allows to express indirect references to a set of libraries, projects and variable entries, - * which can be interpreted differently for each Java project where it is used. - * A classpath container entry can be resolved using JavaCore.getResolvedClasspathContainer, - * and updated with JavaCore.classpathContainerChanged - *

- * A container is exclusively resolved by a ClasspathContainerInitializer registered onto the - * extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * A container path must be formed of at least one segment, where:

    - *
  • the first segment is a unique ID identifying the target container, there must be a container initializer registered - * onto this ID through the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
  • - *
  • the remaining segments will be passed onto the initializer, and can be used as additional - * hints during the initialization phase.
  • - *
- *

- * Example of an ClasspathContainerInitializer for a classpath container denoting a default JDK container: - * - * containerEntry = JavaCore.newContainerEntry(new Path("MyProvidedJDK/default")); - * - * - * - *

- * Note that this operation does not attempt to validate classpath containers - * or access the resources at the given paths. - *

- * @param containerPath the path identifying the container, it must be formed of at least - * one segment (ID+hints) - * @param isExported a boolean indicating whether this entry is contributed to dependent - * projects in addition to the output location - * @return a new container classpath entry - * - * @see JavaCore#getClasspathContainer(IPath, IJavaProject) - * @see JavaCore#setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor) - * @see JavaCore#newContainerEntry(IPath, boolean) - * @since 2.0 - */ -// public static IClasspathEntry newContainerEntry(IPath containerPath, boolean isExported) { -// -// if (containerPath == null || containerPath.segmentCount() < 1) { -// Assert.isTrue( -// false, -// "Illegal classpath container path: \'" + containerPath.makeRelative().toString() + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$//$NON-NLS-2$ -// } -// return new ClasspathEntry( -// IPackageFragmentRoot.K_SOURCE, -// IClasspathEntry.CPE_CONTAINER, -// containerPath, -// ClasspathEntry.NO_EXCLUSION_PATTERNS, -// null, // source attachment -// null, // source attachment root -// null, // specific output folder -// isExported); -// } +/** + * Creates and returns a new classpath entry of kind CPE_CONTAINER + * for the given path. The path of the container will be used during resolution so as to map this + * container entry to a set of other classpath entries the container is acting for. + *

+ * A container entry allows to express indirect references to a set of libraries, projects and variable entries, + * which can be interpreted differently for each Java project where it is used. + * A classpath container entry can be resolved using JavaCore.getResolvedClasspathContainer, + * and updated with JavaCore.classpathContainerChanged + *

+ * A container is exclusively resolved by a ClasspathContainerInitializer registered onto the + * extension point "org.eclipse.jdt.core.classpathContainerInitializer". + *

+ * A container path must be formed of at least one segment, where:

    + *
  • the first segment is a unique ID identifying the target container, there must be a container initializer registered + * onto this ID through the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
  • + *
  • the remaining segments will be passed onto the initializer, and can be used as additional + * hints during the initialization phase.
  • + *
+ *

+ * Example of an ClasspathContainerInitializer for a classpath container denoting a default JDK container: + * + * containerEntry = JavaCore.newContainerEntry(new Path("MyProvidedJDK/default")); + * + * + * + *

+ * Note that this operation does not attempt to validate classpath containers + * or access the resources at the given paths. + *

+ * The resulting entry is not exported to dependent projects. This method is equivalent to + * newContainerEntry(-,false). + *

+ * @param containerPath the path identifying the container, it must be formed of two + * segments + * @return a new container classpath entry + * + * @see JavaCore#getClasspathContainer(IPath, IJavaProject) + * @see JavaCore#newContainerEntry(IPath, boolean) + * @since 2.0 + */ +public static IClasspathEntry newContainerEntry(IPath containerPath) { + + return newContainerEntry(containerPath, false); +} - /** - * Creates and returns a new non-exported classpath entry of kind CPE_LIBRARY for the - * JAR or folder identified by the given absolute path. This specifies that all package fragments - * within the root will have children of type IClassFile. - *

- * A library entry is used to denote a prerequisite JAR or root folder containing binaries. - * The target JAR or folder can either be defined internally to the workspace (absolute path relative - * to the workspace root) or externally to the workspace (absolute path in the file system). - *

- * e.g. Here are some examples of binary path usage

    - *
  • "c:/jdk1.2.2/jre/lib/rt.jar" - reference to an external JAR
  • - *
  • "/Project/someLib.jar" - reference to an internal JAR
  • - *
  • "c:/classes/" - reference to an external binary folder
  • - *
- * Note that this operation does not attempt to validate or access the - * resources at the given paths. - *

- * The resulting entry is not exported to dependent projects. This method is equivalent to - * newLibraryEntry(-,-,-,false). - *

- * - * @param path the absolute path of the binary archive - * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder, - * or null if none - * @param sourceAttachmentRootPath the location of the root within the source archive or folder - * or null if this location should be automatically detected. - * @return a new library classpath entry - * - * @see #newLibraryEntry(IPath, IPath, IPath, boolean) - */ -// public static IClasspathEntry newLibraryEntry( -// IPath path, -// IPath sourceAttachmentPath, -// IPath sourceAttachmentRootPath) { +/** + * Creates and returns a new classpath entry of kind CPE_CONTAINER + * for the given path. The path of the container will be used during resolution so as to map this + * container entry to a set of other classpath entries the container is acting for. + *

+ * A container entry allows to express indirect references to a set of libraries, projects and variable entries, + * which can be interpreted differently for each Java project where it is used. + * A classpath container entry can be resolved using JavaCore.getResolvedClasspathContainer, + * and updated with JavaCore.classpathContainerChanged + *

+ * A container is exclusively resolved by a ClasspathContainerInitializer registered onto the + * extension point "org.eclipse.jdt.core.classpathContainerInitializer". + *

+ * A container path must be formed of at least one segment, where:

    + *
  • the first segment is a unique ID identifying the target container, there must be a container initializer registered + * onto this ID through the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
  • + *
  • the remaining segments will be passed onto the initializer, and can be used as additional + * hints during the initialization phase.
  • + *
+ *

+ * Example of an ClasspathContainerInitializer for a classpath container denoting a default JDK container: + * + * containerEntry = JavaCore.newContainerEntry(new Path("MyProvidedJDK/default")); + * + * + * + *

+ * Note that this operation does not attempt to validate classpath containers + * or access the resources at the given paths. + *

+ * @param containerPath the path identifying the container, it must be formed of at least + * one segment (ID+hints) + * @param isExported a boolean indicating whether this entry is contributed to dependent + * projects in addition to the output location + * @return a new container classpath entry + * + * @see JavaCore#getClasspathContainer(IPath, IJavaProject) + * @see JavaCore#setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor) + * @see JavaCore#newContainerEntry(IPath, boolean) + * @since 2.0 + */ +public static IClasspathEntry newContainerEntry(IPath containerPath, boolean isExported) { + + if (containerPath == null || containerPath.segmentCount() < 1) { + Assert.isTrue( + false, + "Illegal classpath container path: \'" + containerPath.makeRelative().toString() + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$//$NON-NLS-2$ + } + return new ClasspathEntry( + IPackageFragmentRoot.K_SOURCE, + IClasspathEntry.CPE_CONTAINER, + containerPath, + ClasspathEntry.NO_EXCLUSION_PATTERNS, + null, // source attachment + null, // source attachment root + null, // specific output folder + isExported); +} + +/** + * Creates and returns a new non-exported classpath entry of kind CPE_LIBRARY for the + * JAR or folder identified by the given absolute path. This specifies that all package fragments + * within the root will have children of type IClassFile. + *

+ * A library entry is used to denote a prerequisite JAR or root folder containing binaries. + * The target JAR or folder can either be defined internally to the workspace (absolute path relative + * to the workspace root) or externally to the workspace (absolute path in the file system). + *

+ * e.g. Here are some examples of binary path usage

    + *
  • "c:/jdk1.2.2/jre/lib/rt.jar" - reference to an external JAR
  • + *
  • "/Project/someLib.jar" - reference to an internal JAR
  • + *
  • "c:/classes/" - reference to an external binary folder
  • + *
+ * Note that this operation does not attempt to validate or access the + * resources at the given paths. + *

+ * The resulting entry is not exported to dependent projects. This method is equivalent to + * newLibraryEntry(-,-,-,false). + *

+ * + * @param path the absolute path of the binary archive + * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder, + * or null if none + * @param sourceAttachmentRootPath the location of the root within the source archive or folder + * or null if this location should be automatically detected. + * @return a new library classpath entry + * + * @see #newLibraryEntry(IPath, IPath, IPath, boolean) + */ +//public static IClasspathEntry newLibraryEntry( +// IPath path, +// IPath sourceAttachmentPath, +// IPath sourceAttachmentRootPath) { // -// return newLibraryEntry(path, sourceAttachmentPath, sourceAttachmentRootPath, false); -// } +// return newLibraryEntry(path, sourceAttachmentPath, sourceAttachmentRootPath, false); +//} - /** - * Creates and returns a new classpath entry of kind CPE_LIBRARY for the JAR or folder - * identified by the given absolute path. This specifies that all package fragments within the root - * will have children of type IClassFile. - *

- * A library entry is used to denote a prerequisite JAR or root folder containing binaries. - * The target JAR or folder can either be defined internally to the workspace (absolute path relative - * to the workspace root) or externally to the workspace (absolute path in the file system). - *

- * e.g. Here are some examples of binary path usage

    - *
  • "c:/jdk1.2.2/jre/lib/rt.jar" - reference to an external JAR
  • - *
  • "/Project/someLib.jar" - reference to an internal JAR
  • - *
  • "c:/classes/" - reference to an external binary folder
  • - *
- * Note that this operation does not attempt to validate or access the - * resources at the given paths. - *

- * - * @param path the absolute path of the binary archive - * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder, - * or null if none - * @param sourceAttachmentRootPath the location of the root within the source archive or folder - * or null if this location should be automatically detected. - * @param isExported indicates whether this entry is contributed to dependent - * projects in addition to the output location - * @return a new library classpath entry - * @since 2.0 - */ -// public static IClasspathEntry newLibraryEntry( -// IPath path, -// IPath sourceAttachmentPath, -// IPath sourceAttachmentRootPath, -// boolean isExported) { +/** + * Creates and returns a new classpath entry of kind CPE_LIBRARY for the JAR or folder + * identified by the given absolute path. This specifies that all package fragments within the root + * will have children of type IClassFile. + *

+ * A library entry is used to denote a prerequisite JAR or root folder containing binaries. + * The target JAR or folder can either be defined internally to the workspace (absolute path relative + * to the workspace root) or externally to the workspace (absolute path in the file system). + *

+ * e.g. Here are some examples of binary path usage

    + *
  • "c:/jdk1.2.2/jre/lib/rt.jar" - reference to an external JAR
  • + *
  • "/Project/someLib.jar" - reference to an internal JAR
  • + *
  • "c:/classes/" - reference to an external binary folder
  • + *
+ * Note that this operation does not attempt to validate or access the + * resources at the given paths. + *

+ * + * @param path the absolute path of the binary archive + * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder, + * or null if none + * @param sourceAttachmentRootPath the location of the root within the source archive or folder + * or null if this location should be automatically detected. + * @param isExported indicates whether this entry is contributed to dependent + * projects in addition to the output location + * @return a new library classpath entry + * @since 2.0 + */ +//public static IClasspathEntry newLibraryEntry( +// IPath path, +// IPath sourceAttachmentPath, +// IPath sourceAttachmentRootPath, +// boolean isExported) { // -// if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ +// if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ // -// return new ClasspathEntry( -// IPackageFragmentRoot.K_BINARY, -// IClasspathEntry.CPE_LIBRARY, -// JavaProject.canonicalizedPath(path), -// ClasspathEntry.NO_EXCLUSION_PATTERNS, -// sourceAttachmentPath, -// sourceAttachmentRootPath, -// null, // specific output folder -// isExported); -// } +// return new ClasspathEntry( +// IPackageFragmentRoot.K_BINARY, +// IClasspathEntry.CPE_LIBRARY, +// JavaProject.canonicalizedPath(path), +// ClasspathEntry.NO_EXCLUSION_PATTERNS, +// sourceAttachmentPath, +// sourceAttachmentRootPath, +// null, // specific output folder +// isExported); +//} - /** - * Creates and returns a new non-exported classpath entry of kind CPE_PROJECT - * for the project identified by the given absolute path. - *

- * A project entry is used to denote a prerequisite project on a classpath. - * The referenced project will be contributed as a whole, either as sources (in the Java Model, it - * contributes all its package fragment roots) or as binaries (when building, it contributes its - * whole output location). - *

- * A project reference allows to indirect through another project, independently from its internal layout. - *

- * The prerequisite project is referred to using an absolute path relative to the workspace root. - *

- * The resulting entry is not exported to dependent projects. This method is equivalent to - * newProjectEntry(_,false). - *

- * - * @param path the absolute path of the binary archive - * @return a new project classpath entry - * - * @see JavaCore#newProjectEntry(IPath, boolean) - */ -// public static IClasspathEntry newProjectEntry(IPath path) { -// return newProjectEntry(path, false); -// } +/** + * Creates and returns a new non-exported classpath entry of kind CPE_PROJECT + * for the project identified by the given absolute path. + *

+ * A project entry is used to denote a prerequisite project on a classpath. + * The referenced project will be contributed as a whole, either as sources (in the Java Model, it + * contributes all its package fragment roots) or as binaries (when building, it contributes its + * whole output location). + *

+ * A project reference allows to indirect through another project, independently from its internal layout. + *

+ * The prerequisite project is referred to using an absolute path relative to the workspace root. + *

+ * The resulting entry is not exported to dependent projects. This method is equivalent to + * newProjectEntry(_,false). + *

+ * + * @param path the absolute path of the binary archive + * @return a new project classpath entry + * + * @see JavaCore#newProjectEntry(IPath, boolean) + */ +public static IClasspathEntry newProjectEntry(IPath path) { + return newProjectEntry(path, false); +} - /** - * Creates and returns a new classpath entry of kind CPE_PROJECT - * for the project identified by the given absolute path. - *

- * A project entry is used to denote a prerequisite project on a classpath. - * The referenced project will be contributed as a whole, either as sources (in the Java Model, it - * contributes all its package fragment roots) or as binaries (when building, it contributes its - * whole output location). - *

- * A project reference allows to indirect through another project, independently from its internal layout. - *

- * The prerequisite project is referred to using an absolute path relative to the workspace root. - *

- * - * @param path the absolute path of the prerequisite project - * @param isExported indicates whether this entry is contributed to dependent - * projects in addition to the output location - * @return a new project classpath entry - * @since 2.0 - */ -// public static IClasspathEntry newProjectEntry(IPath path, boolean isExported) { -// -// if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ -// -// return new ClasspathEntry( -// IPackageFragmentRoot.K_SOURCE, -// IClasspathEntry.CPE_PROJECT, -// path, -// ClasspathEntry.NO_EXCLUSION_PATTERNS, -// null, // source attachment -// null, // source attachment root -// null, // specific output folder -// isExported); -// } +/** + * Creates and returns a new classpath entry of kind CPE_PROJECT + * for the project identified by the given absolute path. + *

+ * A project entry is used to denote a prerequisite project on a classpath. + * The referenced project will be contributed as a whole, either as sources (in the Java Model, it + * contributes all its package fragment roots) or as binaries (when building, it contributes its + * whole output location). + *

+ * A project reference allows to indirect through another project, independently from its internal layout. + *

+ * The prerequisite project is referred to using an absolute path relative to the workspace root. + *

+ * + * @param path the absolute path of the prerequisite project + * @param isExported indicates whether this entry is contributed to dependent + * projects in addition to the output location + * @return a new project classpath entry + * @since 2.0 + */ +public static IClasspathEntry newProjectEntry(IPath path, boolean isExported) { + + if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ + + return new ClasspathEntry( + IPackageFragmentRoot.K_SOURCE, + IClasspathEntry.CPE_PROJECT, + path, + ClasspathEntry.NO_EXCLUSION_PATTERNS, + null, // source attachment + null, // source attachment root + null, // specific output folder + isExported); +} - /** - * Returns a new empty region. - * - * @return a new empty region - */ - public static IRegion newRegion() { - return new Region(); - } +/** + * Returns a new empty region. + * + * @return a new empty region + */ +public static IRegion newRegion() { + return new Region(); +} - /** - * Creates and returns a new classpath entry of kind CPE_SOURCE - * for the project's source folder identified by the given absolute - * workspace-relative path. This specifies that all package fragments - * within the root will have children of type ICompilationUnit. - *

- * The source folder is referred to using an absolute path relative to the - * workspace root, e.g. /Project/src. A project's source - * folders are located with that project. That is, a source classpath - * entry specifying the path /P1/src is only usable for - * project P1. - *

- *

- * The source classpath entry created by this method includes all source - * files below the given workspace-relative path. To selectively exclude - * some of these source files, use the factory method - * JavaCore.newSourceEntry(IPath,IPath[]) instead. - *

- *

- * Note that all sources/binaries inside a project are contributed as a whole through - * a project entry (see JavaCore.newProjectEntry). Particular - * source entries cannot be selectively exported. - *

- * - * @param path the absolute workspace-relative path of a source folder - * @return a new source classpath entry with not exclusion patterns - * - * @see #newSourceEntry(org.eclipse.core.runtime.IPath,org.eclipse.core.runtime.IPath[]) - */ -// public static IClasspathEntry newSourceEntry(IPath path) { -// -// return newSourceEntry(path, ClasspathEntry.NO_EXCLUSION_PATTERNS, null /*output location*/); -// } +/** + * Creates and returns a new classpath entry of kind CPE_SOURCE + * for the project's source folder identified by the given absolute + * workspace-relative path. This specifies that all package fragments + * within the root will have children of type ICompilationUnit. + *

+ * The source folder is referred to using an absolute path relative to the + * workspace root, e.g. /Project/src. A project's source + * folders are located with that project. That is, a source classpath + * entry specifying the path /P1/src is only usable for + * project P1. + *

+ *

+ * The source classpath entry created by this method includes all source + * files below the given workspace-relative path. To selectively exclude + * some of these source files, use the factory method + * JavaCore.newSourceEntry(IPath,IPath[]) instead. + *

+ *

+ * Note that all sources/binaries inside a project are contributed as a whole through + * a project entry (see JavaCore.newProjectEntry). Particular + * source entries cannot be selectively exported. + *

+ * + * @param path the absolute workspace-relative path of a source folder + * @return a new source classpath entry with not exclusion patterns + * + * @see #newSourceEntry(org.eclipse.core.runtime.IPath,org.eclipse.core.runtime.IPath[]) + */ +public static IClasspathEntry newSourceEntry(IPath path) { + + return newSourceEntry(path, ClasspathEntry.NO_EXCLUSION_PATTERNS, null /*output location*/); +} - /** - * Creates and returns a new classpath entry of kind CPE_SOURCE - * for the project's source folder identified by the given absolute - * workspace-relative path but excluding all source files with paths - * matching any of the given patterns. This specifies that all package - * fragments within the root will have children of type - * ICompilationUnit. - *

- * The source folder is referred to using an absolute path relative to the - * workspace root, e.g. /Project/src. A project's source - * folders are located with that project. That is, a source classpath - * entry specifying the path /P1/src is only usable for - * project P1. - *

- *

- * The source classpath entry created by this method includes all source - * files below the given workspace-relative path except for those matched - * by one (or more) of the given exclusion patterns. Each exclusion pattern - * is represented by a relative path, which is interpreted as relative to - * the source folder. For example, if the source folder path is - * /Project/src and the exclusion pattern is - * com/xyz/tests/**, then source files - * like /Project/src/com/xyz/Foo.java - * and /Project/src/com/xyz/utils/Bar.java would be included, - * whereas /Project/src/com/xyz/tests/T1.java - * and /Project/src/com/xyz/tests/quick/T2.java would be - * excluded. Exclusion patterns can contain can contain '**', '*' or '?' - * wildcards; see IClasspathEntry.getExclusionPatterns - * for the full description of the syntax and semantics of exclusion - * patterns. - *

- * If the empty list of exclusion patterns is specified, the source folder - * will automatically include all resources located inside the source - * folder. In that case, the result is entirely equivalent to using the - * factory method JavaCore.newSourceEntry(IPath). - *

- *

- * Note that all sources/binaries inside a project are contributed as a whole through - * a project entry (see JavaCore.newProjectEntry). Particular - * source entries cannot be selectively exported. - *

- * - * @param path the absolute workspace-relative path of a source folder - * @param exclusionPatterns the possibly empty list of exclusion patterns - * represented as relative paths - * @return a new source classpath entry with the given exclusion patterns - * @see #newSourceEntry(org.eclipse.core.runtime.IPath) - * @see IClasspathEntry#getExclusionPatterns - * - * @since 2.1 - */ -// public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns) { -// -// return newSourceEntry(path, exclusionPatterns, null /*output location*/); -// } +/** + * Creates and returns a new classpath entry of kind CPE_SOURCE + * for the project's source folder identified by the given absolute + * workspace-relative path but excluding all source files with paths + * matching any of the given patterns. This specifies that all package + * fragments within the root will have children of type + * ICompilationUnit. + *

+ * The source folder is referred to using an absolute path relative to the + * workspace root, e.g. /Project/src. A project's source + * folders are located with that project. That is, a source classpath + * entry specifying the path /P1/src is only usable for + * project P1. + *

+ *

+ * The source classpath entry created by this method includes all source + * files below the given workspace-relative path except for those matched + * by one (or more) of the given exclusion patterns. Each exclusion pattern + * is represented by a relative path, which is interpreted as relative to + * the source folder. For example, if the source folder path is + * /Project/src and the exclusion pattern is + * com/xyz/tests/**, then source files + * like /Project/src/com/xyz/Foo.java + * and /Project/src/com/xyz/utils/Bar.java would be included, + * whereas /Project/src/com/xyz/tests/T1.java + * and /Project/src/com/xyz/tests/quick/T2.java would be + * excluded. Exclusion patterns can contain can contain '**', '*' or '?' + * wildcards; see IClasspathEntry.getExclusionPatterns + * for the full description of the syntax and semantics of exclusion + * patterns. + *

+ * If the empty list of exclusion patterns is specified, the source folder + * will automatically include all resources located inside the source + * folder. In that case, the result is entirely equivalent to using the + * factory method JavaCore.newSourceEntry(IPath). + *

+ *

+ * Note that all sources/binaries inside a project are contributed as a whole through + * a project entry (see JavaCore.newProjectEntry). Particular + * source entries cannot be selectively exported. + *

+ * + * @param path the absolute workspace-relative path of a source folder + * @param exclusionPatterns the possibly empty list of exclusion patterns + * represented as relative paths + * @return a new source classpath entry with the given exclusion patterns + * @see #newSourceEntry(org.eclipse.core.runtime.IPath) + * @see IClasspathEntry#getExclusionPatterns + * + * @since 2.1 + */ +public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns) { - /** - * Creates and returns a new classpath entry of kind CPE_SOURCE - * for the project's source folder identified by the given absolute - * workspace-relative path but excluding all source files with paths - * matching any of the given patterns, and associated with a specific output location - * (that is, ".class" files are not going to the project default output location). - * All package fragments within the root will have children of type - * ICompilationUnit. - *

- * The source folder is referred to using an absolute path relative to the - * workspace root, e.g. /Project/src. A project's source - * folders are located with that project. That is, a source classpath - * entry specifying the path /P1/src is only usable for - * project P1. - *

- *

- * The source classpath entry created by this method includes all source - * files below the given workspace-relative path except for those matched - * by one (or more) of the given exclusion patterns. Each exclusion pattern - * is represented by a relative path, which is interpreted as relative to - * the source folder. For example, if the source folder path is - * /Project/src and the exclusion pattern is - * com/xyz/tests/**, then source files - * like /Project/src/com/xyz/Foo.java - * and /Project/src/com/xyz/utils/Bar.java would be included, - * whereas /Project/src/com/xyz/tests/T1.java - * and /Project/src/com/xyz/tests/quick/T2.java would be - * excluded. Exclusion patterns can contain can contain '**', '*' or '?' - * wildcards; see IClasspathEntry.getExclusionPatterns - * for the full description of the syntax and semantics of exclusion - * patterns. - *

- * If the empty list of exclusion patterns is specified, the source folder - * will automatically include all resources located inside the source - * folder. In that case, the result is entirely equivalent to using the - * factory method JavaCore.newSourceEntry(IPath). - *

- *

- * Additionally, a source entry can be associated with a specific output location. - * By doing so, the Java builder will ensure that the generated ".class" files will - * be issued inside this output location, as opposed to be generated into the - * project default output location (when output location is null). - * Note that multiple source entries may target the same output location. - * The output location is referred to using an absolute path relative to the - * workspace root, e.g. "/Project/bin", it must be located inside - * the same project as the source folder. - *

- *

- * Also note that all sources/binaries inside a project are contributed as a whole through - * a project entry (see JavaCore.newProjectEntry). Particular - * source entries cannot be selectively exported. - *

- * - * @param path the absolute workspace-relative path of a source folder - * @param exclusionPatterns the possibly empty list of exclusion patterns - * represented as relative paths - * @param outputLocation the specific output location for this source entry (null if using project default ouput location) - * @return a new source classpath entry with the given exclusion patterns - * @see #newSourceEntry(org.eclipse.core.runtime.IPath) - * @see IClasspathEntry#getExclusionPatterns - * @see IClasspathEntry#getOutputLocation() - * - * @since 2.1 - */ -// public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns, IPath specificOutputLocation) { -// -// if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ -// if (exclusionPatterns == null) Assert.isTrue(false, "Exclusion pattern set cannot be null"); //$NON-NLS-1$ -// -// return new ClasspathEntry( -// IPackageFragmentRoot.K_SOURCE, -// IClasspathEntry.CPE_SOURCE, -// path, -// exclusionPatterns, -// null, // source attachment -// null, // source attachment root -// specificOutputLocation, // custom output location -// false); -// } + return newSourceEntry(path, exclusionPatterns, null /*output location*/); +} + +/** + * Creates and returns a new classpath entry of kind CPE_SOURCE + * for the project's source folder identified by the given absolute + * workspace-relative path but excluding all source files with paths + * matching any of the given patterns, and associated with a specific output location + * (that is, ".class" files are not going to the project default output location). + * All package fragments within the root will have children of type + * ICompilationUnit. + *

+ * The source folder is referred to using an absolute path relative to the + * workspace root, e.g. /Project/src. A project's source + * folders are located with that project. That is, a source classpath + * entry specifying the path /P1/src is only usable for + * project P1. + *

+ *

+ * The source classpath entry created by this method includes all source + * files below the given workspace-relative path except for those matched + * by one (or more) of the given exclusion patterns. Each exclusion pattern + * is represented by a relative path, which is interpreted as relative to + * the source folder. For example, if the source folder path is + * /Project/src and the exclusion pattern is + * com/xyz/tests/**, then source files + * like /Project/src/com/xyz/Foo.java + * and /Project/src/com/xyz/utils/Bar.java would be included, + * whereas /Project/src/com/xyz/tests/T1.java + * and /Project/src/com/xyz/tests/quick/T2.java would be + * excluded. Exclusion patterns can contain can contain '**', '*' or '?' + * wildcards; see IClasspathEntry.getExclusionPatterns + * for the full description of the syntax and semantics of exclusion + * patterns. + *

+ * If the empty list of exclusion patterns is specified, the source folder + * will automatically include all resources located inside the source + * folder. In that case, the result is entirely equivalent to using the + * factory method JavaCore.newSourceEntry(IPath). + *

+ *

+ * Additionally, a source entry can be associated with a specific output location. + * By doing so, the Java builder will ensure that the generated ".class" files will + * be issued inside this output location, as opposed to be generated into the + * project default output location (when output location is null). + * Note that multiple source entries may target the same output location. + * The output location is referred to using an absolute path relative to the + * workspace root, e.g. "/Project/bin", it must be located inside + * the same project as the source folder. + *

+ *

+ * Also note that all sources/binaries inside a project are contributed as a whole through + * a project entry (see JavaCore.newProjectEntry). Particular + * source entries cannot be selectively exported. + *

+ * + * @param path the absolute workspace-relative path of a source folder + * @param exclusionPatterns the possibly empty list of exclusion patterns + * represented as relative paths + * @param outputLocation the specific output location for this source entry (null if using project default ouput location) + * @return a new source classpath entry with the given exclusion patterns + * @see #newSourceEntry(org.eclipse.core.runtime.IPath) + * @see IClasspathEntry#getExclusionPatterns + * @see IClasspathEntry#getOutputLocation() + * + * @since 2.1 + */ +public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns, IPath specificOutputLocation) { + + if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ + if (exclusionPatterns == null) Assert.isTrue(false, "Exclusion pattern set cannot be null"); //$NON-NLS-1$ + + return new ClasspathEntry( + IPackageFragmentRoot.K_SOURCE, + IClasspathEntry.CPE_SOURCE, + path, + exclusionPatterns, + null, // source attachment + null, // source attachment root + specificOutputLocation, // custom output location + false); +} - /** - * Creates and returns a new non-exported classpath entry of kind CPE_VARIABLE - * for the given path. The first segment of the path is the name of a classpath variable. - * The trailing segments of the path will be appended to resolved variable path. - *

- * A variable entry allows to express indirect references on a classpath to other projects or libraries, - * depending on what the classpath variable is referring. - *

- * It is possible to register an automatic initializer (ClasspathVariableInitializer), - * which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer". - * After resolution, a classpath variable entry may either correspond to a project or a library entry. - *

- * e.g. Here are some examples of variable path usage

    - *
  • "JDTCORE" where variable JDTCORE is - * bound to "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the library "c:\jars\jdtcore.jar"
  • - *
  • "JDTCORE" where variable JDTCORE is - * bound to "/Project_JDTCORE". The resolved classpath entry is denoting the project "/Project_JDTCORE"
  • - *
  • "PLUGINS/com.example/example.jar" where variable PLUGINS - * is bound to "c:/eclipse/plugins". The resolved classpath entry is denoting the library "c:/eclipse/plugins/com.example/example.jar"
  • - *
- * Note that this operation does not attempt to validate classpath variables - * or access the resources at the given paths. - *

- * The resulting entry is not exported to dependent projects. This method is equivalent to - * newVariableEntry(-,-,-,false). - *

- * - * @param variablePath the path of the binary archive; first segment is the - * name of a classpath variable - * @param variableSourceAttachmentPath the path of the corresponding source archive, - * or null if none; if present, the first segment is the - * name of a classpath variable (not necessarily the same variable - * as the one that begins variablePath) - * @param sourceAttachmentRootPath the location of the root within the source archive - * or null if archivePath is also null - * @return a new library classpath entry - * - * @see JavaCore#newVariableEntry(IPath, IPath, IPath, boolean) - */ -// public static IClasspathEntry newVariableEntry( -// IPath variablePath, -// IPath variableSourceAttachmentPath, -// IPath sourceAttachmentRootPath) { +/** + * Creates and returns a new non-exported classpath entry of kind CPE_VARIABLE + * for the given path. The first segment of the path is the name of a classpath variable. + * The trailing segments of the path will be appended to resolved variable path. + *

+ * A variable entry allows to express indirect references on a classpath to other projects or libraries, + * depending on what the classpath variable is referring. + *

+ * It is possible to register an automatic initializer (ClasspathVariableInitializer), + * which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer". + * After resolution, a classpath variable entry may either correspond to a project or a library entry. + *

+ * e.g. Here are some examples of variable path usage

    + *
  • "JDTCORE" where variable JDTCORE is + * bound to "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the library "c:\jars\jdtcore.jar"
  • + *
  • "JDTCORE" where variable JDTCORE is + * bound to "/Project_JDTCORE". The resolved classpath entry is denoting the project "/Project_JDTCORE"
  • + *
  • "PLUGINS/com.example/example.jar" where variable PLUGINS + * is bound to "c:/eclipse/plugins". The resolved classpath entry is denoting the library "c:/eclipse/plugins/com.example/example.jar"
  • + *
+ * Note that this operation does not attempt to validate classpath variables + * or access the resources at the given paths. + *

+ * The resulting entry is not exported to dependent projects. This method is equivalent to + * newVariableEntry(-,-,-,false). + *

+ * + * @param variablePath the path of the binary archive; first segment is the + * name of a classpath variable + * @param variableSourceAttachmentPath the path of the corresponding source archive, + * or null if none; if present, the first segment is the + * name of a classpath variable (not necessarily the same variable + * as the one that begins variablePath) + * @param sourceAttachmentRootPath the location of the root within the source archive + * or null if archivePath is also null + * @return a new library classpath entry + * + * @see JavaCore#newVariableEntry(IPath, IPath, IPath, boolean) + */ +//public static IClasspathEntry newVariableEntry( +// IPath variablePath, +// IPath variableSourceAttachmentPath, +// IPath sourceAttachmentRootPath) { // -// return newVariableEntry(variablePath, variableSourceAttachmentPath, sourceAttachmentRootPath, false); -// } +// return newVariableEntry(variablePath, variableSourceAttachmentPath, sourceAttachmentRootPath, false); +//} - /** - * Creates and returns a new non-exported classpath entry of kind CPE_VARIABLE - * for the given path. The first segment of the path is the name of a classpath variable. - * The trailing segments of the path will be appended to resolved variable path. - *

- * A variable entry allows to express indirect references on a classpath to other projects or libraries, - * depending on what the classpath variable is referring. - *

- * It is possible to register an automatic initializer (ClasspathVariableInitializer), - * which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer". - * After resolution, a classpath variable entry may either correspond to a project or a library entry. - *

- * e.g. Here are some examples of variable path usage

    - *
  • "JDTCORE" where variable JDTCORE is - * bound to "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the library "c:\jars\jdtcore.jar"
  • - *
  • "JDTCORE" where variable JDTCORE is - * bound to "/Project_JDTCORE". The resolved classpath entry is denoting the project "/Project_JDTCORE"
  • - *
  • "PLUGINS/com.example/example.jar" where variable PLUGINS - * is bound to "c:/eclipse/plugins". The resolved classpath entry is denoting the library "c:/eclipse/plugins/com.example/example.jar"
  • - *
- * Note that this operation does not attempt to validate classpath variables - * or access the resources at the given paths. - *

- * - * @param variablePath the path of the binary archive; first segment is the - * name of a classpath variable - * @param variableSourceAttachmentPath the path of the corresponding source archive, - * or null if none; if present, the first segment is the - * name of a classpath variable (not necessarily the same variable - * as the one that begins variablePath) - * @param sourceAttachmentRootPath the location of the root within the source archive - * or null if archivePath is also null - * @param isExported indicates whether this entry is contributed to dependent - * projects in addition to the output location - * @return a new variable classpath entry - * @since 2.0 - */ -// public static IClasspathEntry newVariableEntry( -// IPath variablePath, -// IPath variableSourceAttachmentPath, -// IPath variableSourceAttachmentRootPath, -// boolean isExported) { +/** + * Creates and returns a new non-exported classpath entry of kind CPE_VARIABLE + * for the given path. The first segment of the path is the name of a classpath variable. + * The trailing segments of the path will be appended to resolved variable path. + *

+ * A variable entry allows to express indirect references on a classpath to other projects or libraries, + * depending on what the classpath variable is referring. + *

+ * It is possible to register an automatic initializer (ClasspathVariableInitializer), + * which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer". + * After resolution, a classpath variable entry may either correspond to a project or a library entry. + *

+ * e.g. Here are some examples of variable path usage

    + *
  • "JDTCORE" where variable JDTCORE is + * bound to "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the library "c:\jars\jdtcore.jar"
  • + *
  • "JDTCORE" where variable JDTCORE is + * bound to "/Project_JDTCORE". The resolved classpath entry is denoting the project "/Project_JDTCORE"
  • + *
  • "PLUGINS/com.example/example.jar" where variable PLUGINS + * is bound to "c:/eclipse/plugins". The resolved classpath entry is denoting the library "c:/eclipse/plugins/com.example/example.jar"
  • + *
+ * Note that this operation does not attempt to validate classpath variables + * or access the resources at the given paths. + *

+ * + * @param variablePath the path of the binary archive; first segment is the + * name of a classpath variable + * @param variableSourceAttachmentPath the path of the corresponding source archive, + * or null if none; if present, the first segment is the + * name of a classpath variable (not necessarily the same variable + * as the one that begins variablePath) + * @param sourceAttachmentRootPath the location of the root within the source archive + * or null if archivePath is also null + * @param isExported indicates whether this entry is contributed to dependent + * projects in addition to the output location + * @return a new variable classpath entry + * @since 2.0 + */ +//public static IClasspathEntry newVariableEntry( +// IPath variablePath, +// IPath variableSourceAttachmentPath, +// IPath variableSourceAttachmentRootPath, +// boolean isExported) { // -// if (variablePath == null || variablePath.segmentCount() < 1) { -// Assert.isTrue( -// false, -// "Illegal classpath variable path: \'" + variablePath.makeRelative().toString() + "\', must have at least one segment"); //$NON-NLS-1$//$NON-NLS-2$ -// } -// -// return new ClasspathEntry( -// IPackageFragmentRoot.K_SOURCE, -// IClasspathEntry.CPE_VARIABLE, -// variablePath, -// ClasspathEntry.NO_EXCLUSION_PATTERNS, -// variableSourceAttachmentPath, // source attachment -// variableSourceAttachmentRootPath, // source attachment root -// null, // specific output folder -// isExported); +// if (variablePath == null || variablePath.segmentCount() < 1) { +// Assert.isTrue( +// false, +// "Illegal classpath variable path: \'" + variablePath.makeRelative().toString() + "\', must have at least one segment"); //$NON-NLS-1$//$NON-NLS-2$ // } +// +// return new ClasspathEntry( +// IPackageFragmentRoot.K_SOURCE, +// IClasspathEntry.CPE_VARIABLE, +// variablePath, +// ClasspathEntry.NO_EXCLUSION_PATTERNS, +// variableSourceAttachmentPath, // source attachment +// variableSourceAttachmentRootPath, // source attachment root +// null, // specific output folder +// isExported); +//} - /** - * Removed the given classpath variable. Does nothing if no value was - * set for this classpath variable. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * - * @param variableName the name of the classpath variable - * @see #setClasspathVariable - * - * @deprecated - use version with extra IProgressMonitor - */ -// public static void removeClasspathVariable(String variableName) { -// removeClasspathVariable(variableName, null); -// } +/** + * Removed the given classpath variable. Does nothing if no value was + * set for this classpath variable. + *

+ * This functionality cannot be used while the resource tree is locked. + *

+ * Classpath variable values are persisted locally to the workspace, and + * are preserved from session to session. + *

+ * + * @param variableName the name of the classpath variable + * @see #setClasspathVariable + * + * @deprecated - use version with extra IProgressMonitor + */ +//public static void removeClasspathVariable(String variableName) { +// removeClasspathVariable(variableName, null); +//} - /** - * Removed the given classpath variable. Does nothing if no value was - * set for this classpath variable. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * - * @param variableName the name of the classpath variable - * @param monitor the progress monitor to report progress - * @see #setClasspathVariable - */ -// public static void removeClasspathVariable( -// String variableName, -// IProgressMonitor monitor) { +/** + * Removed the given classpath variable. Does nothing if no value was + * set for this classpath variable. + *

+ * This functionality cannot be used while the resource tree is locked. + *

+ * Classpath variable values are persisted locally to the workspace, and + * are preserved from session to session. + *

+ * + * @param variableName the name of the classpath variable + * @param monitor the progress monitor to report progress + * @see #setClasspathVariable + */ +//public static void removeClasspathVariable( +// String variableName, +// IProgressMonitor monitor) { // -// try { -// updateVariableValues(new String[]{ variableName}, new IPath[]{ null }, monitor); -// } catch (JavaModelException e) { -// } +// try { +// updateVariableValues(new String[]{ variableName}, new IPath[]{ null }, monitor); +// } catch (JavaModelException e) { // } +//} - /** - * Removes the given element changed listener. - * Has no affect if an identical listener is not registered. - * - * @param listener the listener - */ - public static void removeElementChangedListener(IElementChangedListener listener) { - JavaModelManager.getJavaModelManager().removeElementChangedListener(listener); - } - /** - * Runs the given action as an atomic Java model operation. - *

- * After running a method that modifies Java elements, - * registered listeners receive after-the-fact notification of - * what just transpired, in the form of a element changed event. - * This method allows clients to call a number of - * methods that modify java elements and only have element - * changed event notifications reported at the end of the entire - * batch. - *

- *

- * If this method is called outside the dynamic scope of another such - * call, this method runs the action and then reports a single - * element changed event describing the net effect of all changes - * done to java elements by the action. - *

- *

- * If this method is called in the dynamic scope of another such - * call, this method simply runs the action. - *

- * - * @param action the action to perform - * @param monitor a progress monitor, or null if progress - * reporting and cancellation are not desired - * @exception CoreException if the operation failed. - * @since 2.1 - */ - public static void run(IWorkspaceRunnable action, IProgressMonitor monitor) throws CoreException { - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - if (workspace.isTreeLocked()) { - new BatchOperation(action).run(monitor); - } else { - // use IWorkspace.run(...) to ensure that a build will be done in autobuild mode - workspace.run(new BatchOperation(action), monitor); - } - } - /** - * Bind a container reference path to some actual containers (IClasspathContainer). - * This API must be invoked whenever changes in container need to be reflected onto the JavaModel. - * Containers can have distinct values in different projects, therefore this API considers a - * set of projects with their respective containers. - *

- * containerPath is the path under which these values can be referenced through - * container classpath entries (IClasspathEntry#CPE_CONTAINER). A container path - * is formed by a first ID segment followed with extra segments, which can be used as additional hints - * for the resolution. The container ID is used to identify a ClasspathContainerInitializer - * registered on the extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * There is no assumption that each individual container value passed in argument - * (respectiveContainers) must answer the exact same path when requested - * IClasspathContainer#getPath. - * Indeed, the containerPath is just an indication for resolving it to an actual container object. It can be - * delegated to a ClasspathContainerInitializer, which can be activated through the extension - * point "org.eclipse.jdt.core.ClasspathContainerInitializer"). - *

- * In reaction to changing container values, the JavaModel will be updated to reflect the new - * state of the updated container. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath container values are persisted locally to the workspace, but - * are not preserved from a session to another. It is thus highly recommended to register a - * ClasspathContainerInitializer for each referenced container - * (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer"). - *

- * Note: setting a container to null will cause it to be lazily resolved again whenever - * its value is required. In particular, this will cause a registered initializer to be invoked - * again. - *

- * @param containerPath - the name of the container reference, which is being updated - * @param affectedProjects - the set of projects for which this container is being bound - * @param respectiveContainers - the set of respective containers for the affected projects - * @param monitor a monitor to report progress - * - * @see ClasspathContainerInitializer - * @see #getClasspathContainer(IPath, IJavaProject) - * @see IClasspathContainer - * @since 2.0 - */ -// public static void setClasspathContainer(final IPath containerPath, IJavaProject[] affectedProjects, IClasspathContainer[] respectiveContainers, IProgressMonitor monitor) throws JavaModelException { +/** + * Removes the given element changed listener. + * Has no affect if an identical listener is not registered. + * + * @param listener the listener + */ +public static void removeElementChangedListener(IElementChangedListener listener) { + JavaModelManager.getJavaModelManager().removeElementChangedListener(listener); +} + +/** + * Bind a container reference path to some actual containers (IClasspathContainer). + * This API must be invoked whenever changes in container need to be reflected onto the JavaModel. + * Containers can have distinct values in different projects, therefore this API considers a + * set of projects with their respective containers. + *

+ * containerPath is the path under which these values can be referenced through + * container classpath entries (IClasspathEntry#CPE_CONTAINER). A container path + * is formed by a first ID segment followed with extra segments, which can be used as additional hints + * for the resolution. The container ID is used to identify a ClasspathContainerInitializer + * registered on the extension point "org.eclipse.jdt.core.classpathContainerInitializer". + *

+ * There is no assumption that each individual container value passed in argument + * (respectiveContainers) must answer the exact same path when requested + * IClasspathContainer#getPath. + * Indeed, the containerPath is just an indication for resolving it to an actual container object. It can be + * delegated to a ClasspathContainerInitializer, which can be activated through the extension + * point "org.eclipse.jdt.core.ClasspathContainerInitializer"). + *

+ * In reaction to changing container values, the JavaModel will be updated to reflect the new + * state of the updated container. + *

+ * This functionality cannot be used while the resource tree is locked. + *

+ * Classpath container values are persisted locally to the workspace, but + * are not preserved from a session to another. It is thus highly recommended to register a + * ClasspathContainerInitializer for each referenced container + * (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer"). + *

+ * Note: setting a container to null will cause it to be lazily resolved again whenever + * its value is required. In particular, this will cause a registered initializer to be invoked + * again. + *

+ * @param containerPath - the name of the container reference, which is being updated + * @param affectedProjects - the set of projects for which this container is being bound + * @param respectiveContainers - the set of respective containers for the affected projects + * @param monitor a monitor to report progress + * + * @see ClasspathContainerInitializer + * @see #getClasspathContainer(IPath, IJavaProject) + * @see IClasspathContainer + * @since 2.0 + */ +//public static void setClasspathContainer(final IPath containerPath, IJavaProject[] affectedProjects, IClasspathContainer[] respectiveContainers, IProgressMonitor monitor) throws JavaModelException { // -// if (affectedProjects.length != respectiveContainers.length) Assert.isTrue(false, "Projects and containers collections should have the same size"); //$NON-NLS-1$ +// if (affectedProjects.length != respectiveContainers.length) Assert.isTrue(false, "Projects and containers collections should have the same size"); //$NON-NLS-1$ // -// if (monitor != null && monitor.isCanceled()) return; +// if (monitor != null && monitor.isCanceled()) return; // -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPContainer SET - setting container: ["+containerPath+"] for projects: {" //$NON-NLS-1$ //$NON-NLS-2$ -// + (Util.toString(affectedProjects, -// new Util.Displayable(){ -// public String displayString(Object o) { return ((IJavaProject) o).getElementName(); } -// })) -// + "} with values: " //$NON-NLS-1$ -// + (Util.toString(respectiveContainers, -// new Util.Displayable(){ -// public String displayString(Object o) { return ((IClasspathContainer) o).getDescription(); } -// })) -// ); -// } +// if (JavaModelManager.CP_RESOLVE_VERBOSE){ +// System.out.println("CPContainer SET - setting container: ["+containerPath+"] for projects: {" //$NON-NLS-1$ //$NON-NLS-2$ +// + (Util.toString(affectedProjects, +// new Util.Displayable(){ +// public String displayString(Object o) { return ((IJavaProject) o).getElementName(); } +// })) +// + "} with values: " //$NON-NLS-1$ +// + (Util.toString(respectiveContainers, +// new Util.Displayable(){ +// public String displayString(Object o) { return ((IClasspathContainer) o).getDescription(); } +// })) +// ); +// } // -// final int projectLength = affectedProjects.length; -// final IJavaProject[] modifiedProjects; -// System.arraycopy(affectedProjects, 0, modifiedProjects = new IJavaProject[projectLength], 0, projectLength); -// final IClasspathEntry[][] oldResolvedPaths = new IClasspathEntry[projectLength][]; +// final int projectLength = affectedProjects.length; +// final IJavaProject[] modifiedProjects; +// System.arraycopy(affectedProjects, 0, modifiedProjects = new IJavaProject[projectLength], 0, projectLength); +// final IClasspathEntry[][] oldResolvedPaths = new IClasspathEntry[projectLength][]; // -// // filter out unmodified project containers -// int remaining = 0; -// for (int i = 0; i < projectLength; i++){ +// // filter out unmodified project containers +// int remaining = 0; +// for (int i = 0; i < projectLength; i++){ // -// if (monitor != null && monitor.isCanceled()) return; +// if (monitor != null && monitor.isCanceled()) return; // -// IJavaProject affectedProject = affectedProjects[i]; -// IClasspathContainer newContainer = respectiveContainers[i]; -// if (newContainer == null) newContainer = JavaModelManager.ContainerInitializationInProgress; // 30920 - prevent infinite loop -// boolean found = false; -// if (JavaProject.hasJavaNature(affectedProject.getProject())){ -// IClasspathEntry[] rawClasspath = affectedProject.getRawClasspath(); -// for (int j = 0, cpLength = rawClasspath.length; j - * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * - * @param variableName the name of the classpath variable - * @param path the path - * @see #getClasspathVariable - * - * @deprecated - use API with IProgressMonitor - */ -// public static void setClasspathVariable(String variableName, IPath path) -// throws JavaModelException { +/** + * Sets the value of the given classpath variable. + * The path must have at least one segment. + *

+ * This functionality cannot be used while the resource tree is locked. + *

+ * Classpath variable values are persisted locally to the workspace, and + * are preserved from session to session. + *

+ * + * @param variableName the name of the classpath variable + * @param path the path + * @see #getClasspathVariable + * + * @deprecated - use API with IProgressMonitor + */ +//public static void setClasspathVariable(String variableName, IPath path) +// throws JavaModelException { // -// setClasspathVariable(variableName, path, null); -// } +// setClasspathVariable(variableName, path, null); +//} - /** - * Sets the value of the given classpath variable. - * The path must not be null. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * Updating a variable with the same value has no effect. - * - * @param variableName the name of the classpath variable - * @param path the path - * @param monitor a monitor to report progress - * @see #getClasspathVariable - */ -// public static void setClasspathVariable( -// String variableName, -// IPath path, -// IProgressMonitor monitor) -// throws JavaModelException { +/** + * Sets the value of the given classpath variable. + * The path must not be null. + *

+ * This functionality cannot be used while the resource tree is locked. + *

+ * Classpath variable values are persisted locally to the workspace, and + * are preserved from session to session. + *

+ * Updating a variable with the same value has no effect. + * + * @param variableName the name of the classpath variable + * @param path the path + * @param monitor a monitor to report progress + * @see #getClasspathVariable + */ +//public static void setClasspathVariable( +// String variableName, +// IPath path, +// IProgressMonitor monitor) +// throws JavaModelException { // -// if (path == null) Assert.isTrue(false, "Variable path cannot be null"); //$NON-NLS-1$ -// setClasspathVariables(new String[]{variableName}, new IPath[]{ path }, monitor); -// } +// if (path == null) Assert.isTrue(false, "Variable path cannot be null"); //$NON-NLS-1$ +// setClasspathVariables(new String[]{variableName}, new IPath[]{ path }, monitor); +//} - /** - * Sets the values of all the given classpath variables at once. - * Null paths can be used to request corresponding variable removal. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * Updating a variable with the same value has no effect. - * - * @param variableNames an array of names for the updated classpath variables - * @param paths an array of path updates for the modified classpath variables (null - * meaning that the corresponding value will be removed - * @param monitor a monitor to report progress - * @see #getClasspathVariable - * @since 2.0 - */ -// public static void setClasspathVariables( -// String[] variableNames, -// IPath[] paths, -// IProgressMonitor monitor) -// throws JavaModelException { +/** + * Sets the values of all the given classpath variables at once. + * Null paths can be used to request corresponding variable removal. + *

+ * This functionality cannot be used while the resource tree is locked. + *

+ * Classpath variable values are persisted locally to the workspace, and + * are preserved from session to session. + *

+ * Updating a variable with the same value has no effect. + * + * @param variableNames an array of names for the updated classpath variables + * @param paths an array of path updates for the modified classpath variables (null + * meaning that the corresponding value will be removed + * @param monitor a monitor to report progress + * @see #getClasspathVariable + * @since 2.0 + */ +//public static void setClasspathVariables( +// String[] variableNames, +// IPath[] paths, +// IProgressMonitor monitor) +// throws JavaModelException { // -// if (variableNames.length != paths.length) Assert.isTrue(false, "Variable names and paths collections should have the same size"); //$NON-NLS-1$ -// //TODO: should check that null cannot be used as variable paths -// updateVariableValues(variableNames, paths, monitor); -// } - - /* (non-Javadoc) - * Method declared on IExecutableExtension. - * Record any necessary initialization data from the plugin. - */ - public void setInitializationData( - IConfigurationElement cfig, - String propertyName, - Object data) - throws CoreException { - } +// if (variableNames.length != paths.length) Assert.isTrue(false, "Variable names and paths collections should have the same size"); //$NON-NLS-1$ +// //TODO: should check that null cannot be used as variable paths +// updateVariableValues(variableNames, paths, monitor); +//} + +/* (non-Javadoc) + * Method declared on IExecutableExtension. + * Record any necessary initialization data from the plugin. + */ +public void setInitializationData( + IConfigurationElement cfig, + String propertyName, + Object data) + throws CoreException { +} - /** - * Sets the current table of options. All and only the options explicitly included in the given table - * are remembered; all previous option settings are forgotten, including ones not explicitly - * mentioned. - *

- * For a complete description of the configurable options, see getDefaultOptions. - *

- * - * @param newOptions the new options (key type: String; value type: String), - * or null to reset all options to their default values - * @see JavaCore#getDefaultOptions - */ - public static void setOptions(Hashtable newOptions) { +/** + * Sets the current table of options. All and only the options explicitly included in the given table + * are remembered; all previous option settings are forgotten, including ones not explicitly + * mentioned. + *

+ * For a complete description of the configurable options, see getDefaultOptions. + *

+ * + * @param newOptions the new options (key type: String; value type: String), + * or null to reset all options to their default values + * @see JavaCore#getDefaultOptions + */ +public static void setOptions(Hashtable newOptions) { - // see #initializeDefaultPluginPreferences() for changing default settings - Preferences preferences = getPlugin().getPluginPreferences(); + // see #initializeDefaultPluginPreferences() for changing default settings + Preferences preferences = getPlugin().getPluginPreferences(); - if (newOptions == null){ - newOptions = JavaCore.getDefaultOptions(); - } - Enumeration keys = newOptions.keys(); - while (keys.hasMoreElements()){ - String key = (String)keys.nextElement(); - if (!JavaModelManager.OptionNames.contains(key)) continue; // unrecognized option - if (key.equals(CORE_ENCODING)) continue; // skipped, contributed by resource prefs - String value = (String)newOptions.get(key); - preferences.setValue(key, value); - } - - // persist options - getPlugin().savePluginPreferences(); + if (newOptions == null){ + newOptions = JavaCore.getDefaultOptions(); } - - /** - * Shutdown the JavaCore plug-in. - *

- * De-registers the JavaModelManager as a resource changed listener and save participant. - *

- * @see org.eclipse.core.runtime.Plugin#shutdown() - */ - public void shutdown() { - - savePluginPreferences(); - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - workspace.removeResourceChangeListener(JavaModelManager.getJavaModelManager().deltaProcessor); - workspace.removeSaveParticipant(this); - - ((JavaModelManager) JavaModelManager.getJavaModelManager()).shutdown(); + Enumeration keys = newOptions.keys(); + while (keys.hasMoreElements()){ + String key = (String)keys.nextElement(); + if (!JavaModelManager.OptionNames.contains(key)) continue; // unrecognized option + if (key.equals(CORE_ENCODING)) continue; // skipped, contributed by resource prefs + String value = (String)newOptions.get(key); + preferences.setValue(key, value); } + + // persist options + getPlugin().savePluginPreferences(); +} + +/** + * Shutdown the JavaCore plug-in. + *

+ * De-registers the JavaModelManager as a resource changed listener and save participant. + *

+ * @see org.eclipse.core.runtime.Plugin#shutdown() + */ +// moved to PHPeclipsePlugin#shutdown() +//public void shutdown() { +// +// //savePluginPreferences(); +// getPlugin().savePluginPreferences(); +// IWorkspace workspace = ResourcesPlugin.getWorkspace(); +// workspace.removeResourceChangeListener(JavaModelManager.getJavaModelManager().deltaProcessor); +// workspace.removeSaveParticipant(PHPeclipsePlugin.getDefault()); +// +// ((JavaModelManager) JavaModelManager.getJavaModelManager()).shutdown(); +//} - /** - * Initiate the background indexing process. - * This should be deferred after the plugin activation. - */ -// private void startIndexing() { +/** + * Initiate the background indexing process. + * This should be deferred after the plugin activation. + */ +//private void startIndexing() { // -// JavaModelManager.getJavaModelManager().getIndexManager().reset(); -// } +// JavaModelManager.getJavaModelManager().getIndexManager().reset(); +//} - /** - * Startup of the JavaCore plug-in. - *

- * Registers the JavaModelManager as a resource changed listener and save participant. - * Starts the background indexing, and restore saved classpath variable values. - *

- * @see org.eclipse.core.runtime.Plugin#startup() - */ - public void startup() { - - JavaModelManager manager = JavaModelManager.getJavaModelManager(); - try { - manager.configurePluginDebugOptions(); - - // request state folder creation (workaround 19885) - JavaCore.getPlugin().getStateLocation(); - - // retrieve variable values - JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new JavaModelManager.PluginPreferencesListener()); -// TODO khartlage temp-del -// manager.loadVariablesAndContainers(); - - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - workspace.addResourceChangeListener( - manager.deltaProcessor, - IResourceChangeEvent.PRE_AUTO_BUILD - | IResourceChangeEvent.POST_AUTO_BUILD - | IResourceChangeEvent.POST_CHANGE - | IResourceChangeEvent.PRE_DELETE - | IResourceChangeEvent.PRE_CLOSE); - -// startIndexing(); - workspace.addSaveParticipant(this, manager); - - } catch (CoreException e) { - } catch (RuntimeException e) { - manager.shutdown(); - throw e; - } - } +/** + * Startup of the JavaCore plug-in. + *

+ * Registers the JavaModelManager as a resource changed listener and save participant. + * Starts the background indexing, and restore saved classpath variable values. + *

+ * @see org.eclipse.core.runtime.Plugin#startup() + */ +// moved to PHPeclipsePlugin#startup() +//public void startup() { +// +// JavaModelManager manager = JavaModelManager.getJavaModelManager(); +// try { +// manager.configurePluginDebugOptions(); +// +// // request state folder creation (workaround 19885) +// JavaCore.getPlugin().getStateLocation(); +// +// // retrieve variable values +// JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new JavaModelManager.PluginPreferencesListener()); +//// TODO khartlage temp-del +//// manager.loadVariablesAndContainers(); +// +// IWorkspace workspace = ResourcesPlugin.getWorkspace(); +// workspace.addResourceChangeListener( +// manager.deltaProcessor, +// IResourceChangeEvent.PRE_AUTO_BUILD +// | IResourceChangeEvent.POST_AUTO_BUILD +// | IResourceChangeEvent.POST_CHANGE +// | IResourceChangeEvent.PRE_DELETE +// | IResourceChangeEvent.PRE_CLOSE); +// +//// startIndexing(); +// workspace.addSaveParticipant(PHPeclipsePlugin.getDefault(), manager); +// +// } catch (CoreException e) { +// } catch (RuntimeException e) { +// manager.shutdown(); +// throw e; +// } +//} - /** - * Internal updating of a variable values (null path meaning removal), allowing to change multiple variable values at once. - */ -// private static void updateVariableValues( -// String[] variableNames, -// IPath[] variablePaths, -// IProgressMonitor monitor) throws JavaModelException { + +/** + * Internal updating of a variable values (null path meaning removal), allowing to change multiple variable values at once. + */ +//private static void updateVariableValues( +// String[] variableNames, +// IPath[] variablePaths, +// IProgressMonitor monitor) throws JavaModelException { // -// if (monitor != null && monitor.isCanceled()) return; +// if (monitor != null && monitor.isCanceled()) return; // -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable SET - setting variables: {" + Util.toString(variableNames) //$NON-NLS-1$ -// + "} with values: " + Util.toString(variablePaths)); //$NON-NLS-1$ -// } +// if (JavaModelManager.CP_RESOLVE_VERBOSE){ +// System.out.println("CPVariable SET - setting variables: {" + Util.toString(variableNames) //$NON-NLS-1$ +// + "} with values: " + Util.toString(variablePaths)); //$NON-NLS-1$ +// } // -// int varLength = variableNames.length; +// int varLength = variableNames.length; // -// // gather classpath information for updating -// final HashMap affectedProjects = new HashMap(5); -// JavaModelManager manager = JavaModelManager.getJavaModelManager(); -// IJavaModel model = manager.getJavaModel(); +// // gather classpath information for updating +// final HashMap affectedProjects = new HashMap(5); +// JavaModelManager manager = JavaModelManager.getJavaModelManager(); +// IJavaModel model = manager.getJavaModel(); // -// // filter out unmodified variables -// int discardCount = 0; -// for (int i = 0; i < varLength; i++){ -// String variableName = variableNames[i]; -// IPath oldPath = (IPath)JavaModelManager.variableGet(variableName); // if reentering will provide previous session value -// if (oldPath == JavaModelManager.VariableInitializationInProgress){ -// IPath previousPath = (IPath)JavaModelManager.PreviousSessionVariables.get(variableName); -// if (previousPath != null){ -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable INIT - reentering access to variable: " + variableName+ " during its initialization, will see previous value: "+ previousPath); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// JavaModelManager.variablePut(variableName, previousPath); // replace value so reentering calls are seeing old value +// // filter out unmodified variables +// int discardCount = 0; +// for (int i = 0; i < varLength; i++){ +// String variableName = variableNames[i]; +// IPath oldPath = (IPath)JavaModelManager.variableGet(variableName); // if reentering will provide previous session value +// if (oldPath == JavaModelManager.VariableInitializationInProgress){ +// IPath previousPath = (IPath)JavaModelManager.PreviousSessionVariables.get(variableName); +// if (previousPath != null){ +// if (JavaModelManager.CP_RESOLVE_VERBOSE){ +// System.out.println("CPVariable INIT - reentering access to variable: " + variableName+ " during its initialization, will see previous value: "+ previousPath); //$NON-NLS-1$ //$NON-NLS-2$ // } -// oldPath = null; //33695 - cannot filter out restored variable, must update affected project to reset cached CP -// } -// if (oldPath != null && oldPath.equals(variablePaths[i])){ -// variableNames[i] = null; -// discardCount++; +// JavaModelManager.variablePut(variableName, previousPath); // replace value so reentering calls are seeing old value // } +// oldPath = null; //33695 - cannot filter out restored variable, must update affected project to reset cached CP // } -// if (discardCount > 0){ -// if (discardCount == varLength) return; -// int changedLength = varLength - discardCount; -// String[] changedVariableNames = new String[changedLength]; -// IPath[] changedVariablePaths = new IPath[changedLength]; -// for (int i = 0, index = 0; i < varLength; i++){ -// if (variableNames[i] != null){ -// changedVariableNames[index] = variableNames[i]; -// changedVariablePaths[index] = variablePaths[i]; -// index++; -// } +// if (oldPath != null && oldPath.equals(variablePaths[i])){ +// variableNames[i] = null; +// discardCount++; +// } +// } +// if (discardCount > 0){ +// if (discardCount == varLength) return; +// int changedLength = varLength - discardCount; +// String[] changedVariableNames = new String[changedLength]; +// IPath[] changedVariablePaths = new IPath[changedLength]; +// for (int i = 0, index = 0; i < varLength; i++){ +// if (variableNames[i] != null){ +// changedVariableNames[index] = variableNames[i]; +// changedVariablePaths[index] = variablePaths[i]; +// index++; // } -// variableNames = changedVariableNames; -// variablePaths = changedVariablePaths; -// varLength = changedLength; // } +// variableNames = changedVariableNames; +// variablePaths = changedVariablePaths; +// varLength = changedLength; +// } // -// if (monitor != null && monitor.isCanceled()) return; +// if (monitor != null && monitor.isCanceled()) return; // -// if (model != null) { -// IJavaProject[] projects = model.getJavaProjects(); -// nextProject : for (int i = 0, projectLength = projects.length; i < projectLength; i++){ -// IJavaProject project = projects[i]; +// if (model != null) { +// IJavaProject[] projects = model.getJavaProjects(); +// nextProject : for (int i = 0, projectLength = projects.length; i < projectLength; i++){ +// IJavaProject project = projects[i]; // -// // check to see if any of the modified variables is present on the classpath -// IClasspathEntry[] classpath = project.getRawClasspath(); -// for (int j = 0, cpLength = classpath.length; j < cpLength; j++){ +// // check to see if any of the modified variables is present on the classpath +// IClasspathEntry[] classpath = project.getRawClasspath(); +// for (int j = 0, cpLength = classpath.length; j < cpLength; j++){ // -// IClasspathEntry entry = classpath[j]; -// for (int k = 0; k < varLength; k++){ +// IClasspathEntry entry = classpath[j]; +// for (int k = 0; k < varLength; k++){ // -// String variableName = variableNames[k]; -// if (entry.getEntryKind() == IClasspathEntry.CPE_VARIABLE){ +// String variableName = variableNames[k]; +// if (entry.getEntryKind() == IClasspathEntry.CPE_VARIABLE){ // -// if (variableName.equals(entry.getPath().segment(0))){ -// affectedProjects.put(project, project.getResolvedClasspath(true)); -// continue nextProject; -// } -// IPath sourcePath, sourceRootPath; -// if (((sourcePath = entry.getSourceAttachmentPath()) != null && variableName.equals(sourcePath.segment(0))) -// || ((sourceRootPath = entry.getSourceAttachmentRootPath()) != null && variableName.equals(sourceRootPath.segment(0)))) { +// if (variableName.equals(entry.getPath().segment(0))){ +// affectedProjects.put(project, project.getResolvedClasspath(true)); +// continue nextProject; +// } +// IPath sourcePath, sourceRootPath; +// if (((sourcePath = entry.getSourceAttachmentPath()) != null && variableName.equals(sourcePath.segment(0))) +// || ((sourceRootPath = entry.getSourceAttachmentRootPath()) != null && variableName.equals(sourceRootPath.segment(0)))) { // -// affectedProjects.put(project, project.getResolvedClasspath(true)); -// continue nextProject; -// } -// } -// } +// affectedProjects.put(project, project.getResolvedClasspath(true)); +// continue nextProject; +// } +// } // } // } // } -// // update variables -// for (int i = 0; i < varLength; i++){ -// JavaModelManager.variablePut(variableNames[i], variablePaths[i]); -// } -// final String[] dbgVariableNames = variableNames; +// } +// // update variables +// for (int i = 0; i < varLength; i++){ +// JavaModelManager.variablePut(variableNames[i], variablePaths[i]); +// } +// final String[] dbgVariableNames = variableNames; // -// // update affected project classpaths -// if (!affectedProjects.isEmpty()) { -// try { -// JavaCore.run( -// new IWorkspaceRunnable() { -// public void run(IProgressMonitor monitor) throws CoreException { -// // propagate classpath change -// Iterator projectsToUpdate = affectedProjects.keySet().iterator(); -// while (projectsToUpdate.hasNext()) { +// // update affected project classpaths +// if (!affectedProjects.isEmpty()) { +// try { +// JavaCore_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt.run( +// new IWorkspaceRunnable() { +// public void run(IProgressMonitor monitor) throws CoreException { +// // propagate classpath change +// Iterator projectsToUpdate = affectedProjects.keySet().iterator(); +// while (projectsToUpdate.hasNext()) { // -// if (monitor != null && monitor.isCanceled()) return; +// if (monitor != null && monitor.isCanceled()) return; // -// JavaProject project = (JavaProject) projectsToUpdate.next(); +// JavaProject project = (JavaProject) projectsToUpdate.next(); // -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable SET - updating affected project: ["+project.getElementName()+"] due to setting variables: "+ Util.toString(dbgVariableNames)); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// -// project -// .setRawClasspath( -// project.getRawClasspath(), -// SetClasspathOperation.ReuseOutputLocation, -// null, // don't call beginTask on the monitor (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=3717) -// !ResourcesPlugin.getWorkspace().isTreeLocked(), // can change resources -// (IClasspathEntry[]) affectedProjects.get(project), -// false, // updating - no validation -// false); // updating - no need to save +// if (JavaModelManager.CP_RESOLVE_VERBOSE){ +// System.out.println("CPVariable SET - updating affected project: ["+project.getElementName()+"] due to setting variables: "+ Util.toString(dbgVariableNames)); //$NON-NLS-1$ //$NON-NLS-2$ // } +// +// project +// .setRawClasspath( +// project.getRawClasspath(), +// SetClasspathOperation.ReuseOutputLocation, +// null, // don't call beginTask on the monitor (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=3717) +// !ResourcesPlugin.getWorkspace().isTreeLocked(), // can change resources +// (IClasspathEntry[]) affectedProjects.get(project), +// false, // updating - no validation +// false); // updating - no need to save // } -// }, -// monitor); -// } catch (CoreException e) { -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable SET - FAILED DUE TO EXCEPTION: "+Util.toString(dbgVariableNames)); //$NON-NLS-1$ -// e.printStackTrace(); -// } -// if (e instanceof JavaModelException) { -// throw (JavaModelException)e; -// } else { -// throw new JavaModelException(e); -// } +// } +// }, +// monitor); +// } catch (CoreException e) { +// if (JavaModelManager.CP_RESOLVE_VERBOSE){ +// System.out.println("CPVariable SET - FAILED DUE TO EXCEPTION: "+Util.toString(dbgVariableNames)); //$NON-NLS-1$ +// e.printStackTrace(); +// } +// if (e instanceof JavaModelException) { +// throw (JavaModelException)e; +// } else { +// throw new JavaModelException(e); // } // } // } +//} } \ No newline at end of file diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ToolFactory.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ToolFactory.java index 9f8a201..e008a21 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ToolFactory.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/ToolFactory.java @@ -10,12 +10,11 @@ * IBM Corporation - added #createScanner allowing to make comment check stricter ******************************************************************************/ package net.sourceforge.phpdt.core; - + import java.util.Map; import net.sourceforge.phpdt.internal.compiler.parser.Scanner; import net.sourceforge.phpdt.internal.formatter.CodeFormatter; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.runtime.Plugin; @@ -40,7 +39,7 @@ public class ToolFactory { */ public static ICodeFormatter createCodeFormatter(){ - Plugin jdtCorePlugin = PHPCore.getPlugin(); + Plugin jdtCorePlugin = JavaCore.getPlugin(); if (jdtCorePlugin == null) return null; // IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.FORMATTER_EXTPOINT_ID); @@ -79,7 +78,7 @@ public class ToolFactory { */ public static ICodeFormatter createDefaultCodeFormatter(Map options){ - if (options == null) options = PHPCore.getOptions(); + if (options == null) options = JavaCore.getOptions(); return new CodeFormatter(options); } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java index 62feaeb..7d6e6b7 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java @@ -43,7 +43,7 @@ public interface ITerminalSymbols { final static int TokenNameEOF = 0; final static int TokenNameERROR = 1; - final static int TokenNameStopPHP = 2; + final static int TokenNameINLINE_HTML = 2; final static int TokenNameREMAINDER = 30; final static int TokenNameNOT = 31; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java index 2a0e2c1..820b0c7 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java @@ -23,7 +23,7 @@ import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclarati import net.sourceforge.phpeclipse.internal.compiler.ast.MethodDeclaration; import net.sourceforge.phpeclipse.internal.compiler.ast.SingleTypeReference; import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration; -import net.sourceforge.phpeclipse.phpeditor.PHPString; + import org.eclipse.core.resources.IFile; public class Parser //extends PHPParserSuperclass implements ITerminalSymbols, CompilerModifiers, ParserBasicInformation { @@ -1111,7 +1111,7 @@ public class Parser //extends PHPParserSuperclass if (token == TokenNameSEMICOLON) { getNextToken(); } else { - if (token != TokenNameStopPHP) { + if (token != TokenNameINLINE_HTML) { throwSyntaxError("';' expected after do-while statement."); } getNextToken(); @@ -1151,7 +1151,7 @@ public class Parser //extends PHPParserSuperclass if (token == TokenNameSEMICOLON) { getNextToken(); } else { - if (token != TokenNameStopPHP) { + if (token != TokenNameINLINE_HTML) { throwSyntaxError("';' expected after 'continue', 'break' or 'return'."); } getNextToken(); @@ -1163,12 +1163,15 @@ public class Parser //extends PHPParserSuperclass if (token == TokenNameSEMICOLON) { getNextToken(); } else { - if (token != TokenNameStopPHP) { + if (token != TokenNameINLINE_HTML) { throwSyntaxError("';' expected after 'echo' statement."); } getNextToken(); } return; + } else if (token == TokenNameINLINE_HTML) { + getNextToken(); + return; // } else if (token == TokenNameprint) { // getNextToken(); // expression(); @@ -1187,7 +1190,7 @@ public class Parser //extends PHPParserSuperclass if (token == TokenNameSEMICOLON) { getNextToken(); } else { - if (token != TokenNameStopPHP) { + if (token != TokenNameINLINE_HTML) { throwSyntaxError("';' expected after 'global' statement."); } getNextToken(); @@ -1199,7 +1202,7 @@ public class Parser //extends PHPParserSuperclass if (token == TokenNameSEMICOLON) { getNextToken(); } else { - if (token != TokenNameStopPHP) { + if (token != TokenNameINLINE_HTML) { throwSyntaxError("';' expected after 'static' statement."); } getNextToken(); @@ -1221,59 +1224,12 @@ public class Parser //extends PHPParserSuperclass if (token == TokenNameSEMICOLON) { getNextToken(); } else { - if (token != TokenNameStopPHP) { + if (token != TokenNameINLINE_HTML) { throwSyntaxError("';' expected after 'unset' statement."); } getNextToken(); } return; - // } else if (token == TokenNameexit || token == TokenNamedie) { - // getNextToken(); - // if (token != TokenNameSEMICOLON) { - // exitStatus(); - // } - // if (token == TokenNameSEMICOLON) { - // getNextToken(); - // } else { - // if (token != TokenNameStopPHP) { - // throwSyntaxError("';' expected after 'exit' or 'die' - // statement."); - // } - // getNextToken(); - // } - // return; - // } else if (token == TokenNamedefine) { - // getNextToken(); - // if (token == TokenNameLPAREN) { - // getNextToken(); - // } else { - // throwSyntaxError("'(' expected after 'define' keyword."); - // } - // expr(); - // if (token == TokenNameCOMMA) { - // getNextToken(); - // } else { - // throwSyntaxError("',' expected after first 'define' constant."); - // } - // expr(); - // if (token == TokenNameCOMMA) { - // getNextToken(); - // expr(); - // } - // if (token == TokenNameRPAREN) { - // getNextToken(); - // } else { - // throwSyntaxError("')' expected after 'define' statement."); - // } - // if (token == TokenNameSEMICOLON) { - // getNextToken(); - // } else { - // if (token != TokenNameStopPHP) { - // throwSyntaxError("';' expected after 'define' statement."); - // } - // getNextToken(); - // } - // return; } else if (token == TokenNamefunction) { MethodDeclaration methodDecl = new MethodDeclaration( this.compilationUnit.compilationResult); @@ -1282,6 +1238,57 @@ public class Parser //extends PHPParserSuperclass getNextToken(); functionDefinition(methodDecl); return; + } else if (token == TokenNametry) { + getNextToken(); +if (token != TokenNameLBRACE) { + throwSyntaxError("'{' expected in 'try' statement."); + } + getNextToken(); + statementList(); +if (token != TokenNameRBRACE) { + throwSyntaxError("'}' expected in 'try' statement."); + } +getNextToken(); + return; + } else if (token == TokenNamecatch) { +getNextToken(); +if (token != TokenNameLPAREN) { + throwSyntaxError("'(' expected in 'catch' statement."); + } + getNextToken(); + fully_qualified_class_name(); + if (token != TokenNameVariable) { + throwSyntaxError("Variable expected in 'catch' statement."); + } + getNextToken(); + + if (token != TokenNameRBRACE) { + throwSyntaxError("')' expected in 'catch' statement."); + } + getNextToken(); +getNextToken(); +if (token != TokenNameLBRACE) { + throwSyntaxError("'{' expected in 'catch' statement."); + } + getNextToken(); + statementList(); +if (token != TokenNameRBRACE) { + throwSyntaxError("'}' expected in 'catch' statement."); + } +getNextToken(); + additional_catches(); + return; + } else if (token == TokenNamethrow) { + getNextToken(); + + expr(); + if (token == TokenNameSEMICOLON) { + getNextToken(); + } else { + throwSyntaxError("';' expected after 'throw' exxpression."); + } + + return; } else if (token == TokenNamefinal || token == TokenNameabstract || token == TokenNameclass || token == TokenNameinterface) { TypeDeclaration typeDecl = new TypeDeclaration( @@ -1320,7 +1327,7 @@ public class Parser //extends PHPParserSuperclass getNextToken(); return; } else { - if (token != TokenNameStopPHP && token != TokenNameEOF) { + if (token != TokenNameINLINE_HTML && token != TokenNameEOF) { throwSyntaxError("';' expected after expression (Found token: " + scanner.toStringAction(token) + ")"); } @@ -1328,6 +1335,36 @@ public class Parser //extends PHPParserSuperclass } } } + private void additional_catches() { + while (token == TokenNamecatch) { + getNextToken(); + if (token != TokenNameLPAREN) { + throwSyntaxError("'(' expected in 'catch' statement."); + } + getNextToken(); + fully_qualified_class_name(); + if (token != TokenNameVariable) { + throwSyntaxError("Variable expected in 'catch' statement."); + } + getNextToken(); + + if (token != TokenNameRBRACE) { + throwSyntaxError("')' expected in 'catch' statement."); + } + getNextToken(); + getNextToken(); + if (token != TokenNameLBRACE) { + throwSyntaxError("'{' expected in 'catch' statement."); + } + getNextToken(); + statementList(); + if (token != TokenNameRBRACE) { + throwSyntaxError("'}' expected in 'catch' statement."); + } + getNextToken(); + } + } + private void global_var_list() { // global_var_list: // global_var_list ',' global_var @@ -2388,7 +2425,7 @@ public class Parser //extends PHPParserSuperclass } break; default : - if (token != TokenNameStopPHP) { + if (token != TokenNameINLINE_HTML) { throwSyntaxError("Error in expression (found token '" + scanner.toStringAction(token) + "')."); } @@ -3234,7 +3271,7 @@ public class Parser //extends PHPParserSuperclass break; } getNextToken(); - if (token != TokenNameRPAREN) { + if (token == TokenNameRPAREN) { break; } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java index 041fd95..9b91cf2 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java @@ -1081,7 +1081,7 @@ public class Scanner implements IScanner, ITerminalSymbols { case '?' : if (getNextChar('>')) { phpMode = false; - return TokenNameStopPHP; + return TokenNameINLINE_HTML; } return TokenNameQUESTION; case ':' : @@ -1522,7 +1522,7 @@ public class Scanner implements IScanner, ITerminalSymbols { if (getNextChar('>')) { startPosition = currentPosition - 2; phpMode = false; - return TokenNameStopPHP; + return TokenNameINLINE_HTML; } } //get the next char @@ -3471,7 +3471,7 @@ public class Scanner implements IScanner, ITerminalSymbols { case TokenNameERROR : return "ScannerError"; // + new String(getCurrentTokenSource()) + ")"; // //$NON-NLS-1$ - case TokenNameStopPHP : + case TokenNameINLINE_HTML : return "StopPHP(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ case TokenNameIdentifier : return "Identifier(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ClasspathEntry.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ClasspathEntry.java index bdb0401..df61b62 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ClasspathEntry.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/ClasspathEntry.java @@ -14,9 +14,9 @@ import net.sourceforge.phpdt.core.IClasspathEntry; import net.sourceforge.phpdt.core.IJavaProject; import net.sourceforge.phpdt.core.IPackageFragmentRoot; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.compiler.CharOperation; import net.sourceforge.phpdt.internal.corext.Assert; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; @@ -256,7 +256,7 @@ public class ClasspathEntry implements IClasspathEntry { switch (kind) { case IClasspathEntry.CPE_PROJECT : - return PHPCore.newProjectEntry(path, isExported); + return JavaCore.newProjectEntry(path, isExported); // case IClasspathEntry.CPE_LIBRARY : // return JavaCore.newLibraryEntry( @@ -269,9 +269,9 @@ public class ClasspathEntry implements IClasspathEntry { // must be an entry in this project or specify another project String projSegment = path.segment(0); if (projSegment != null && projSegment.equals(project.getElementName())) { // this project - return PHPCore.newSourceEntry(path, exclusionPatterns, outputLocation); + return JavaCore.newSourceEntry(path, exclusionPatterns, outputLocation); } else { // another project - return PHPCore.newProjectEntry(path, isExported); + return JavaCore.newProjectEntry(path, isExported); } // case IClasspathEntry.CPE_VARIABLE : @@ -282,7 +282,7 @@ public class ClasspathEntry implements IClasspathEntry { // isExported); case IClasspathEntry.CPE_CONTAINER : - return PHPCore.newContainerEntry( + return JavaCore.newContainerEntry( path, isExported); @@ -582,6 +582,6 @@ public class ClasspathEntry implements IClasspathEntry { */ public IClasspathEntry getResolvedEntry() { - return PHPCore.getResolvedClasspathEntry(this); + return JavaCore.getResolvedClasspathEntry(this); } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitProblemFinder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitProblemFinder.java index 6cfb4c4..695eb36 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitProblemFinder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CompilationUnitProblemFinder.java @@ -18,6 +18,7 @@ import net.sourceforge.phpdt.core.IJavaProject; import net.sourceforge.phpdt.core.IPackageFragment; import net.sourceforge.phpdt.core.IProblemRequestor; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.compiler.CharOperation; import net.sourceforge.phpdt.core.compiler.IProblem; import net.sourceforge.phpdt.internal.compiler.CompilationResult; @@ -32,7 +33,6 @@ import net.sourceforge.phpdt.internal.compiler.lookup.PackageBinding; import net.sourceforge.phpdt.internal.compiler.parser.SourceTypeConverter; import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation; import net.sourceforge.phpdt.internal.compiler.problem.DefaultProblemFactory; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclaration; import org.eclipse.core.runtime.IProgressMonitor; @@ -205,7 +205,7 @@ public class CompilationUnitProblemFinder extends Compiler { CompilationUnitDeclaration unit = null; try { - String encoding = project.getOption(PHPCore.CORE_ENCODING, true); + String encoding = project.getOption(JavaCore.CORE_ENCODING, true); IPackageFragment packageFragment = (IPackageFragment)unitElement.getAncestor(IJavaElement.PACKAGE_FRAGMENT); char[][] expectedPackageName = null; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyResourceElementsOperation.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyResourceElementsOperation.java index 2e30065..e6d149e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyResourceElementsOperation.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/CopyResourceElementsOperation.java @@ -29,12 +29,12 @@ import net.sourceforge.phpdt.core.IPackageFragment; import net.sourceforge.phpdt.core.IPackageFragmentRoot; import net.sourceforge.phpdt.core.IType; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.jdom.DOMException; import net.sourceforge.phpdt.core.jdom.DOMFactory; import net.sourceforge.phpdt.core.jdom.IDOMCompilationUnit; import net.sourceforge.phpdt.core.jdom.IDOMNode; import net.sourceforge.phpdt.core.jdom.IDOMPackage; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; @@ -276,7 +276,7 @@ public class CopyResourceElementsOperation extends MultiOperation { // update new resource content try { if (newContent != null){ - String encoding = source.getJavaProject().getOption(PHPCore.CORE_ENCODING, true); + String encoding = source.getJavaProject().getOption(JavaCore.CORE_ENCODING, true); destFile.setContents( new ByteArrayInputStream(encoding == null ? newContent.getBytes() : newContent.getBytes(encoding)), fForce ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, @@ -310,7 +310,7 @@ public class CopyResourceElementsOperation extends MultiOperation { // see http://dev.eclipse.org/bugs/show_bug.cgi?id=9351 try { if (newContent != null){ - String encoding = source.getJavaProject().getOption(PHPCore.CORE_ENCODING, true); + String encoding = source.getJavaProject().getOption(JavaCore.CORE_ENCODING, true); destFile.setContents( new ByteArrayInputStream(encoding == null ? newContent.getBytes() : newContent.getBytes(encoding)), fForce ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java index 45ffede..bbfe240 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/DeltaProcessor.java @@ -22,8 +22,8 @@ import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.IJavaModel; import net.sourceforge.phpdt.core.IJavaProject; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IFile; @@ -229,7 +229,7 @@ public class DeltaProcessor implements IResourceChangeListener { * to update. */ void addToProjectsToUpdateWithDependents(IProject project) { - this.projectsToUpdate.add(PHPCore.create(project)); + this.projectsToUpdate.add(JavaCore.create(project)); // this.addDependentProjects(project.getFullPath(), this.projectsToUpdate); } @@ -1114,7 +1114,7 @@ public class DeltaProcessor implements IResourceChangeListener { // source attachment path if (entry.getEntryKind() != IClasspathEntry.CPE_LIBRARY) continue; - QualifiedName qName = new QualifiedName(PHPCore.PLUGIN_ID, "sourceattachment: " + path.toOSString()); //$NON-NLS-1$; + QualifiedName qName = new QualifiedName(JavaCore.PLUGIN_ID, "sourceattachment: " + path.toOSString()); //$NON-NLS-1$; String propertyString = null; try { propertyString = ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(qName); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java index 1838edf..4c295b7 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java @@ -39,8 +39,8 @@ import net.sourceforge.phpdt.core.IPackageFragment; import net.sourceforge.phpdt.core.IPackageFragmentRoot; import net.sourceforge.phpdt.core.IWorkingCopy; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpdt.internal.core.builder.PHPBuilder; @@ -248,13 +248,13 @@ public class JavaModelManager implements ISaveParticipant { int type = resource.getType(); switch (type) { case IResource.PROJECT : - return PHPCore.create((IProject) resource); + return JavaCore.create((IProject) resource); case IResource.FILE : return create((IFile) resource, project); case IResource.FOLDER : return create((IFolder) resource, project); case IResource.ROOT : - return PHPCore.create((IWorkspaceRoot) resource); + return JavaCore.create((IWorkspaceRoot) resource); default : return null; } @@ -280,7 +280,7 @@ public class JavaModelManager implements ISaveParticipant { return null; } if (project == null) { - project = PHPCore.create(file.getProject()); + project = JavaCore.create(file.getProject()); } if (file.getFileExtension() != null) { @@ -311,7 +311,7 @@ public class JavaModelManager implements ISaveParticipant { return null; } if (project == null) { - project = PHPCore.create(folder.getProject()); + project = JavaCore.create(folder.getProject()); } IJavaElement element = determineIfOnClasspath(folder, project); if (conflictsWithOutputLocation(folder.getFullPath(), (JavaProject)project) @@ -355,7 +355,7 @@ public class JavaModelManager implements ISaveParticipant { if (file == null) return null; if (project == null) { - project = PHPCore.create(file.getProject()); + project = JavaCore.create(file.getProject()); } IPackageFragment pkg = (IPackageFragment) determineIfOnClasspath(file, project); if (pkg == null) { @@ -655,7 +655,7 @@ public class JavaModelManager implements ISaveParticipant { * Configure the plugin with respect to option settings defined in ".options" file */ public void configurePluginDebugOptions(){ - if(PHPCore.getPlugin().isDebugging()){ + if(JavaCore.getPlugin().isDebugging()){ // TODO khartlage temp-del String option = Platform.getDebugOption(BUILDER_DEBUG); // if(option != null) JavaBuilder.DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ @@ -1000,7 +1000,7 @@ public class JavaModelManager implements ISaveParticipant { JavaModelManager.PerProjectInfo info = getPerProjectInfo(project, false /* don't create info */); if (info == null) { if (!JavaProject.hasJavaNature(project)) { - throw ((JavaProject)PHPCore.create(project)).newNotPresentException(); + throw ((JavaProject)JavaCore.create(project)).newNotPresentException(); } info = getPerProjectInfo(project, true /* create info */); } @@ -1012,7 +1012,7 @@ public class JavaModelManager implements ISaveParticipant { */ public static String[] getRegisteredVariableNames(){ - Plugin jdtCorePlugin = PHPCore.getPlugin(); + Plugin jdtCorePlugin = JavaCore.getPlugin(); if (jdtCorePlugin == null) return null; ArrayList variableList = new ArrayList(5); @@ -1062,7 +1062,7 @@ public class JavaModelManager implements ISaveParticipant { */ private File getSerializationFile(IProject project) { if (!project.exists()) return null; - IPluginDescriptor descr= PHPCore.getJavaCore().getDescriptor(); + IPluginDescriptor descr= JavaCore.getJavaCore().getDescriptor(); IPath workingLocation= project.getPluginWorkingLocation(descr); return workingLocation.append("state.dat").toFile(); //$NON-NLS-1$ } @@ -1094,18 +1094,18 @@ public class JavaModelManager implements ISaveParticipant { } else { // internal resource (not an IFile or not existing) IPath location; if (file.getType() != IResource.FILE || (location = file.getLocation()) == null) { - throw new CoreException(new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ + throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ } fileSystemPath= location.toOSString(); } } else if (!path.isAbsolute()) { file= root.getFile(path); if (file == null || file.getType() != IResource.FILE) { - throw new CoreException(new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ + throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ } IPath location = file.getLocation(); if (location == null) { - throw new CoreException(new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ + throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ } fileSystemPath= location.toOSString(); } else { @@ -1122,7 +1122,7 @@ public class JavaModelManager implements ISaveParticipant { } return zipFile; } catch (IOException e) { - throw new CoreException(new Status(Status.ERROR, PHPCore.PLUGIN_ID, -1, Util.bind("status.IOException"), e)); //$NON-NLS-1$ + throw new CoreException(new Status(Status.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("status.IOException"), e)); //$NON-NLS-1$ } } } @@ -1297,7 +1297,7 @@ public class JavaModelManager implements ISaveParticipant { DataInputStream in= new DataInputStream(new BufferedInputStream(new FileInputStream(file))); try { String pluginID= in.readUTF(); - if (!pluginID.equals(PHPCore.PLUGIN_ID)) + if (!pluginID.equals(JavaCore.PLUGIN_ID)) throw new IOException(Util.bind("build.wrongFileFormat")); //$NON-NLS-1$ String kind= in.readUTF(); if (!kind.equals("STATE")) //$NON-NLS-1$ @@ -1311,7 +1311,7 @@ public class JavaModelManager implements ISaveParticipant { } } catch (Exception e) { e.printStackTrace(); - throw new CoreException(new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, Platform.PLUGIN_ERROR, "Error reading last build state for project "+ project.getName(), e)); //$NON-NLS-1$ + throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, "Error reading last build state for project "+ project.getName(), e)); //$NON-NLS-1$ } } return null; @@ -1453,7 +1453,7 @@ public class JavaModelManager implements ISaveParticipant { try { DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file))); try { - out.writeUTF(PHPCore.PLUGIN_ID); + out.writeUTF(JavaCore.PLUGIN_ID); out.writeUTF("STATE"); //$NON-NLS-1$ if (info.savedState == null) { out.writeBoolean(false); @@ -1467,12 +1467,12 @@ public class JavaModelManager implements ISaveParticipant { } catch (RuntimeException e) { try {file.delete();} catch(SecurityException se) {} throw new CoreException( - new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, Platform.PLUGIN_ERROR, + new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, Util.bind("build.cannotSaveState", info.project.getName()), e)); //$NON-NLS-1$ } catch (IOException e) { try {file.delete();} catch(SecurityException se) {} throw new CoreException( - new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, Platform.PLUGIN_ERROR, + new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, Util.bind("build.cannotSaveState", info.project.getName()), e)); //$NON-NLS-1$ } if (PHPBuilder.DEBUG) { @@ -1508,7 +1508,7 @@ public class JavaModelManager implements ISaveParticipant { if (vStats != null) { IStatus[] stats= new IStatus[vStats.size()]; vStats.toArray(stats); - throw new CoreException(new MultiStatus(PHPCore.PLUGIN_ID, IStatus.ERROR, stats, Util.bind("build.cannotSaveStates"), null)); //$NON-NLS-1$ + throw new CoreException(new MultiStatus(JavaCore.PLUGIN_ID, IStatus.ERROR, stats, Util.bind("build.cannotSaveStates"), null)); //$NON-NLS-1$ } } @@ -1520,7 +1520,7 @@ public class JavaModelManager implements ISaveParticipant { // optional behaviour // possible value of index 0 is Compute - if (!PHPCore.COMPUTE.equals(PHPCore.getOption(PHPCore.CORE_JAVA_BUILD_ORDER))) return; // cannot be customized at project level + if (!JavaCore.COMPUTE.equals(JavaCore.getOption(JavaCore.CORE_JAVA_BUILD_ORDER))) return; // cannot be customized at project level if (javaBuildOrder == null || javaBuildOrder.length <= 1) return; @@ -1661,11 +1661,11 @@ public class JavaModelManager implements ISaveParticipant { if (variablePath == JavaModelManager.VariableInitializationInProgress){ return; } - Preferences preferences = PHPCore.getPlugin().getPluginPreferences(); + Preferences preferences = JavaCore.getPlugin().getPluginPreferences(); String variableKey = CP_VARIABLE_PREFERENCES_PREFIX+variableName; String variableString = variablePath == null ? CP_ENTRY_IGNORE : variablePath.toString(); preferences.setDefault(variableKey, CP_ENTRY_IGNORE); // use this default to get rid of removed ones preferences.setValue(variableKey, variableString); - PHPCore.getPlugin().savePluginPreferences(); + JavaCore.getPlugin().savePluginPreferences(); } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelStatus.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelStatus.java index 37a591d..9f7e031 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelStatus.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelStatus.java @@ -13,7 +13,7 @@ package net.sourceforge.phpdt.internal.core; import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.IJavaModelStatus; import net.sourceforge.phpdt.core.IJavaModelStatusConstants; -import net.sourceforge.phpeclipse.PHPCore; +import net.sourceforge.phpdt.core.JavaCore; import org.eclipse.core.resources.IResourceStatus; import org.eclipse.core.runtime.CoreException; @@ -68,13 +68,13 @@ public class JavaModelStatus */ public JavaModelStatus() { // no code for an multi-status - super(ERROR, PHPCore.PLUGIN_ID, 0, "JavaModelStatus", null); //$NON-NLS-1$ + super(ERROR, JavaCore.PLUGIN_ID, 0, "JavaModelStatus", null); //$NON-NLS-1$ } /** * Constructs an Java model status with no corresponding elements. */ public JavaModelStatus(int code) { - super(ERROR, PHPCore.PLUGIN_ID, code, "JavaModelStatus", null); //$NON-NLS-1$ + super(ERROR, JavaCore.PLUGIN_ID, code, "JavaModelStatus", null); //$NON-NLS-1$ // fElements= JavaElementInfo.fgEmptyChildren; fElements = fgObjectEmptyChildren; } @@ -83,7 +83,7 @@ public class JavaModelStatus * elements. */ public JavaModelStatus(int code, IJavaElement[] elements) { - super(ERROR, PHPCore.PLUGIN_ID, code, "JavaModelStatus", null); //$NON-NLS-1$ + super(ERROR, JavaCore.PLUGIN_ID, code, "JavaModelStatus", null); //$NON-NLS-1$ fElements = elements; fPath = null; } @@ -97,7 +97,7 @@ public class JavaModelStatus * Constructs an Java model status with no corresponding elements. */ public JavaModelStatus(int severity, int code, String string) { - super(severity, PHPCore.PLUGIN_ID, code, "JavaModelStatus", null); //$NON-NLS-1$ + super(severity, JavaCore.PLUGIN_ID, code, "JavaModelStatus", null); //$NON-NLS-1$ // fElements= JavaElementInfo.fgEmptyChildren; fElements = fgObjectEmptyChildren; fPath = null; @@ -107,7 +107,7 @@ public class JavaModelStatus * Constructs an Java model status with no corresponding elements. */ public JavaModelStatus(int code, Throwable throwable) { - super(ERROR, PHPCore.PLUGIN_ID, code, "JavaModelStatus", throwable); //$NON-NLS-1$ + super(ERROR, JavaCore.PLUGIN_ID, code, "JavaModelStatus", throwable); //$NON-NLS-1$ // fElements= JavaElementInfo.fgEmptyChildren; fElements = fgObjectEmptyChildren; } @@ -115,7 +115,7 @@ public class JavaModelStatus * Constructs an Java model status with no corresponding elements. */ public JavaModelStatus(int code, IPath path) { - super(ERROR, PHPCore.PLUGIN_ID, code, "JavaModelStatus", null); //$NON-NLS-1$ + super(ERROR, JavaCore.PLUGIN_ID, code, "JavaModelStatus", null); //$NON-NLS-1$ // fElements= JavaElementInfo.fgEmptyChildren; fElements = fgObjectEmptyChildren; fPath = path; @@ -148,7 +148,7 @@ public class JavaModelStatus * Constructs an Java model status with no corresponding elements. */ public JavaModelStatus(CoreException coreException) { - super(ERROR, PHPCore.PLUGIN_ID, CORE_EXCEPTION, "JavaModelStatus", coreException); //$NON-NLS-1$ + super(ERROR, JavaCore.PLUGIN_ID, CORE_EXCEPTION, "JavaModelStatus", coreException); //$NON-NLS-1$ // fElements= JavaElementInfo.fgEmptyChildren; fElements = fgObjectEmptyChildren; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java index a634464..3215459 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java @@ -44,11 +44,11 @@ import net.sourceforge.phpdt.core.IJavaProject; import net.sourceforge.phpdt.core.IPackageFragment; import net.sourceforge.phpdt.core.IPackageFragmentRoot; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.codeassist.ISearchableNameEnvironment; import net.sourceforge.phpdt.internal.compiler.util.ObjectVector; import net.sourceforge.phpdt.internal.corext.Assert; import net.sourceforge.phpeclipse.LoadPathEntry; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.apache.xerces.dom.DocumentImpl; @@ -419,7 +419,7 @@ public class JavaProject if (member != null && member.getType() == IResource.PROJECT){ // double check if bound to project (23977) IProject projRsc = (IProject) member; if (JavaProject.hasJavaNature(projRsc)) { - JavaProject project = (JavaProject) PHPCore.create(projRsc); + JavaProject project = (JavaProject) JavaCore.create(projRsc); project.computeExpandedClasspath( initialProject, ignoreUnresolvedVariable, @@ -560,7 +560,7 @@ public class JavaProject IProject requiredProjectRsc = (IProject) member; if (JavaProject.hasJavaNature(requiredProjectRsc)){ // special builder binary output rootIDs.add(rootID); - JavaProject requiredProject = (JavaProject)PHPCore.create(requiredProjectRsc); + JavaProject requiredProject = (JavaProject)JavaCore.create(requiredProjectRsc); requiredProject.computePackageFragmentRoots( requiredProject.getResolvedClasspath(true), accumulatedRoots, @@ -680,7 +680,7 @@ public class JavaProject case IJavaModelStatusConstants.CLASSPATH_CYCLE : isCycleProblem = true; - if (PHPCore.ERROR.equals(getOption(PHPCore.CORE_CIRCULAR_CLASSPATH, true))) { + if (JavaCore.ERROR.equals(getOption(JavaCore.CORE_CIRCULAR_CLASSPATH, true))) { severity = IMarker.SEVERITY_ERROR; } else { severity = IMarker.SEVERITY_WARNING; @@ -695,7 +695,7 @@ public class JavaProject default: IPath path = status.getPath(); if (path != null) arguments = new String[] { path.toString() }; - if (PHPCore.ERROR.equals(getOption(PHPCore.CORE_INCOMPLETE_CLASSPATH, true))) { + if (JavaCore.ERROR.equals(getOption(JavaCore.CORE_INCOMPLETE_CLASSPATH, true))) { severity = IMarker.SEVERITY_ERROR; } else { severity = IMarker.SEVERITY_WARNING; @@ -836,7 +836,7 @@ public class JavaProject protected IClasspathEntry[] defaultClasspath() throws JavaModelException { return new IClasspathEntry[] { - PHPCore.newSourceEntry(getProject().getFullPath())}; + JavaCore.newSourceEntry(getProject().getFullPath())}; } /** @@ -1296,7 +1296,7 @@ public class JavaProject Preferences preferences = getPreferences(); if (preferences == null || preferences.isDefault(optionName)) { - return inheritJavaCoreOptions ? PHPCore.getOption(optionName) : null; + return inheritJavaCoreOptions ? JavaCore.getOption(optionName) : null; } return preferences.getString(optionName).trim(); } @@ -1309,7 +1309,7 @@ public class JavaProject public Map getOptions(boolean inheritJavaCoreOptions) { // initialize to the defaults from JavaCore options pool - Map options = inheritJavaCoreOptions ? PHPCore.getOptions() : new Hashtable(5); + Map options = inheritJavaCoreOptions ? JavaCore.getOptions() : new Hashtable(5); Preferences preferences = getPreferences(); if (preferences == null) return options; // cannot do better (non-Java project) @@ -1693,7 +1693,7 @@ public class JavaProject case IClasspathEntry.CPE_VARIABLE : - IClasspathEntry resolvedEntry = PHPCore.getResolvedClasspathEntry(rawEntry); + IClasspathEntry resolvedEntry = JavaCore.getResolvedClasspathEntry(rawEntry); if (resolvedEntry == null) { if (!ignoreUnresolvedEntry) throw new JavaModelException(status); } else { @@ -1955,7 +1955,7 @@ public class JavaProject Preferences preferences = new Preferences(); // File prefFile = getProject().getLocation().append(PREF_FILENAME).toFile(); - IPath projectMetaLocation = getProject().getPluginWorkingLocation(PHPCore.getPlugin().getDescriptor()); + IPath projectMetaLocation = getProject().getPluginWorkingLocation(JavaCore.getPlugin().getDescriptor()); if (projectMetaLocation != null) { File prefFile = projectMetaLocation.append(PREF_FILENAME).toFile(); if (prefFile.exists()) { // load preferences from file @@ -2164,7 +2164,7 @@ public class JavaProject // the preferences file is located in the plug-in's state area // at a well-known name (.jprefs) // File prefFile = getProject().getLocation().append(PREF_FILENAME).toFile(); - File prefFile = project.getPluginWorkingLocation(PHPCore.getPlugin().getDescriptor()).append(PREF_FILENAME).toFile(); + File prefFile = project.getPluginWorkingLocation(JavaCore.getPlugin().getDescriptor()).append(PREF_FILENAME).toFile(); if (preferences.propertyNames().length == 0) { // there are no preference settings // rather than write an empty file, just delete any existing file @@ -2438,8 +2438,8 @@ public class JavaProject if (cycleParticipants.contains(project.getPath())){ IMarker cycleMarker = project.getCycleMarker(); - String circularCPOption = project.getOption(PHPCore.CORE_CIRCULAR_CLASSPATH, true); - int circularCPSeverity = PHPCore.ERROR.equals(circularCPOption) ? IMarker.SEVERITY_ERROR : IMarker.SEVERITY_WARNING; + String circularCPOption = project.getOption(JavaCore.CORE_CIRCULAR_CLASSPATH, true); + int circularCPSeverity = JavaCore.ERROR.equals(circularCPOption) ? IMarker.SEVERITY_ERROR : IMarker.SEVERITY_WARNING; if (cycleMarker != null) { // update existing cycle marker if needed try { @@ -2491,7 +2491,7 @@ public class JavaProject if (!traversed.contains(prereqProjectPath)) { IResource member = workspaceRoot.findMember(prereqProjectPath); if (member != null && member.getType() == IResource.PROJECT){ - JavaProject project = (JavaProject)PHPCore.create((IProject)member); + JavaProject project = (JavaProject)JavaCore.create((IProject)member); project.updateCycleParticipants(null, prereqChain, cycleParticipants, workspaceRoot, traversed); } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/NameLookup.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/NameLookup.java index d32a9d3..f2d66c4 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/NameLookup.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/NameLookup.java @@ -24,8 +24,8 @@ import net.sourceforge.phpdt.core.IType; import net.sourceforge.phpdt.core.IWorkingCopy; import net.sourceforge.phpdt.core.JavaModelException; import net.sourceforge.phpdt.core.ICompilationUnit; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.core.util.PerThreadObject; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspace; @@ -260,7 +260,7 @@ public class NameLookup { } } } else { - IJavaElement fromFactory = PHPCore.create(possibleFragment); + IJavaElement fromFactory = JavaCore.create(possibleFragment); if (fromFactory == null) { return null; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentRoot.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentRoot.java index 11aec11..f3e3f82 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentRoot.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/PackageFragmentRoot.java @@ -17,8 +17,8 @@ import net.sourceforge.phpdt.core.IJavaProject; import net.sourceforge.phpdt.core.IPackageFragment; import net.sourceforge.phpdt.core.IPackageFragmentRoot; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.compiler.CharOperation; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IResource; @@ -623,7 +623,7 @@ public IResource getResource() { * of this root. */ protected QualifiedName getSourceAttachmentPropertyName() throws JavaModelException { - return new QualifiedName(PHPCore.PLUGIN_ID, "sourceattachment: " + this.getPath().toOSString()); //$NON-NLS-1$ + return new QualifiedName(JavaCore.PLUGIN_ID, "sourceattachment: " + this.getPath().toOSString()); //$NON-NLS-1$ } public void setSourceAttachmentProperty(String property) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/Util.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/Util.java index 825cd1a..93e8ef0 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/Util.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/Util.java @@ -22,12 +22,12 @@ import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.IJavaModelStatusConstants; import net.sourceforge.phpdt.core.IPackageFragment; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.Signature; import net.sourceforge.phpdt.core.compiler.CharOperation; import net.sourceforge.phpdt.internal.core.util.CharArrayBuffer; import net.sourceforge.phpdt.internal.corext.Assert; import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; @@ -619,7 +619,7 @@ public class Util { * Returns the given file's contents as a character array. */ public static char[] getResourceContentsAsCharArray(IFile file) throws JavaModelException { - String encoding = PHPCore.create(file.getProject()).getOption(PHPCore.CORE_ENCODING, true); + String encoding = JavaCore.create(file.getProject()).getOption(JavaCore.CORE_ENCODING, true); return getResourceContentsAsCharArray(file, encoding); } @@ -848,11 +848,11 @@ public class Util { } IStatus status= new Status( IStatus.ERROR, - PHPCore.getPlugin().getDescriptor().getUniqueIdentifier(), + JavaCore.getPlugin().getDescriptor().getUniqueIdentifier(), IStatus.ERROR, message, e); - PHPCore.getPlugin().getLog().log(status); + JavaCore.getPlugin().getLog().log(status); } /** diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/WorkingCopy.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/WorkingCopy.java index 416eb26..f101c98 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/WorkingCopy.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/WorkingCopy.java @@ -25,7 +25,7 @@ import net.sourceforge.phpdt.core.IPackageFragment; import net.sourceforge.phpdt.core.IProblemRequestor; import net.sourceforge.phpdt.core.IType; import net.sourceforge.phpdt.core.JavaModelException; -import net.sourceforge.phpeclipse.PHPCore; +import net.sourceforge.phpdt.core.JavaCore; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; @@ -89,7 +89,7 @@ public void commit(boolean force, IProgressMonitor monitor) throws JavaModelExce CommitWorkingCopyOperation op= new CommitWorkingCopyOperation(this, force); runOperation(op, monitor); } else { - String encoding = this.getJavaProject().getOption(PHPCore.CORE_ENCODING, true); + String encoding = this.getJavaProject().getOption(JavaCore.CORE_ENCODING, true); String contents = this.getSource(); if (contents == null) return; try { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/AbstractImageBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/AbstractImageBuilder.java index 6b40b16..e79256b 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/AbstractImageBuilder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/AbstractImageBuilder.java @@ -15,6 +15,7 @@ import java.util.Locale; import net.sourceforge.phpdt.core.IJavaModelMarker; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.compiler.IProblem; import net.sourceforge.phpdt.internal.compiler.Compiler; import net.sourceforge.phpdt.internal.compiler.CompilationResult; @@ -22,7 +23,6 @@ import net.sourceforge.phpdt.internal.compiler.DefaultErrorHandlingPolicies; import net.sourceforge.phpdt.internal.compiler.ICompilerRequestor; import net.sourceforge.phpdt.internal.compiler.problem.AbortCompilation; import net.sourceforge.phpdt.internal.core.Util; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFolder; @@ -65,7 +65,7 @@ protected AbstractImageBuilder(PHPBuilder javaBuilder) { this.sourceLocations = this.nameEnvironment.sourceLocations; this.notifier = javaBuilder.notifier; - this.encoding = javaBuilder.javaProject.getOption(PHPCore.CORE_ENCODING, true); + this.encoding = javaBuilder.javaProject.getOption(JavaCore.CORE_ENCODING, true); this.compiler = newCompiler(); this.workQueue = new WorkQueue(); this.problemSourceFiles = new ArrayList(3); @@ -215,7 +215,7 @@ protected void createErrorFor(IResource resource, String message) { IMarker marker = resource.createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); int severity = IMarker.SEVERITY_ERROR; if (message.equals(Util.bind("build.duplicateResource"))) //$NON-NLS-1$ - if (PHPCore.WARNING.equals(javaBuilder.javaProject.getOption(PHPCore.CORE_JAVA_BUILD_DUPLICATE_RESOURCE, true))) + if (JavaCore.WARNING.equals(javaBuilder.javaProject.getOption(JavaCore.CORE_JAVA_BUILD_DUPLICATE_RESOURCE, true))) severity = IMarker.SEVERITY_WARNING; marker.setAttributes( new String[] {IMarker.MESSAGE, IMarker.SEVERITY, IMarker.CHAR_START, IMarker.CHAR_END}, @@ -387,9 +387,9 @@ protected void storeTasksFor(SourceFile sourceFile, IProblem[] tasks) throws Cor IMarker marker = resource.createMarker(IJavaModelMarker.TASK_MARKER); int priority = IMarker.PRIORITY_NORMAL; String compilerPriority = task.getArguments()[2]; - if (PHPCore.COMPILER_TASK_PRIORITY_HIGH.equals(compilerPriority)) + if (JavaCore.COMPILER_TASK_PRIORITY_HIGH.equals(compilerPriority)) priority = IMarker.PRIORITY_HIGH; - else if (PHPCore.COMPILER_TASK_PRIORITY_LOW.equals(compilerPriority)) + else if (JavaCore.COMPILER_TASK_PRIORITY_LOW.equals(compilerPriority)) priority = IMarker.PRIORITY_LOW; marker.setAttributes( new String[] { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/BatchImageBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/BatchImageBuilder.java index 2be5495..967d8c3 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/BatchImageBuilder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/BatchImageBuilder.java @@ -12,9 +12,9 @@ package net.sourceforge.phpdt.internal.core.builder; import java.util.ArrayList; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.core.JavaModelManager; import net.sourceforge.phpdt.internal.core.Util; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.builder.IdentifierIndexManager; @@ -102,8 +102,8 @@ protected void addAllSourceFiles(final ArrayList sourceFiles) throws CoreExcepti } protected void cleanOutputFolders() throws CoreException { - boolean deleteAll = PHPCore.CLEAN.equals( - javaBuilder.javaProject.getOption(PHPCore.CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, true)); + boolean deleteAll = JavaCore.CLEAN.equals( + javaBuilder.javaProject.getOption(JavaCore.CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, true)); if (deleteAll) { ArrayList visited = new ArrayList(sourceLocations.length); for (int i = 0, l = sourceLocations.length; i < l; i++) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/IncrementalImageBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/IncrementalImageBuilder.java index 635ac56..ffbe886 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/IncrementalImageBuilder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/IncrementalImageBuilder.java @@ -137,7 +137,7 @@ public class IncrementalImageBuilder extends AbstractImageBuilder { / allSourceFiles.length); increment = increment / 2; compile(allSourceFiles); - removeSecondaryTypes(); +// removeSecondaryTypes(); addAffectedSourceFiles(); } if (this.hasStructuralChanges && javaBuilder.javaProject.hasCycleMarker()) @@ -171,41 +171,41 @@ public class IncrementalImageBuilder extends AbstractImageBuilder { // if a well known name was found then we can skip over these if (simpleNames.length < simpleStrings.size()) simpleNames = null; - Object[] keyTable = newState.references.keyTable; - Object[] valueTable = newState.references.valueTable; - next : for (int i = 0, l = valueTable.length; i < l; i++) { - ReferenceCollection refs = (ReferenceCollection) valueTable[i]; - if (refs != null && refs.includes(qualifiedNames, simpleNames)) { - String typeLocator = (String) keyTable[i]; - IFile file = javaBuilder.currentProject.getFile(typeLocator); - if (file.exists()) { - ClasspathMultiDirectory md = sourceLocations[0]; - if (sourceLocations.length > 1) { - IPath sourceFileFullPath = file.getFullPath(); - for (int j = 0, m = sourceLocations.length; j < m; j++) { - if (sourceLocations[j].sourceFolder.getFullPath().isPrefixOf( - sourceFileFullPath)) { - md = sourceLocations[j]; - if (md.exclusionPatterns == null - || !Util.isExcluded(file, md.exclusionPatterns)) - break; - } - } - } - SourceFile sourceFile = new SourceFile(file, md, encoding); - if (sourceFiles.contains(sourceFile)) - continue next; - if (compiledAllAtOnce && previousSourceFiles != null - && previousSourceFiles.contains(sourceFile)) - continue next; // can skip previously compiled files since already - // saw hierarchy related problems - if (PHPBuilder.DEBUG) - System.out.println(" adding affected source file " + typeLocator); //$NON-NLS-1$ - // // update indexfile for the project: - sourceFiles.add(sourceFile); - } - } - } +// Object[] keyTable = newState.references.keyTable; +// Object[] valueTable = newState.references.valueTable; +// next : for (int i = 0, l = valueTable.length; i < l; i++) { +// ReferenceCollection refs = (ReferenceCollection) valueTable[i]; +// if (refs != null && refs.includes(qualifiedNames, simpleNames)) { +// String typeLocator = (String) keyTable[i]; +// IFile file = javaBuilder.currentProject.getFile(typeLocator); +// if (file.exists()) { +// ClasspathMultiDirectory md = sourceLocations[0]; +// if (sourceLocations.length > 1) { +// IPath sourceFileFullPath = file.getFullPath(); +// for (int j = 0, m = sourceLocations.length; j < m; j++) { +// if (sourceLocations[j].sourceFolder.getFullPath().isPrefixOf( +// sourceFileFullPath)) { +// md = sourceLocations[j]; +// if (md.exclusionPatterns == null +// || !Util.isExcluded(file, md.exclusionPatterns)) +// break; +// } +// } +// } +// SourceFile sourceFile = new SourceFile(file, md, encoding); +// if (sourceFiles.contains(sourceFile)) +// continue next; +// if (compiledAllAtOnce && previousSourceFiles != null +// && previousSourceFiles.contains(sourceFile)) +// continue next; // can skip previously compiled files since already +// // saw hierarchy related problems +// if (PHPBuilder.DEBUG) +// System.out.println(" adding affected source file " + typeLocator); //$NON-NLS-1$ +// // // update indexfile for the project: +// sourceFiles.add(sourceFile); +// } +// } +// } } protected void addDependentsOf(IPath path, boolean hasStructuralChanges) { if (hasStructuralChanges) { @@ -292,12 +292,12 @@ public class IncrementalImageBuilder extends AbstractImageBuilder { if (binaryDelta.getKind() == IResourceDelta.ADDED) { // see if any known source file is from the same package... // classpath already includes new package - if (!newState.isKnownPackage(packageName)) { - if (PHPBuilder.DEBUG) - System.out.println("Found added package " + packageName); //$NON-NLS-1$ - addDependentsOf(packagePath, false); - return; - } +// if (!newState.isKnownPackage(packageName)) { +// if (PHPBuilder.DEBUG) +// System.out.println("Found added package " + packageName); //$NON-NLS-1$ +// addDependentsOf(packagePath, false); +// return; +// } if (PHPBuilder.DEBUG) System.out.println("Skipped dependents of added package " + packageName); //$NON-NLS-1$ @@ -453,37 +453,37 @@ public class IncrementalImageBuilder extends AbstractImageBuilder { + typeLocator); //$NON-NLS-1$ sourceFiles.add(new SourceFile((IFile) resource, md, encoding)); String typeName = typePath.toString(); - if (!newState.isDuplicateLocator(typeName, typeLocator)) { // adding - // dependents - // results - // in - // 2 - // duplicate - // errors - if (PHPBuilder.DEBUG) - System.out.println("Found added source file " + typeName); //$NON-NLS-1$ - addDependentsOf(typePath, true); - } +// if (!newState.isDuplicateLocator(typeName, typeLocator)) { // adding +// // dependents +// // results +// // in +// // 2 +// // duplicate +// // errors +// if (PHPBuilder.DEBUG) +// System.out.println("Found added source file " + typeName); //$NON-NLS-1$ +// addDependentsOf(typePath, true); +// } return; case IResourceDelta.REMOVED : - char[][] definedTypeNames = newState - .getDefinedTypeNamesFor(typeLocator); - if (definedTypeNames == null) { // defined a single type matching - // typePath - removeClassFile(typePath, md.binaryFolder); - if ((sourceDelta.getFlags() & IResourceDelta.MOVED_TO) != 0) { - // remove problems and tasks for a compilation unit that is - // being moved (to another package or renamed) - // if the target file is a compilation unit, the new cu will - // be recompiled - // if the target file is a non-java resource, then markers - // are removed - // see bug 2857 - IResource movedFile = javaBuilder.workspaceRoot - .getFile(sourceDelta.getMovedToPath()); - PHPBuilder.removeProblemsAndTasksFor(movedFile); - } - } else { +// char[][] definedTypeNames = newState +// .getDefinedTypeNamesFor(typeLocator); +// if (definedTypeNames == null) { // defined a single type matching +// // typePath +// removeClassFile(typePath, md.binaryFolder); +// if ((sourceDelta.getFlags() & IResourceDelta.MOVED_TO) != 0) { +// // remove problems and tasks for a compilation unit that is +// // being moved (to another package or renamed) +// // if the target file is a compilation unit, the new cu will +// // be recompiled +// // if the target file is a non-java resource, then markers +// // are removed +// // see bug 2857 +// IResource movedFile = javaBuilder.workspaceRoot +// .getFile(sourceDelta.getMovedToPath()); +// PHPBuilder.removeProblemsAndTasksFor(movedFile); +// } +// } else { if (PHPBuilder.DEBUG) System.out.println("Found removed source file " + typePath.toString()); //$NON-NLS-1$ @@ -491,16 +491,16 @@ public class IncrementalImageBuilder extends AbstractImageBuilder { // source file since it may be // involved in a name // collision - if (definedTypeNames.length > 0) { // skip it if it failed to - // successfully define a - // type - IPath packagePath = typePath.removeLastSegments(1); - for (int i = 0, l = definedTypeNames.length; i < l; i++) - removeClassFile(packagePath.append(new String( - definedTypeNames[i])), md.binaryFolder); - } - } - newState.removeLocator(typeLocator); +// if (definedTypeNames.length > 0) { // skip it if it failed to +// // successfully define a +// // type +// IPath packagePath = typePath.removeLastSegments(1); +// for (int i = 0, l = definedTypeNames.length; i < l; i++) +// removeClassFile(packagePath.append(new String( +// definedTypeNames[i])), md.binaryFolder); +// } +// } +// newState.removeLocator(typeLocator); return; case IResourceDelta.CHANGED : if ((sourceDelta.getFlags() & IResourceDelta.CONTENT) == 0) @@ -573,73 +573,73 @@ public class IncrementalImageBuilder extends AbstractImageBuilder { protected void finishedWith(String sourceLocator, CompilationResult result, char[] mainTypeName, ArrayList definedTypeNames, ArrayList duplicateTypeNames) throws CoreException { - char[][] previousTypeNames = newState.getDefinedTypeNamesFor(sourceLocator); - if (previousTypeNames == null) - previousTypeNames = new char[][]{mainTypeName}; - IPath packagePath = null; - next : for (int i = 0, l = previousTypeNames.length; i < l; i++) { - char[] previous = previousTypeNames[i]; - for (int j = 0, m = definedTypeNames.size(); j < m; j++) - if (CharOperation.equals(previous, (char[]) definedTypeNames.get(j))) - continue next; - SourceFile sourceFile = (SourceFile) result.getCompilationUnit(); - if (packagePath == null) { - int count = sourceFile.sourceLocation.sourceFolder.getFullPath() - .segmentCount(); - packagePath = sourceFile.resource.getFullPath().removeFirstSegments( - count).removeLastSegments(1); - } - if (secondaryTypesToRemove == null) - this.secondaryTypesToRemove = new SimpleLookupTable(); - ArrayList types = (ArrayList) secondaryTypesToRemove - .get(sourceFile.sourceLocation.binaryFolder); - if (types == null) - types = new ArrayList(definedTypeNames.size()); - types.add(packagePath.append(new String(previous))); - secondaryTypesToRemove.put(sourceFile.sourceLocation.binaryFolder, types); - } +// char[][] previousTypeNames = newState.getDefinedTypeNamesFor(sourceLocator); +// if (previousTypeNames == null) +// previousTypeNames = new char[][]{mainTypeName}; +// IPath packagePath = null; +// next : for (int i = 0, l = previousTypeNames.length; i < l; i++) { +// char[] previous = previousTypeNames[i]; +// for (int j = 0, m = definedTypeNames.size(); j < m; j++) +// if (CharOperation.equals(previous, (char[]) definedTypeNames.get(j))) +// continue next; +// SourceFile sourceFile = (SourceFile) result.getCompilationUnit(); +// if (packagePath == null) { +// int count = sourceFile.sourceLocation.sourceFolder.getFullPath() +// .segmentCount(); +// packagePath = sourceFile.resource.getFullPath().removeFirstSegments( +// count).removeLastSegments(1); +// } +// if (secondaryTypesToRemove == null) +// this.secondaryTypesToRemove = new SimpleLookupTable(); +// ArrayList types = (ArrayList) secondaryTypesToRemove +// .get(sourceFile.sourceLocation.binaryFolder); +// if (types == null) +// types = new ArrayList(definedTypeNames.size()); +// types.add(packagePath.append(new String(previous))); +// secondaryTypesToRemove.put(sourceFile.sourceLocation.binaryFolder, types); +// } // super.finishedWith(sourceLocator, result, mainTypeName, // definedTypeNames, duplicateTypeNames); } - protected void removeClassFile(IPath typePath, IContainer outputFolder) - throws CoreException { - if (typePath.lastSegment().indexOf('$') == -1) { // is not a nested type - newState.removeQualifiedTypeName(typePath.toString()); - // add dependents even when the type thinks it does not exist to be on - // the safe side - if (PHPBuilder.DEBUG) - System.out.println("Found removed type " + typePath); //$NON-NLS-1$ - addDependentsOf(typePath, true); // when member types are removed, their - // enclosing type is structurally - // changed - } - IFile classFile = outputFolder.getFile(typePath - .addFileExtension(PHPBuilder.CLASS_EXTENSION)); - if (classFile.exists()) { - if (PHPBuilder.DEBUG) - System.out.println("Deleting class file of removed type " + typePath); //$NON-NLS-1$ - classFile.delete(IResource.FORCE, null); - } - } - protected void removeSecondaryTypes() throws CoreException { - if (secondaryTypesToRemove != null) { // delayed deleting secondary types - // until the end of the compile loop - Object[] keyTable = secondaryTypesToRemove.keyTable; - Object[] valueTable = secondaryTypesToRemove.valueTable; - for (int i = 0, l = keyTable.length; i < l; i++) { - IContainer outputFolder = (IContainer) keyTable[i]; - if (outputFolder != null) { - ArrayList paths = (ArrayList) valueTable[i]; - for (int j = 0, m = paths.size(); j < m; j++) - removeClassFile((IPath) paths.get(j), outputFolder); - } - } - this.secondaryTypesToRemove = null; - if (previousSourceFiles != null && previousSourceFiles.size() > 1) - this.previousSourceFiles = null; // cannot optimize recompile case when - // a secondary type is deleted - } - } +// protected void removeClassFile(IPath typePath, IContainer outputFolder) +// throws CoreException { +// if (typePath.lastSegment().indexOf('$') == -1) { // is not a nested type +// newState.removeQualifiedTypeName(typePath.toString()); +// // add dependents even when the type thinks it does not exist to be on +// // the safe side +// if (PHPBuilder.DEBUG) +// System.out.println("Found removed type " + typePath); //$NON-NLS-1$ +// addDependentsOf(typePath, true); // when member types are removed, their +// // enclosing type is structurally +// // changed +// } +// IFile classFile = outputFolder.getFile(typePath +// .addFileExtension(PHPBuilder.CLASS_EXTENSION)); +// if (classFile.exists()) { +// if (PHPBuilder.DEBUG) +// System.out.println("Deleting class file of removed type " + typePath); //$NON-NLS-1$ +// classFile.delete(IResource.FORCE, null); +// } +// } +// protected void removeSecondaryTypes() throws CoreException { +// if (secondaryTypesToRemove != null) { // delayed deleting secondary types +// // until the end of the compile loop +// Object[] keyTable = secondaryTypesToRemove.keyTable; +// Object[] valueTable = secondaryTypesToRemove.valueTable; +// for (int i = 0, l = keyTable.length; i < l; i++) { +// IContainer outputFolder = (IContainer) keyTable[i]; +// if (outputFolder != null) { +// ArrayList paths = (ArrayList) valueTable[i]; +// for (int j = 0, m = paths.size(); j < m; j++) +// removeClassFile((IPath) paths.get(j), outputFolder); +// } +// } +// this.secondaryTypesToRemove = null; +// if (previousSourceFiles != null && previousSourceFiles.size() > 1) +// this.previousSourceFiles = null; // cannot optimize recompile case when +// // a secondary type is deleted +// } +// } protected void resetCollections() { previousSourceFiles = sourceFiles.isEmpty() ? null diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/NameEnvironment.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/NameEnvironment.java index 9265c4c..50456a0 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/NameEnvironment.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/NameEnvironment.java @@ -14,6 +14,7 @@ import java.util.ArrayList; import net.sourceforge.phpdt.core.IClasspathEntry; import net.sourceforge.phpdt.core.IJavaProject; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.compiler.CharOperation; import net.sourceforge.phpdt.internal.compiler.env.INameEnvironment; import net.sourceforge.phpdt.internal.compiler.env.NameEnvironmentAnswer; @@ -22,7 +23,6 @@ import net.sourceforge.phpdt.internal.core.ClasspathEntry; import net.sourceforge.phpdt.internal.core.JavaModel; import net.sourceforge.phpdt.internal.core.JavaProject; import net.sourceforge.phpdt.internal.core.util.SimpleLookupTable; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFolder; @@ -93,7 +93,7 @@ public class NameEnvironment implements INameEnvironment { /* Update cycle marker */ IMarker cycleMarker = javaProject.getCycleMarker(); if (cycleMarker != null) { - int severity = PHPCore.ERROR.equals(javaProject.getOption(PHPCore.CORE_CIRCULAR_CLASSPATH, true)) + int severity = JavaCore.ERROR.equals(javaProject.getOption(JavaCore.CORE_CIRCULAR_CLASSPATH, true)) ? IMarker.SEVERITY_ERROR : IMarker.SEVERITY_WARNING; if (severity != ((Integer) cycleMarker.getAttribute(IMarker.SEVERITY)).intValue()) @@ -131,7 +131,7 @@ public class NameEnvironment implements INameEnvironment { IProject prereqProject = (IProject) target; if (!JavaProject.hasJavaNature(prereqProject)) continue nextEntry; // if project doesn't have java nature or is not accessible - JavaProject prereqJavaProject = (JavaProject) PHPCore.create(prereqProject); + JavaProject prereqJavaProject = (JavaProject) JavaCore.create(prereqProject); IClasspathEntry[] prereqClasspathEntries = prereqJavaProject.getRawClasspath(); ArrayList seen = new ArrayList(); nextPrereqEntry: for (int j = 0, m = prereqClasspathEntries.length; j < m; j++) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/PHPBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/PHPBuilder.java index 575bb44..f7a56a6 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/PHPBuilder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/PHPBuilder.java @@ -20,6 +20,7 @@ import java.util.Map; import net.sourceforge.phpdt.core.IClasspathEntry; import net.sourceforge.phpdt.core.IJavaModelMarker; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.compiler.CharOperation; import net.sourceforge.phpdt.internal.core.JavaModel; import net.sourceforge.phpdt.internal.core.JavaModelManager; @@ -27,7 +28,6 @@ import net.sourceforge.phpdt.internal.core.JavaProject; import net.sourceforge.phpdt.internal.core.Util; import net.sourceforge.phpdt.internal.core.util.SimpleLookupTable; import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.builder.IdentifierIndexManager; import net.sourceforge.phpeclipse.phpeditor.PHPParserAction; @@ -532,7 +532,7 @@ public class PHPBuilder extends IncrementalProjectBuilder { return false; } private void initializeBuilder() throws CoreException { - this.javaProject = (JavaProject) PHPCore.create(currentProject); + this.javaProject = (JavaProject) JavaCore.create(currentProject); this.workspaceRoot = currentProject.getWorkspace().getRoot(); // Flush the existing external files cache if this is the beginning of a // build cycle @@ -546,7 +546,7 @@ public class PHPBuilder extends IncrementalProjectBuilder { this.nameEnvironment = new NameEnvironment(workspaceRoot, javaProject, binaryLocationsPerProject); String filterSequence = javaProject.getOption( - PHPCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, true); + JavaCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, true); char[][] filters = filterSequence != null && filterSequence.length() > 0 ? CharOperation.splitAndTrimOn(',', filterSequence.toCharArray()) : null; @@ -591,8 +591,8 @@ public class PHPBuilder extends IncrementalProjectBuilder { return false; } private boolean isWorthBuilding() throws CoreException { - boolean abortBuilds = PHPCore.ABORT.equals(javaProject.getOption( - PHPCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, true)); + boolean abortBuilds = JavaCore.ABORT.equals(javaProject.getOption( + JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, true)); if (!abortBuilds) return true; // Abort build only if there are classpath errors @@ -622,10 +622,10 @@ public class PHPBuilder extends IncrementalProjectBuilder { if (getLastState(p) == null) { // The prereq project has no build state: if this prereq project has a // 'warning' cycle marker then allow build (see bug id 23357) - JavaProject prereq = (JavaProject) PHPCore.create(p); + JavaProject prereq = (JavaProject) JavaCore.create(p); if (prereq.hasCycleMarker() - && PHPCore.WARNING.equals(javaProject.getOption( - PHPCore.CORE_CIRCULAR_CLASSPATH, true))) + && JavaCore.WARNING.equals(javaProject.getOption( + JavaCore.CORE_CIRCULAR_CLASSPATH, true))) continue; if (DEBUG) System.out.println("Aborted build because prereq project " diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/State.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/State.java index 06bf6ca..9b0a223 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/State.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/builder/State.java @@ -36,9 +36,9 @@ public class State { //ClasspathLocation[] binaryLocations; // keyed by the project relative path of the type (ie. "src1/p1/p2/A.java"), value is a ReferenceCollection or an // AdditionalTypeCollection - SimpleLookupTable references; +// SimpleLookupTable references; // keyed by qualified type name "p1/p2/A", value is the project relative path which defines this type "src1/p1/p2/A.java" - SimpleLookupTable typeLocators; +// SimpleLookupTable typeLocators; int buildNumber; long lastStructuralBuildTime; @@ -61,8 +61,8 @@ public class State { this.javaProjectName = javaBuilder.currentProject.getName(); this.sourceLocations = javaBuilder.nameEnvironment.sourceLocations; // this.binaryLocations = javaBuilder.nameEnvironment.binaryLocations; - this.references = new SimpleLookupTable(7); - this.typeLocators = new SimpleLookupTable(7); +// this.references = new SimpleLookupTable(7); +// this.typeLocators = new SimpleLookupTable(7); this.buildNumber = 0; // indicates a full build this.lastStructuralBuildTime = System.currentTimeMillis(); @@ -70,91 +70,91 @@ public class State { } void copyFrom(State lastState) { - try { +// try { this.knownPackageNames = null; this.buildNumber = lastState.buildNumber + 1; this.lastStructuralBuildTime = lastState.lastStructuralBuildTime; - this.references = (SimpleLookupTable) lastState.references.clone(); - this.typeLocators = (SimpleLookupTable) lastState.typeLocators.clone(); - } catch (CloneNotSupportedException e) { - this.references = new SimpleLookupTable(lastState.references.elementSize); - Object[] keyTable = lastState.references.keyTable; - Object[] valueTable = lastState.references.valueTable; - for (int i = 0, l = keyTable.length; i < l; i++) - if (keyTable[i] != null) - this.references.put(keyTable[i], valueTable[i]); - - this.typeLocators = new SimpleLookupTable(lastState.typeLocators.elementSize); - keyTable = lastState.typeLocators.keyTable; - valueTable = lastState.typeLocators.valueTable; - for (int i = 0, l = keyTable.length; i < l; i++) - if (keyTable[i] != null) - this.typeLocators.put(keyTable[i], valueTable[i]); - } - } - - char[][] getDefinedTypeNamesFor(String typeLocator) { - Object c = references.get(typeLocator); - if (c instanceof AdditionalTypeCollection) - return ((AdditionalTypeCollection) c).definedTypeNames; - return null; // means only one type is defined with the same name as the file... saves space - } - - boolean isDuplicateLocator(String qualifiedTypeName, String typeLocator) { - String existing = (String) typeLocators.get(qualifiedTypeName); - return existing != null && !existing.equals(typeLocator); - } - - boolean isKnownPackage(String qualifiedPackageName) { - if (knownPackageNames == null) { - ArrayList names = new ArrayList(typeLocators.elementSize); - Object[] keyTable = typeLocators.keyTable; - for (int i = 0, l = keyTable.length; i < l; i++) { - if (keyTable[i] != null) { - String packageName = (String) keyTable[i]; // is a type name of the form p1/p2/A - int last = packageName.lastIndexOf('/'); - packageName = last == -1 ? null : packageName.substring(0, last); - while (packageName != null && !names.contains(packageName)) { - names.add(packageName); - last = packageName.lastIndexOf('/'); - packageName = last == -1 ? null : packageName.substring(0, last); - } - } - } - knownPackageNames = new String[names.size()]; - names.toArray(knownPackageNames); - } - for (int i = 0, l = knownPackageNames.length; i < l; i++) - if (knownPackageNames[i].equals(qualifiedPackageName)) - return true; - return false; +// this.references = (SimpleLookupTable) lastState.references.clone(); +// this.typeLocators = (SimpleLookupTable) lastState.typeLocators.clone(); +// } catch (CloneNotSupportedException e) { +// this.references = new SimpleLookupTable(lastState.references.elementSize); +// Object[] keyTable = lastState.references.keyTable; +// Object[] valueTable = lastState.references.valueTable; +// for (int i = 0, l = keyTable.length; i < l; i++) +// if (keyTable[i] != null) +// this.references.put(keyTable[i], valueTable[i]); +// +// this.typeLocators = new SimpleLookupTable(lastState.typeLocators.elementSize); +// keyTable = lastState.typeLocators.keyTable; +// valueTable = lastState.typeLocators.valueTable; +// for (int i = 0, l = keyTable.length; i < l; i++) +// if (keyTable[i] != null) +// this.typeLocators.put(keyTable[i], valueTable[i]); +// } } - void record(String typeLocator, char[][][] qualifiedRefs, char[][] simpleRefs, char[] mainTypeName, ArrayList typeNames) { - if (typeNames.size() == 1 && CharOperation.equals(mainTypeName, (char[]) typeNames.get(0))) { - references.put(typeLocator, new ReferenceCollection(qualifiedRefs, simpleRefs)); - } else { - char[][] definedTypeNames = new char[typeNames.size()][]; // can be empty when no types are defined - typeNames.toArray(definedTypeNames); - references.put(typeLocator, new AdditionalTypeCollection(definedTypeNames, qualifiedRefs, simpleRefs)); - } - } - - void recordLocatorForType(String qualifiedTypeName, String typeLocator) { - this.knownPackageNames = null; - typeLocators.put(qualifiedTypeName, typeLocator); - } +// char[][] getDefinedTypeNamesFor(String typeLocator) { +// Object c = references.get(typeLocator); +// if (c instanceof AdditionalTypeCollection) +// return ((AdditionalTypeCollection) c).definedTypeNames; +// return null; // means only one type is defined with the same name as the file... saves space +// } + +// boolean isDuplicateLocator(String qualifiedTypeName, String typeLocator) { +// String existing = (String) typeLocators.get(qualifiedTypeName); +// return existing != null && !existing.equals(typeLocator); +// } + +// boolean isKnownPackage(String qualifiedPackageName) { +// if (knownPackageNames == null) { +// ArrayList names = new ArrayList(typeLocators.elementSize); +// Object[] keyTable = typeLocators.keyTable; +// for (int i = 0, l = keyTable.length; i < l; i++) { +// if (keyTable[i] != null) { +// String packageName = (String) keyTable[i]; // is a type name of the form p1/p2/A +// int last = packageName.lastIndexOf('/'); +// packageName = last == -1 ? null : packageName.substring(0, last); +// while (packageName != null && !names.contains(packageName)) { +// names.add(packageName); +// last = packageName.lastIndexOf('/'); +// packageName = last == -1 ? null : packageName.substring(0, last); +// } +// } +// } +// knownPackageNames = new String[names.size()]; +// names.toArray(knownPackageNames); +// } +// for (int i = 0, l = knownPackageNames.length; i < l; i++) +// if (knownPackageNames[i].equals(qualifiedPackageName)) +// return true; +// return false; +// } + +// void record(String typeLocator, char[][][] qualifiedRefs, char[][] simpleRefs, char[] mainTypeName, ArrayList typeNames) { +// if (typeNames.size() == 1 && CharOperation.equals(mainTypeName, (char[]) typeNames.get(0))) { +// references.put(typeLocator, new ReferenceCollection(qualifiedRefs, simpleRefs)); +// } else { +// char[][] definedTypeNames = new char[typeNames.size()][]; // can be empty when no types are defined +// typeNames.toArray(definedTypeNames); +// references.put(typeLocator, new AdditionalTypeCollection(definedTypeNames, qualifiedRefs, simpleRefs)); +// } +// } +// +// void recordLocatorForType(String qualifiedTypeName, String typeLocator) { +// this.knownPackageNames = null; +// typeLocators.put(qualifiedTypeName, typeLocator); +// } void recordStructuralDependency(IProject prereqProject, State prereqState) { if (prereqState != null) structuralBuildTimes.put(prereqProject.getName(), new Long(prereqState.lastStructuralBuildTime)); } - void removeLocator(String typeLocatorToRemove) { - this.knownPackageNames = null; - references.removeKey(typeLocatorToRemove); - typeLocators.removeValue(typeLocatorToRemove); - } +// void removeLocator(String typeLocatorToRemove) { +// this.knownPackageNames = null; +// references.removeKey(typeLocatorToRemove); +// typeLocators.removeValue(typeLocatorToRemove); +// } void removePackage(IResourceDelta sourceDelta) { IResource resource = sourceDelta.getResource(); @@ -166,15 +166,15 @@ public class State { return; case IResource.FILE : IPath typeLocatorPath = resource.getProjectRelativePath(); - if (Util.isJavaFileName(typeLocatorPath.lastSegment())) - removeLocator(typeLocatorPath.toString()); +// if (Util.isJavaFileName(typeLocatorPath.lastSegment())) +// removeLocator(typeLocatorPath.toString()); } } - void removeQualifiedTypeName(String qualifiedTypeNameToRemove) { - this.knownPackageNames = null; - typeLocators.removeKey(qualifiedTypeNameToRemove); - } +// void removeQualifiedTypeName(String qualifiedTypeNameToRemove) { +// this.knownPackageNames = null; +// typeLocators.removeKey(qualifiedTypeNameToRemove); +// } static State read(IProject project, DataInputStream in) throws IOException { if (PHPBuilder.DEBUG) @@ -194,9 +194,10 @@ public class State { } newState.buildNumber = in.readInt(); newState.lastStructuralBuildTime = in.readLong(); - - int length = in.readInt(); - newState.sourceLocations = new ClasspathMultiDirectory[0]; + + int length; +// int length = in.readInt(); +// newState.sourceLocations = new ClasspathMultiDirectory[0]; // newState.sourceLocations = new ClasspathMultiDirectory[length]; // for (int i = 0; i < length; i++) { // IContainer sourceFolder = project, outputFolder = project; @@ -210,7 +211,7 @@ public class State { // newState.sourceLocations[i] = md; // } - length = in.readInt(); +// length = in.readInt(); // newState.binaryLocations = new ClasspathLocation[length]; // IWorkspaceRoot root = project.getWorkspace().getRoot(); // for (int i = 0; i < length; i++) { @@ -237,51 +238,51 @@ public class State { for (int i = 0; i < length; i++) newState.structuralBuildTimes.put(in.readUTF(), new Long(in.readLong())); - String[] internedTypeLocators = new String[length = in.readInt()]; - for (int i = 0; i < length; i++) - internedTypeLocators[i] = in.readUTF(); - - newState.typeLocators = new SimpleLookupTable(length = in.readInt()); - for (int i = 0; i < length; i++) - newState.typeLocators.put(in.readUTF(), internedTypeLocators[in.readInt()]); - - char[][] internedSimpleNames = ReferenceCollection.internSimpleNames(readNames(in), false); - char[][][] internedQualifiedNames = new char[length = in.readInt()][][]; - for (int i = 0; i < length; i++) { - int qLength = in.readInt(); - char[][] qName = new char[qLength][]; - for (int j = 0; j < qLength; j++) - qName[j] = internedSimpleNames[in.readInt()]; - internedQualifiedNames[i] = qName; - } - internedQualifiedNames = ReferenceCollection.internQualifiedNames(internedQualifiedNames); - - newState.references = new SimpleLookupTable(length = in.readInt()); - for (int i = 0; i < length; i++) { - String typeLocator = internedTypeLocators[in.readInt()]; - ReferenceCollection collection = null; - switch (in.readByte()) { - case 1 : - char[][] additionalTypeNames = readNames(in); - char[][][] qualifiedNames = new char[in.readInt()][][]; - for (int j = 0, m = qualifiedNames.length; j < m; j++) - qualifiedNames[j] = internedQualifiedNames[in.readInt()]; - char[][] simpleNames = new char[in.readInt()][]; - for (int j = 0, m = simpleNames.length; j < m; j++) - simpleNames[j] = internedSimpleNames[in.readInt()]; - collection = new AdditionalTypeCollection(additionalTypeNames, qualifiedNames, simpleNames); - break; - case 2 : - char[][][] qNames = new char[in.readInt()][][]; - for (int j = 0, m = qNames.length; j < m; j++) - qNames[j] = internedQualifiedNames[in.readInt()]; - char[][] sNames = new char[in.readInt()][]; - for (int j = 0, m = sNames.length; j < m; j++) - sNames[j] = internedSimpleNames[in.readInt()]; - collection = new ReferenceCollection(qNames, sNames); - } - newState.references.put(typeLocator, collection); - } +// String[] internedTypeLocators = new String[length = in.readInt()]; +// for (int i = 0; i < length; i++) +// internedTypeLocators[i] = in.readUTF(); + +// newState.typeLocators = new SimpleLookupTable(length = in.readInt()); +// for (int i = 0; i < length; i++) +// newState.typeLocators.put(in.readUTF(), internedTypeLocators[in.readInt()]); + +// char[][] internedSimpleNames = ReferenceCollection.internSimpleNames(readNames(in), false); +// char[][][] internedQualifiedNames = new char[length = in.readInt()][][]; +// for (int i = 0; i < length; i++) { +// int qLength = in.readInt(); +// char[][] qName = new char[qLength][]; +// for (int j = 0; j < qLength; j++) +// qName[j] = internedSimpleNames[in.readInt()]; +// internedQualifiedNames[i] = qName; +// } +// internedQualifiedNames = ReferenceCollection.internQualifiedNames(internedQualifiedNames); +// +// newState.references = new SimpleLookupTable(length = in.readInt()); +// for (int i = 0; i < length; i++) { +// String typeLocator = internedTypeLocators[in.readInt()]; +// ReferenceCollection collection = null; +// switch (in.readByte()) { +// case 1 : +// char[][] additionalTypeNames = readNames(in); +// char[][][] qualifiedNames = new char[in.readInt()][][]; +// for (int j = 0, m = qualifiedNames.length; j < m; j++) +// qualifiedNames[j] = internedQualifiedNames[in.readInt()]; +// char[][] simpleNames = new char[in.readInt()][]; +// for (int j = 0, m = simpleNames.length; j < m; j++) +// simpleNames[j] = internedSimpleNames[in.readInt()]; +// collection = new AdditionalTypeCollection(additionalTypeNames, qualifiedNames, simpleNames); +// break; +// case 2 : +// char[][][] qNames = new char[in.readInt()][][]; +// for (int j = 0, m = qNames.length; j < m; j++) +// qNames[j] = internedQualifiedNames[in.readInt()]; +// char[][] sNames = new char[in.readInt()][]; +// for (int j = 0, m = sNames.length; j < m; j++) +// sNames[j] = internedSimpleNames[in.readInt()]; +// collection = new ReferenceCollection(qNames, sNames); +// } +// newState.references.put(typeLocator, collection); +// } if (PHPBuilder.DEBUG) System.out.println("Successfully read state for " + newState.javaProjectName); //$NON-NLS-1$ return newState; @@ -338,14 +339,14 @@ public class State { /* * ClasspathMultiDirectory[] int id String path(s) */ - out.writeInt(length = sourceLocations.length); - for (int i = 0; i < length; i++) { - ClasspathMultiDirectory md = sourceLocations[i]; - out.writeUTF(md.sourceFolder.getProjectRelativePath().toString()); - out.writeUTF(md.binaryFolder.getProjectRelativePath().toString()); - writeNames(md.exclusionPatterns, out); - out.writeBoolean(md.hasIndependentOutputFolder); - } +// out.writeInt(length = sourceLocations.length); +// for (int i = 0; i < length; i++) { +// ClasspathMultiDirectory md = sourceLocations[i]; +// out.writeUTF(md.sourceFolder.getProjectRelativePath().toString()); +// out.writeUTF(md.binaryFolder.getProjectRelativePath().toString()); +// writeNames(md.exclusionPatterns, out); +// out.writeBoolean(md.hasIndependentOutputFolder); +// } /* * ClasspathLocation[] int id String path(s) @@ -399,115 +400,115 @@ public class State { /* * String[] Interned type locators */ - out.writeInt(length = references.elementSize); - ArrayList internedTypeLocators = new ArrayList(length); - if (length > 0) { - keyTable = references.keyTable; - for (int i = 0, l = keyTable.length; i < l; i++) { - if (keyTable[i] != null) { - length--; - String key = (String) keyTable[i]; - out.writeUTF(key); - internedTypeLocators.add(key); - } - } - if (PHPBuilder.DEBUG && length != 0) - System.out.println("references table is inconsistent"); //$NON-NLS-1$ - } +// out.writeInt(length = references.elementSize); +// ArrayList internedTypeLocators = new ArrayList(length); +// if (length > 0) { +// keyTable = references.keyTable; +// for (int i = 0, l = keyTable.length; i < l; i++) { +// if (keyTable[i] != null) { +// length--; +// String key = (String) keyTable[i]; +// out.writeUTF(key); +// internedTypeLocators.add(key); +// } +// } +// if (PHPBuilder.DEBUG && length != 0) +// System.out.println("references table is inconsistent"); //$NON-NLS-1$ +// } /* * Type locators table String type name int interned locator id */ - out.writeInt(length = typeLocators.elementSize); - if (length > 0) { - keyTable = typeLocators.keyTable; - valueTable = typeLocators.valueTable; - for (int i = 0, l = keyTable.length; i < l; i++) { - if (keyTable[i] != null) { - length--; - out.writeUTF((String) keyTable[i]); - out.writeInt(internedTypeLocators.indexOf((String) valueTable[i])); - } - } - if (PHPBuilder.DEBUG && length != 0) - System.out.println("typeLocators table is inconsistent"); //$NON-NLS-1$ - } +// out.writeInt(length = typeLocators.elementSize); +// if (length > 0) { +// keyTable = typeLocators.keyTable; +// valueTable = typeLocators.valueTable; +// for (int i = 0, l = keyTable.length; i < l; i++) { +// if (keyTable[i] != null) { +// length--; +// out.writeUTF((String) keyTable[i]); +// out.writeInt(internedTypeLocators.indexOf((String) valueTable[i])); +// } +// } +// if (PHPBuilder.DEBUG && length != 0) +// System.out.println("typeLocators table is inconsistent"); //$NON-NLS-1$ +// } /* * char[][][] Interned qualified names char[][] Interned simple names */ - ArrayList internedQualifiedNames = new ArrayList(31); - ArrayList internedSimpleNames = new ArrayList(31); - valueTable = references.valueTable; - for (int i = 0, l = valueTable.length; i < l; i++) { - if (valueTable[i] != null) { - ReferenceCollection collection = (ReferenceCollection) valueTable[i]; - char[][][] qNames = collection.qualifiedNameReferences; - for (int j = 0, m = qNames.length; j < m; j++) { - char[][] qName = qNames[j]; - if (!internedQualifiedNames.contains(qName)) { // remember the names have been interned - internedQualifiedNames.add(qName); - for (int k = 0, n = qName.length; k < n; k++) { - char[] sName = qName[k]; - if (!internedSimpleNames.contains(sName)) // remember the names have been interned - internedSimpleNames.add(sName); - } - } - } - char[][] sNames = collection.simpleNameReferences; - for (int j = 0, m = sNames.length; j < m; j++) { - char[] sName = sNames[j]; - if (!internedSimpleNames.contains(sName)) // remember the names have been interned - internedSimpleNames.add(sName); - } - } - } - char[][] internedArray = new char[internedSimpleNames.size()][]; - internedSimpleNames.toArray(internedArray); - writeNames(internedArray, out); - // now write the interned qualified names as arrays of interned simple names - out.writeInt(length = internedQualifiedNames.size()); - for (int i = 0; i < length; i++) { - char[][] qName = (char[][]) internedQualifiedNames.get(i); - int qLength = qName.length; - out.writeInt(qLength); - for (int j = 0; j < qLength; j++) - out.writeInt(internedSimpleNames.indexOf(qName[j])); - } - - /* - * References table int interned locator id ReferenceCollection - */ - out.writeInt(length = references.elementSize); - if (length > 0) { - keyTable = references.keyTable; - for (int i = 0, l = keyTable.length; i < l; i++) { - if (keyTable[i] != null) { - length--; - out.writeInt(internedTypeLocators.indexOf((String) keyTable[i])); - ReferenceCollection collection = (ReferenceCollection) valueTable[i]; - if (collection instanceof AdditionalTypeCollection) { - out.writeByte(1); - AdditionalTypeCollection atc = (AdditionalTypeCollection) collection; - writeNames(atc.definedTypeNames, out); - } else { - out.writeByte(2); - } - char[][][] qNames = collection.qualifiedNameReferences; - int qLength = qNames.length; - out.writeInt(qLength); - for (int j = 0; j < qLength; j++) - out.writeInt(internedQualifiedNames.indexOf(qNames[j])); - char[][] sNames = collection.simpleNameReferences; - int sLength = sNames.length; - out.writeInt(sLength); - for (int j = 0; j < sLength; j++) - out.writeInt(internedSimpleNames.indexOf(sNames[j])); - } - } - if (PHPBuilder.DEBUG && length != 0) - System.out.println("references table is inconsistent"); //$NON-NLS-1$ - } +// ArrayList internedQualifiedNames = new ArrayList(31); +// ArrayList internedSimpleNames = new ArrayList(31); +// valueTable = references.valueTable; +// for (int i = 0, l = valueTable.length; i < l; i++) { +// if (valueTable[i] != null) { +// ReferenceCollection collection = (ReferenceCollection) valueTable[i]; +// char[][][] qNames = collection.qualifiedNameReferences; +// for (int j = 0, m = qNames.length; j < m; j++) { +// char[][] qName = qNames[j]; +// if (!internedQualifiedNames.contains(qName)) { // remember the names have been interned +// internedQualifiedNames.add(qName); +// for (int k = 0, n = qName.length; k < n; k++) { +// char[] sName = qName[k]; +// if (!internedSimpleNames.contains(sName)) // remember the names have been interned +// internedSimpleNames.add(sName); +// } +// } +// } +// char[][] sNames = collection.simpleNameReferences; +// for (int j = 0, m = sNames.length; j < m; j++) { +// char[] sName = sNames[j]; +// if (!internedSimpleNames.contains(sName)) // remember the names have been interned +// internedSimpleNames.add(sName); +// } +// } +// } +// char[][] internedArray = new char[internedSimpleNames.size()][]; +// internedSimpleNames.toArray(internedArray); +// writeNames(internedArray, out); +// // now write the interned qualified names as arrays of interned simple names +// out.writeInt(length = internedQualifiedNames.size()); +// for (int i = 0; i < length; i++) { +// char[][] qName = (char[][]) internedQualifiedNames.get(i); +// int qLength = qName.length; +// out.writeInt(qLength); +// for (int j = 0; j < qLength; j++) +// out.writeInt(internedSimpleNames.indexOf(qName[j])); +// } +// +// /* +// * References table int interned locator id ReferenceCollection +// */ +// out.writeInt(length = references.elementSize); +// if (length > 0) { +// keyTable = references.keyTable; +// for (int i = 0, l = keyTable.length; i < l; i++) { +// if (keyTable[i] != null) { +// length--; +// out.writeInt(internedTypeLocators.indexOf((String) keyTable[i])); +// ReferenceCollection collection = (ReferenceCollection) valueTable[i]; +// if (collection instanceof AdditionalTypeCollection) { +// out.writeByte(1); +// AdditionalTypeCollection atc = (AdditionalTypeCollection) collection; +// writeNames(atc.definedTypeNames, out); +// } else { +// out.writeByte(2); +// } +// char[][][] qNames = collection.qualifiedNameReferences; +// int qLength = qNames.length; +// out.writeInt(qLength); +// for (int j = 0; j < qLength; j++) +// out.writeInt(internedQualifiedNames.indexOf(qNames[j])); +// char[][] sNames = collection.simpleNameReferences; +// int sLength = sNames.length; +// out.writeInt(sLength); +// for (int j = 0; j < sLength; j++) +// out.writeInt(internedSimpleNames.indexOf(sNames[j])); +// } +// } +// if (PHPBuilder.DEBUG && length != 0) +// System.out.println("references table is inconsistent"); //$NON-NLS-1$ +// } } private void writeNames(char[][] names, DataOutputStream out) throws IOException { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/DOMBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/DOMBuilder.java index f1faf41..0ee24f0 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/DOMBuilder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/DOMBuilder.java @@ -13,6 +13,7 @@ package net.sourceforge.phpdt.internal.core.jdom; import java.util.ArrayList; import java.util.Map; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.compiler.IProblem; import net.sourceforge.phpdt.core.jdom.IDOMCompilationUnit; import net.sourceforge.phpdt.core.jdom.IDOMField; @@ -27,7 +28,6 @@ import net.sourceforge.phpdt.internal.compiler.IDocumentElementRequestor; import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit; import net.sourceforge.phpdt.internal.compiler.problem.DefaultProblemFactory; import net.sourceforge.phpdt.internal.core.util.CharArrayOps; -import net.sourceforge.phpeclipse.PHPCore; /** * The DOMBuilder constructs each type of JDOM document fragment, @@ -56,7 +56,7 @@ public class DOMBuilder extends AbstractDOMBuilder implements IDocumentElementRe */ protected ArrayList fFields; - Map options = PHPCore.getOptions(); + Map options = JavaCore.getOptions(); /** * Creates a new DOMBuilder diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/SimpleDOMBuilder.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/SimpleDOMBuilder.java index c923015..df63d2c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/SimpleDOMBuilder.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/jdom/SimpleDOMBuilder.java @@ -12,13 +12,13 @@ package net.sourceforge.phpdt.internal.core.jdom; import java.util.Map; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.jdom.IDOMCompilationUnit; import net.sourceforge.phpdt.internal.compiler.ISourceElementRequestor; import net.sourceforge.phpdt.internal.compiler.SourceElementParser; import net.sourceforge.phpdt.internal.compiler.env.ICompilationUnit; import net.sourceforge.phpdt.internal.compiler.problem.DefaultProblemFactory; import net.sourceforge.phpdt.internal.core.util.CharArrayOps; -import net.sourceforge.phpeclipse.PHPCore; /** * A DOM builder that uses the SourceElementParser @@ -51,7 +51,7 @@ public IDOMCompilationUnit createCompilationUnit(String sourceCode, String name) */ public IDOMCompilationUnit createCompilationUnit(ICompilationUnit compilationUnit) { initializeBuild(compilationUnit.getContents(), true, true); - getParser(PHPCore.getOptions()).parseCompilationUnit(compilationUnit, false); + getParser(JavaCore.getOptions()).parseCompilationUnit(compilationUnit, false); return super.createCompilationUnit(compilationUnit); } /** diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/WorkbenchRunnableAdapter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/WorkbenchRunnableAdapter.java index 7c4ae96..a062bba 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/WorkbenchRunnableAdapter.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/actions/WorkbenchRunnableAdapter.java @@ -12,7 +12,7 @@ package net.sourceforge.phpdt.internal.ui.actions; import java.lang.reflect.InvocationTargetException; -import net.sourceforge.phpeclipse.PHPCore; +import net.sourceforge.phpdt.core.JavaCore; import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.runtime.CoreException; @@ -39,7 +39,7 @@ public class WorkbenchRunnableAdapter implements IRunnableWithProgress { */ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { - PHPCore.run(fWorkspaceRunnable, monitor); + JavaCore.run(fWorkspaceRunnable, monitor); } catch (OperationCanceledException e) { throw new InterruptedException(e.getMessage()); } catch (CoreException e) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java index 2f7e150..ab22fb0 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/CodeFormatterPreferencePage.java @@ -11,12 +11,12 @@ import java.util.ArrayList; import java.util.Hashtable; import net.sourceforge.phpdt.core.ICodeFormatter; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.ToolFactory; import net.sourceforge.phpdt.internal.ui.PHPUIMessages; import net.sourceforge.phpdt.internal.ui.dialog.StatusInfo; import net.sourceforge.phpdt.internal.ui.dialog.StatusUtil; import net.sourceforge.phpdt.internal.ui.util.TabFolderLayout; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.runtime.IStatus; @@ -46,28 +46,28 @@ import org.eclipse.ui.IWorkbenchPreferencePage; public class CodeFormatterPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { // Preference store keys, see PHPCore.getOptions - private static final String PREF_NEWLINE_OPENING_BRACES= PHPCore.FORMATTER_NEWLINE_OPENING_BRACE; - private static final String PREF_NEWLINE_CONTROL_STATEMENT= PHPCore.FORMATTER_NEWLINE_CONTROL; - private static final String PREF_NEWLINE_CLEAR_ALL= PHPCore.FORMATTER_CLEAR_BLANK_LINES; + private static final String PREF_NEWLINE_OPENING_BRACES= JavaCore.FORMATTER_NEWLINE_OPENING_BRACE; + private static final String PREF_NEWLINE_CONTROL_STATEMENT= JavaCore.FORMATTER_NEWLINE_CONTROL; + private static final String PREF_NEWLINE_CLEAR_ALL= JavaCore.FORMATTER_CLEAR_BLANK_LINES; // private static final String PREF_NEWLINE_ELSE_IF= PHPCore.FORMATTER_NEWLINE_ELSE_IF; - private static final String PREF_NEWLINE_EMPTY_BLOCK= PHPCore.FORMATTER_NEWLINE_EMPTY_BLOCK; - private static final String PREF_LINE_SPLIT= PHPCore.FORMATTER_LINE_SPLIT; - private static final String PREF_STYLE_COMPACT_ASSIGNEMENT= PHPCore.FORMATTER_COMPACT_ASSIGNMENT; - private static final String PREF_TAB_CHAR= PHPCore.FORMATTER_TAB_CHAR; - private static final String PREF_TAB_SIZE= PHPCore.FORMATTER_TAB_SIZE; + private static final String PREF_NEWLINE_EMPTY_BLOCK= JavaCore.FORMATTER_NEWLINE_EMPTY_BLOCK; + private static final String PREF_LINE_SPLIT= JavaCore.FORMATTER_LINE_SPLIT; + private static final String PREF_STYLE_COMPACT_ASSIGNEMENT= JavaCore.FORMATTER_COMPACT_ASSIGNMENT; + private static final String PREF_TAB_CHAR= JavaCore.FORMATTER_TAB_CHAR; + private static final String PREF_TAB_SIZE= JavaCore.FORMATTER_TAB_SIZE; // values - private static final String INSERT= PHPCore.INSERT; - private static final String DO_NOT_INSERT= PHPCore.DO_NOT_INSERT; + private static final String INSERT= JavaCore.INSERT; + private static final String DO_NOT_INSERT= JavaCore.DO_NOT_INSERT; - private static final String COMPACT= PHPCore.COMPACT; - private static final String NORMAL= PHPCore.NORMAL; + private static final String COMPACT= JavaCore.COMPACT; + private static final String NORMAL= JavaCore.NORMAL; - private static final String TAB= PHPCore.TAB; - private static final String SPACE= PHPCore.SPACE; + private static final String TAB= JavaCore.TAB; + private static final String SPACE= JavaCore.SPACE; - private static final String CLEAR_ALL= PHPCore.CLEAR_ALL; - private static final String PRESERVE_ONE= PHPCore.PRESERVE_ONE; + private static final String CLEAR_ALL= JavaCore.CLEAR_ALL; + private static final String PRESERVE_ONE= JavaCore.PRESERVE_ONE; private static String[] getAllKeys() { @@ -84,7 +84,7 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork * @deprecated Inline to avoid reference to preference page */ public static int getTabSize() { - String string= (String) PHPCore.getOptions().get(PREF_TAB_SIZE); + String string= (String) JavaCore.getOptions().get(PREF_TAB_SIZE); return getPositiveIntValue(string, 4); } @@ -93,7 +93,7 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork * @deprecated Inline to avoid reference to preference page */ public static boolean isCompactingAssignment() { - return COMPACT.equals(PHPCore.getOptions().get(PREF_STYLE_COMPACT_ASSIGNEMENT)); + return COMPACT.equals(JavaCore.getOptions().get(PREF_STYLE_COMPACT_ASSIGNEMENT)); } /** @@ -101,7 +101,7 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork * @deprecated Inline to avoid reference to preference page */ public static boolean useSpaces() { - return SPACE.equals(PHPCore.getOptions().get(PREF_TAB_CHAR)); + return SPACE.equals(JavaCore.getOptions().get(PREF_TAB_CHAR)); } @@ -167,7 +167,7 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore()); setDescription(PHPUIMessages.getString("CodeFormatterPreferencePage.description")); //$NON-NLS-1$ - fWorkingValues= PHPCore.getOptions(); + fWorkingValues= JavaCore.getOptions(); fCheckBoxes= new ArrayList(); fTextBoxes= new ArrayList(); @@ -385,13 +385,13 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork String[] allKeys= getAllKeys(); // preserve other options // store in JCore - Hashtable actualOptions= PHPCore.getOptions(); + Hashtable actualOptions= JavaCore.getOptions(); for (int i= 0; i < allKeys.length; i++) { String key= allKeys[i]; String val= (String) fWorkingValues.get(key); actualOptions.put(key, val); } - PHPCore.setOptions(actualOptions); + JavaCore.setOptions(actualOptions); PHPeclipsePlugin.getDefault().savePluginPreferences(); return super.performOk(); } @@ -400,7 +400,7 @@ public class CodeFormatterPreferencePage extends PreferencePage implements IWork * @see PreferencePage#performDefaults() */ protected void performDefaults() { - fWorkingValues= PHPCore.getDefaultOptions(); + fWorkingValues= JavaCore.getDefaultOptions(); updateControls(); super.performDefaults(); } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PHPEditorPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PHPEditorPreferencePage.java index 641374d..c273cfe 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PHPEditorPreferencePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/PHPEditorPreferencePage.java @@ -19,6 +19,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.PHPUIMessages; import net.sourceforge.phpdt.internal.ui.dialog.StatusInfo; import net.sourceforge.phpdt.internal.ui.dialog.StatusUtil; @@ -26,7 +27,6 @@ import net.sourceforge.phpdt.internal.ui.util.TabFolderLayout; import net.sourceforge.phpdt.ui.PreferenceConstants; import net.sourceforge.phpdt.ui.text.JavaTextTools; import net.sourceforge.phpeclipse.IPreferenceConstants; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.phpeditor.PHPSourceViewerConfiguration; import net.sourceforge.phpeclipse.preferences.ColorEditor; @@ -76,7 +76,7 @@ import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor; public class PHPEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { private static final String BOLD = PreferenceConstants.EDITOR_BOLD_SUFFIX; - private static final String COMPILER_TASK_TAGS = PHPCore.COMPILER_TASK_TAGS; + private static final String COMPILER_TASK_TAGS = JavaCore.COMPILER_TASK_TAGS; public final OverlayPreferenceStore.OverlayKey[] fKeys = new OverlayPreferenceStore.OverlayKey[] { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPProjectSelector.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPProjectSelector.java index 6199901..c52aeb5 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPProjectSelector.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPProjectSelector.java @@ -1,7 +1,7 @@ package net.sourceforge.phpdt.internal.ui.util; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.dialog.ElementListSelectionDialog; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IProject; @@ -28,7 +28,7 @@ public class PHPProjectSelector extends ResourceSelector { ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new WorkbenchLabelProvider()); dialog.setTitle(browseDialogTitle); dialog.setMessage(browseDialogMessage); - dialog.setElements(PHPCore.getPHPProjects()); + dialog.setElements(JavaCore.getPHPProjects()); if (dialog.open() == ElementListSelectionDialog.OK) { textField.setText(((IProject) dialog.getFirstResult()).getName()); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/JavaUI.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/JavaUI.java index 23ff50e..3120edf 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/JavaUI.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/JavaUI.java @@ -14,7 +14,7 @@ import net.sourceforge.phpdt.core.IBufferFactory; import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.IWorkingCopy; import net.sourceforge.phpdt.core.JavaModelException; -import net.sourceforge.phpeclipse.PHPCore; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.phpeditor.EditorUtility; import net.sourceforge.phpeclipse.phpeditor.PHPDocumentProvider; @@ -556,7 +556,7 @@ public final class JavaUI { * @since 2.0 */ public static IWorkingCopy[] getSharedWorkingCopies() { - return PHPCore.getSharedWorkingCopies(getBufferFactory()); + return JavaCore.getSharedWorkingCopies(getBufferFactory()); } /** diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/StandardJavaElementContentProvider.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/StandardJavaElementContentProvider.java index 21b7dc1..7f1d21b 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/StandardJavaElementContentProvider.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/StandardJavaElementContentProvider.java @@ -23,8 +23,8 @@ import net.sourceforge.phpdt.core.IPackageFragmentRoot; import net.sourceforge.phpdt.core.IParent; import net.sourceforge.phpdt.core.ISourceReference; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.corext.util.JavaModelUtil; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; @@ -318,7 +318,7 @@ public class StandardJavaElementContentProvider implements ITreeContentProvider, // Included is a member of excluded, but since it is rendered as a source // folder we have to exclude it as a normal child. if (o instanceof IFolder) { - IJavaElement element= PHPCore.create((IFolder)o); + IJavaElement element= JavaCore.create((IFolder)o); if (element instanceof IPackageFragmentRoot && element.exists()) { continue; } @@ -408,7 +408,7 @@ public class StandardJavaElementContentProvider implements ITreeContentProvider, // try to map resources to the containing package fragment if (element instanceof IResource) { IResource parent= ((IResource)element).getParent(); - IJavaElement jParent= PHPCore.create(parent); + IJavaElement jParent= JavaCore.create(parent); // http://bugs.eclipse.org/bugs/show_bug.cgi?id=31374 if (jParent != null && jParent.exists()) return jParent; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/wizards/NewContainerWizardPage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/wizards/NewContainerWizardPage.java index 7dddc0f..735c2a7 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/wizards/NewContainerWizardPage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/wizards/NewContainerWizardPage.java @@ -14,6 +14,7 @@ import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.IJavaProject; import net.sourceforge.phpdt.core.IPackageFragmentRoot; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.externaltools.internal.ui.StatusInfo; import net.sourceforge.phpdt.internal.ui.viewsupport.IViewPartInputProvider; import net.sourceforge.phpdt.internal.ui.wizards.NewWizardMessages; @@ -22,7 +23,6 @@ import net.sourceforge.phpdt.internal.ui.wizards.dialogfields.IDialogFieldListen import net.sourceforge.phpdt.internal.ui.wizards.dialogfields.IStringButtonAdapter; import net.sourceforge.phpdt.internal.ui.wizards.dialogfields.LayoutUtil; import net.sourceforge.phpdt.internal.ui.wizards.dialogfields.StringButtonDialogField; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IProject; @@ -141,7 +141,7 @@ public abstract class NewContainerWizardPage extends NewElementWizardPage { jelem= (IJavaElement) resource.getAdapter(IJavaElement.class); } if (jelem == null) { - jelem= PHPCore.create(resource); // java project + jelem= JavaCore.create(resource); // java project } } } @@ -163,7 +163,7 @@ public abstract class NewContainerWizardPage extends NewElementWizardPage { if (jelem == null || jelem.getElementType() == IJavaElement.JAVA_MODEL) { try { - IJavaProject[] projects= PHPCore.create(getWorkspaceRoot()).getJavaProjects(); + IJavaProject[] projects= JavaCore.create(getWorkspaceRoot()).getJavaProjects(); if (projects.length == 1) { jelem= projects[0]; } @@ -270,7 +270,7 @@ public abstract class NewContainerWizardPage extends NewElementWizardPage { status.setError(NewWizardMessages.getFormattedString("NewContainerWizardPage.error.ProjectClosed", proj.getFullPath().toString())); //$NON-NLS-1$ return status; } - IJavaProject jproject= PHPCore.create(proj); + IJavaProject jproject= JavaCore.create(proj); // fCurrRoot= jproject.getPackageFragmentRoot(res); // if (res.exists()) { // try { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPCore.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPCore.java deleted file mode 100644 index aff160f..0000000 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPCore.java +++ /dev/null @@ -1,3780 +0,0 @@ -package net.sourceforge.phpeclipse; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; - -import net.sourceforge.phpdt.core.ClasspathVariableInitializer; -import net.sourceforge.phpdt.core.ElementChangedEvent; -import net.sourceforge.phpdt.core.IBufferFactory; -import net.sourceforge.phpdt.core.IClasspathEntry; -import net.sourceforge.phpdt.core.ICompilationUnit; -import net.sourceforge.phpdt.core.IElementChangedListener; -import net.sourceforge.phpdt.core.IJavaElement; -import net.sourceforge.phpdt.core.IJavaModel; -import net.sourceforge.phpdt.core.IJavaProject; -import net.sourceforge.phpdt.core.IMember; -import net.sourceforge.phpdt.core.IPackageFragmentRoot; -import net.sourceforge.phpdt.core.IRegion; -import net.sourceforge.phpdt.core.IWorkingCopy; -import net.sourceforge.phpdt.core.JavaModelException; -import net.sourceforge.phpdt.internal.core.BatchOperation; -import net.sourceforge.phpdt.internal.core.BufferManager; -import net.sourceforge.phpdt.internal.core.ClasspathEntry; -import net.sourceforge.phpdt.internal.core.JavaModel; -import net.sourceforge.phpdt.internal.core.JavaModelManager; -import net.sourceforge.phpdt.internal.core.Region; -import net.sourceforge.phpdt.internal.corext.Assert; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IMarkerDelta; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Preferences; - -public class PHPCore { - -// public static HashSet OptionNames = new HashSet(20); - /** - * The plug-in identifier of the Java core support - * (value "org.phpeclipse.phpdt.core"). - */ -// public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.core"; //$NON-NLS-1$ - public static final String PLUGIN_ID = PHPeclipsePlugin.PLUGIN_ID; - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CORE_ENCODING = PLUGIN_ID + ".encoding"; //$NON-NLS-1$ - - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_NEWLINE_OPENING_BRACE = PLUGIN_ID + ".formatter.newline.openingBrace"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_NEWLINE_CONTROL = PLUGIN_ID + ".formatter.newline.controlStatement"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_NEWLINE_ELSE_IF = PLUGIN_ID + ".formatter.newline.elseIf"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_NEWLINE_EMPTY_BLOCK = PLUGIN_ID + ".formatter.newline.emptyBlock"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_CLEAR_BLANK_LINES = PLUGIN_ID + ".formatter.newline.clearAll"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_LINE_SPLIT = PLUGIN_ID + ".formatter.lineSplit"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_COMPACT_ASSIGNMENT = PLUGIN_ID + ".formatter.style.assignment"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_TAB_CHAR = PLUGIN_ID + ".formatter.tabulation.char"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String FORMATTER_TAB_SIZE = PLUGIN_ID + ".formatter.tabulation.size"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String INSERT = "insert"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String DO_NOT_INSERT = "do not insert"; //$NON-NLS-1$ - - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String PRESERVE_ONE = "preserve one"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CLEAR_ALL = "clear all"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String NORMAL = "normal"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPACT = "compact"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String TAB = "tab"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String SPACE = "space"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String ENABLED = "enabled"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String DISABLED = "disabled"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CLEAN = "clean"; //$NON-NLS-1$ - - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_TAGS = PLUGIN_ID + ".compiler.taskTags"; //$NON-NLS-1$ - - /** - * Name of the handle id attribute in a Java marker. - */ - protected static final String ATT_HANDLE_ID = - "net.sourceforge.phpdt.internal.core.JavaModelManager.handleId" ; //$NON-NLS-1$ - - // *************** Possible IDs for configurable options. ******************** - - /** - * Possible configurable option ID. - * @see #getDefaultOptions() - */ - public static final String COMPILER_LOCAL_VARIABLE_ATTR = PLUGIN_ID + ".compiler.debug.localVariable"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions() - */ - public static final String COMPILER_LINE_NUMBER_ATTR = PLUGIN_ID + ".compiler.debug.lineNumber"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_SOURCE_FILE_ATTR = PLUGIN_ID + ".compiler.debug.sourceFile"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_CODEGEN_UNUSED_LOCAL = PLUGIN_ID + ".compiler.codegen.unusedLocal"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_CODEGEN_TARGET_PLATFORM = PLUGIN_ID + ".compiler.codegen.targetPlatform"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_UNREACHABLE_CODE = PLUGIN_ID + ".compiler.problem.unreachableCode"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_INVALID_IMPORT = PLUGIN_ID + ".compiler.problem.invalidImport"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD = PLUGIN_ID + ".compiler.problem.overridingPackageDefaultMethod"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME = PLUGIN_ID + ".compiler.problem.methodWithConstructorName"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_DEPRECATION = PLUGIN_ID + ".compiler.problem.deprecation"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE = PLUGIN_ID + ".compiler.problem.deprecationInDeprecatedCode"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_HIDDEN_CATCH_BLOCK = PLUGIN_ID + ".compiler.problem.hiddenCatchBlock"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_UNUSED_LOCAL = PLUGIN_ID + ".compiler.problem.unusedLocal"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_UNUSED_PARAMETER = PLUGIN_ID + ".compiler.problem.unusedParameter"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT = PLUGIN_ID + ".compiler.problem.unusedParameterWhenImplementingAbstract"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE = PLUGIN_ID + ".compiler.problem.unusedParameterWhenOverridingConcrete"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_PB_UNUSED_IMPORT = PLUGIN_ID + ".compiler.problem.unusedImport"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String COMPILER_PB_SYNTHETIC_ACCESS_EMULATION = PLUGIN_ID + ".compiler.problem.syntheticAccessEmulation"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_PB_NON_NLS_STRING_LITERAL = PLUGIN_ID + ".compiler.problem.nonExternalizedStringLiteral"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_PB_ASSERT_IDENTIFIER = PLUGIN_ID + ".compiler.problem.assertIdentifier"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_STATIC_ACCESS_RECEIVER = PLUGIN_ID + ".compiler.problem.staticAccessReceiver"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_NO_EFFECT_ASSIGNMENT = PLUGIN_ID + ".compiler.problem.noEffectAssignment"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD = PLUGIN_ID + ".compiler.problem.incompatibleNonInheritedInterfaceMethod"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_UNUSED_PRIVATE_MEMBER = PLUGIN_ID + ".compiler.problem.unusedPrivateMember"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION = PLUGIN_ID + ".compiler.problem.noImplicitStringConversion"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_PB_MAX_PER_UNIT = PLUGIN_ID + ".compiler.maxProblemPerUnit"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_SOURCE = PLUGIN_ID + ".compiler.source"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String COMPILER_COMPLIANCE = PLUGIN_ID + ".compiler.compliance"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_PRIORITIES = PLUGIN_ID + ".compiler.taskPriorities"; //$NON-NLS-1$ - /** - * Possible configurable option value for COMPILER_TASK_PRIORITIES. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_PRIORITY_HIGH = "HIGH"; //$NON-NLS-1$ - /** - * Possible configurable option value for COMPILER_TASK_PRIORITIES. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_PRIORITY_LOW = "LOW"; //$NON-NLS-1$ - /** - * Possible configurable option value for COMPILER_TASK_PRIORITIES. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String COMPILER_TASK_PRIORITY_NORMAL = "NORMAL"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - */ - public static final String CORE_JAVA_BUILD_ORDER = PLUGIN_ID + ".computeJavaBuildOrder"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CORE_JAVA_BUILD_RESOURCE_COPY_FILTER = PLUGIN_ID + ".builder.resourceCopyExclusionFilter"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_JAVA_BUILD_DUPLICATE_RESOURCE = PLUGIN_ID + ".builder.duplicateResourceTask"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER = PLUGIN_ID + ".builder.cleanOutputFolder"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_INCOMPLETE_CLASSPATH = PLUGIN_ID + ".incompleteClasspath"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_CIRCULAR_CLASSPATH = PLUGIN_ID + ".circularClasspath"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CORE_JAVA_BUILD_INVALID_CLASSPATH = PLUGIN_ID + ".builder.invalidClasspath"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS = PLUGIN_ID + ".classpath.exclusionPatterns"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS = PLUGIN_ID + ".classpath.multipleOutputLocations"; //$NON-NLS-1$ - /** - * Default task tag - * @since 2.1 - */ - public static final String DEFAULT_TASK_TAG = "TODO"; //$NON-NLS-1$ - /** - * Default task priority - * @since 2.1 - */ - public static final String DEFAULT_TASK_PRIORITY = "NORMAL"; //$NON-NLS-1$ - /** - * Possible configurable option ID - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String FORMATTER_SPACE_CASTEXPRESSION = PLUGIN_ID + ".formatter.space.castexpression"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CODEASSIST_VISIBILITY_CHECK = PLUGIN_ID + ".codeComplete.visibilityCheck"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String CODEASSIST_IMPLICIT_QUALIFICATION = PLUGIN_ID + ".codeComplete.forceImplicitQualification"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_FIELD_PREFIXES = PLUGIN_ID + ".codeComplete.fieldPrefixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_STATIC_FIELD_PREFIXES = PLUGIN_ID + ".codeComplete.staticFieldPrefixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_LOCAL_PREFIXES = PLUGIN_ID + ".codeComplete.localPrefixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_ARGUMENT_PREFIXES = PLUGIN_ID + ".codeComplete.argumentPrefixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_FIELD_SUFFIXES = PLUGIN_ID + ".codeComplete.fieldSuffixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_STATIC_FIELD_SUFFIXES = PLUGIN_ID + ".codeComplete.staticFieldSuffixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_LOCAL_SUFFIXES = PLUGIN_ID + ".codeComplete.localSuffixes"; //$NON-NLS-1$ - /** - * Possible configurable option ID. - * @see #getDefaultOptions - * @since 2.1 - */ - public static final String CODEASSIST_ARGUMENT_SUFFIXES = PLUGIN_ID + ".codeComplete.argumentSuffixes"; //$NON-NLS-1$ - - // *************** Possible values for configurable options. ******************** - - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String GENERATE = "generate"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String DO_NOT_GENERATE = "do not generate"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String PRESERVE = "preserve"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String OPTIMIZE_OUT = "optimize out"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String VERSION_1_1 = "1.1"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String VERSION_1_2 = "1.2"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String VERSION_1_3 = "1.3"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String VERSION_1_4 = "1.4"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - public static final String ABORT = "abort"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String ERROR = "error"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String WARNING = "warning"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String IGNORE = "ignore"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - */ - public static final String COMPUTE = "compute"; //$NON-NLS-1$ - /** - * Possible configurable option value. - * @see #getDefaultOptions - * @since 2.0 - */ - - - /** - * Returns a table of all known configurable options with their default values. - * These options allow to configure the behaviour of the underlying components. - * The client may safely use the result as a template that they can modify and - * then pass to setOptions. - * - * Helper constants have been defined on JavaCore for each of the option ID and - * their possible constant values. - * - * Note: more options might be added in further releases. - *

-   * RECOGNIZED OPTIONS:
-   * COMPILER / Generating Local Variable Debug Attribute
-   *    When generated, this attribute will enable local variable names 
-   *    to be displayed in debugger, only in place where variables are 
-   *    definitely assigned (.class file is then bigger)
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.debug.localVariable"
-   *     - possible values:   { "generate", "do not generate" }
-   *     - default:           "generate"
-   *
-   * COMPILER / Generating Line Number Debug Attribute 
-   *    When generated, this attribute will enable source code highlighting in debugger 
-   *    (.class file is then bigger).
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.debug.lineNumber"
-   *     - possible values:   { "generate", "do not generate" }
-   *     - default:           "generate"
-   *    
-   * COMPILER / Generating Source Debug Attribute 
-   *    When generated, this attribute will enable the debugger to present the 
-   *    corresponding source code.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.debug.sourceFile"
-   *     - possible values:   { "generate", "do not generate" }
-   *     - default:           "generate"
-   *    
-   * COMPILER / Preserving Unused Local Variables
-   *    Unless requested to preserve unused local variables (i.e. never read), the 
-   *    compiler will optimize them out, potentially altering debugging
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.codegen.unusedLocal"
-   *     - possible values:   { "preserve", "optimize out" }
-   *     - default:           "preserve"
-   * 
-   * COMPILER / Defining Target Java Platform
-   *    For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
-   *    Note that "1.4" target require to toggle compliance mode to "1.4" too.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.codegen.targetPlatform"
-   *     - possible values:   { "1.1", "1.2", "1.3", "1.4" }
-   *     - default:           "1.1"
-   *
-   * COMPILER / Reporting Unreachable Code
-   *    Unreachable code can optionally be reported as an error, warning or simply 
-   *    ignored. The bytecode generation will always optimized it out.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unreachableCode"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "error"
-   *
-   * COMPILER / Reporting Invalid Import
-   *    An import statement that cannot be resolved might optionally be reported 
-   *    as an error, as a warning or ignored.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.invalidImport"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "error"
-   *
-   * COMPILER / Reporting Attempt to Override Package-Default Method
-   *    A package default method is not visible in a different package, and thus 
-   *    cannot be overridden. When enabling this option, the compiler will signal 
-   *    such scenarii either as an error or a warning.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.overridingPackageDefaultMethod"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "warning"
-   *
-   * COMPILER / Reporting Method With Constructor Name
-   *    Naming a method with a constructor name is generally considered poor 
-   *    style programming. When enabling this option, the compiler will signal such 
-   *    scenarii either as an error or a warning.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.methodWithConstructorName"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "warning"
-   *
-   * COMPILER / Reporting Deprecation
-   *    When enabled, the compiler will signal use of deprecated API either as an 
-   *    error or a warning.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.deprecation"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "warning"
-   *
-   * COMPILER / Reporting Deprecation Inside Deprecated Code
-   *    When enabled, the compiler will signal use of deprecated API inside deprecated code.
-   *    The severity of the problem is controlled with option "org.phpeclipse.phpdt.core.compiler.problem.deprecation".
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.deprecationInDeprecatedCode"
-   *     - possible values:   { "enabled", "disabled" }
-   *     - default:           "disabled"
-   *
-   * COMPILER / Reporting Hidden Catch Block
-   *    Locally to a try statement, some catch blocks may hide others , e.g.
-   *      try {  throw new java.io.CharConversionException();
-   *      } catch (java.io.CharConversionException e) {
-   *      } catch (java.io.IOException e) {}. 
-   *    When enabling this option, the compiler will issue an error or a warning for hidden 
-   *    catch blocks corresponding to checked exceptions
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.hiddenCatchBlock"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "warning"
-   *
-   * COMPILER / Reporting Unused Local
-   *    When enabled, the compiler will issue an error or a warning for unused local 
-   *    variables (i.e. variables never read from)
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unusedLocal"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "ignore"
-   *
-   * COMPILER / Reporting Unused Parameter
-   *    When enabled, the compiler will issue an error or a warning for unused method 
-   *    parameters (i.e. parameters never read from)
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unusedParameter"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "ignore"
-   *
-   * COMPILER / Reporting Unused Import
-   *    When enabled, the compiler will issue an error or a warning for unused import 
-   *    reference 
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.unusedImport"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "warning"
-   *
-   * COMPILER / Reporting Synthetic Access Emulation
-   *    When enabled, the compiler will issue an error or a warning whenever it emulates 
-   *    access to a non-accessible member of an enclosing type. Such access can have
-   *    performance implications.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.syntheticAccessEmulation"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "ignore"
-   *
-   * COMPILER / Reporting Non-Externalized String Literal
-   *    When enabled, the compiler will issue an error or a warning for non externalized 
-   *    String literal (i.e. non tagged with //$NON-NLS-$). 
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.nonExternalizedStringLiteral"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "ignore"
-   * 
-   * COMPILER / Reporting Usage of 'assert' Identifier
-   *    When enabled, the compiler will issue an error or a warning whenever 'assert' is 
-   *    used as an identifier (reserved keyword in 1.4)
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.assertIdentifier"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "ignore"
-   * 
-   * COMPILER / Reporting Usage of expression receiver on static invocation/field access
-   *    When enabled, the compiler will issue an error or a warning whenever a static field
-   *    or method is accessed with an expression receiver.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.staticAccessReceiver"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "warning"
-   * 
-   * COMPILER / Reporting Assignment with no effect
-   *    When enabled, the compiler will issue an error or a warning whenever an assignment
-   *    has no effect (e.g 'x = x').
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.problem.noEffectAssignment"
-   *     - possible values:   { "error", "warning", "ignore" }
-   *     - default:           "warning"
-   * 
-   * COMPILER / Setting Source Compatibility Mode
-   *    Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
-   *    reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
-   *   level should be set to "1.4" and the compliance mode should be "1.4".
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.source"
-   *     - possible values:   { "1.3", "1.4" }
-   *     - default:           "1.3"
-   * 
-   * COMPILER / Setting Compliance Level
-   *    Select the compliance level for the compiler. In "1.3" mode, source and target settings
-   *    should not go beyond "1.3" level.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.compliance"
-   *     - possible values:   { "1.3", "1.4" }
-   *     - default:           "1.3"
-   * 
-   * COMPILER / Maximum number of problems reported per compilation unit
-   *    Specify the maximum number of problems reported on each compilation unit.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.maxProblemPerUnit"
-   *     - possible values:	"" where  is zero or a positive integer (if zero then all problems are reported).
-   *     - default:           "100"
-   * 
-   * COMPILER / Define the Automatic Task Tags
-   *    When the tag is non empty, the compiler will issue a task marker whenever it encounters
-   *    one of the corresponding tag inside any comment in Java source code.
-   *    Generated task messages will include the tag, and range until the next line separator or comment ending, and will be trimmed.
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.taskTags"
-   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-   *     - default:           ""
-   * COMPILER / Define the Automatic Task Priorities
-   *    In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
-   *    of the task markers issued by the compiler.
-   *    If the default is specified, the priority of each task marker is "NORMAL".
-   *     - option id:         "org.phpeclipse.phpdt.core.compiler.taskPriorities"
-   *     - possible values:   { "[,]*" } where  is one of "HIGH", "NORMAL" or "LOW"
-   *     - default:           ""
-   * 
-   * BUILDER / Specifying Filters for Resource Copying Control
-   *    Allow to specify some filters to control the resource copy process.
-   *     - option id:         "org.phpeclipse.phpdt.core.builder.resourceCopyExclusionFilter"
-   *     - possible values:   { "[,]* } where  is a file name pattern (* and ? wild-cards allowed)
-   *       or the name of a folder which ends with '/'
-   *     - default:           ""
-   * 
-   * BUILDER / Abort if Invalid Classpath
-   *    Allow to toggle the builder to abort if the classpath is invalid
-   *     - option id:         "org.phpeclipse.phpdt.core.builder.invalidClasspath"
-   *     - possible values:   { "abort", "ignore" }
-   *     - default:           "ignore"
-   * 
-   * BUILDER / Cleaning Output Folder(s)
-   *    Indicate whether the JavaBuilder is allowed to clean the output folders
-   *    when performing full build operations.
-   *     - option id:         "org.phpeclipse.phpdt.core.builder.cleanOutputFolder"
-   *     - possible values:   { "clean", "ignore" }
-   *     - default:           "clean"
-   * 
-   * JAVACORE / Computing Project Build Order
-   *    Indicate whether JavaCore should enforce the project build order to be based on
-   *    the classpath prerequisite chain. When requesting to compute, this takes over
-   *    the platform default order (based on project references).
-   *     - option id:         "org.phpeclipse.phpdt.core.computeJavaBuildOrder"
-   *     - possible values:   { "compute", "ignore" }
-   *     - default:           "ignore"	 
-   * 
-   * JAVACORE / Specify Default Source Encoding Format
-   *    Get the encoding format for compiled sources. This setting is read-only, it is equivalent
-   *    to 'ResourcesPlugin.getEncoding()'.
-   *     - option id:         "org.phpeclipse.phpdt.core.encoding"
-   *     - possible values:   { any of the supported encoding name}.
-   *     - default:           
-   * 
-   * JAVACORE / Reporting Incomplete Classpath
-   *    An entry on the classpath doesn't exist or is not visible (e.g. a referenced project is closed).
-   *     - option id:         "org.phpeclipse.phpdt.core.incompleteClasspath"
-   *     - possible values:   { "error", "warning"}
-   *     - default:           "error"
-   * 
-   * JAVACORE / Reporting Classpath Cycle
-   *    A project is involved in a cycle.
-   *     - option id:         "org.phpeclipse.phpdt.core.circularClasspath"
-   *     - possible values:   { "error", "warning" }
-   *     - default:           "error"
-   * 
-   *	FORMATTER / Inserting New Line Before Opening Brace
-   *    When Insert, a new line is inserted before an opening brace, otherwise nothing
-   *    is inserted
-   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.openingBrace"
-   *     - possible values:   { "insert", "do not insert" }
-   *     - default:           "do not insert"
-   * 
-   *	FORMATTER / Inserting New Line Inside Control Statement
-   *    When Insert, a new line is inserted between } and following else, catch, finally
-   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.controlStatement"
-   *     - possible values:   { "insert", "do not insert" }
-   *     - default:           "do not insert"
-   * 
-   *	FORMATTER / Clearing Blank Lines
-   *    When Clear all, all blank lines are removed. When Preserve one, only one is kept
-   *    and all others removed.
-   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.clearAll"
-   *     - possible values:   { "clear all", "preserve one" }
-   *     - default:           "preserve one"
-   * 
-   *	FORMATTER / Inserting New Line Between Else/If 
-   *    When Insert, a blank line is inserted between an else and an if when they are 
-   *    contiguous. When choosing to not insert, else-if will be kept on the same
-   *    line when possible.
-   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.elseIf"
-   *     - possible values:   { "insert", "do not insert" }
-   *     - default:           "do not insert"
-   * 
-   *	FORMATTER / Inserting New Line In Empty Block
-   *    When insert, a line break is inserted between contiguous { and }, if } is not followed
-   *    by a keyword.
-   *     - option id:         "org.phpeclipse.phpdt.core.formatter.newline.emptyBlock"
-   *     - possible values:   { "insert", "do not insert" }
-   *     - default:           "insert"
-   * 
-   *	FORMATTER / Splitting Lines Exceeding Length
-   *    Enable splitting of long lines (exceeding the configurable length). Length of 0 will
-   *    disable line splitting
-   *     - option id:         "org.phpeclipse.phpdt.core.formatter.lineSplit"
-   *     - possible values:	"", where n is zero or a positive integer
-   *     - default:           "80"
-   * 
-   *	FORMATTER / Compacting Assignment
-   *    Assignments can be formatted asymmetrically, e.g. 'int x= 2;', when Normal, a space
-   *    is inserted before the assignment operator
-   *     - option id:         "org.phpeclipse.phpdt.core.formatter.style.assignment"
-   *     - possible values:   { "compact", "normal" }
-   *     - default:           "normal"
-   * 
-   *	FORMATTER / Defining Indentation Character
-   *    Either choose to indent with tab characters or spaces
-   *     - option id:         "org.phpeclipse.phpdt.core.formatter.tabulation.char"
-   *     - possible values:   { "tab", "space" }
-   *     - default:           "tab"
-   * 
-   *	FORMATTER / Defining Space Indentation Length
-   *    When using spaces, set the amount of space characters to use for each 
-   *    indentation mark.
-   *     - option id:         "org.phpeclipse.phpdt.core.formatter.tabulation.size"
-   *     - possible values:	"", where n is a positive integer
-   *     - default:           "4"
-   * 
-   *	CODEASSIST / Activate Visibility Sensitive Completion
-   *    When active, completion doesn't show that you can not see
-   *    (e.g. you can not see private methods of a super class).
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.visibilityCheck"
-   *     - possible values:   { "enabled", "disabled" }
-   *     - default:           "disabled"
-   * 
-   *	CODEASSIST / Automatic Qualification of Implicit Members
-   *    When active, completion automatically qualifies completion on implicit
-   *    field references and message expressions.
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.forceImplicitQualification"
-   *     - possible values:   { "enabled", "disabled" }
-   *     - default:           "disabled"
-   * 
-   *  CODEASSIST / Define the Prefixes for Field Name
-   *    When the prefixes is non empty, completion for field name will begin with
-   *    one of the proposed prefixes.
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.fieldPrefixes"
-   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-   *     - default:           ""
-   * 
-   *  CODEASSIST / Define the Prefixes for Static Field Name
-   *    When the prefixes is non empty, completion for static field name will begin with
-   *    one of the proposed prefixes.
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.staticFieldPrefixes"
-   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-   *     - default:           ""
-   * 
-   *  CODEASSIST / Define the Prefixes for Local Variable Name
-   *    When the prefixes is non empty, completion for local variable name will begin with
-   *    one of the proposed prefixes.
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.localPrefixes"
-   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-   *     - default:           ""
-   * 
-   *  CODEASSIST / Define the Prefixes for Argument Name
-   *    When the prefixes is non empty, completion for argument name will begin with
-   *    one of the proposed prefixes.
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.argumentPrefixes"
-   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-   *     - default:           ""
-   * 
-   *  CODEASSIST / Define the Suffixes for Field Name
-   *    When the suffixes is non empty, completion for field name will end with
-   *    one of the proposed suffixes.
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.fieldSuffixes"
-   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-   *     - default:           ""
-   * 
-   *  CODEASSIST / Define the Suffixes for Static Field Name
-   *    When the suffixes is non empty, completion for static field name will end with
-   *    one of the proposed suffixes.
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.staticFieldSuffixes"
-   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-   *     - default:           ""
-   * 
-   *  CODEASSIST / Define the Suffixes for Local Variable Name
-   *    When the suffixes is non empty, completion for local variable name will end with
-   *    one of the proposed suffixes.
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.localSuffixes"
-   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-   *     - default:           ""
-   * 
-   *  CODEASSIST / Define the Suffixes for Argument Name
-   *    When the suffixes is non empty, completion for argument name will end with
-   *    one of the proposed suffixes.
-   *     - option id:         "org.phpeclipse.phpdt.core.codeComplete.argumentSuffixes"
-   *     - possible values:   { "[,]*" } where  is a String without any wild-card 
-   *     - default:           ""
-   * 
- * - * @return a mutable table containing the default settings of all known options - * (key type: String; value type: String) - * @see #setOptions - */ -// public static Hashtable getDefaultOptions() { -// -// Hashtable defaultOptions = new Hashtable(10); -// -// // see #initializeDefaultPluginPreferences() for changing default settings -// Preferences preferences = getPlugin().getPluginPreferences(); -// HashSet optionNames = OptionNames; -// -// // get preferences set to their default -// String[] defaultPropertyNames = preferences.defaultPropertyNames(); -// for (int i = 0; i < defaultPropertyNames.length; i++) { -// String propertyName = defaultPropertyNames[i]; -// if (optionNames.contains(propertyName)) { -// defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); -// } -// } -// // get preferences not set to their default -// String[] propertyNames = preferences.propertyNames(); -// for (int i = 0; i < propertyNames.length; i++) { -// String propertyName = propertyNames[i]; -// if (optionNames.contains(propertyName)) { -// defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); -// } -// } -// // get encoding through resource plugin -// defaultOptions.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); -// -// return defaultOptions; -// } - /** - * Helper method for returning one option value only. Equivalent to (String)JavaCore.getOptions().get(optionName) - * Note that it may answer null if this option does not exist. - *

- * For a complete description of the configurable options, see getDefaultOptions. - *

- * - * @param optionName the name of an option - * @return the String value of a given option - * @see JavaCore#getDefaultOptions - * @since 2.0 - */ -// public static String getOption(String optionName) { -// -// if (CORE_ENCODING.equals(optionName)) { -// return ResourcesPlugin.getEncoding(); -// } -// if (OptionNames.contains(optionName)) { -// Preferences preferences = getPlugin().getPluginPreferences(); -// return preferences.getString(optionName).trim(); -// } -// return null; -// } - - /** - * Returns the table of the current options. Initially, all options have their default values, - * and this method returns a table that includes all known options. - *

- * For a complete description of the configurable options, see getDefaultOptions. - *

- * - * @return table of current settings of all options - * (key type: String; value type: String) - * @see JavaCore#getDefaultOptions - */ -// public static Hashtable getOptions() { -// -// Hashtable options = new Hashtable(10); -// -// // see #initializeDefaultPluginPreferences() for changing default settings -// Plugin plugin = getPlugin(); -// if (plugin != null) { -// Preferences preferences = getPlugin().getPluginPreferences(); -// HashSet optionNames = OptionNames; -// -// // get preferences set to their default -// String[] defaultPropertyNames = preferences.defaultPropertyNames(); -// for (int i = 0; i < defaultPropertyNames.length; i++) { -// String propertyName = defaultPropertyNames[i]; -// if (optionNames.contains(propertyName)) { -// options.put(propertyName, preferences.getDefaultString(propertyName)); -// } -// } -// // get preferences not set to their default -// String[] propertyNames = preferences.propertyNames(); -// for (int i = 0; i < propertyNames.length; i++) { -// String propertyName = propertyNames[i]; -// if (optionNames.contains(propertyName)) { -// options.put(propertyName, preferences.getString(propertyName).trim()); -// } -// } -// // get encoding through resource plugin -// options.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); -// } -// return options; -// } - /** - * Sets the current table of options. All and only the options explicitly included in the given table - * are remembered; all previous option settings are forgotten, including ones not explicitly - * mentioned. - *

- * For a complete description of the configurable options, see getDefaultOptions. - *

- * - * @param newOptions the new options (key type: String; value type: String), - * or null to reset all options to their default values - * @see JavaCore#getDefaultOptions - */ -// public static void setOptions(Hashtable newOptions) { -// -// // see #initializeDefaultPluginPreferences() for changing default settings -// Preferences preferences = getPlugin().getPluginPreferences(); -// -// if (newOptions == null) { -// newOptions = getDefaultOptions(); -// } -// Enumeration keys = newOptions.keys(); -// while (keys.hasMoreElements()) { -// String key = (String) keys.nextElement(); -// if (!OptionNames.contains(key)) -// continue; // unrecognized option -// if (key.equals(CORE_ENCODING)) -// continue; // skipped, contributed by resource prefs -// String value = (String) newOptions.get(key); -// preferences.setValue(key, value); -// } -// -// // persist options -// getPlugin().savePluginPreferences(); -// } - public static IProject[] getPHPProjects() { - List phpProjectsList = new ArrayList(); - IProject[] workspaceProjects = PHPeclipsePlugin.getWorkspace().getRoot().getProjects(); - - for (int i = 0; i < workspaceProjects.length; i++) { - IProject iProject = workspaceProjects[i]; - if (isPHPProject(iProject)) - phpProjectsList.add(iProject); - } - - IProject[] phpProjects = new IProject[phpProjectsList.size()]; - return (IProject[]) phpProjectsList.toArray(phpProjects); - } - -// public static PHPProject getPHPProject(String name) { -// IProject aProject = PHPeclipsePlugin.getWorkspace().getRoot().getProject(name); -// if (isPHPProject(aProject)) { -// PHPProject thePHPProject = new PHPProject(); -// thePHPProject.setProject(aProject); -// return thePHPProject; -// } -// return null; -// } - - public static boolean isPHPProject(IProject aProject) { - try { - return aProject.hasNature(PHPeclipsePlugin.PHP_NATURE_ID); - } catch (CoreException e) { - } - - return false; - } - -// public static PHPFile create(IFile aFile) { -// if (PHPFile.EXTENSION.equalsIgnoreCase(aFile.getFileExtension())) -// return new PHPFile(aFile); -// if (PHPFile.EXTENSION1.equalsIgnoreCase(aFile.getFileExtension())) -// return new PHPFile(aFile); -// if (PHPFile.EXTENSION2.equalsIgnoreCase(aFile.getFileExtension())) -// return new PHPFile(aFile); -// if (PHPFile.EXTENSION3.equalsIgnoreCase(aFile.getFileExtension())) -// return new PHPFile(aFile); -// if (PHPFile.EXTENSION4.equalsIgnoreCase(aFile.getFileExtension())) -// return new PHPFile(aFile); -// if (PHPFile.EXTENSION5.equalsIgnoreCase(aFile.getFileExtension())) -// return new PHPFile(aFile); -// -// return null; -// } - -// public static PHPProject create(IProject aProject) { -// -// try { -// if (aProject.hasNature(PHPeclipsePlugin.PHP_NATURE_ID)) { -// PHPProject project = new PHPProject(); -// project.setProject(aProject); -// return project; -// } -// } catch (CoreException e) { -// System.err.println("Exception occurred in PHPCore#create(IProject): " + e.toString()); -// } -// -// return null; -// } - - public static void addPHPNature(IProject project, IProgressMonitor monitor) throws CoreException { - if (!project.hasNature(PHPeclipsePlugin.PHP_NATURE_ID)) { - IProjectDescription description = project.getDescription(); - String[] prevNatures = description.getNatureIds(); - String[] newNatures = new String[prevNatures.length + 1]; - System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length); - newNatures[prevNatures.length] = PHPeclipsePlugin.PHP_NATURE_ID; - description.setNatureIds(newNatures); - project.setDescription(description, monitor); - } - } - - /** - * Returns the single instance of the PHP core plug-in runtime class. - * - * @return the single instance of the PHP core plug-in runtime class - */ - public static Plugin getPlugin() { - return PHPeclipsePlugin.getDefault(); - } - - /** - * Initializes the default preferences settings for this plug-in. - */ - - /** - * Runs the given action as an atomic Java model operation. - *

- * After running a method that modifies Java elements, - * registered listeners receive after-the-fact notification of - * what just transpired, in the form of a element changed event. - * This method allows clients to call a number of - * methods that modify java elements and only have element - * changed event notifications reported at the end of the entire - * batch. - *

- *

- * If this method is called outside the dynamic scope of another such - * call, this method runs the action and then reports a single - * element changed event describing the net effect of all changes - * done to java elements by the action. - *

- *

- * If this method is called in the dynamic scope of another such - * call, this method simply runs the action. - *

- * - * @param action the action to perform - * @param monitor a progress monitor, or null if progress - * reporting and cancellation are not desired - * @exception CoreException if the operation failed. - * @since 2.1 - */ - public static void run(IWorkspaceRunnable action, IProgressMonitor monitor) throws CoreException { - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - if (workspace.isTreeLocked()) { - new BatchOperation(action).run(monitor); - } else { - // use IWorkspace.run(...) to ensure that a build will be done in autobuild mode - workspace.run(new BatchOperation(action), monitor); - } - } - -/** - * Adds the given listener for changes to Java elements. - * Has no effect if an identical listener is already registered. - * - * This listener will only be notified during the POST_CHANGE resource change notification - * and any reconcile operation (POST_RECONCILE). - * For finer control of the notification, use addElementChangedListener(IElementChangedListener,int), - * which allows to specify a different eventMask. - * - * @see ElementChangedEvent - * @param listener the listener - */ -public static void addElementChangedListener(IElementChangedListener listener) { - addElementChangedListener(listener, ElementChangedEvent.POST_CHANGE | ElementChangedEvent.POST_RECONCILE); -} - -/** - * Adds the given listener for changes to Java elements. - * Has no effect if an identical listener is already registered. - * After completion of this method, the given listener will be registered for exactly - * the specified events. If they were previously registered for other events, they - * will be deregistered. - *

- * Once registered, a listener starts receiving notification of changes to - * java elements in the model. The listener continues to receive - * notifications until it is replaced or removed. - *

- *

- * Listeners can listen for several types of event as defined in ElementChangeEvent. - * Clients are free to register for any number of event types however if they register - * for more than one, it is their responsibility to ensure they correctly handle the - * case where the same java element change shows up in multiple notifications. - * Clients are guaranteed to receive only the events for which they are registered. - *

- * - * @param listener the listener - * @param eventMask the bit-wise OR of all event types of interest to the listener - * @see IElementChangedListener - * @see ElementChangedEvent - * @see #removeElementChangedListener(IElementChangedListener) - * @since 2.0 - */ -public static void addElementChangedListener(IElementChangedListener listener, int eventMask) { - JavaModelManager.getJavaModelManager().addElementChangedListener(listener, eventMask); -} - -/** - * Configures the given marker attribute map for the given Java element. - * Used for markers, which denote a Java element rather than a resource. - * - * @param attributes the mutable marker attribute map (key type: String, - * value type: String) - * @param element the Java element for which the marker needs to be configured - */ -public static void addJavaElementMarkerAttributes( - Map attributes, - IJavaElement element) { -// if (element instanceof IMember) -// element = ((IMember) element).getClassFile(); - if (attributes != null && element != null) - attributes.put(ATT_HANDLE_ID, element.getHandleIdentifier()); -} - -/** - * Configures the given marker for the given Java element. - * Used for markers, which denote a Java element rather than a resource. - * - * @param marker the marker to be configured - * @param element the Java element for which the marker needs to be configured - * @exception CoreException if the IMarker.setAttribute on the marker fails - */ -public void configureJavaElementMarker(IMarker marker, IJavaElement element) - throws CoreException { -// if (element instanceof IMember) -// element = ((IMember) element).getClassFile(); - if (marker != null && element != null) - marker.setAttribute(ATT_HANDLE_ID, element.getHandleIdentifier()); -} - -/** - * Returns the Java model element corresponding to the given handle identifier - * generated by IJavaElement.getHandleIdentifier(), or - * null if unable to create the associated element. - */ -public static IJavaElement create(String handleIdentifier) { - if (handleIdentifier == null) { - return null; - } - try { - return JavaModelManager.getJavaModelManager().getHandleFromMemento(handleIdentifier); - } catch (JavaModelException e) { - return null; - } -} -/** - * Returns the Java element corresponding to the given file, or - * null if unable to associate the given file - * with a Java element. - * - *

The file must be one of:

    - *
  • a .java file - the element returned is the corresponding ICompilationUnit
  • - *
  • a .class file - the element returned is the corresponding IClassFile
  • - *
  • a .jar file - the element returned is the corresponding IPackageFragmentRoot
  • - *
- *

- * Creating a Java element has the side effect of creating and opening all of the - * element's parents if they are not yet open. - * - * @param the given file - * @return the Java element corresponding to the given file, or - * null if unable to associate the given file - * with a Java element - */ -public static IJavaElement create(IFile file) { - return JavaModelManager.create(file, null); -} -/** - * Returns the package fragment or package fragment root corresponding to the given folder, or - * null if unable to associate the given folder with a Java element. - *

- * Note that a package fragment root is returned rather than a default package. - *

- * Creating a Java element has the side effect of creating and opening all of the - * element's parents if they are not yet open. - * - * @param the given folder - * @return the package fragment or package fragment root corresponding to the given folder, or - * null if unable to associate the given folder with a Java element - */ -public static IJavaElement create(IFolder folder) { - return JavaModelManager.create(folder, null); -} -/** - * Returns the Java project corresponding to the given project. - *

- * Creating a Java Project has the side effect of creating and opening all of the - * project's parents if they are not yet open. - *

- * Note that no check is done at this time on the existence or the java nature of this project. - * - * @param project the given project - * @return the Java project corresponding to the given project, null if the given project is null - */ -public static IJavaProject create(IProject project) { - if (project == null) { - return null; - } - JavaModel javaModel = JavaModelManager.getJavaModelManager().getJavaModel(); - return javaModel.getJavaProject(project); -} -/** - * Returns the Java element corresponding to the given resource, or - * null if unable to associate the given resource - * with a Java element. - *

- * The resource must be one of:

    - *
  • a project - the element returned is the corresponding IJavaProject
  • - *
  • a .java file - the element returned is the corresponding ICompilationUnit
  • - *
  • a .class file - the element returned is the corresponding IClassFile
  • - *
  • a .jar file - the element returned is the corresponding IPackageFragmentRoot
  • - *
  • a folder - the element returned is the corresponding IPackageFragmentRoot - * or IPackageFragment
  • - *
  • the workspace root resource - the element returned is the IJavaModel
  • - *
- *

- * Creating a Java element has the side effect of creating and opening all of the - * element's parents if they are not yet open. - * - * @param resource the given resource - * @return the Java element corresponding to the given resource, or - * null if unable to associate the given resource - * with a Java element - */ -public static IJavaElement create(IResource resource) { - return JavaModelManager.create(resource, null); -} -/** - * Returns the Java model. - * - * @param root the given root - * @return the Java model, or null if the root is null - */ -public static IJavaModel create(IWorkspaceRoot root) { - if (root == null) { - return null; - } - return JavaModelManager.getJavaModelManager().getJavaModel(); -} -/** - * Creates and returns a class file element for - * the given .class file. Returns null if unable - * to recognize the class file. - * - * @param file the given .class file - * @return a class file element for the given .class file, or null if unable - * to recognize the class file - */ -//public static IClassFile createClassFileFrom(IFile file) { -// return JavaModelManager.createClassFileFrom(file, null); -//} -/** - * Creates and returns a compilation unit element for - * the given .java file. Returns null if unable - * to recognize the compilation unit. - * - * @param file the given .java file - * @return a compilation unit element for the given .java file, or null if unable - * to recognize the compilation unit - */ -public static ICompilationUnit createCompilationUnitFrom(IFile file) { - return JavaModelManager.createCompilationUnitFrom(file, null); -} -/** - * Creates and returns a handle for the given JAR file. - * The Java model associated with the JAR's project may be - * created as a side effect. - * - * @param file the given JAR file - * @return a handle for the given JAR file, or null if unable to create a JAR package fragment root. - * (for example, if the JAR file represents a non-Java resource) - */ -//public static IPackageFragmentRoot createJarPackageFragmentRootFrom(IFile file) { -// return JavaModelManager.createJarPackageFragmentRootFrom(file, null); -//} - -/** - * Answers the project specific value for a given classpath container. - * In case this container path could not be resolved, then will answer null. - * Both the container path and the project context are supposed to be non-null. - *

- * The containerPath is a formed by a first ID segment followed with extra segments, which can be - * used as additional hints for resolution. If no container was ever recorded for this container path - * onto this project (using setClasspathContainer, then a - * ClasspathContainerInitializer will be activated if any was registered for this container - * ID onto the extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * There is no assumption that the returned container must answer the exact same containerPath - * when requested IClasspathContainer#getPath. - * Indeed, the containerPath is just an indication for resolving it to an actual container object. - *

- * Classpath container values are persisted locally to the workspace, but - * are not preserved from a session to another. It is thus highly recommended to register a - * ClasspathContainerInitializer for each referenced container - * (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer"). - *

- * @param containerPath the name of the container, which needs to be resolved - * @param project a specific project in which the container is being resolved - * @return the corresponding classpath container or null if unable to find one. - * - * @exception JavaModelException if an exception occurred while resolving the container, or if the resolved container - * contains illegal entries (contains CPE_CONTAINER entries or null entries). - * - * @see ClasspathContainerInitializer - * @see IClasspathContainer - * @see #setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor) - * @since 2.0 - */ -//public static IClasspathContainer getClasspathContainer(final IPath containerPath, final IJavaProject project) throws JavaModelException { -// -// IClasspathContainer container = JavaModelManager.containerGet(project, containerPath); -// if (container == JavaModelManager.ContainerInitializationInProgress) return null; // break cycle -// -// if (container == null){ -// final ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(containerPath.segment(0)); -// if (initializer != null){ -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPContainer INIT - triggering initialization of: ["+project.getElementName()+"] " + containerPath + " using initializer: "+ initializer); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ -// new Exception("FAKE exception for dumping current CPContainer (["+project.getElementName()+"] "+ containerPath+ ")INIT invocation stack trace").printStackTrace(); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ -// } -// JavaModelManager.containerPut(project, containerPath, JavaModelManager.ContainerInitializationInProgress); // avoid initialization cycles -// boolean ok = false; -// try { -// // wrap initializer call with Safe runnable in case initializer would be causing some grief -// Platform.run(new ISafeRunnable() { -// public void handleException(Throwable exception) { -// Util.log(exception, "Exception occurred in classpath container initializer: "+initializer); //$NON-NLS-1$ -// } -// public void run() throws Exception { -// initializer.initialize(containerPath, project); -// } -// }); -// -// // retrieve value (if initialization was successful) -// container = JavaModelManager.containerGet(project, containerPath); -// if (container == JavaModelManager.ContainerInitializationInProgress) return null; // break cycle -// ok = true; -// } finally { -// if (!ok) JavaModelManager.containerPut(project, containerPath, null); // flush cache -// } -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.print("CPContainer INIT - after resolution: ["+project.getElementName()+"] " + containerPath + " --> "); //$NON-NLS-2$//$NON-NLS-1$//$NON-NLS-3$ -// if (container != null){ -// System.out.print("container: "+container.getDescription()+" {"); //$NON-NLS-2$//$NON-NLS-1$ -// IClasspathEntry[] entries = container.getClasspathEntries(); -// if (entries != null){ -// for (int i = 0; i < entries.length; i++){ -// if (i > 0) System.out.println(", ");//$NON-NLS-1$ -// System.out.println(entries[i]); -// } -// } -// System.out.println("}");//$NON-NLS-1$ -// } else { -// System.out.println("{unbound}");//$NON-NLS-1$ -// } -// } -// } else { -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPContainer INIT - no initializer found for: "+project.getElementName()+"] " + containerPath); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// } -// } -// return container; -//} - -/** - * Helper method finding the classpath container initializer registered for a given classpath container ID - * or null if none was found while iterating over the contributions to extension point to - * the extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * A containerID is the first segment of any container path, used to identify the registered container initializer. - *

- * @param String - a containerID identifying a registered initializer - * @return ClasspathContainerInitializer - the registered classpath container initializer or null if - * none was found. - * @since 2.1 - */ -//public static ClasspathContainerInitializer getClasspathContainerInitializer(String containerID){ -// -// Plugin jdtCorePlugin = JavaCore.getPlugin(); -// if (jdtCorePlugin == null) return null; -// -// IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPCONTAINER_INITIALIZER_EXTPOINT_ID); -// if (extension != null) { -// IExtension[] extensions = extension.getExtensions(); -// for(int i = 0; i < extensions.length; i++){ -// IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); -// for(int j = 0; j < configElements.length; j++){ -// String initializerID = configElements[j].getAttribute("id"); //$NON-NLS-1$ -// if (initializerID != null && initializerID.equals(containerID)){ -// if (JavaModelManager.CP_RESOLVE_VERBOSE) { -// System.out.println("CPContainer INIT - found initializer: "+containerID +" --> " + configElements[j].getAttribute("class"));//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ -// } -// try { -// Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ -// if (execExt instanceof ClasspathContainerInitializer){ -// return (ClasspathContainerInitializer)execExt; -// } -// } catch(CoreException e) { -// } -// } -// } -// } -// } -// return null; -//} - -/** - * Returns the path held in the given classpath variable. - * Returns null if unable to bind. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * Note that classpath variables can be contributed registered initializers for, - * using the extension point "org.eclipse.jdt.core.classpathVariableInitializer". - * If an initializer is registered for a variable, its persisted value will be ignored: - * its initializer will thus get the opportunity to rebind the variable differently on - * each session. - * - * @param variableName the name of the classpath variable - * @return the path, or null if none - * @see #setClasspathVariable - */ -public static IPath getClasspathVariable(final String variableName) { - - IPath variablePath = JavaModelManager.variableGet(variableName); - if (variablePath == JavaModelManager.VariableInitializationInProgress) return null; // break cycle - - if (variablePath != null) { - return variablePath; - } - - // even if persisted value exists, initializer is given priority, only if no initializer is found the persisted value is reused -// final ClasspathVariableInitializer initializer = PHPCore.getClasspathVariableInitializer(variableName); -// if (initializer != null){ -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable INIT - triggering initialization of: " + variableName+ " using initializer: "+ initializer); //$NON-NLS-1$ //$NON-NLS-2$ -// new Exception("FAKE exception for dumping current CPVariable ("+variableName+ ")INIT invocation stack trace").printStackTrace(); //$NON-NLS-1$//$NON-NLS-2$ -// } -// JavaModelManager.variablePut(variableName, JavaModelManager.VariableInitializationInProgress); // avoid initialization cycles -// boolean ok = false; -// try { -// // wrap initializer call with Safe runnable in case initializer would be causing some grief -// Platform.run(new ISafeRunnable() { -// public void handleException(Throwable exception) { -// Util.log(exception, "Exception occurred in classpath variable initializer: "+initializer+" while initializing variable: "+variableName); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// public void run() throws Exception { -// initializer.initialize(variableName); -// } -// }); -// variablePath = (IPath) JavaModelManager.variableGet(variableName); // initializer should have performed side-effect -// if (variablePath == JavaModelManager.VariableInitializationInProgress) return null; // break cycle (initializer did not init or reentering call) -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable INIT - after initialization: " + variableName + " --> " + variablePath); //$NON-NLS-2$//$NON-NLS-1$ -// } -// ok = true; -// } finally { -// if (!ok) JavaModelManager.variablePut(variableName, null); // flush cache -// } -// } else { -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable INIT - no initializer found for: " + variableName); //$NON-NLS-1$ -// } -// } - return variablePath; -} - -/** - * Helper method finding the classpath variable initializer registered for a given classpath variable name - * or null if none was found while iterating over the contributions to extension point to - * the extension point "org.eclipse.jdt.core.classpathVariableInitializer". - *

- * @param the given variable - * @return ClasspathVariableInitializer - the registered classpath variable initializer or null if - * none was found. - * @since 2.1 - */ -public static ClasspathVariableInitializer getClasspathVariableInitializer(String variable){ - - Plugin jdtCorePlugin = PHPCore.getPlugin(); - if (jdtCorePlugin == null) return null; - -// IExtensionPoint extension = jdtCorePlugin.getDescriptor().getExtensionPoint(JavaModelManager.CPVARIABLE_INITIALIZER_EXTPOINT_ID); -// if (extension != null) { -// IExtension[] extensions = extension.getExtensions(); -// for(int i = 0; i < extensions.length; i++){ -// IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); -// for(int j = 0; j < configElements.length; j++){ -// try { -// String varAttribute = configElements[j].getAttribute("variable"); //$NON-NLS-1$ -// if (variable.equals(varAttribute)) { -// if (JavaModelManager.CP_RESOLVE_VERBOSE) { -// System.out.println("CPVariable INIT - found initializer: "+variable+" --> " + configElements[j].getAttribute("class"));//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ -// } -// Object execExt = configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ -// if (execExt instanceof ClasspathVariableInitializer){ -// return (ClasspathVariableInitializer)execExt; -// } -// } -// } catch(CoreException e){ -// } -// } -// } -// } - return null; -} - -/** - * Returns the names of all known classpath variables. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * - * @return the list of classpath variable names - * @see #setClasspathVariable - */ -//public static String[] getClasspathVariableNames() { -// return JavaModelManager.variableNames(); -//} - -/** - * Returns a table of all known configurable options with their default values. - * These options allow to configure the behaviour of the underlying components. - * The client may safely use the result as a template that they can modify and - * then pass to setOptions. - * - * Helper constants have been defined on JavaCore for each of the option ID and - * their possible constant values. - * - * Note: more options might be added in further releases. - *

- * RECOGNIZED OPTIONS:
- * COMPILER / Generating Local Variable Debug Attribute
- *    When generated, this attribute will enable local variable names 
- *    to be displayed in debugger, only in place where variables are 
- *    definitely assigned (.class file is then bigger)
- *     - option id:         "org.eclipse.jdt.core.compiler.debug.localVariable"
- *     - possible values:   { "generate", "do not generate" }
- *     - default:           "generate"
- *
- * COMPILER / Generating Line Number Debug Attribute 
- *    When generated, this attribute will enable source code highlighting in debugger 
- *    (.class file is then bigger).
- *     - option id:         "org.eclipse.jdt.core.compiler.debug.lineNumber"
- *     - possible values:   { "generate", "do not generate" }
- *     - default:           "generate"
- *    
- * COMPILER / Generating Source Debug Attribute 
- *    When generated, this attribute will enable the debugger to present the 
- *    corresponding source code.
- *     - option id:         "org.eclipse.jdt.core.compiler.debug.sourceFile"
- *     - possible values:   { "generate", "do not generate" }
- *     - default:           "generate"
- *    
- * COMPILER / Preserving Unused Local Variables
- *    Unless requested to preserve unused local variables (that is, never read), the 
- *    compiler will optimize them out, potentially altering debugging
- *     - option id:         "org.eclipse.jdt.core.compiler.codegen.unusedLocal"
- *     - possible values:   { "preserve", "optimize out" }
- *     - default:           "preserve"
- * 
- * COMPILER / Defining Target Java Platform
- *    For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
- *    Note that "1.4" target require to toggle compliance mode to "1.4" too.
- *     - option id:         "org.eclipse.jdt.core.compiler.codegen.targetPlatform"
- *     - possible values:   { "1.1", "1.2", "1.3", "1.4" }
- *     - default:           "1.1"
- *
- * COMPILER / Reporting Unreachable Code
- *    Unreachable code can optionally be reported as an error, warning or simply 
- *    ignored. The bytecode generation will always optimized it out.
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.unreachableCode"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "error"
- *
- * COMPILER / Reporting Invalid Import
- *    An import statement that cannot be resolved might optionally be reported 
- *    as an error, as a warning or ignored.
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.invalidImport"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "error"
- *
- * COMPILER / Reporting Attempt to Override Package-Default Method
- *    A package default method is not visible in a different package, and thus 
- *    cannot be overridden. When enabling this option, the compiler will signal 
- *    such scenarii either as an error or a warning.
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "warning"
- *
- * COMPILER / Reporting Method With Constructor Name
- *    Naming a method with a constructor name is generally considered poor 
- *    style programming. When enabling this option, the compiler will signal such 
- *    scenarii either as an error or a warning.
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.methodWithConstructorName"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "warning"
- *
- * COMPILER / Reporting Deprecation
- *    When enabled, the compiler will signal use of deprecated API either as an 
- *    error or a warning.
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.deprecation"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "warning"
- *
- * COMPILER / Reporting Deprecation Inside Deprecated Code
- *    When enabled, the compiler will signal use of deprecated API inside deprecated code.
- *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.deprecation".
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode"
- *     - possible values:   { "enabled", "disabled" }
- *     - default:           "disabled"
- *
- * COMPILER / Reporting Hidden Catch Block
- *    Locally to a try statement, some catch blocks may hide others . For example,
- *      try {  throw new java.io.CharConversionException();
- *      } catch (java.io.CharConversionException e) {
- *      } catch (java.io.IOException e) {}. 
- *    When enabling this option, the compiler will issue an error or a warning for hidden 
- *    catch blocks corresponding to checked exceptions
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "warning"
- *
- * COMPILER / Reporting Unused Local
- *    When enabled, the compiler will issue an error or a warning for unused local 
- *    variables (that is, variables never read from)
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedLocal"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "ignore"
- *
- * COMPILER / Reporting Unused Parameter
- *    When enabled, the compiler will issue an error or a warning for unused method 
- *    parameters (that is, parameters never read from)
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameter"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "ignore"
- *
- * COMPILER / Reporting Unused Parameter if Implementing Abstract Method
- *    When enabled, the compiler will signal unused parameters in abstract method implementations.
- *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract"
- *     - possible values:   { "enabled", "disabled" }
- *     - default:           "disabled"
- *
- * COMPILER / Reporting Unused Parameter if Overriding Concrete Method
- *    When enabled, the compiler will signal unused parameters in methods overriding concrete ones.
- *    The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter".
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete"
- *     - possible values:   { "enabled", "disabled" }
- *     - default:           "disabled"
- *
- * COMPILER / Reporting Unused Import
- *    When enabled, the compiler will issue an error or a warning for unused import 
- *    reference 
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedImport"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "warning"
- *
- * COMPILER / Reporting Unused Private Members
- *    When enabled, the compiler will issue an error or a warning whenever a private 
- *    method or field is declared but never used within the same unit.
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.unusedPrivateMember"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "ignore"
- *
- * COMPILER / Reporting Synthetic Access Emulation
- *    When enabled, the compiler will issue an error or a warning whenever it emulates 
- *    access to a non-accessible member of an enclosing type. Such access can have
- *    performance implications.
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "ignore"
- *
- * COMPILER / Reporting Non-Externalized String Literal
- *    When enabled, the compiler will issue an error or a warning for non externalized 
- *    String literal (that is, not tagged with //$NON-NLS-$). 
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "ignore"
- * 
- * COMPILER / Reporting Usage of 'assert' Identifier
- *    When enabled, the compiler will issue an error or a warning whenever 'assert' is 
- *    used as an identifier (reserved keyword in 1.4)
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.assertIdentifier"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "ignore"
- * 
- * COMPILER / Reporting Non-Static Reference to a Static Member
- *    When enabled, the compiler will issue an error or a warning whenever a static field
- *    or method is accessed with an expression receiver. A reference to a static member should
- *    be qualified with a type name.
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.staticAccessReceiver"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "warning"
- * 
- * COMPILER / Reporting Assignment with no Effect
- *    When enabled, the compiler will issue an error or a warning whenever an assignment
- *    has no effect (e.g 'x = x').
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.noEffectAssignment"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "warning"
- * 
- * COMPILER / Reporting Interface Method not Compatible with non-Inherited Methods
- *    When enabled, the compiler will issue an error or a warning whenever an interface
- *    defines a method incompatible with a non-inherited Object method. Until this conflict
- *    is resolved, such an interface cannot be implemented, For example, 
- *      interface I { 
- *         int clone();
- *      } 
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "warning"
- * 
- * COMPILER / Reporting Usage of char[] Expressions in String Concatenations
- *    When enabled, the compiler will issue an error or a warning whenever a char[] expression
- *    is used in String concatenations (for example, "hello" + new char[]{'w','o','r','l','d'}).
- *     - option id:         "org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion"
- *     - possible values:   { "error", "warning", "ignore" }
- *     - default:           "warning"
- *
- * COMPILER / Setting Source Compatibility Mode
- *    Specify whether source is 1.3 or 1.4 compatible. From 1.4 on, 'assert' is a keyword
- *    reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
- *   level should be set to "1.4" and the compliance mode should be "1.4".
- *     - option id:         "org.eclipse.jdt.core.compiler.source"
- *     - possible values:   { "1.3", "1.4" }
- *     - default:           "1.3"
- * 
- * COMPILER / Setting Compliance Level
- *    Select the compliance level for the compiler. In "1.3" mode, source and target settings
- *    should not go beyond "1.3" level.
- *     - option id:         "org.eclipse.jdt.core.compiler.compliance"
- *     - possible values:   { "1.3", "1.4" }
- *     - default:           "1.3"
- * 
- * COMPILER / Maximum number of problems reported per compilation unit
- *    Specify the maximum number of problems reported on each compilation unit.
- *     - option id:         "org.eclipse.jdt.core.compiler.maxProblemPerUnit"
- *     - possible values:	"" where  is zero or a positive integer (if zero then all problems are reported).
- *     - default:           "100"
- * 
- * COMPILER / Define the Automatic Task Tags
- *    When the tag list is not empty, the compiler will issue a task marker whenever it encounters
- *    one of the corresponding tag inside any comment in Java source code.
- *    Generated task messages will include the tag, and range until the next line separator or comment ending.
- *    Note that tasks messages are trimmed.
- *     - option id:         "org.eclipse.jdt.core.compiler.taskTags"
- *     - possible values:   { "[,]*" } where  is a String without any wild-card or leading/trailing spaces 
- *     - default:           ""
- * 
- * COMPILER / Define the Automatic Task Priorities
- *    In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
- *    of the task markers issued by the compiler.
- *    If the default is specified, the priority of each task marker is "NORMAL".
- *     - option id:         "org.eclipse.jdt.core.compiler.taskPriorities"
- *     - possible values:   { "[,]*" } where  is one of "HIGH", "NORMAL" or "LOW"
- *     - default:           ""
- *
- * BUILDER / Specifying Filters for Resource Copying Control
- *    Allow to specify some filters to control the resource copy process.
- *     - option id:         "org.eclipse.jdt.core.builder.resourceCopyExclusionFilter"
- *     - possible values:   { "[,]* } where  is a file name pattern (* and ? wild-cards allowed)
- *       or the name of a folder which ends with '/'
- *     - default:           ""
- * 
- * BUILDER / Abort if Invalid Classpath
- *    Allow to toggle the builder to abort if the classpath is invalid
- *     - option id:         "org.eclipse.jdt.core.builder.invalidClasspath"
- *     - possible values:   { "abort", "ignore" }
- *     - default:           "abort"
- * 
- * BUILDER / Cleaning Output Folder(s)
- *    Indicate whether the JavaBuilder is allowed to clean the output folders
- *    when performing full build operations.
- *     - option id:         "org.eclipse.jdt.core.builder.cleanOutputFolder"
- *     - possible values:   { "clean", "ignore" }
- *     - default:           "clean"
- * 
- * BUILDER / Reporting Duplicate Resources
- *    Indicate the severity of the problem reported when more than one occurrence
- *    of a resource is to be copied into the output location.
- *     - option id:         "org.eclipse.jdt.core.builder.duplicateResourceTask"
- *     - possible values:   { "error", "warning" }
- *     - default:           "warning"
- * 
- * JAVACORE / Computing Project Build Order
- *    Indicate whether JavaCore should enforce the project build order to be based on
- *    the classpath prerequisite chain. When requesting to compute, this takes over
- *    the platform default order (based on project references).
- *     - option id:         "org.eclipse.jdt.core.computeJavaBuildOrder"
- *     - possible values:   { "compute", "ignore" }
- *     - default:           "ignore"	 
- * 
- * JAVACORE / Specify Default Source Encoding Format
- *    Get the encoding format for compiled sources. This setting is read-only, it is equivalent
- *    to 'ResourcesPlugin.getEncoding()'.
- *     - option id:         "org.eclipse.jdt.core.encoding"
- *     - possible values:   { any of the supported encoding name}.
- *     - default:           
- * 
- * JAVACORE / Reporting Incomplete Classpath
- *    Indicate the severity of the problem reported when an entry on the classpath does not exist, 
- *    is not legite or is not visible (for example, a referenced project is closed).
- *     - option id:         "org.eclipse.jdt.core.incompleteClasspath"
- *     - possible values:   { "error", "warning"}
- *     - default:           "error"
- * 
- * JAVACORE / Reporting Classpath Cycle
- *    Indicate the severity of the problem reported when a project is involved in a cycle.
- *     - option id:         "org.eclipse.jdt.core.circularClasspath"
- *     - possible values:   { "error", "warning" }
- *     - default:           "error"
- * 
- * JAVACORE / Enabling Usage of Classpath Exclusion Patterns
- *    When disabled, no entry on a project classpath can be associated with
- *    an exclusion pattern.
- *     - option id:         "org.eclipse.jdt.core.classpath.exclusionPatterns"
- *     - possible values:   { "enabled", "disabled" }
- *     - default:           "enabled"
- * 
- * JAVACORE / Enabling Usage of Classpath Multiple Output Locations
- *    When disabled, no entry on a project classpath can be associated with
- *    a specific output location, preventing thus usage of multiple output locations.
- *     - option id:         "org.eclipse.jdt.core.classpath.multipleOutputLocations"
- *     - possible values:   { "enabled", "disabled" }
- *     - default:           "enabled"
- * 
- *	FORMATTER / Inserting New Line Before Opening Brace
- *    When Insert, a new line is inserted before an opening brace, otherwise nothing
- *    is inserted
- *     - option id:         "org.eclipse.jdt.core.formatter.newline.openingBrace"
- *     - possible values:   { "insert", "do not insert" }
- *     - default:           "do not insert"
- * 
- *	FORMATTER / Inserting New Line Inside Control Statement
- *    When Insert, a new line is inserted between } and following else, catch, finally
- *     - option id:         "org.eclipse.jdt.core.formatter.newline.controlStatement"
- *     - possible values:   { "insert", "do not insert" }
- *     - default:           "do not insert"
- * 
- *	FORMATTER / Clearing Blank Lines
- *    When Clear all, all blank lines are removed. When Preserve one, only one is kept
- *    and all others removed.
- *     - option id:         "org.eclipse.jdt.core.formatter.newline.clearAll"
- *     - possible values:   { "clear all", "preserve one" }
- *     - default:           "preserve one"
- * 
- *	FORMATTER / Inserting New Line Between Else/If 
- *    When Insert, a blank line is inserted between an else and an if when they are 
- *    contiguous. When choosing to not insert, else-if will be kept on the same
- *    line when possible.
- *     - option id:         "org.eclipse.jdt.core.formatter.newline.elseIf"
- *     - possible values:   { "insert", "do not insert" }
- *     - default:           "do not insert"
- * 
- *	FORMATTER / Inserting New Line In Empty Block
- *    When insert, a line break is inserted between contiguous { and }, if } is not followed
- *    by a keyword.
- *     - option id:         "org.eclipse.jdt.core.formatter.newline.emptyBlock"
- *     - possible values:   { "insert", "do not insert" }
- *     - default:           "insert"
- * 
- *	FORMATTER / Splitting Lines Exceeding Length
- *    Enable splitting of long lines (exceeding the configurable length). Length of 0 will
- *    disable line splitting
- *     - option id:         "org.eclipse.jdt.core.formatter.lineSplit"
- *     - possible values:	"", where n is zero or a positive integer
- *     - default:           "80"
- * 
- *	FORMATTER / Compacting Assignment
- *    Assignments can be formatted asymmetrically, for example 'int x= 2;', when Normal, a space
- *    is inserted before the assignment operator
- *     - option id:         "org.eclipse.jdt.core.formatter.style.assignment"
- *     - possible values:   { "compact", "normal" }
- *     - default:           "normal"
- * 
- *	FORMATTER / Defining Indentation Character
- *    Either choose to indent with tab characters or spaces
- *     - option id:         "org.eclipse.jdt.core.formatter.tabulation.char"
- *     - possible values:   { "tab", "space" }
- *     - default:           "tab"
- * 
- *	FORMATTER / Defining Space Indentation Length
- *    When using spaces, set the amount of space characters to use for each 
- *    indentation mark.
- *     - option id:         "org.eclipse.jdt.core.formatter.tabulation.size"
- *     - possible values:	"", where n is a positive integer
- *     - default:           "4"
- * 
- *	FORMATTER / Inserting space in cast expression
- *    When Insert, a space is added between the type and the expression in a cast expression.
- *     - option id:         "org.eclipse.jdt.core.formatter.space.castexpression"
- *     - possible values:   { "insert", "do not insert" }
- *     - default:           "insert"
- * 
- *	CODEASSIST / Activate Visibility Sensitive Completion
- *    When active, completion doesn't show that you can not see
- *    (for example, you can not see private methods of a super class).
- *     - option id:         "org.eclipse.jdt.core.codeComplete.visibilityCheck"
- *     - possible values:   { "enabled", "disabled" }
- *     - default:           "disabled"
- * 
- *	CODEASSIST / Automatic Qualification of Implicit Members
- *    When active, completion automatically qualifies completion on implicit
- *    field references and message expressions.
- *     - option id:         "org.eclipse.jdt.core.codeComplete.forceImplicitQualification"
- *     - possible values:   { "enabled", "disabled" }
- *     - default:           "disabled"
- * 
- *  CODEASSIST / Define the Prefixes for Field Name
- *    When the prefixes is non empty, completion for field name will begin with
- *    one of the proposed prefixes.
- *     - option id:         "org.eclipse.jdt.core.codeComplete.fieldPrefixes"
- *     - possible values:   { "[,]*" } where  is a String without any wild-card 
- *     - default:           ""
- * 
- *  CODEASSIST / Define the Prefixes for Static Field Name
- *    When the prefixes is non empty, completion for static field name will begin with
- *    one of the proposed prefixes.
- *     - option id:         "org.eclipse.jdt.core.codeComplete.staticFieldPrefixes"
- *     - possible values:   { "[,]*" } where  is a String without any wild-card 
- *     - default:           ""
- * 
- *  CODEASSIST / Define the Prefixes for Local Variable Name
- *    When the prefixes is non empty, completion for local variable name will begin with
- *    one of the proposed prefixes.
- *     - option id:         "org.eclipse.jdt.core.codeComplete.localPrefixes"
- *     - possible values:   { "[,]*" } where  is a String without any wild-card 
- *     - default:           ""
- * 
- *  CODEASSIST / Define the Prefixes for Argument Name
- *    When the prefixes is non empty, completion for argument name will begin with
- *    one of the proposed prefixes.
- *     - option id:         "org.eclipse.jdt.core.codeComplete.argumentPrefixes"
- *     - possible values:   { "[,]*" } where  is a String without any wild-card 
- *     - default:           ""
- * 
- *  CODEASSIST / Define the Suffixes for Field Name
- *    When the suffixes is non empty, completion for field name will end with
- *    one of the proposed suffixes.
- *     - option id:         "org.eclipse.jdt.core.codeComplete.fieldSuffixes"
- *     - possible values:   { "[,]*" } where  is a String without any wild-card 
- *     - default:           ""
- * 
- *  CODEASSIST / Define the Suffixes for Static Field Name
- *    When the suffixes is non empty, completion for static field name will end with
- *    one of the proposed suffixes.
- *     - option id:         "org.eclipse.jdt.core.codeComplete.staticFieldSuffixes"
- *     - possible values:   { "[,]*" } where  is a String without any wild-card 
- *     - default:           ""
- * 
- *  CODEASSIST / Define the Suffixes for Local Variable Name
- *    When the suffixes is non empty, completion for local variable name will end with
- *    one of the proposed suffixes.
- *     - option id:         "org.eclipse.jdt.core.codeComplete.localSuffixes"
- *     - possible values:   { "[,]*" } where  is a String without any wild-card 
- *     - default:           ""
- * 
- *  CODEASSIST / Define the Suffixes for Argument Name
- *    When the suffixes is non empty, completion for argument name will end with
- *    one of the proposed suffixes.
- *     - option id:         "org.eclipse.jdt.core.codeComplete.argumentSuffixes"
- *     - possible values:   { "[,]*" } where  is a String without any wild-card 
- *     - default:           ""
- * 
- * - * @return a mutable table containing the default settings of all known options - * (key type: String; value type: String) - * @see #setOptions - */ -public static Hashtable getDefaultOptions(){ - - Hashtable defaultOptions = new Hashtable(10); - - // see #initializeDefaultPluginPreferences() for changing default settings - Preferences preferences = getPlugin().getPluginPreferences(); - HashSet optionNames = JavaModelManager.OptionNames; - - // get preferences set to their default - String[] defaultPropertyNames = preferences.defaultPropertyNames(); - for (int i = 0; i < defaultPropertyNames.length; i++){ - String propertyName = defaultPropertyNames[i]; - if (optionNames.contains(propertyName)) { - defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); - } - } - // get preferences not set to their default - String[] propertyNames = preferences.propertyNames(); - for (int i = 0; i < propertyNames.length; i++){ - String propertyName = propertyNames[i]; - if (optionNames.contains(propertyName)) { - defaultOptions.put(propertyName, preferences.getDefaultString(propertyName)); - } - } - // get encoding through resource plugin - defaultOptions.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); - - return defaultOptions; -} - -/** - * Returns the single instance of the Java core plug-in runtime class. - * Equivalent to (JavaCore) getPlugin(). - * - * @return the single instance of the Java core plug-in runtime class - */ -public static PHPeclipsePlugin getJavaCore() { - return (PHPeclipsePlugin) getPlugin(); -} - -/** - * Helper method for returning one option value only. Equivalent to (String)JavaCore.getOptions().get(optionName) - * Note that it may answer null if this option does not exist. - *

- * For a complete description of the configurable options, see getDefaultOptions. - *

- * - * @param optionName the name of an option - * @return the String value of a given option - * @see JavaCore#getDefaultOptions - * @since 2.0 - */ -public static String getOption(String optionName) { - - if (CORE_ENCODING.equals(optionName)){ - return ResourcesPlugin.getEncoding(); - } - if (JavaModelManager.OptionNames.contains(optionName)){ - Preferences preferences = getPlugin().getPluginPreferences(); - return preferences.getString(optionName).trim(); - } - return null; -} - -/** - * Returns the table of the current options. Initially, all options have their default values, - * and this method returns a table that includes all known options. - *

- * For a complete description of the configurable options, see getDefaultOptions. - *

- * - * @return table of current settings of all options - * (key type: String; value type: String) - * @see JavaCore#getDefaultOptions - */ -public static Hashtable getOptions() { - - Hashtable options = new Hashtable(10); - - // see #initializeDefaultPluginPreferences() for changing default settings - Plugin plugin = getPlugin(); - if (plugin != null) { - Preferences preferences = getPlugin().getPluginPreferences(); - HashSet optionNames = JavaModelManager.OptionNames; - - // get preferences set to their default - String[] defaultPropertyNames = preferences.defaultPropertyNames(); - for (int i = 0; i < defaultPropertyNames.length; i++){ - String propertyName = defaultPropertyNames[i]; - if (optionNames.contains(propertyName)){ - options.put(propertyName, preferences.getDefaultString(propertyName)); - } - } - // get preferences not set to their default - String[] propertyNames = preferences.propertyNames(); - for (int i = 0; i < propertyNames.length; i++){ - String propertyName = propertyNames[i]; - if (optionNames.contains(propertyName)){ - options.put(propertyName, preferences.getString(propertyName).trim()); - } - } - // get encoding through resource plugin - options.put(CORE_ENCODING, ResourcesPlugin.getEncoding()); - } - return options; -} - -/** - * This is a helper method, which returns the resolved classpath entry denoted - * by a given entry (if it is a variable entry). It is obtained by resolving the variable - * reference in the first segment. Returns null if unable to resolve using - * the following algorithm: - *
    - *
  • if variable segment cannot be resolved, returns null
  • - *
  • finds a project, JAR or binary folder in the workspace at the resolved path location
  • - *
  • if none finds an external JAR file or folder outside the workspace at the resolved path location
  • - *
  • if none returns null
  • - *
- *

- * Variable source attachment path and root path are also resolved and recorded in the resulting classpath entry. - *

- * NOTE: This helper method does not handle classpath containers, for which should rather be used - * JavaCore#getClasspathContainer(IPath, IJavaProject). - *

- * - * @param entry the given variable entry - * @return the resolved library or project classpath entry, or null - * if the given variable entry could not be resolved to a valid classpath entry - */ -public static IClasspathEntry getResolvedClasspathEntry(IClasspathEntry entry) { - - if (entry.getEntryKind() != IClasspathEntry.CPE_VARIABLE) - return entry; - - IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); - IPath resolvedPath = PHPCore.getResolvedVariablePath(entry.getPath()); - if (resolvedPath == null) - return null; - - Object target = JavaModel.getTarget(workspaceRoot, resolvedPath, false); - if (target == null) - return null; - - // inside the workspace - if (target instanceof IResource) { - IResource resolvedResource = (IResource) target; - if (resolvedResource != null) { - switch (resolvedResource.getType()) { - - case IResource.PROJECT : - // internal project - return PHPCore.newProjectEntry(resolvedPath, entry.isExported()); - - case IResource.FILE : -// if (Util.isArchiveFileName(resolvedResource.getName())) { -// // internal binary archive -// return JavaCore.newLibraryEntry( -// resolvedPath, -// getResolvedVariablePath(entry.getSourceAttachmentPath()), -// getResolvedVariablePath(entry.getSourceAttachmentRootPath()), -// entry.isExported()); -// } - break; - - case IResource.FOLDER : - // internal binary folder -// return JavaCore.newLibraryEntry( -// resolvedPath, -// getResolvedVariablePath(entry.getSourceAttachmentPath()), -// getResolvedVariablePath(entry.getSourceAttachmentRootPath()), -// entry.isExported()); - break; - } - } - } - // outside the workspace - if (target instanceof File) { - File externalFile = (File) target; - if (externalFile.isFile()) { - String fileName = externalFile.getName().toLowerCase(); -// if (fileName.endsWith(".jar" //$NON-NLS-1$ -// ) || fileName.endsWith(".zip" //$NON-NLS-1$ -// )) { // external binary archive -// return JavaCore.newLibraryEntry( -// resolvedPath, -// getResolvedVariablePath(entry.getSourceAttachmentPath()), -// getResolvedVariablePath(entry.getSourceAttachmentRootPath()), -// entry.isExported()); -// } - } else { // external binary folder - if (resolvedPath.isAbsolute()){ -// return JavaCore.newLibraryEntry( -// resolvedPath, -// getResolvedVariablePath(entry.getSourceAttachmentPath()), -// getResolvedVariablePath(entry.getSourceAttachmentRootPath()), -// entry.isExported()); - } - } - } - return null; -} - - -/** - * Resolve a variable path (helper method). - * - * @param variablePath the given variable path - * @return the resolved variable path or null if none - */ -public static IPath getResolvedVariablePath(IPath variablePath) { - - if (variablePath == null) - return null; - int count = variablePath.segmentCount(); - if (count == 0) - return null; - - // lookup variable - String variableName = variablePath.segment(0); - IPath resolvedPath = PHPCore.getClasspathVariable(variableName); - if (resolvedPath == null) - return null; - - // append path suffix - if (count > 1) { - resolvedPath = resolvedPath.append(variablePath.removeFirstSegments(1)); - } - return resolvedPath; -} - -/** - * Answers the shared working copies currently registered for this buffer factory. - * Working copies can be shared by several clients using the same buffer factory,see - * IWorkingCopy.getSharedWorkingCopy. - * - * @param factory the given buffer factory - * @return the list of shared working copies for a given buffer factory - * @see IWorkingCopy - * @since 2.0 - */ -public static IWorkingCopy[] getSharedWorkingCopies(IBufferFactory factory){ - - // if factory is null, default factory must be used - if (factory == null) factory = BufferManager.getDefaultBufferManager().getDefaultBufferFactory(); - Map sharedWorkingCopies = JavaModelManager.getJavaModelManager().sharedWorkingCopies; - - Map perFactoryWorkingCopies = (Map) sharedWorkingCopies.get(factory); - if (perFactoryWorkingCopies == null) return JavaModelManager.NoWorkingCopy; - Collection copies = perFactoryWorkingCopies.values(); - IWorkingCopy[] result = new IWorkingCopy[copies.size()]; - copies.toArray(result); - return result; -} - -/** - * Initializes the default preferences settings for this plug-in. - */ -protected static void initializeDefaultPluginPreferences() { - - Preferences preferences = PHPeclipsePlugin.getDefault().getPluginPreferences(); - HashSet optionNames = JavaModelManager.OptionNames; - - // Compiler settings - preferences.setDefault(COMPILER_LOCAL_VARIABLE_ATTR, GENERATE); - optionNames.add(COMPILER_LOCAL_VARIABLE_ATTR); - - preferences.setDefault(COMPILER_LINE_NUMBER_ATTR, GENERATE); - optionNames.add(COMPILER_LINE_NUMBER_ATTR); - - preferences.setDefault(COMPILER_SOURCE_FILE_ATTR, GENERATE); - optionNames.add(COMPILER_SOURCE_FILE_ATTR); - - preferences.setDefault(COMPILER_CODEGEN_UNUSED_LOCAL, PRESERVE); - optionNames.add(COMPILER_CODEGEN_UNUSED_LOCAL); - - preferences.setDefault(COMPILER_CODEGEN_TARGET_PLATFORM, VERSION_1_1); - optionNames.add(COMPILER_CODEGEN_TARGET_PLATFORM); - - preferences.setDefault(COMPILER_PB_UNREACHABLE_CODE, ERROR); - optionNames.add(COMPILER_PB_UNREACHABLE_CODE); - - preferences.setDefault(COMPILER_PB_INVALID_IMPORT, ERROR); - optionNames.add(COMPILER_PB_INVALID_IMPORT); - - preferences.setDefault(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, WARNING); - optionNames.add(COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD); - - preferences.setDefault(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME, WARNING); - optionNames.add(COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME); - - preferences.setDefault(COMPILER_PB_DEPRECATION, WARNING); - optionNames.add(COMPILER_PB_DEPRECATION); - - preferences.setDefault(COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE, DISABLED); - optionNames.add(COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE); - - preferences.setDefault(COMPILER_PB_HIDDEN_CATCH_BLOCK, WARNING); - optionNames.add(COMPILER_PB_HIDDEN_CATCH_BLOCK); - - preferences.setDefault(COMPILER_PB_UNUSED_LOCAL, IGNORE); - optionNames.add(COMPILER_PB_UNUSED_LOCAL); - - preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER, IGNORE); - optionNames.add(COMPILER_PB_UNUSED_PARAMETER); - - preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT, DISABLED); - optionNames.add(COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT); - - preferences.setDefault(COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE, DISABLED); - optionNames.add(COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE); - - preferences.setDefault(COMPILER_PB_UNUSED_IMPORT, WARNING); - optionNames.add(COMPILER_PB_UNUSED_IMPORT); - - preferences.setDefault(COMPILER_PB_UNUSED_PRIVATE_MEMBER, IGNORE); - optionNames.add(COMPILER_PB_UNUSED_PRIVATE_MEMBER); - - preferences.setDefault(COMPILER_PB_SYNTHETIC_ACCESS_EMULATION, IGNORE); - optionNames.add(COMPILER_PB_SYNTHETIC_ACCESS_EMULATION); - - preferences.setDefault(COMPILER_PB_NON_NLS_STRING_LITERAL, IGNORE); - optionNames.add(COMPILER_PB_NON_NLS_STRING_LITERAL); - - preferences.setDefault(COMPILER_PB_ASSERT_IDENTIFIER, IGNORE); - optionNames.add(COMPILER_PB_ASSERT_IDENTIFIER); - - preferences.setDefault(COMPILER_PB_STATIC_ACCESS_RECEIVER, WARNING); - optionNames.add(COMPILER_PB_STATIC_ACCESS_RECEIVER); - - preferences.setDefault(COMPILER_PB_NO_EFFECT_ASSIGNMENT, WARNING); - optionNames.add(COMPILER_PB_NO_EFFECT_ASSIGNMENT); - - preferences.setDefault(COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD, WARNING); - optionNames.add(COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD); - - preferences.setDefault(COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION, WARNING); - optionNames.add(COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION); - - preferences.setDefault(COMPILER_TASK_TAGS, DEFAULT_TASK_TAG); //$NON-NLS-1$ - optionNames.add(COMPILER_TASK_TAGS); - - preferences.setDefault(COMPILER_TASK_PRIORITIES, DEFAULT_TASK_PRIORITY); //$NON-NLS-1$ - optionNames.add(COMPILER_TASK_PRIORITIES); - - preferences.setDefault(COMPILER_SOURCE, VERSION_1_3); - optionNames.add(COMPILER_SOURCE); - - preferences.setDefault(COMPILER_COMPLIANCE, VERSION_1_3); - optionNames.add(COMPILER_COMPLIANCE); - - preferences.setDefault(COMPILER_PB_MAX_PER_UNIT, "100"); //$NON-NLS-1$ - optionNames.add(COMPILER_PB_MAX_PER_UNIT); - - // Builder settings - preferences.setDefault(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, ""); //$NON-NLS-1$ - optionNames.add(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER); - - preferences.setDefault(CORE_JAVA_BUILD_INVALID_CLASSPATH, ABORT); - optionNames.add(CORE_JAVA_BUILD_INVALID_CLASSPATH); - - preferences.setDefault(CORE_JAVA_BUILD_DUPLICATE_RESOURCE, WARNING); - optionNames.add(CORE_JAVA_BUILD_DUPLICATE_RESOURCE); - - preferences.setDefault(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, CLEAN); - optionNames.add(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER); - - // JavaCore settings - preferences.setDefault(CORE_JAVA_BUILD_ORDER, IGNORE); - optionNames.add(CORE_JAVA_BUILD_ORDER); - - preferences.setDefault(CORE_CIRCULAR_CLASSPATH, ERROR); - optionNames.add(CORE_CIRCULAR_CLASSPATH); - - preferences.setDefault(CORE_INCOMPLETE_CLASSPATH, ERROR); - optionNames.add(CORE_INCOMPLETE_CLASSPATH); - - preferences.setDefault(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, ENABLED); - optionNames.add(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS); - - preferences.setDefault(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS, ENABLED); - optionNames.add(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS); - - // encoding setting comes from resource plug-in - optionNames.add(CORE_ENCODING); - - // Formatter settings - preferences.setDefault(FORMATTER_NEWLINE_OPENING_BRACE, DO_NOT_INSERT); - optionNames.add(FORMATTER_NEWLINE_OPENING_BRACE); - - preferences.setDefault(FORMATTER_NEWLINE_CONTROL, DO_NOT_INSERT); - optionNames.add(FORMATTER_NEWLINE_CONTROL); - - preferences.setDefault(FORMATTER_CLEAR_BLANK_LINES, PRESERVE_ONE); - optionNames.add(FORMATTER_CLEAR_BLANK_LINES); - - preferences.setDefault(FORMATTER_NEWLINE_ELSE_IF, DO_NOT_INSERT); - optionNames.add(FORMATTER_NEWLINE_ELSE_IF); - - preferences.setDefault(FORMATTER_NEWLINE_EMPTY_BLOCK, INSERT); - optionNames.add(FORMATTER_NEWLINE_EMPTY_BLOCK); - - preferences.setDefault(FORMATTER_LINE_SPLIT, "80"); //$NON-NLS-1$ - optionNames.add(FORMATTER_LINE_SPLIT); - - preferences.setDefault(FORMATTER_COMPACT_ASSIGNMENT, NORMAL); - optionNames.add(FORMATTER_COMPACT_ASSIGNMENT); - - preferences.setDefault(FORMATTER_TAB_CHAR, TAB); - optionNames.add(FORMATTER_TAB_CHAR); - - preferences.setDefault(FORMATTER_TAB_SIZE, "4"); //$NON-NLS-1$ - optionNames.add(FORMATTER_TAB_SIZE); - - preferences.setDefault(FORMATTER_SPACE_CASTEXPRESSION, INSERT); //$NON-NLS-1$ - optionNames.add(FORMATTER_SPACE_CASTEXPRESSION); - - // CodeAssist settings - preferences.setDefault(CODEASSIST_VISIBILITY_CHECK, DISABLED); //$NON-NLS-1$ - optionNames.add(CODEASSIST_VISIBILITY_CHECK); - - preferences.setDefault(CODEASSIST_IMPLICIT_QUALIFICATION, DISABLED); //$NON-NLS-1$ - optionNames.add(CODEASSIST_IMPLICIT_QUALIFICATION); - - preferences.setDefault(CODEASSIST_FIELD_PREFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_FIELD_PREFIXES); - - preferences.setDefault(CODEASSIST_STATIC_FIELD_PREFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_STATIC_FIELD_PREFIXES); - - preferences.setDefault(CODEASSIST_LOCAL_PREFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_LOCAL_PREFIXES); - - preferences.setDefault(CODEASSIST_ARGUMENT_PREFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_ARGUMENT_PREFIXES); - - preferences.setDefault(CODEASSIST_FIELD_SUFFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_FIELD_SUFFIXES); - - preferences.setDefault(CODEASSIST_STATIC_FIELD_SUFFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_STATIC_FIELD_SUFFIXES); - - preferences.setDefault(CODEASSIST_LOCAL_SUFFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_LOCAL_SUFFIXES); - - preferences.setDefault(CODEASSIST_ARGUMENT_SUFFIXES, ""); //$NON-NLS-1$ - optionNames.add(CODEASSIST_ARGUMENT_SUFFIXES); -} - -/** - * Returns whether the given marker references the given Java element. - * Used for markers, which denote a Java element rather than a resource. - * - * @param element the element - * @param marker the marker - * @return true if the marker references the element, false otherwise - * @exception CoreException if the IMarker.getAttribute on the marker fails - */ -public static boolean isReferencedBy(IJavaElement element, IMarker marker) throws CoreException { - - // only match units or classfiles - if (element instanceof IMember){ - IMember member = (IMember) element; - if (member.isBinary()){ - element = null; //member.getClassFile(); - } else { - element = member.getCompilationUnit(); - } - } - if (element == null) return false; - if (marker == null) return false; - - String markerHandleId = (String)marker.getAttribute(ATT_HANDLE_ID); - if (markerHandleId == null) return false; - - IJavaElement markerElement = PHPCore.create(markerHandleId); -// while (true){ - if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs. - - // cycle through enclosing types in case marker is associated with a classfile (15568) -// if (markerElement instanceof IClassFile){ -// IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType(); -// if (enclosingType != null){ -// markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile -// continue; -// } -// } -// break; -// } - return false; -} - -/** - * Returns whether the given marker delta references the given Java element. - * Used for markers deltas, which denote a Java element rather than a resource. - * - * @param element the element - * @param markerDelta the marker delta - * @return true if the marker delta references the element - * @exception CoreException if the IMarkerDelta.getAttribute on the marker delta fails - */ -public static boolean isReferencedBy(IJavaElement element, IMarkerDelta markerDelta) throws CoreException { - - // only match units or classfiles - if (element instanceof IMember){ - IMember member = (IMember) element; - if (member.isBinary()){ - element = null; //member.getClassFile(); - } else { - element = member.getCompilationUnit(); - } - } - if (element == null) return false; - if (markerDelta == null) return false; - - String markerDeltarHandleId = (String)markerDelta.getAttribute(ATT_HANDLE_ID); - if (markerDeltarHandleId == null) return false; - - IJavaElement markerElement = PHPCore.create(markerDeltarHandleId); -// while (true){ - if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs. - - // cycle through enclosing types in case marker is associated with a classfile (15568) -// if (markerElement instanceof IClassFile){ -// IType enclosingType = ((IClassFile)markerElement).getType().getDeclaringType(); -// if (enclosingType != null){ -// markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile -// continue; -// } -// } -// break; -// } - return false; -} - -/** - * Creates and returns a new classpath entry of kind CPE_CONTAINER - * for the given path. The path of the container will be used during resolution so as to map this - * container entry to a set of other classpath entries the container is acting for. - *

- * A container entry allows to express indirect references to a set of libraries, projects and variable entries, - * which can be interpreted differently for each Java project where it is used. - * A classpath container entry can be resolved using JavaCore.getResolvedClasspathContainer, - * and updated with JavaCore.classpathContainerChanged - *

- * A container is exclusively resolved by a ClasspathContainerInitializer registered onto the - * extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * A container path must be formed of at least one segment, where:

    - *
  • the first segment is a unique ID identifying the target container, there must be a container initializer registered - * onto this ID through the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
  • - *
  • the remaining segments will be passed onto the initializer, and can be used as additional - * hints during the initialization phase.
  • - *
- *

- * Example of an ClasspathContainerInitializer for a classpath container denoting a default JDK container: - * - * containerEntry = JavaCore.newContainerEntry(new Path("MyProvidedJDK/default")); - * - * - * - *

- * Note that this operation does not attempt to validate classpath containers - * or access the resources at the given paths. - *

- * The resulting entry is not exported to dependent projects. This method is equivalent to - * newContainerEntry(-,false). - *

- * @param containerPath the path identifying the container, it must be formed of two - * segments - * @return a new container classpath entry - * - * @see JavaCore#getClasspathContainer(IPath, IJavaProject) - * @see JavaCore#newContainerEntry(IPath, boolean) - * @since 2.0 - */ -public static IClasspathEntry newContainerEntry(IPath containerPath) { - - return newContainerEntry(containerPath, false); -} - -/** - * Creates and returns a new classpath entry of kind CPE_CONTAINER - * for the given path. The path of the container will be used during resolution so as to map this - * container entry to a set of other classpath entries the container is acting for. - *

- * A container entry allows to express indirect references to a set of libraries, projects and variable entries, - * which can be interpreted differently for each Java project where it is used. - * A classpath container entry can be resolved using JavaCore.getResolvedClasspathContainer, - * and updated with JavaCore.classpathContainerChanged - *

- * A container is exclusively resolved by a ClasspathContainerInitializer registered onto the - * extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * A container path must be formed of at least one segment, where:

    - *
  • the first segment is a unique ID identifying the target container, there must be a container initializer registered - * onto this ID through the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
  • - *
  • the remaining segments will be passed onto the initializer, and can be used as additional - * hints during the initialization phase.
  • - *
- *

- * Example of an ClasspathContainerInitializer for a classpath container denoting a default JDK container: - * - * containerEntry = JavaCore.newContainerEntry(new Path("MyProvidedJDK/default")); - * - * - * - *

- * Note that this operation does not attempt to validate classpath containers - * or access the resources at the given paths. - *

- * @param containerPath the path identifying the container, it must be formed of at least - * one segment (ID+hints) - * @param isExported a boolean indicating whether this entry is contributed to dependent - * projects in addition to the output location - * @return a new container classpath entry - * - * @see JavaCore#getClasspathContainer(IPath, IJavaProject) - * @see JavaCore#setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor) - * @see JavaCore#newContainerEntry(IPath, boolean) - * @since 2.0 - */ -public static IClasspathEntry newContainerEntry(IPath containerPath, boolean isExported) { - - if (containerPath == null || containerPath.segmentCount() < 1) { - Assert.isTrue( - false, - "Illegal classpath container path: \'" + containerPath.makeRelative().toString() + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$//$NON-NLS-2$ - } - return new ClasspathEntry( - IPackageFragmentRoot.K_SOURCE, - IClasspathEntry.CPE_CONTAINER, - containerPath, - ClasspathEntry.NO_EXCLUSION_PATTERNS, - null, // source attachment - null, // source attachment root - null, // specific output folder - isExported); -} - -/** - * Creates and returns a new non-exported classpath entry of kind CPE_LIBRARY for the - * JAR or folder identified by the given absolute path. This specifies that all package fragments - * within the root will have children of type IClassFile. - *

- * A library entry is used to denote a prerequisite JAR or root folder containing binaries. - * The target JAR or folder can either be defined internally to the workspace (absolute path relative - * to the workspace root) or externally to the workspace (absolute path in the file system). - *

- * e.g. Here are some examples of binary path usage

    - *
  • "c:/jdk1.2.2/jre/lib/rt.jar" - reference to an external JAR
  • - *
  • "/Project/someLib.jar" - reference to an internal JAR
  • - *
  • "c:/classes/" - reference to an external binary folder
  • - *
- * Note that this operation does not attempt to validate or access the - * resources at the given paths. - *

- * The resulting entry is not exported to dependent projects. This method is equivalent to - * newLibraryEntry(-,-,-,false). - *

- * - * @param path the absolute path of the binary archive - * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder, - * or null if none - * @param sourceAttachmentRootPath the location of the root within the source archive or folder - * or null if this location should be automatically detected. - * @return a new library classpath entry - * - * @see #newLibraryEntry(IPath, IPath, IPath, boolean) - */ -//public static IClasspathEntry newLibraryEntry( -// IPath path, -// IPath sourceAttachmentPath, -// IPath sourceAttachmentRootPath) { -// -// return newLibraryEntry(path, sourceAttachmentPath, sourceAttachmentRootPath, false); -//} - -/** - * Creates and returns a new classpath entry of kind CPE_LIBRARY for the JAR or folder - * identified by the given absolute path. This specifies that all package fragments within the root - * will have children of type IClassFile. - *

- * A library entry is used to denote a prerequisite JAR or root folder containing binaries. - * The target JAR or folder can either be defined internally to the workspace (absolute path relative - * to the workspace root) or externally to the workspace (absolute path in the file system). - *

- * e.g. Here are some examples of binary path usage

    - *
  • "c:/jdk1.2.2/jre/lib/rt.jar" - reference to an external JAR
  • - *
  • "/Project/someLib.jar" - reference to an internal JAR
  • - *
  • "c:/classes/" - reference to an external binary folder
  • - *
- * Note that this operation does not attempt to validate or access the - * resources at the given paths. - *

- * - * @param path the absolute path of the binary archive - * @param sourceAttachmentPath the absolute path of the corresponding source archive or folder, - * or null if none - * @param sourceAttachmentRootPath the location of the root within the source archive or folder - * or null if this location should be automatically detected. - * @param isExported indicates whether this entry is contributed to dependent - * projects in addition to the output location - * @return a new library classpath entry - * @since 2.0 - */ -//public static IClasspathEntry newLibraryEntry( -// IPath path, -// IPath sourceAttachmentPath, -// IPath sourceAttachmentRootPath, -// boolean isExported) { -// -// if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ -// -// return new ClasspathEntry( -// IPackageFragmentRoot.K_BINARY, -// IClasspathEntry.CPE_LIBRARY, -// JavaProject.canonicalizedPath(path), -// ClasspathEntry.NO_EXCLUSION_PATTERNS, -// sourceAttachmentPath, -// sourceAttachmentRootPath, -// null, // specific output folder -// isExported); -//} - -/** - * Creates and returns a new non-exported classpath entry of kind CPE_PROJECT - * for the project identified by the given absolute path. - *

- * A project entry is used to denote a prerequisite project on a classpath. - * The referenced project will be contributed as a whole, either as sources (in the Java Model, it - * contributes all its package fragment roots) or as binaries (when building, it contributes its - * whole output location). - *

- * A project reference allows to indirect through another project, independently from its internal layout. - *

- * The prerequisite project is referred to using an absolute path relative to the workspace root. - *

- * The resulting entry is not exported to dependent projects. This method is equivalent to - * newProjectEntry(_,false). - *

- * - * @param path the absolute path of the binary archive - * @return a new project classpath entry - * - * @see JavaCore#newProjectEntry(IPath, boolean) - */ -public static IClasspathEntry newProjectEntry(IPath path) { - return newProjectEntry(path, false); -} - -/** - * Creates and returns a new classpath entry of kind CPE_PROJECT - * for the project identified by the given absolute path. - *

- * A project entry is used to denote a prerequisite project on a classpath. - * The referenced project will be contributed as a whole, either as sources (in the Java Model, it - * contributes all its package fragment roots) or as binaries (when building, it contributes its - * whole output location). - *

- * A project reference allows to indirect through another project, independently from its internal layout. - *

- * The prerequisite project is referred to using an absolute path relative to the workspace root. - *

- * - * @param path the absolute path of the prerequisite project - * @param isExported indicates whether this entry is contributed to dependent - * projects in addition to the output location - * @return a new project classpath entry - * @since 2.0 - */ -public static IClasspathEntry newProjectEntry(IPath path, boolean isExported) { - - if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ - - return new ClasspathEntry( - IPackageFragmentRoot.K_SOURCE, - IClasspathEntry.CPE_PROJECT, - path, - ClasspathEntry.NO_EXCLUSION_PATTERNS, - null, // source attachment - null, // source attachment root - null, // specific output folder - isExported); -} - -/** - * Returns a new empty region. - * - * @return a new empty region - */ -public static IRegion newRegion() { - return new Region(); -} - -/** - * Creates and returns a new classpath entry of kind CPE_SOURCE - * for the project's source folder identified by the given absolute - * workspace-relative path. This specifies that all package fragments - * within the root will have children of type ICompilationUnit. - *

- * The source folder is referred to using an absolute path relative to the - * workspace root, e.g. /Project/src. A project's source - * folders are located with that project. That is, a source classpath - * entry specifying the path /P1/src is only usable for - * project P1. - *

- *

- * The source classpath entry created by this method includes all source - * files below the given workspace-relative path. To selectively exclude - * some of these source files, use the factory method - * JavaCore.newSourceEntry(IPath,IPath[]) instead. - *

- *

- * Note that all sources/binaries inside a project are contributed as a whole through - * a project entry (see JavaCore.newProjectEntry). Particular - * source entries cannot be selectively exported. - *

- * - * @param path the absolute workspace-relative path of a source folder - * @return a new source classpath entry with not exclusion patterns - * - * @see #newSourceEntry(org.eclipse.core.runtime.IPath,org.eclipse.core.runtime.IPath[]) - */ -public static IClasspathEntry newSourceEntry(IPath path) { - - return newSourceEntry(path, ClasspathEntry.NO_EXCLUSION_PATTERNS, null /*output location*/); -} - -/** - * Creates and returns a new classpath entry of kind CPE_SOURCE - * for the project's source folder identified by the given absolute - * workspace-relative path but excluding all source files with paths - * matching any of the given patterns. This specifies that all package - * fragments within the root will have children of type - * ICompilationUnit. - *

- * The source folder is referred to using an absolute path relative to the - * workspace root, e.g. /Project/src. A project's source - * folders are located with that project. That is, a source classpath - * entry specifying the path /P1/src is only usable for - * project P1. - *

- *

- * The source classpath entry created by this method includes all source - * files below the given workspace-relative path except for those matched - * by one (or more) of the given exclusion patterns. Each exclusion pattern - * is represented by a relative path, which is interpreted as relative to - * the source folder. For example, if the source folder path is - * /Project/src and the exclusion pattern is - * com/xyz/tests/**, then source files - * like /Project/src/com/xyz/Foo.java - * and /Project/src/com/xyz/utils/Bar.java would be included, - * whereas /Project/src/com/xyz/tests/T1.java - * and /Project/src/com/xyz/tests/quick/T2.java would be - * excluded. Exclusion patterns can contain can contain '**', '*' or '?' - * wildcards; see IClasspathEntry.getExclusionPatterns - * for the full description of the syntax and semantics of exclusion - * patterns. - *

- * If the empty list of exclusion patterns is specified, the source folder - * will automatically include all resources located inside the source - * folder. In that case, the result is entirely equivalent to using the - * factory method JavaCore.newSourceEntry(IPath). - *

- *

- * Note that all sources/binaries inside a project are contributed as a whole through - * a project entry (see JavaCore.newProjectEntry). Particular - * source entries cannot be selectively exported. - *

- * - * @param path the absolute workspace-relative path of a source folder - * @param exclusionPatterns the possibly empty list of exclusion patterns - * represented as relative paths - * @return a new source classpath entry with the given exclusion patterns - * @see #newSourceEntry(org.eclipse.core.runtime.IPath) - * @see IClasspathEntry#getExclusionPatterns - * - * @since 2.1 - */ -public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns) { - - return newSourceEntry(path, exclusionPatterns, null /*output location*/); -} - -/** - * Creates and returns a new classpath entry of kind CPE_SOURCE - * for the project's source folder identified by the given absolute - * workspace-relative path but excluding all source files with paths - * matching any of the given patterns, and associated with a specific output location - * (that is, ".class" files are not going to the project default output location). - * All package fragments within the root will have children of type - * ICompilationUnit. - *

- * The source folder is referred to using an absolute path relative to the - * workspace root, e.g. /Project/src. A project's source - * folders are located with that project. That is, a source classpath - * entry specifying the path /P1/src is only usable for - * project P1. - *

- *

- * The source classpath entry created by this method includes all source - * files below the given workspace-relative path except for those matched - * by one (or more) of the given exclusion patterns. Each exclusion pattern - * is represented by a relative path, which is interpreted as relative to - * the source folder. For example, if the source folder path is - * /Project/src and the exclusion pattern is - * com/xyz/tests/**, then source files - * like /Project/src/com/xyz/Foo.java - * and /Project/src/com/xyz/utils/Bar.java would be included, - * whereas /Project/src/com/xyz/tests/T1.java - * and /Project/src/com/xyz/tests/quick/T2.java would be - * excluded. Exclusion patterns can contain can contain '**', '*' or '?' - * wildcards; see IClasspathEntry.getExclusionPatterns - * for the full description of the syntax and semantics of exclusion - * patterns. - *

- * If the empty list of exclusion patterns is specified, the source folder - * will automatically include all resources located inside the source - * folder. In that case, the result is entirely equivalent to using the - * factory method JavaCore.newSourceEntry(IPath). - *

- *

- * Additionally, a source entry can be associated with a specific output location. - * By doing so, the Java builder will ensure that the generated ".class" files will - * be issued inside this output location, as opposed to be generated into the - * project default output location (when output location is null). - * Note that multiple source entries may target the same output location. - * The output location is referred to using an absolute path relative to the - * workspace root, e.g. "/Project/bin", it must be located inside - * the same project as the source folder. - *

- *

- * Also note that all sources/binaries inside a project are contributed as a whole through - * a project entry (see JavaCore.newProjectEntry). Particular - * source entries cannot be selectively exported. - *

- * - * @param path the absolute workspace-relative path of a source folder - * @param exclusionPatterns the possibly empty list of exclusion patterns - * represented as relative paths - * @param outputLocation the specific output location for this source entry (null if using project default ouput location) - * @return a new source classpath entry with the given exclusion patterns - * @see #newSourceEntry(org.eclipse.core.runtime.IPath) - * @see IClasspathEntry#getExclusionPatterns - * @see IClasspathEntry#getOutputLocation() - * - * @since 2.1 - */ -public static IClasspathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns, IPath specificOutputLocation) { - - if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ - if (exclusionPatterns == null) Assert.isTrue(false, "Exclusion pattern set cannot be null"); //$NON-NLS-1$ - - return new ClasspathEntry( - IPackageFragmentRoot.K_SOURCE, - IClasspathEntry.CPE_SOURCE, - path, - exclusionPatterns, - null, // source attachment - null, // source attachment root - specificOutputLocation, // custom output location - false); -} - -/** - * Creates and returns a new non-exported classpath entry of kind CPE_VARIABLE - * for the given path. The first segment of the path is the name of a classpath variable. - * The trailing segments of the path will be appended to resolved variable path. - *

- * A variable entry allows to express indirect references on a classpath to other projects or libraries, - * depending on what the classpath variable is referring. - *

- * It is possible to register an automatic initializer (ClasspathVariableInitializer), - * which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer". - * After resolution, a classpath variable entry may either correspond to a project or a library entry. - *

- * e.g. Here are some examples of variable path usage

    - *
  • "JDTCORE" where variable JDTCORE is - * bound to "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the library "c:\jars\jdtcore.jar"
  • - *
  • "JDTCORE" where variable JDTCORE is - * bound to "/Project_JDTCORE". The resolved classpath entry is denoting the project "/Project_JDTCORE"
  • - *
  • "PLUGINS/com.example/example.jar" where variable PLUGINS - * is bound to "c:/eclipse/plugins". The resolved classpath entry is denoting the library "c:/eclipse/plugins/com.example/example.jar"
  • - *
- * Note that this operation does not attempt to validate classpath variables - * or access the resources at the given paths. - *

- * The resulting entry is not exported to dependent projects. This method is equivalent to - * newVariableEntry(-,-,-,false). - *

- * - * @param variablePath the path of the binary archive; first segment is the - * name of a classpath variable - * @param variableSourceAttachmentPath the path of the corresponding source archive, - * or null if none; if present, the first segment is the - * name of a classpath variable (not necessarily the same variable - * as the one that begins variablePath) - * @param sourceAttachmentRootPath the location of the root within the source archive - * or null if archivePath is also null - * @return a new library classpath entry - * - * @see JavaCore#newVariableEntry(IPath, IPath, IPath, boolean) - */ -//public static IClasspathEntry newVariableEntry( -// IPath variablePath, -// IPath variableSourceAttachmentPath, -// IPath sourceAttachmentRootPath) { -// -// return newVariableEntry(variablePath, variableSourceAttachmentPath, sourceAttachmentRootPath, false); -//} - -/** - * Creates and returns a new non-exported classpath entry of kind CPE_VARIABLE - * for the given path. The first segment of the path is the name of a classpath variable. - * The trailing segments of the path will be appended to resolved variable path. - *

- * A variable entry allows to express indirect references on a classpath to other projects or libraries, - * depending on what the classpath variable is referring. - *

- * It is possible to register an automatic initializer (ClasspathVariableInitializer), - * which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer". - * After resolution, a classpath variable entry may either correspond to a project or a library entry. - *

- * e.g. Here are some examples of variable path usage

    - *
  • "JDTCORE" where variable JDTCORE is - * bound to "c:/jars/jdtcore.jar". The resolved classpath entry is denoting the library "c:\jars\jdtcore.jar"
  • - *
  • "JDTCORE" where variable JDTCORE is - * bound to "/Project_JDTCORE". The resolved classpath entry is denoting the project "/Project_JDTCORE"
  • - *
  • "PLUGINS/com.example/example.jar" where variable PLUGINS - * is bound to "c:/eclipse/plugins". The resolved classpath entry is denoting the library "c:/eclipse/plugins/com.example/example.jar"
  • - *
- * Note that this operation does not attempt to validate classpath variables - * or access the resources at the given paths. - *

- * - * @param variablePath the path of the binary archive; first segment is the - * name of a classpath variable - * @param variableSourceAttachmentPath the path of the corresponding source archive, - * or null if none; if present, the first segment is the - * name of a classpath variable (not necessarily the same variable - * as the one that begins variablePath) - * @param sourceAttachmentRootPath the location of the root within the source archive - * or null if archivePath is also null - * @param isExported indicates whether this entry is contributed to dependent - * projects in addition to the output location - * @return a new variable classpath entry - * @since 2.0 - */ -//public static IClasspathEntry newVariableEntry( -// IPath variablePath, -// IPath variableSourceAttachmentPath, -// IPath variableSourceAttachmentRootPath, -// boolean isExported) { -// -// if (variablePath == null || variablePath.segmentCount() < 1) { -// Assert.isTrue( -// false, -// "Illegal classpath variable path: \'" + variablePath.makeRelative().toString() + "\', must have at least one segment"); //$NON-NLS-1$//$NON-NLS-2$ -// } -// -// return new ClasspathEntry( -// IPackageFragmentRoot.K_SOURCE, -// IClasspathEntry.CPE_VARIABLE, -// variablePath, -// ClasspathEntry.NO_EXCLUSION_PATTERNS, -// variableSourceAttachmentPath, // source attachment -// variableSourceAttachmentRootPath, // source attachment root -// null, // specific output folder -// isExported); -//} - -/** - * Removed the given classpath variable. Does nothing if no value was - * set for this classpath variable. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * - * @param variableName the name of the classpath variable - * @see #setClasspathVariable - * - * @deprecated - use version with extra IProgressMonitor - */ -//public static void removeClasspathVariable(String variableName) { -// removeClasspathVariable(variableName, null); -//} - -/** - * Removed the given classpath variable. Does nothing if no value was - * set for this classpath variable. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * - * @param variableName the name of the classpath variable - * @param monitor the progress monitor to report progress - * @see #setClasspathVariable - */ -//public static void removeClasspathVariable( -// String variableName, -// IProgressMonitor monitor) { -// -// try { -// updateVariableValues(new String[]{ variableName}, new IPath[]{ null }, monitor); -// } catch (JavaModelException e) { -// } -//} - -/** - * Removes the given element changed listener. - * Has no affect if an identical listener is not registered. - * - * @param listener the listener - */ -public static void removeElementChangedListener(IElementChangedListener listener) { - JavaModelManager.getJavaModelManager().removeElementChangedListener(listener); -} - -/** - * Bind a container reference path to some actual containers (IClasspathContainer). - * This API must be invoked whenever changes in container need to be reflected onto the JavaModel. - * Containers can have distinct values in different projects, therefore this API considers a - * set of projects with their respective containers. - *

- * containerPath is the path under which these values can be referenced through - * container classpath entries (IClasspathEntry#CPE_CONTAINER). A container path - * is formed by a first ID segment followed with extra segments, which can be used as additional hints - * for the resolution. The container ID is used to identify a ClasspathContainerInitializer - * registered on the extension point "org.eclipse.jdt.core.classpathContainerInitializer". - *

- * There is no assumption that each individual container value passed in argument - * (respectiveContainers) must answer the exact same path when requested - * IClasspathContainer#getPath. - * Indeed, the containerPath is just an indication for resolving it to an actual container object. It can be - * delegated to a ClasspathContainerInitializer, which can be activated through the extension - * point "org.eclipse.jdt.core.ClasspathContainerInitializer"). - *

- * In reaction to changing container values, the JavaModel will be updated to reflect the new - * state of the updated container. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath container values are persisted locally to the workspace, but - * are not preserved from a session to another. It is thus highly recommended to register a - * ClasspathContainerInitializer for each referenced container - * (through the extension point "org.eclipse.jdt.core.ClasspathContainerInitializer"). - *

- * Note: setting a container to null will cause it to be lazily resolved again whenever - * its value is required. In particular, this will cause a registered initializer to be invoked - * again. - *

- * @param containerPath - the name of the container reference, which is being updated - * @param affectedProjects - the set of projects for which this container is being bound - * @param respectiveContainers - the set of respective containers for the affected projects - * @param monitor a monitor to report progress - * - * @see ClasspathContainerInitializer - * @see #getClasspathContainer(IPath, IJavaProject) - * @see IClasspathContainer - * @since 2.0 - */ -//public static void setClasspathContainer(final IPath containerPath, IJavaProject[] affectedProjects, IClasspathContainer[] respectiveContainers, IProgressMonitor monitor) throws JavaModelException { -// -// if (affectedProjects.length != respectiveContainers.length) Assert.isTrue(false, "Projects and containers collections should have the same size"); //$NON-NLS-1$ -// -// if (monitor != null && monitor.isCanceled()) return; -// -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPContainer SET - setting container: ["+containerPath+"] for projects: {" //$NON-NLS-1$ //$NON-NLS-2$ -// + (Util.toString(affectedProjects, -// new Util.Displayable(){ -// public String displayString(Object o) { return ((IJavaProject) o).getElementName(); } -// })) -// + "} with values: " //$NON-NLS-1$ -// + (Util.toString(respectiveContainers, -// new Util.Displayable(){ -// public String displayString(Object o) { return ((IClasspathContainer) o).getDescription(); } -// })) -// ); -// } -// -// final int projectLength = affectedProjects.length; -// final IJavaProject[] modifiedProjects; -// System.arraycopy(affectedProjects, 0, modifiedProjects = new IJavaProject[projectLength], 0, projectLength); -// final IClasspathEntry[][] oldResolvedPaths = new IClasspathEntry[projectLength][]; -// -// // filter out unmodified project containers -// int remaining = 0; -// for (int i = 0; i < projectLength; i++){ -// -// if (monitor != null && monitor.isCanceled()) return; -// -// IJavaProject affectedProject = affectedProjects[i]; -// IClasspathContainer newContainer = respectiveContainers[i]; -// if (newContainer == null) newContainer = JavaModelManager.ContainerInitializationInProgress; // 30920 - prevent infinite loop -// boolean found = false; -// if (JavaProject.hasJavaNature(affectedProject.getProject())){ -// IClasspathEntry[] rawClasspath = affectedProject.getRawClasspath(); -// for (int j = 0, cpLength = rawClasspath.length; j - * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * - * @param variableName the name of the classpath variable - * @param path the path - * @see #getClasspathVariable - * - * @deprecated - use API with IProgressMonitor - */ -//public static void setClasspathVariable(String variableName, IPath path) -// throws JavaModelException { -// -// setClasspathVariable(variableName, path, null); -//} - -/** - * Sets the value of the given classpath variable. - * The path must not be null. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * Updating a variable with the same value has no effect. - * - * @param variableName the name of the classpath variable - * @param path the path - * @param monitor a monitor to report progress - * @see #getClasspathVariable - */ -//public static void setClasspathVariable( -// String variableName, -// IPath path, -// IProgressMonitor monitor) -// throws JavaModelException { -// -// if (path == null) Assert.isTrue(false, "Variable path cannot be null"); //$NON-NLS-1$ -// setClasspathVariables(new String[]{variableName}, new IPath[]{ path }, monitor); -//} - -/** - * Sets the values of all the given classpath variables at once. - * Null paths can be used to request corresponding variable removal. - *

- * This functionality cannot be used while the resource tree is locked. - *

- * Classpath variable values are persisted locally to the workspace, and - * are preserved from session to session. - *

- * Updating a variable with the same value has no effect. - * - * @param variableNames an array of names for the updated classpath variables - * @param paths an array of path updates for the modified classpath variables (null - * meaning that the corresponding value will be removed - * @param monitor a monitor to report progress - * @see #getClasspathVariable - * @since 2.0 - */ -//public static void setClasspathVariables( -// String[] variableNames, -// IPath[] paths, -// IProgressMonitor monitor) -// throws JavaModelException { -// -// if (variableNames.length != paths.length) Assert.isTrue(false, "Variable names and paths collections should have the same size"); //$NON-NLS-1$ -// //TODO: should check that null cannot be used as variable paths -// updateVariableValues(variableNames, paths, monitor); -//} - -/* (non-Javadoc) - * Method declared on IExecutableExtension. - * Record any necessary initialization data from the plugin. - */ -public void setInitializationData( - IConfigurationElement cfig, - String propertyName, - Object data) - throws CoreException { -} - -/** - * Sets the current table of options. All and only the options explicitly included in the given table - * are remembered; all previous option settings are forgotten, including ones not explicitly - * mentioned. - *

- * For a complete description of the configurable options, see getDefaultOptions. - *

- * - * @param newOptions the new options (key type: String; value type: String), - * or null to reset all options to their default values - * @see JavaCore#getDefaultOptions - */ -public static void setOptions(Hashtable newOptions) { - - // see #initializeDefaultPluginPreferences() for changing default settings - Preferences preferences = getPlugin().getPluginPreferences(); - - if (newOptions == null){ - newOptions = PHPCore.getDefaultOptions(); - } - Enumeration keys = newOptions.keys(); - while (keys.hasMoreElements()){ - String key = (String)keys.nextElement(); - if (!JavaModelManager.OptionNames.contains(key)) continue; // unrecognized option - if (key.equals(CORE_ENCODING)) continue; // skipped, contributed by resource prefs - String value = (String)newOptions.get(key); - preferences.setValue(key, value); - } - - // persist options - getPlugin().savePluginPreferences(); -} - -/** - * Shutdown the JavaCore plug-in. - *

- * De-registers the JavaModelManager as a resource changed listener and save participant. - *

- * @see org.eclipse.core.runtime.Plugin#shutdown() - */ -public void shutdown() { - - //savePluginPreferences(); - getPlugin().savePluginPreferences(); - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - workspace.removeResourceChangeListener(JavaModelManager.getJavaModelManager().deltaProcessor); - workspace.removeSaveParticipant(PHPeclipsePlugin.getDefault()); - - ((JavaModelManager) JavaModelManager.getJavaModelManager()).shutdown(); -} - -/** - * Initiate the background indexing process. - * This should be deferred after the plugin activation. - */ -//private void startIndexing() { -// -// JavaModelManager.getJavaModelManager().getIndexManager().reset(); -//} - -/** - * Startup of the JavaCore plug-in. - *

- * Registers the JavaModelManager as a resource changed listener and save participant. - * Starts the background indexing, and restore saved classpath variable values. - *

- * @see org.eclipse.core.runtime.Plugin#startup() - */ -public void startup() { - - JavaModelManager manager = JavaModelManager.getJavaModelManager(); - try { - manager.configurePluginDebugOptions(); - - // request state folder creation (workaround 19885) - PHPCore.getPlugin().getStateLocation(); - - // retrieve variable values - PHPCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new JavaModelManager.PluginPreferencesListener()); -// TODO khartlage temp-del -// manager.loadVariablesAndContainers(); - - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - workspace.addResourceChangeListener( - manager.deltaProcessor, - IResourceChangeEvent.PRE_AUTO_BUILD - | IResourceChangeEvent.POST_AUTO_BUILD - | IResourceChangeEvent.POST_CHANGE - | IResourceChangeEvent.PRE_DELETE - | IResourceChangeEvent.PRE_CLOSE); - -// startIndexing(); - workspace.addSaveParticipant(PHPeclipsePlugin.getDefault(), manager); - - } catch (CoreException e) { - } catch (RuntimeException e) { - manager.shutdown(); - throw e; - } -} - - -/** - * Internal updating of a variable values (null path meaning removal), allowing to change multiple variable values at once. - */ -//private static void updateVariableValues( -// String[] variableNames, -// IPath[] variablePaths, -// IProgressMonitor monitor) throws JavaModelException { -// -// if (monitor != null && monitor.isCanceled()) return; -// -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable SET - setting variables: {" + Util.toString(variableNames) //$NON-NLS-1$ -// + "} with values: " + Util.toString(variablePaths)); //$NON-NLS-1$ -// } -// -// int varLength = variableNames.length; -// -// // gather classpath information for updating -// final HashMap affectedProjects = new HashMap(5); -// JavaModelManager manager = JavaModelManager.getJavaModelManager(); -// IJavaModel model = manager.getJavaModel(); -// -// // filter out unmodified variables -// int discardCount = 0; -// for (int i = 0; i < varLength; i++){ -// String variableName = variableNames[i]; -// IPath oldPath = (IPath)JavaModelManager.variableGet(variableName); // if reentering will provide previous session value -// if (oldPath == JavaModelManager.VariableInitializationInProgress){ -// IPath previousPath = (IPath)JavaModelManager.PreviousSessionVariables.get(variableName); -// if (previousPath != null){ -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable INIT - reentering access to variable: " + variableName+ " during its initialization, will see previous value: "+ previousPath); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// JavaModelManager.variablePut(variableName, previousPath); // replace value so reentering calls are seeing old value -// } -// oldPath = null; //33695 - cannot filter out restored variable, must update affected project to reset cached CP -// } -// if (oldPath != null && oldPath.equals(variablePaths[i])){ -// variableNames[i] = null; -// discardCount++; -// } -// } -// if (discardCount > 0){ -// if (discardCount == varLength) return; -// int changedLength = varLength - discardCount; -// String[] changedVariableNames = new String[changedLength]; -// IPath[] changedVariablePaths = new IPath[changedLength]; -// for (int i = 0, index = 0; i < varLength; i++){ -// if (variableNames[i] != null){ -// changedVariableNames[index] = variableNames[i]; -// changedVariablePaths[index] = variablePaths[i]; -// index++; -// } -// } -// variableNames = changedVariableNames; -// variablePaths = changedVariablePaths; -// varLength = changedLength; -// } -// -// if (monitor != null && monitor.isCanceled()) return; -// -// if (model != null) { -// IJavaProject[] projects = model.getJavaProjects(); -// nextProject : for (int i = 0, projectLength = projects.length; i < projectLength; i++){ -// IJavaProject project = projects[i]; -// -// // check to see if any of the modified variables is present on the classpath -// IClasspathEntry[] classpath = project.getRawClasspath(); -// for (int j = 0, cpLength = classpath.length; j < cpLength; j++){ -// -// IClasspathEntry entry = classpath[j]; -// for (int k = 0; k < varLength; k++){ -// -// String variableName = variableNames[k]; -// if (entry.getEntryKind() == IClasspathEntry.CPE_VARIABLE){ -// -// if (variableName.equals(entry.getPath().segment(0))){ -// affectedProjects.put(project, project.getResolvedClasspath(true)); -// continue nextProject; -// } -// IPath sourcePath, sourceRootPath; -// if (((sourcePath = entry.getSourceAttachmentPath()) != null && variableName.equals(sourcePath.segment(0))) -// || ((sourceRootPath = entry.getSourceAttachmentRootPath()) != null && variableName.equals(sourceRootPath.segment(0)))) { -// -// affectedProjects.put(project, project.getResolvedClasspath(true)); -// continue nextProject; -// } -// } -// } -// } -// } -// } -// // update variables -// for (int i = 0; i < varLength; i++){ -// JavaModelManager.variablePut(variableNames[i], variablePaths[i]); -// } -// final String[] dbgVariableNames = variableNames; -// -// // update affected project classpaths -// if (!affectedProjects.isEmpty()) { -// try { -// JavaCore_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt_DeleteIt.run( -// new IWorkspaceRunnable() { -// public void run(IProgressMonitor monitor) throws CoreException { -// // propagate classpath change -// Iterator projectsToUpdate = affectedProjects.keySet().iterator(); -// while (projectsToUpdate.hasNext()) { -// -// if (monitor != null && monitor.isCanceled()) return; -// -// JavaProject project = (JavaProject) projectsToUpdate.next(); -// -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable SET - updating affected project: ["+project.getElementName()+"] due to setting variables: "+ Util.toString(dbgVariableNames)); //$NON-NLS-1$ //$NON-NLS-2$ -// } -// -// project -// .setRawClasspath( -// project.getRawClasspath(), -// SetClasspathOperation.ReuseOutputLocation, -// null, // don't call beginTask on the monitor (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=3717) -// !ResourcesPlugin.getWorkspace().isTreeLocked(), // can change resources -// (IClasspathEntry[]) affectedProjects.get(project), -// false, // updating - no validation -// false); // updating - no need to save -// } -// } -// }, -// monitor); -// } catch (CoreException e) { -// if (JavaModelManager.CP_RESOLVE_VERBOSE){ -// System.out.println("CPVariable SET - FAILED DUE TO EXCEPTION: "+Util.toString(dbgVariableNames)); //$NON-NLS-1$ -// e.printStackTrace(); -// } -// if (e instanceof JavaModelException) { -// throw (JavaModelException)e; -// } else { -// throw new JavaModelException(e); -// } -// } -// } -//} -} \ No newline at end of file diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java index 735cda1..4511487 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java @@ -1,16 +1,15 @@ /********************************************************************** -Copyright (c) 2000, 2002 IBM Corp. and others. -All rights reserved. This program and the accompanying materials -are made available under the terms of the Common Public License v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/cpl-v10.html - -Contributors: - IBM Corporation - Initial implementation - Klaus Hartlage - www.eclipseproject.de -**********************************************************************/ + Copyright (c) 2000, 2002 IBM Corp. and others. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Common Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/cpl-v10.html + + Contributors: + IBM Corporation - Initial implementation + Klaus Hartlage - www.eclipseproject.de + **********************************************************************/ package net.sourceforge.phpeclipse; - import java.io.File; import java.util.ArrayList; import java.util.Collection; @@ -19,10 +18,11 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; - +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.externaltools.internal.model.ColorManager; import net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsPlugin; import net.sourceforge.phpdt.externaltools.internal.model.VariableContextManager; +import net.sourceforge.phpdt.internal.core.JavaModelManager; import net.sourceforge.phpdt.internal.ui.preferences.MembersOrderPreferenceCache; import net.sourceforge.phpdt.internal.ui.preferences.TemplatePreferencePage; import net.sourceforge.phpdt.internal.ui.text.java.hover.JavaEditorTextHoverDescriptor; @@ -43,11 +43,11 @@ import net.sourceforge.phpeclipse.phpeditor.util.PHPColorProvider; import net.sourceforge.phpeclipse.resourcesview.PHPElement; import net.sourceforge.phpeclipse.resourcesview.PHPElementAdapterFactory; import net.sourceforge.phpeclipse.resourcesview.ResourceAdapterFactory; - import org.eclipse.core.boot.BootLoader; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceChangeEvent; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; @@ -79,85 +79,66 @@ import org.eclipse.ui.ide.IDE; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.ui.texteditor.IDocumentProvider; import org.eclipse.ui.texteditor.ITextEditor; - /** * The main plugin class to be used in the desktop. */ -public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceConstants { +public class PHPeclipsePlugin extends AbstractUIPlugin + implements + IPreferenceConstants { /** * The id of the PHP plugin (value "net.sourceforge.phpeclipse"). */ public static final String PLUGIN_ID = "net.sourceforge.phpeclipse"; //$NON-NLS-1$ - - /** - * id of builder - matches plugin.xml (concatenate pluginid.builderid) + /** + * id of builder - matches plugin.xml (concatenate pluginid.builderid) */ public static final String BUILDER_PARSER_ID = PLUGIN_ID + ".parserbuilder"; //public static final String BUILDER_INDEX_ID = PLUGIN_ID + ".indexbuilder"; - - /** General debug flag*/ + /** General debug flag */ public static final boolean DEBUG = false; - /** * The maximum number of allowed proposals by category */ public final static int MAX_PROPOSALS = 200; - private static ExternalToolsPlugin externalTools; - /** - * The Java virtual machine that we are running on. - */ + * The Java virtual machine that we are running on. + */ private static int jvm; - /** MRJ 2.0 */ private static final int MRJ_2_0 = 0; - /** MRJ 2.1 or later */ private static final int MRJ_2_1 = 1; - /** Java on Mac OS X 10.0 (MRJ 3.0) */ private static final int MRJ_3_0 = 3; - /** MRJ 3.1 */ private static final int MRJ_3_1 = 4; - /** JVM constant for any other platform */ private static final int OTHER = -1; - - // public static final String PHP_RESOURCES_VIEW_ID = PLUGIN_ID + ".resourcesview.ViewPHPResources"; //$NON-NLS-1$ - public static final String PHP_CODING_ACTION_SET_ID = PLUGIN_ID + ".ui.CodingActionSet"; //$NON-NLS-1$ + // public static final String PHP_RESOURCES_VIEW_ID = PLUGIN_ID + + // ".resourcesview.ViewPHPResources"; //$NON-NLS-1$ + public static final String PHP_CODING_ACTION_SET_ID = PLUGIN_ID + + ".ui.CodingActionSet"; //$NON-NLS-1$ public final static String PHP_NATURE_ID = PLUGIN_ID + ".phpnature"; - public static final String PHPPARSER_ORIGINAL = "net.sourceforge.phpdt.internal.compiler.parser.Parser"; - public static final String PHPPARSER_NEW = "test.PHPParser"; - /** Change this if you want to switch PHP Parser. */ public static final String PHPPARSER = PHPPARSER_ORIGINAL; - //The shared instance. private static PHPeclipsePlugin plugin; - - /** Windows 9x */ + /** Windows 9x */ private static final int WINDOWS_9x = 6; - - /** Windows NT */ + /** Windows NT */ private static final int WINDOWS_NT = 5; - private ImageDescriptorRegistry fImageDescriptorRegistry; private HashMap fIndexManagerMap = new HashMap(); - private IWorkingCopyManager fWorkingCopyManager; private PHPDocumentProvider fCompilationUnitDocumentProvider; private JavaTextTools fJavaTextTools; private ProblemMarkerManager fProblemMarkerManager; - private MembersOrderPreferenceCache fMembersOrderPreferenceCache; - + private MembersOrderPreferenceCache fMembersOrderPreferenceCache; private IFile fLastEditorFile = null; - - private JavaEditorTextHoverDescriptor[] fJavaEditorTextHoverDescriptors; - + private JavaEditorTextHoverDescriptor[] fJavaEditorTextHoverDescriptors; /** * The constructor. */ @@ -167,69 +148,68 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon setJVM(); externalTools = new ExternalToolsPlugin(); // try { - // resourceBundle = ResourceBundle.getBundle("net.sourceforge.PHPeclipsePluginResources"); + // resourceBundle = + // ResourceBundle.getBundle("net.sourceforge.PHPeclipsePluginResources"); // } catch (MissingResourceException x) { // resourceBundle = null; // } } - /** - * Returns all Java editor text hovers contributed to the workbench. - * - * @return an array of JavaEditorTextHoverDescriptor - * @since 2.1 - */ - public JavaEditorTextHoverDescriptor[] getJavaEditorTextHoverDescriptors() { - if (fJavaEditorTextHoverDescriptors == null) - fJavaEditorTextHoverDescriptors= JavaEditorTextHoverDescriptor.getContributedHovers(); - return fJavaEditorTextHoverDescriptors; - } - - /** - * Resets the Java editor text hovers contributed to the workbench. - *

- * This will force a rebuild of the descriptors the next time - * a client asks for them. - *

- * - * @return an array of JavaEditorTextHoverDescriptor - * @since 2.1 - */ - public void resetJavaEditorTextHoverDescriptors() { - fJavaEditorTextHoverDescriptors= null; - } - /** - * Creates the PHP plugin standard groups in a context menu. - */ - public static void createStandardGroups(IMenuManager menu) { - if (!menu.isEmpty()) - return; - - menu.add(new Separator(IContextMenuConstants.GROUP_NEW)); - menu.add(new GroupMarker(IContextMenuConstants.GROUP_GOTO)); - menu.add(new Separator(IContextMenuConstants.GROUP_OPEN)); - menu.add(new GroupMarker(IContextMenuConstants.GROUP_SHOW)); - menu.add(new Separator(IContextMenuConstants.GROUP_REORGANIZE)); - menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE)); - menu.add(new Separator(IContextMenuConstants.GROUP_SEARCH)); - menu.add(new Separator(IContextMenuConstants.GROUP_BUILD)); - menu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS)); - menu.add(new Separator(IContextMenuConstants.GROUP_VIEWER_SETUP)); - menu.add(new Separator(IContextMenuConstants.GROUP_PROPERTIES)); - } + /** + * Returns all Java editor text hovers contributed to the workbench. + * + * @return an array of JavaEditorTextHoverDescriptor + * @since 2.1 + */ + public JavaEditorTextHoverDescriptor[] getJavaEditorTextHoverDescriptors() { + if (fJavaEditorTextHoverDescriptors == null) + fJavaEditorTextHoverDescriptors = JavaEditorTextHoverDescriptor + .getContributedHovers(); + return fJavaEditorTextHoverDescriptors; + } + /** + * Resets the Java editor text hovers contributed to the workbench. + *

+ * This will force a rebuild of the descriptors the next time a client asks + * for them. + *

+ * + * @return an array of JavaEditorTextHoverDescriptor + * @since 2.1 + */ + public void resetJavaEditorTextHoverDescriptors() { + fJavaEditorTextHoverDescriptors = null; + } + /** + * Creates the PHP plugin standard groups in a context menu. + */ + public static void createStandardGroups(IMenuManager menu) { + if (!menu.isEmpty()) + return; + menu.add(new Separator(IContextMenuConstants.GROUP_NEW)); + menu.add(new GroupMarker(IContextMenuConstants.GROUP_GOTO)); + menu.add(new Separator(IContextMenuConstants.GROUP_OPEN)); + menu.add(new GroupMarker(IContextMenuConstants.GROUP_SHOW)); + menu.add(new Separator(IContextMenuConstants.GROUP_REORGANIZE)); + menu.add(new Separator(IContextMenuConstants.GROUP_GENERATE)); + menu.add(new Separator(IContextMenuConstants.GROUP_SEARCH)); + menu.add(new Separator(IContextMenuConstants.GROUP_BUILD)); + menu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS)); + menu.add(new Separator(IContextMenuConstants.GROUP_VIEWER_SETUP)); + menu.add(new Separator(IContextMenuConstants.GROUP_PROPERTIES)); + } public static IWorkbenchPage getActivePage() { return getDefault().internalGetActivePage(); } - public static Shell getActiveWorkbenchShell() { return getActiveWorkbenchWindow().getShell(); } - /** - * Returns an array of all editors that have an unsaved content. If the identical content is - * presented in more than one editor, only one of those editor parts is part of the result. - * - * @return an array of all dirty editor parts. - */ + * Returns an array of all editors that have an unsaved content. If the + * identical content is presented in more than one editor, only one of those + * editor parts is part of the result. + * + * @return an array of all dirty editor parts. + */ public static IEditorPart[] getDirtyEditors() { Set inputs = new HashSet(); List result = new ArrayList(0); @@ -251,7 +231,6 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon } return (IEditorPart[]) result.toArray(new IEditorPart[result.size()]); } - public static IWorkbenchWindow getActiveWorkbenchWindow() { return getDefault().getWorkbench().getActiveWorkbenchWindow(); } @@ -261,26 +240,22 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon public static PHPeclipsePlugin getDefault() { return plugin; } - public static ImageDescriptorRegistry getImageDescriptorRegistry() { return getDefault().internalGetImageDescriptorRegistry(); } - static IPath getInstallLocation() { return new Path(getDefault().getDescriptor().getInstallURL().getFile()); } public static int getJVM() { return jvm; } - public static String getPluginId() { return getDefault().getDescriptor().getUniqueIdentifier(); } - /** - * Returns the standard display to be used. The method first checks, if - * the thread calling this method has an associated display. If so, this - * display is returned. Otherwise the method returns the default display. + * Returns the standard display to be used. The method first checks, if the + * thread calling this method has an associated display. If so, this display + * is returned. Otherwise the method returns the default display. */ public static Display getStandardDisplay() { Display display = Display.getCurrent(); @@ -289,7 +264,6 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon } return display; } - // public static ExternalToolsPlugin getExternalTools() { // return externalTools; // } @@ -299,13 +273,12 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon public static IWorkspace getWorkspace() { return ResourcesPlugin.getWorkspace(); } - public static boolean isDebug() { return getDefault().isDebugging(); } - // public static void logErrorMessage(String message) { - // log(new Status(IStatus.ERROR, getPluginId(), JavaStatusConstants.INTERNAL_ERROR, message, null)); + // log(new Status(IStatus.ERROR, getPluginId(), + // JavaStatusConstants.INTERNAL_ERROR, message, null)); // } // // public static void logErrorStatus(String message, IStatus status) { @@ -313,38 +286,36 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon // logErrorMessage(message); // return; // } - // MultiStatus multi= new MultiStatus(getPluginId(), JavaStatusConstants.INTERNAL_ERROR, message, null); + // MultiStatus multi= new MultiStatus(getPluginId(), + // JavaStatusConstants.INTERNAL_ERROR, message, null); // multi.add(status); // log(multi); // } // // public static void log(Throwable e) { - // log(new Status(IStatus.ERROR, getPluginId(), JavaStatusConstants.INTERNAL_ERROR, JavaUIMessages.getString("JavaPlugin.internal_error"), e)); //$NON-NLS-1$ + // log(new Status(IStatus.ERROR, getPluginId(), + // JavaStatusConstants.INTERNAL_ERROR, + // JavaUIMessages.getString("JavaPlugin.internal_error"), e)); //$NON-NLS-1$ // } - public static void log(int severity, String message) { Status status = new Status(severity, PLUGIN_ID, IStatus.OK, message, null); log(status); } - public static void log(IStatus status) { getDefault().getLog().log(status); } public static void log(Throwable e) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "PHPeclipsePlugin.internalErrorOccurred", e)); //$NON-NLS-1$ + log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, + "PHPeclipsePlugin.internalErrorOccurred", e)); //$NON-NLS-1$ } - private static void setJVM() { String osName = System.getProperty("os.name"); - if (osName.startsWith("Mac OS")) { String mrjVersion = System.getProperty("mrj.version"); String majorMRJVersion = mrjVersion.substring(0, 3); jvm = OTHER; try { - double version = Double.valueOf(majorMRJVersion).doubleValue(); - if (version == 2) { jvm = MRJ_2_0; } else if (version >= 2.1 && version < 3) { @@ -354,11 +325,8 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon } else if (version >= 3.1) { jvm = MRJ_3_1; } - } catch (NumberFormatException nfe) { - } - } else if (osName.startsWith("Windows")) { if (osName.indexOf("9") != -1) { jvm = WINDOWS_9x; @@ -367,30 +335,30 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon } } } - // TODO: refactor this into a better method name ! public synchronized PHPDocumentProvider getCompilationUnitDocumentProvider() { if (fCompilationUnitDocumentProvider == null) fCompilationUnitDocumentProvider = new PHPDocumentProvider(); return fCompilationUnitDocumentProvider; } - /** * Get the identifier index manager for the given project * - * @param iProject the current project + * @param iProject + * the current project * @return */ public IdentifierIndexManager getIndexManager(IProject iProject) { - String indexFilename = iProject.getLocation() + File.separator + "project.index"; - IdentifierIndexManager indexManager = (IdentifierIndexManager) fIndexManagerMap.get(indexFilename); + String indexFilename = iProject.getLocation() + File.separator + + "project.index"; + IdentifierIndexManager indexManager = (IdentifierIndexManager) fIndexManagerMap + .get(indexFilename); if (indexManager == null) { indexManager = new IdentifierIndexManager(indexFilename); fIndexManagerMap.put(indexFilename, indexManager); } return indexManager; } - public synchronized IWorkingCopyManager getWorkingCopyManager() { if (fWorkingCopyManager == null) { PHPDocumentProvider provider = getCompilationUnitDocumentProvider(); @@ -398,32 +366,27 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon } return fWorkingCopyManager; } - - public synchronized MembersOrderPreferenceCache getMemberOrderPreferenceCache() { - if (fMembersOrderPreferenceCache == null) - fMembersOrderPreferenceCache= new MembersOrderPreferenceCache(); - return fMembersOrderPreferenceCache; - } - + public synchronized MembersOrderPreferenceCache getMemberOrderPreferenceCache() { + if (fMembersOrderPreferenceCache == null) + fMembersOrderPreferenceCache = new MembersOrderPreferenceCache(); + return fMembersOrderPreferenceCache; + } public synchronized ProblemMarkerManager getProblemMarkerManager() { if (fProblemMarkerManager == null) fProblemMarkerManager = new ProblemMarkerManager(); return fProblemMarkerManager; } - public synchronized JavaTextTools getJavaTextTools() { if (fJavaTextTools == null) fJavaTextTools = new JavaTextTools(getPreferenceStore()); return fJavaTextTools; } - public IFile getLastEditorFile() { return fLastEditorFile; } - /** - * Returns the string from the plugin's resource bundle, - * or 'key' if not found. + * Returns the string from the plugin's resource bundle, or 'key' if not + * found. */ // public static String getResourceString(String key) { // ResourceBundle bundle = PHPeclipsePlugin.getDefault().getResourceBundle(); @@ -433,36 +396,33 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon // return key; // } // } - /** * Returns the plugin's resource bundle, */ // public ResourceBundle getResourceBundle() { // return resourceBundle; // } - protected void initializeDefaultPreferences(IPreferenceStore store) { // windows preferences: store.setDefault(LOCALHOST_PREF, "http://localhost"); - store.setDefault(SHOW_EXTERNAL_PREVIEW_PREF, "true"); store.setDefault(USE_EXTERNAL_BROWSER_PREF, "false"); store.setDefault(SHOW_OUTPUT_IN_CONSOLE, "true"); - String windowsSystem = BootLoader.getWS(); - if (jvm == WINDOWS_9x) { - store.setDefault(EXTERNAL_BROWSER_PREF, "command.com /c start iexplore {0}"); + store.setDefault(EXTERNAL_BROWSER_PREF, + "command.com /c start iexplore {0}"); } else if (windowsSystem.equals(BootLoader.WS_WIN32)) { - store.setDefault(EXTERNAL_BROWSER_PREF, "rundll32 url.dll,FileProtocolHandler {0}"); + store.setDefault(EXTERNAL_BROWSER_PREF, + "rundll32 url.dll,FileProtocolHandler {0}"); } else if (windowsSystem.equals(BootLoader.WS_CARBON)) { // TODO How do we start Safari on Mac OS X ? store.setDefault(EXTERNAL_BROWSER_PREF, "netscape {0}"); } else { store.setDefault(EXTERNAL_BROWSER_PREF, "netscape {0}"); } - store.setDefault(DOCUMENTROOT_PREF, getWorkspace().getRoot().getLocation().toString()); - + store.setDefault(DOCUMENTROOT_PREF, getWorkspace().getRoot().getLocation() + .toString()); // if ((jvm == WINDOWS_9x) || (jvm == WINDOWS_NT)) { // if (windowsSystem.equals(BootLoader.WS_WIN32)) { @@ -471,53 +431,54 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon store.setDefault(MYSQL_RUN_PREF, "c:\\apache\\mysql\\bin\\mysqld-nt.exe"); store.setDefault(APACHE_RUN_PREF, "c:\\apache\\apache.exe"); } else { - store.setDefault(PHP_RUN_PREF, "/apache/php/php"); store.setDefault(EXTERNAL_PARSER_PREF, "/apache/php/php -l -f {0}"); store.setDefault(MYSQL_RUN_PREF, "/apache/mysql/bin/mysqld"); store.setDefault(APACHE_RUN_PREF, "/apache/apache"); - } store.setDefault(MYSQL_PREF, "--standalone"); store.setDefault(APACHE_START_PREF, "-c \"DocumentRoot \"{0}\"\""); store.setDefault(APACHE_STOP_PREF, "-k shutdown"); store.setDefault(APACHE_RESTART_PREF, "-k restart"); - store.setDefault(MYSQL_START_BACKGROUND, "true"); store.setDefault(APACHE_START_BACKGROUND, "true"); store.setDefault(APACHE_STOP_BACKGROUND, "true"); store.setDefault(APACHE_RESTART_BACKGROUND, "true"); - store.setDefault(PHP_PARSER_DEFAULT, PHP_EXTERNAL_PARSER); store.setDefault(PHP_INTERNAL_PARSER, "false"); store.setDefault(PHP_EXTERNAL_PARSER, "true"); - // store.setDefault(PHP_PARSE_ON_SAVE, "true"); - // show line numbers: // store.setDefault(LINE_NUMBER_RULER, "false"); // store.setDefault(FORMATTER_TAB_SIZE, "4"); - // php syntax highlighting store.setDefault(PHP_USERDEF_XMLFILE, ""); - //assume there is none chooA - - PreferenceConverter.setDefault(store, PHP_MULTILINE_COMMENT, PHPColorProvider.MULTI_LINE_COMMENT); - PreferenceConverter.setDefault(store, PHP_SINGLELINE_COMMENT, PHPColorProvider.SINGLE_LINE_COMMENT); + //assume there is none chooA + PreferenceConverter.setDefault(store, PHP_MULTILINE_COMMENT, + PHPColorProvider.MULTI_LINE_COMMENT); + PreferenceConverter.setDefault(store, PHP_SINGLELINE_COMMENT, + PHPColorProvider.SINGLE_LINE_COMMENT); PreferenceConverter.setDefault(store, PHP_TAG, PHPColorProvider.TAG); - PreferenceConverter.setDefault(store, PHP_KEYWORD, PHPColorProvider.KEYWORD); - PreferenceConverter.setDefault(store, PHP_VARIABLE, PHPColorProvider.VARIABLE); - PreferenceConverter.setDefault(store, PHP_FUNCTIONNAME, PHPColorProvider.FUNCTION_NAME); - PreferenceConverter.setDefault(store, PHP_CONSTANT, PHPColorProvider.CONSTANT); + PreferenceConverter + .setDefault(store, PHP_KEYWORD, PHPColorProvider.KEYWORD); + PreferenceConverter.setDefault(store, PHP_VARIABLE, + PHPColorProvider.VARIABLE); + PreferenceConverter.setDefault(store, PHP_FUNCTIONNAME, + PHPColorProvider.FUNCTION_NAME); + PreferenceConverter.setDefault(store, PHP_CONSTANT, + PHPColorProvider.CONSTANT); PreferenceConverter.setDefault(store, PHP_TYPE, PHPColorProvider.TYPE); PreferenceConverter.setDefault(store, PHP_STRING, PHPColorProvider.STRING); - PreferenceConverter.setDefault(store, PHP_DEFAULT, PHPColorProvider.DEFAULT); - - PreferenceConverter.setDefault(store, PHPDOC_KEYWORD, PHPColorProvider.PHPDOC_KEYWORD); - PreferenceConverter.setDefault(store, PHPDOC_TAG, PHPColorProvider.PHPDOC_TAG); - PreferenceConverter.setDefault(store, PHPDOC_LINK, PHPColorProvider.PHPDOC_LINK); - PreferenceConverter.setDefault(store, PHPDOC_DEFAULT, PHPColorProvider.PHPDOC_DEFAULT); - + PreferenceConverter + .setDefault(store, PHP_DEFAULT, PHPColorProvider.DEFAULT); + PreferenceConverter.setDefault(store, PHPDOC_KEYWORD, + PHPColorProvider.PHPDOC_KEYWORD); + PreferenceConverter.setDefault(store, PHPDOC_TAG, + PHPColorProvider.PHPDOC_TAG); + PreferenceConverter.setDefault(store, PHPDOC_LINK, + PHPColorProvider.PHPDOC_LINK); + PreferenceConverter.setDefault(store, PHPDOC_DEFAULT, + PHPColorProvider.PHPDOC_DEFAULT); // PreferenceConverter.setDefault( // store, // PHP_EDITOR_BACKGROUND, @@ -530,81 +491,70 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon // store, // LINE_NUMBER_COLOR, // PHPColorProvider.LINE_NUMBER_COLOR); - // // set default PHPDoc colors: // PreferenceConverter.setDefault( // store, - // PHPDOC_KEYWORD, + // PHPDOC_KEYWORD, // PHPColorProvider.PHPDOC_KEYWORD); // PreferenceConverter.setDefault( // store, - // PHPDOC_LINK, - // PHPColorProvider.PHPDOC_LINK); + // PHPDOC_LINK, + // PHPColorProvider.PHPDOC_LINK); // PreferenceConverter.setDefault( // store, - // PHPDOC_DEFAULT, + // PHPDOC_DEFAULT, // PHPColorProvider.PHPDOC_DEFAULT); // PreferenceConverter.setDefault( // store, - // PHPDOC_TAG, + // PHPDOC_TAG, // PHPColorProvider.PHPDOC_TAG); - // store.setDefault(PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, "true"); // PreferenceConverter.setDefault( // store, // PREFERENCE_COLOR_BACKGROUND, // PHPColorProvider.BACKGROUND_COLOR); - //language stuff // store.setDefault(RESOURCE_BUNDLE, LANGUAGE_DEFAULT); // store.setDefault(RESOURCE_BUNDLE_EN_GB, "true"); // store.setDefault(RESOURCE_BUNDLE_DE, "false"); // store.setDefault(RESOURCE_BUNDLE_FR, "false"); // store.setDefault(RESOURCE_BUNDLE_ES, "false"); - store.setDefault(PHP_OUTLINE_CLASS, "true"); //$NON-NLS-1$ store.setDefault(PHP_OUTLINE_FUNC, "true"); //$NON-NLS-1$ store.setDefault(PHP_OUTLINE_VAR, "true"); //$NON-NLS-1$ - TemplatePreferencePage.initDefaults(store); //this will initialize the static fields in the syntaxrdr class new PHPSyntaxRdr(); - - PHPCore.initializeDefaultPluginPreferences(); + JavaCore.initializeDefaultPluginPreferences(); PreferenceConstants.initializeDefaultValues(store); - externalTools.initializeDefaultPreferences(store); } - private IWorkbenchPage internalGetActivePage() { IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow(); if (window != null) return window.getActivePage(); return null; } - private ImageDescriptorRegistry internalGetImageDescriptorRegistry() { if (fImageDescriptorRegistry == null) fImageDescriptorRegistry = new ImageDescriptorRegistry(); return fImageDescriptorRegistry; } /** - * Open a file in the Workbench that may or may not exist in the workspace. - * Must be run on the UI thread. - * @param filename - * @throws CoreException - */ + * Open a file in the Workbench that may or may not exist in the workspace. + * Must be run on the UI thread. + * + * @param filename + * @throws CoreException + */ public ITextEditor openFileInTextEditor(String filename) throws CoreException { - // reject directories if (new File(filename).isDirectory()) return null; - IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow window = workbench.getWorkbenchWindows()[0]; IWorkbenchPage page = window.getActivePage(); IPath path = new Path(filename); - // If the file exists in the workspace, open it IFile file = getWorkspace().getRoot().getFileForLocation(path); IEditorPart editor; @@ -625,7 +575,6 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon IEditorInput input = new ExternalEditorInput(storage); editor = page.openEditor(input, desc.getId()); textEditor = (ITextEditor) editor.getAdapter(ITextEditor.class); - // If the storage provider is not ours, we can't guarantee read/write. if (textEditor != null) { IDocumentProvider documentProvider = textEditor.getDocumentProvider(); @@ -637,81 +586,79 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon return textEditor; } /** - * Open a file in the Workbench that may or may not exist in the workspace. - * Must be run on the UI thread. - * @param filename - * @param line - * @throws CoreException - */ - public void openFileAndGotoLine(String filename, int line) throws CoreException { - + * Open a file in the Workbench that may or may not exist in the workspace. + * Must be run on the UI thread. + * + * @param filename + * @param line + * @throws CoreException + */ + public void openFileAndGotoLine(String filename, int line) + throws CoreException { ITextEditor textEditor = openFileInTextEditor(filename); if (textEditor != null) { // If a line number was given, go to it if (line > 0) { try { line--; // document is 0 based - IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()); - textEditor.selectAndReveal(document.getLineOffset(line), document.getLineLength(line)); - + IDocument document = textEditor.getDocumentProvider().getDocument( + textEditor.getEditorInput()); + textEditor.selectAndReveal(document.getLineOffset(line), document + .getLineLength(line)); } catch (BadLocationException e) { // invalid text position -> do nothing } } } } - /** - * Open a file in the Workbench that may or may not exist in the workspace. - * Must be run on the UI thread. - * @param filename - * @param offset - * @throws CoreException - */ - public void openFileAndGotoOffset(String filename, int offset, int length) throws CoreException { - + * Open a file in the Workbench that may or may not exist in the workspace. + * Must be run on the UI thread. + * + * @param filename + * @param offset + * @throws CoreException + */ + public void openFileAndGotoOffset(String filename, int offset, int length) + throws CoreException { ITextEditor textEditor = openFileInTextEditor(filename); if (textEditor != null) { // If a line number was given, go to it if (offset >= 0) { - IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()); + IDocument document = textEditor.getDocumentProvider().getDocument( + textEditor.getEditorInput()); textEditor.selectAndReveal(offset, length); } } } - - public void openFileAndFindString(String filename, String findString) throws CoreException { - + public void openFileAndFindString(String filename, String findString) + throws CoreException { ITextEditor textEditor = openFileInTextEditor(filename); if (textEditor != null) { // If a string was given, go to it if (findString != null) { try { - IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()); + IDocument document = textEditor.getDocumentProvider().getDocument( + textEditor.getEditorInput()); int offset = document.search(0, findString, true, false, true); textEditor.selectAndReveal(offset, findString.length()); - } catch (BadLocationException e) { // invalid text position -> do nothing } - } } } public void setLastEditorFile(IFile textEditor) { this.fLastEditorFile = textEditor; } - /** * @see org.eclipse.ui.plugin.AbstractUIPlugin#shutdown() */ public void shutdown() throws CoreException { - // moved down: + // moved down (see below): // super.shutdown(); - // externalTools.shutDown(); ColorManager.getDefault().dispose(); - // save the information from the php index files if necessary Collection collection = fIndexManagerMap.values(); Iterator iterator = collection.iterator(); @@ -720,41 +667,72 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon indexManager = (IdentifierIndexManager) iterator.next(); indexManager.writeFile(); } - if (fImageDescriptorRegistry != null) fImageDescriptorRegistry.dispose(); - // unregisterAdapters(); - super.shutdown(); - if (fWorkingCopyManager != null) { fWorkingCopyManager.shutdown(); fWorkingCopyManager = null; } - if (fCompilationUnitDocumentProvider != null) { fCompilationUnitDocumentProvider.shutdown(); fCompilationUnitDocumentProvider = null; } - if (fJavaTextTools != null) { fJavaTextTools.dispose(); fJavaTextTools = null; } - // JavaDocLocations.shutdownJavadocLocations(); // // JFaceResources.getFontRegistry().removeListener(fFontPropertyChangeListener); - + // begin JavaCore#shutdown() + //savePluginPreferences(); + savePluginPreferences(); + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + workspace.removeResourceChangeListener(JavaModelManager + .getJavaModelManager().deltaProcessor); + workspace.removeSaveParticipant(PHPeclipsePlugin.getDefault()); + ((JavaModelManager) JavaModelManager.getJavaModelManager()).shutdown(); + // end JavaCore#shutdown() } - public void startup() throws CoreException { super.startup(); - IAdapterManager manager = Platform.getAdapterManager(); - manager.registerAdapters(new PHPElementAdapterFactory(), PHPElement.class); - manager.registerAdapters(new ResourceAdapterFactory(), IResource.class); - // externalTools.startUp(); + // begin JavaCore.startup(); + JavaModelManager manager = JavaModelManager.getJavaModelManager(); + try { + manager.configurePluginDebugOptions(); + // request state folder creation (workaround 19885) + // JavaCore.getPlugin().getStateLocation(); + getStateLocation(); + // retrieve variable values + // JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new + // JavaModelManager.PluginPreferencesListener()); + getPluginPreferences().addPropertyChangeListener( + new JavaModelManager.PluginPreferencesListener()); + // TODO khartlage temp-del + // manager.loadVariablesAndContainers(); + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + workspace.addResourceChangeListener(manager.deltaProcessor, + IResourceChangeEvent.PRE_AUTO_BUILD + | IResourceChangeEvent.POST_AUTO_BUILD + | IResourceChangeEvent.POST_CHANGE + | IResourceChangeEvent.PRE_DELETE + | IResourceChangeEvent.PRE_CLOSE); + // startIndexing(); + workspace.addSaveParticipant(PHPeclipsePlugin.getDefault(), manager); + } catch (CoreException e) { + } catch (RuntimeException e) { + manager.shutdown(); + throw e; + } + // end JavaCore.startup(); + IAdapterManager platformManager = Platform.getAdapterManager(); + platformManager.registerAdapters(new PHPElementAdapterFactory(), + PHPElement.class); + platformManager.registerAdapters(new ResourceAdapterFactory(), + IResource.class); + // externalTools.startUp(); getStandardDisplay().asyncExec(new Runnable() { public void run() { //initialize the variable context manager @@ -762,5 +740,4 @@ public class PHPeclipsePlugin extends AbstractUIPlugin implements IPreferenceCon } }); } - } \ No newline at end of file diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaMarkerAnnotation.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaMarkerAnnotation.java index 65b7e5d..c5e2f9d 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaMarkerAnnotation.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaMarkerAnnotation.java @@ -14,20 +14,17 @@ package net.sourceforge.phpeclipse.phpeditor; import java.util.Iterator; -import org.eclipse.core.resources.IMarker; - -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; - -import org.eclipse.ui.texteditor.MarkerAnnotation; - import net.sourceforge.phpdt.core.ICompilationUnit; import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.IJavaModelMarker; import net.sourceforge.phpdt.core.JavaCore; - import net.sourceforge.phpdt.internal.corext.util.JavaModelUtil; +import org.eclipse.core.resources.IMarker; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.texteditor.MarkerAnnotation; + public class JavaMarkerAnnotation extends MarkerAnnotation implements IJavaAnnotation { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaOutlinePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaOutlinePage.java index b6d1eb1..d72d62c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaOutlinePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaOutlinePage.java @@ -28,6 +28,7 @@ import net.sourceforge.phpdt.core.ISourceRange; import net.sourceforge.phpdt.core.ISourceReference; import net.sourceforge.phpdt.core.IType; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.PHPUiImages; import net.sourceforge.phpdt.internal.ui.actions.CompositeActionGroup; import net.sourceforge.phpdt.internal.ui.dnd.JdtViewerDragAdapter; @@ -43,7 +44,6 @@ import net.sourceforge.phpdt.ui.PreferenceConstants; import net.sourceforge.phpdt.ui.ProblemsLabelDecorator.ProblemsLabelChangedEvent; import net.sourceforge.phpdt.ui.actions.GenerateActionGroup; import net.sourceforge.phpdt.ui.actions.MemberFilterActionGroup; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IResource; @@ -298,7 +298,7 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt public void dispose() { if (fListener != null) { - PHPCore.removeElementChangedListener(fListener); + JavaCore.removeElementChangedListener(fListener); fListener= null; } } @@ -311,9 +311,9 @@ public class JavaOutlinePage extends Page implements IContentOutlinePage, IAdapt if (isCU && fListener == null) { fListener= new ElementChangedListener(); - PHPCore.addElementChangedListener(fListener); + JavaCore.addElementChangedListener(fListener); } else if (!isCU && fListener != null) { - PHPCore.removeElementChangedListener(fListener); + JavaCore.removeElementChangedListener(fListener); fListener= null; } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaSelectMarkerRulerAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaSelectMarkerRulerAction.java index 6e01d7b..c01b0de 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaSelectMarkerRulerAction.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/JavaSelectMarkerRulerAction.java @@ -17,8 +17,6 @@ import net.sourceforge.phpdt.core.ICompilationUnit; import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.IJavaHelpContextIds; -import net.sourceforge.phpdt.ui.PreferenceConstants; -import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IFile; import org.eclipse.jface.text.IDocument; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPDocumentProvider.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPDocumentProvider.java index a79460d..ec23358 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPDocumentProvider.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPDocumentProvider.java @@ -26,13 +26,13 @@ import net.sourceforge.phpdt.core.IJavaModelStatusConstants; import net.sourceforge.phpdt.core.IOpenable; import net.sourceforge.phpdt.core.IProblemRequestor; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.compiler.IProblem; import net.sourceforge.phpdt.internal.ui.PHPStatusConstants; import net.sourceforge.phpdt.internal.ui.PHPUIStatus; import net.sourceforge.phpdt.internal.ui.text.java.IProblemRequestorExtension; import net.sourceforge.phpdt.ui.PreferenceConstants; import net.sourceforge.phpdt.ui.text.JavaTextTools; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IFile; @@ -937,7 +937,7 @@ public class PHPDocumentProvider extends FileDocumentProvider { * @param file the file from which to create the compilation unit */ protected ICompilationUnit createCompilationUnit(IFile file) { - Object element = PHPCore.create(file); + Object element = JavaCore.create(file); if (element instanceof ICompilationUnit) return (ICompilationUnit) element; return null; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java index 47c1963..e6a298c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPEditor.java @@ -25,6 +25,7 @@ import net.sourceforge.phpdt.core.IMember; import net.sourceforge.phpdt.core.ISourceRange; import net.sourceforge.phpdt.core.ISourceReference; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.actions.CompositeActionGroup; import net.sourceforge.phpdt.internal.ui.text.HTMLTextPresenter; import net.sourceforge.phpdt.internal.ui.text.PHPPairMatcher; @@ -35,7 +36,6 @@ import net.sourceforge.phpdt.ui.PreferenceConstants; import net.sourceforge.phpdt.ui.actions.GenerateActionGroup; import net.sourceforge.phpdt.ui.actions.GotoMatchingBracketAction; import net.sourceforge.phpdt.ui.text.JavaTextTools; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.phpeditor.php.IPHPPartitionScannerConstants; @@ -1123,7 +1123,7 @@ public abstract class PHPEditor extends ExtendedTextEditor implements IViewPart /** Preference key for the link color */ private final static String LINK_COLOR = PreferenceConstants.EDITOR_LINK_COLOR; /** Preference key for compiler task tags */ - private final static String COMPILER_TASK_TAGS = PHPCore.COMPILER_TASK_TAGS; + private final static String COMPILER_TASK_TAGS = JavaCore.COMPILER_TASK_TAGS; // protected PHPActionGroup fActionGroups; // /** The outline page */ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPSourceViewerConfiguration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPSourceViewerConfiguration.java index 627a046..b8ab839 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPSourceViewerConfiguration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPSourceViewerConfiguration.java @@ -11,6 +11,8 @@ **********************************************************************/ package net.sourceforge.phpeclipse.phpeditor; import java.util.Vector; + +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.text.ContentAssistPreference; import net.sourceforge.phpdt.internal.ui.text.HTMLTextPresenter; import net.sourceforge.phpdt.internal.ui.text.JavaAnnotationHover; @@ -24,7 +26,6 @@ import net.sourceforge.phpdt.internal.ui.text.java.hover.JavaEditorTextHoverProx import net.sourceforge.phpdt.internal.ui.text.phpdoc.PHPDocCompletionProcessor; import net.sourceforge.phpdt.ui.PreferenceConstants; import net.sourceforge.phpdt.ui.text.JavaTextTools; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.phpeditor.html.HTMLFormattingStrategy; import net.sourceforge.phpeclipse.phpeditor.php.HTMLCompletionProcessor; @@ -423,7 +424,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration { // prefix[0] is either '\t' or ' ' x tabWidth, depending on useSpaces final IPreferenceStore preferences = PHPeclipsePlugin.getDefault() .getPreferenceStore(); - int tabWidth = preferences.getInt(PHPCore.FORMATTER_TAB_SIZE); + int tabWidth = preferences.getInt(JavaCore.FORMATTER_TAB_SIZE); boolean useSpaces = getPreferenceStore().getBoolean(SPACES_FOR_TABS); for (int i = 0; i <= tabWidth; i++) { StringBuffer prefix = new StringBuffer(); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java index 419fd01..d8c935d 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/PHPUnitEditor.java @@ -11,6 +11,7 @@ import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.ISourceRange; import net.sourceforge.phpdt.core.ISourceReference; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.compiler.parser.Scanner; import net.sourceforge.phpdt.internal.ui.text.ContentAssistPreference; import net.sourceforge.phpdt.internal.ui.text.PHPPairMatcher; @@ -20,7 +21,6 @@ import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionUI.ExitFlags; import net.sourceforge.phpdt.ui.IWorkingCopyManager; import net.sourceforge.phpdt.ui.PreferenceConstants; import net.sourceforge.phpdt.ui.text.JavaTextTools; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.phpeditor.php.IPHPPartitionScannerConstants; @@ -867,7 +867,7 @@ public class PHPUnitEditor extends PHPEditor { // } // } /* Preference key for code formatter tab size */ - private final static String CODE_FORMATTER_TAB_SIZE = PHPCore.FORMATTER_TAB_SIZE; + private final static String CODE_FORMATTER_TAB_SIZE = JavaCore.FORMATTER_TAB_SIZE; /** Preference key for matching brackets */ private final static String MATCHING_BRACKETS = PreferenceConstants.EDITOR_MATCHING_BRACKETS; /** Preference key for matching brackets color */ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/resourcesview/ResourceAdapterFactory.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/resourcesview/ResourceAdapterFactory.java index e288032..4a5799c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/resourcesview/ResourceAdapterFactory.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/resourcesview/ResourceAdapterFactory.java @@ -1,7 +1,7 @@ package net.sourceforge.phpeclipse.resourcesview; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.core.JavaProject; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; @@ -17,17 +17,17 @@ public class ResourceAdapterFactory implements IAdapterFactory { public Object getAdapter(Object adaptableObject, Class adapterType) { if (PHPFile.class.equals(adapterType)) - return PHPCore.create((IFile) adaptableObject); + return JavaCore.create((IFile) adaptableObject); if (JavaProject.class.equals(adapterType)) - return PHPCore.create((IProject) adaptableObject); + return JavaCore.create((IProject) adaptableObject); if (PHPElement.class.equals(adapterType)) { if (adaptableObject instanceof IFile) - return PHPCore.create((IFile) adaptableObject); + return JavaCore.create((IFile) adaptableObject); if (adaptableObject instanceof IProject) - return PHPCore.create((IProject) adaptableObject); + return JavaCore.create((IProject) adaptableObject); } return null; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/NewProjectCreationWizard.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/NewProjectCreationWizard.java index 4378e2f..cbeca0a 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/NewProjectCreationWizard.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/NewProjectCreationWizard.java @@ -2,7 +2,7 @@ package net.sourceforge.phpeclipse.wizards; import java.lang.reflect.InvocationTargetException; -import net.sourceforge.phpeclipse.PHPCore; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.resources.IProject; @@ -73,7 +73,7 @@ public class NewProjectCreationWizard extends BasicNewResourceWizard implements newProject.open(new SubProgressMonitor(monitor, 1)); remainingWorkUnits--; } - PHPCore.addPHPNature(newProject, new SubProgressMonitor(monitor, remainingWorkUnits)); + JavaCore.addPHPNature(newProject, new SubProgressMonitor(monitor, remainingWorkUnits)); } catch (CoreException e) { throw new InvocationTargetException(e); } finally { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/TempnewPHPProject.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/TempnewPHPProject.java index ec03535..caff19b 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/TempnewPHPProject.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/TempnewPHPProject.java @@ -2,8 +2,8 @@ package net.sourceforge.phpeclipse.wizards; import java.lang.reflect.InvocationTargetException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; @@ -83,7 +83,7 @@ public class TempnewPHPProject extends BasicNewResourceWizard implements INewWiz project.open(monitor); monitor= null; } - PHPCore.addPHPNature(project, new NullProgressMonitor()); + JavaCore.addPHPNature(project, new NullProgressMonitor()); } finally { if (monitor != null) { monitor.done(); -- 1.7.1 From a1622122cab1d39005dd183565abd649bd3ce1ed Mon Sep 17 00:00:00 2001 From: khartlage Date: Fri, 26 Mar 2004 21:41:41 +0000 Subject: [PATCH 06/16] misc parser changes --- .../phpeditor/php/test/PHPFormatterTest.java | 6 +- .../phpeclipse/tests/parser/PHPParserTestCase.java | 15 ++- .../phpdt/core/compiler/ITerminalSymbols.java | 4 +- .../phpdt/internal/compiler/parser/Parser.java | 6 +- .../phpdt/internal/compiler/parser/Scanner.java | 132 ++++++++++---------- 5 files changed, 91 insertions(+), 72 deletions(-) diff --git a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/phpeditor/php/test/PHPFormatterTest.java b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/phpeditor/php/test/PHPFormatterTest.java index 11e7ed1..b9e7618 100644 --- a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/phpeditor/php/test/PHPFormatterTest.java +++ b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/phpeditor/php/test/PHPFormatterTest.java @@ -7,18 +7,18 @@ package net.sourceforge.phpeclipse.phpeditor.php.test; import java.util.Map; import junit.framework.TestCase; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.corext.codemanipulation.StubUtility; import net.sourceforge.phpdt.internal.corext.util.Strings; import net.sourceforge.phpdt.internal.formatter.CodeFormatter; import net.sourceforge.phpdt.internal.ui.preferences.CodeFormatterPreferencePage; -import net.sourceforge.phpeclipse.PHPCore; import org.eclipse.jface.text.IDocument; /** * Testcase for the PHP CodeFormatter * @author Stefan Langer - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ public class PHPFormatterTest extends TestCase { private CodeFormatter fFormatter; @@ -29,7 +29,7 @@ public class PHPFormatterTest extends TestCase { * @see junit.framework.TestCase#setUp() */ protected void setUp() throws Exception { - Map options = PHPCore.getOptions(); + Map options = JavaCore.getOptions(); fFormatter = new CodeFormatter(options); fDocument = new DummyDocument(); } diff --git a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPParserTestCase.java b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPParserTestCase.java index d7759ea..c8b0443 100644 --- a/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPParserTestCase.java +++ b/net.sourceforge.phpeclipse.tests/src/net/sourceforge/phpeclipse/tests/parser/PHPParserTestCase.java @@ -6,7 +6,6 @@ package net.sourceforge.phpeclipse.tests.parser; * distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html ******************************************************************************/ import net.sourceforge.phpdt.core.tests.util.AbstractCompilerTest; -import net.sourceforge.phpdt.internal.compiler.parser.Parser; import net.sourceforge.phpdt.internal.compiler.parser.Scanner; /** * Tests the php parser @@ -20,7 +19,19 @@ public class PHPParserTestCase extends AbstractCompilerTest { * Test the PHP Parser with different PHP snippets */ public void testPHPParser() { - checkHTML(""); + checkHTML(" "); + checkHTML("\n" + + "test me\n" + + ""); + + checkHTML(""); + checkPHP("function clean_words($mode, &$entry, &$stopword_list, &$synonym_list)\r\n" + + "{ static $drop_char_match = array(\'^\', \'$\'); }"); + checkPHP("if ($topic<1) { $topic = 1;}"); checkPHP("$this->result_field_names[$result_id][] = odbc_field_name($result_id, $i);"); checkPHP("$db->sql_query($sql);"); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java index 7d6e6b7..4a841f4 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java @@ -38,8 +38,8 @@ public interface ITerminalSymbols { public final static int TokenNameWHITESPACE = 900, TokenNameCOMMENT_LINE = 901, TokenNameCOMMENT_BLOCK = 902, - TokenNameCOMMENT_PHPDOC = 903, - TokenNameHTML = 904; + TokenNameCOMMENT_PHPDOC = 903; +// TokenNameHTML = 904; final static int TokenNameEOF = 0; final static int TokenNameERROR = 1; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java index 820b0c7..c9b73cf 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java @@ -2938,9 +2938,13 @@ getNextToken(); if (Scanner.TRACE) { System.out.println("TRACE: variable_name()"); } - if (token == TokenNameIdentifier) { + if (token == TokenNameIdentifier || token > TokenNameKEYWORD) { + if (token > TokenNameKEYWORD) { + // TODO show a warning "Keyword used as variable" ? + } getNextToken(); } else { + if (token != TokenNameLBRACE) { throwSyntaxError("'{' expected in variable name."); } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java index 9b91cf2..ff11fa1 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java @@ -804,65 +804,8 @@ public class Scanner implements IScanner, ITerminalSymbols { return TokenNameLPAREN; } public int getNextToken() throws InvalidInputException { - int htmlPosition = currentPosition; - try { - while (!phpMode) { - currentCharacter = source[currentPosition++]; - if (currentCharacter == '<') { - if (getNextChar('?')) { - currentCharacter = source[currentPosition++]; - if ((currentCharacter == ' ') - || Character.isWhitespace(currentCharacter)) { - // = 0) { - test = getNextChar('P', 'p'); - if (test >= 0) { - // ')) { phpMode = false; - return TokenNameINLINE_HTML; + if (currentPosition==source.length) { + phpMode = true; + return TokenNameINLINE_HTML; + } + return getInlinedHTML(currentPosition - 2); } return TokenNameQUESTION; case ':' : @@ -1702,7 +1649,6 @@ public class Scanner implements IScanner, ITerminalSymbols { int oldPosition = currentPosition; try { currentCharacter = source[currentPosition++]; - if (isPHPIdentifierStart(currentCharacter)) { return scanIdentifierOrKeyword(true); } else { @@ -1727,6 +1673,63 @@ public class Scanner implements IScanner, ITerminalSymbols { } return TokenNameEOF; } + /** + * @return @throws + * InvalidInputException + */ + private int getInlinedHTML(int start) throws InvalidInputException { + // int htmlPosition = start; + if (currentPosition>source.length) { + currentPosition = source.length; + return TokenNameEOF; + } + startPosition = start; + try { + while (!phpMode) { + currentCharacter = source[currentPosition++]; + if (currentCharacter == '<') { + if (getNextChar('?')) { + currentCharacter = source[currentPosition++]; + if ((currentCharacter == ' ') + || Character.isWhitespace(currentCharacter)) { + // = 0) { + test = getNextChar('P', 'p'); + if (test >= 0) { + // Date: Sat, 27 Mar 2004 18:39:42 +0000 Subject: [PATCH 07/16] Eclipse 3.x compatible; --- net.sourceforge.phpeclipse.debug.core/plugin.xml | 7 ++++ .../plugin.properties | 7 +++- net.sourceforge.phpeclipse.debug.ui/plugin.xml | 34 +++++++++++++++++++- net.sourceforge.phpeclipse.launching/plugin.xml | 7 ++++ 4 files changed, 53 insertions(+), 2 deletions(-) diff --git a/net.sourceforge.phpeclipse.debug.core/plugin.xml b/net.sourceforge.phpeclipse.debug.core/plugin.xml index f2a5952..46e6b66 100644 --- a/net.sourceforge.phpeclipse.debug.core/plugin.xml +++ b/net.sourceforge.phpeclipse.debug.core/plugin.xml @@ -1,4 +1,5 @@ + + + + + + + diff --git a/net.sourceforge.phpeclipse.debug.ui/plugin.properties b/net.sourceforge.phpeclipse.debug.ui/plugin.properties index d74728d..6b3b861 100644 --- a/net.sourceforge.phpeclipse.debug.ui/plugin.properties +++ b/net.sourceforge.phpeclipse.debug.ui/plugin.properties @@ -9,4 +9,9 @@ LaunchShortcut.PHP.label=PHP Application DebugActionSet.label=PHP Debug RunMenu.label=&Run -GlobalManageBreakpointAction.label=Add/Remove Brea&kpoint (PHP) \ No newline at end of file +GlobalManageBreakpointAction.label=Add/Remove Brea&kpoint (PHP) + +Context.Debugging.name=Debugging PHP +Context.Debugging.description=Debugging PHP-Scripts +DebugHover.description=Shows the value of the selected variable. +DebugHover.label=debug variable hover \ No newline at end of file diff --git a/net.sourceforge.phpeclipse.debug.ui/plugin.xml b/net.sourceforge.phpeclipse.debug.ui/plugin.xml index c32d3b7..deb23ed 100644 --- a/net.sourceforge.phpeclipse.debug.ui/plugin.xml +++ b/net.sourceforge.phpeclipse.debug.ui/plugin.xml @@ -1,4 +1,5 @@ + + + + + + + @@ -91,7 +98,7 @@ + point="org.eclipse.ui.ide.markerImageProviders"> + + + + + + + + + + + + diff --git a/net.sourceforge.phpeclipse.launching/plugin.xml b/net.sourceforge.phpeclipse.launching/plugin.xml index f4a8503..da280ef 100644 --- a/net.sourceforge.phpeclipse.launching/plugin.xml +++ b/net.sourceforge.phpeclipse.launching/plugin.xml @@ -1,4 +1,5 @@ + + + + + + + -- 1.7.1 From e8debfab0c32a381eb107081eb09e7300ca844c3 Mon Sep 17 00:00:00 2001 From: cperkonig Date: Sun, 28 Mar 2004 08:30:30 +0000 Subject: [PATCH 08/16] make sure that the VariableHover for the debugPlugin is the first to show --- .../java/hover/JavaEditorTextHoverDescriptor.java | 10 ++++++++++ .../sourceforge/phpeclipse/PHPeclipsePlugin.java | 11 +++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/hover/JavaEditorTextHoverDescriptor.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/hover/JavaEditorTextHoverDescriptor.java index 7f8148f..410463d 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/hover/JavaEditorTextHoverDescriptor.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/java/hover/JavaEditorTextHoverDescriptor.java @@ -309,4 +309,14 @@ public class JavaEditorTextHoverDescriptor implements Comparable { public boolean isEnabled() { return fIsEnabled; } + + /** + * Returns this hover descriptors configuration element. + * + * @return the configuration element + * @since 3.0 + */ + public IConfigurationElement getConfigurationElement() { + return fElement; + } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java index 4511487..e748758 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java @@ -54,6 +54,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdapterManager; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPluginDescriptor; +import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; @@ -79,6 +80,7 @@ import org.eclipse.ui.ide.IDE; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.ui.texteditor.IDocumentProvider; import org.eclipse.ui.texteditor.ITextEditor; +import org.eclipse.ui.texteditor.ConfigurationElementSorter; /** * The main plugin class to be used in the desktop. */ @@ -162,8 +164,13 @@ public class PHPeclipsePlugin extends AbstractUIPlugin */ public JavaEditorTextHoverDescriptor[] getJavaEditorTextHoverDescriptors() { if (fJavaEditorTextHoverDescriptors == null) - fJavaEditorTextHoverDescriptors = JavaEditorTextHoverDescriptor - .getContributedHovers(); + fJavaEditorTextHoverDescriptors = JavaEditorTextHoverDescriptor.getContributedHovers(); + ConfigurationElementSorter sorter= new ConfigurationElementSorter() { + public IConfigurationElement getConfigurationElement(Object object) { + return ((JavaEditorTextHoverDescriptor)object).getConfigurationElement(); + } + }; + sorter.sort(fJavaEditorTextHoverDescriptors); return fJavaEditorTextHoverDescriptors; } /** -- 1.7.1 From fb4d28cebc7efe36f683c5eeb223255a6903f757 Mon Sep 17 00:00:00 2001 From: cperkonig Date: Sun, 28 Mar 2004 08:34:24 +0000 Subject: [PATCH 09/16] changes for VariableHover --- .../internal/debug/core/model/PHPStackFrame.java | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPStackFrame.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPStackFrame.java index cf68846..2e1d71f 100644 --- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPStackFrame.java +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/model/PHPStackFrame.java @@ -64,6 +64,18 @@ public class PHPStackFrame implements IStackFrame { return variables; } + public IVariable findVariable(String s) throws DebugException { + if (this.hasVariables()) { + String name="$"+s; + for(int i= 0; i < variables.length; i++) { + String n= variables[i].getName(); + if((variables[i].getName()).equals(name)) + return variables[i]; + } + } + return null; + } + public boolean hasVariables() throws DebugException { if (variables == null) { return false; @@ -194,7 +206,10 @@ public class PHPStackFrame implements IStackFrame { } public Object getAdapter(Class arg0) { - return null; + if (arg0==PHPStackFrame.class) + return this; + else + return null; } public int getIndex() { -- 1.7.1 From 424138b8ec9e3a53086d6bdf702d95502e85f39a Mon Sep 17 00:00:00 2001 From: cperkonig Date: Sun, 28 Mar 2004 08:36:35 +0000 Subject: [PATCH 10/16] Changes for 3.x --- .../debug/ui/launcher/PHPEnvironmentTab.java | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab.java index 92162b0..754118d 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab.java +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/launcher/PHPEnvironmentTab.java @@ -14,9 +14,10 @@ import net.sourceforge.phpdt.internal.launching.PHPInterpreter; import net.sourceforge.phpdt.internal.launching.PHPLaunchConfigurationAttribute; import net.sourceforge.phpdt.internal.launching.PHPRuntime; import net.sourceforge.phpdt.internal.ui.PHPUiImages; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpeclipse.LoadPathEntry; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.resourcesview.PHPProject; +import net.sourceforge.phpeclipse.PHPeclipsePlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.ILaunchConfiguration; @@ -26,6 +27,7 @@ import org.eclipse.jface.viewers.ListViewer; import org.eclipse.jface.viewers.TableLayout; import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.swt.SWT; +import org.eclipse.core.resources.IProject; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; @@ -495,9 +497,11 @@ public class PHPEnvironmentTab extends AbstractLaunchConfigurationTab { if (useDefaultLoadPath) { String projectName = configuration.getAttribute(PHPLaunchConfigurationAttribute.PROJECT_NAME, ""); if (projectName != "") { - PHPProject project = PHPCore.getPHPProject(projectName); - if (project != null) { - List loadPathEntries = project.getLoadPathEntries(); + IProject aProject = PHPeclipsePlugin.getWorkspace().getRoot().getProject(projectName); + if ((aProject != null) && JavaCore.isPHPProject(aProject)) { + PHPProject thePHPProject = new PHPProject(); + thePHPProject.setProject(aProject); + List loadPathEntries = thePHPProject.getLoadPathEntries(); loadPathListViewer.setInput(loadPathEntries); } } -- 1.7.1 From 096a632c2b0d765d16410bbe46c54a1c67e4075b Mon Sep 17 00:00:00 2001 From: cperkonig Date: Sun, 28 Mar 2004 08:38:15 +0000 Subject: [PATCH 11/16] initial implementation of VariableHover --- .../phpdt/internal/debug/ui/PHPDebugHover.java | 240 ++++++++++++++++++++ 1 files changed, 240 insertions(+), 0 deletions(-) create mode 100644 net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugHover.java diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugHover.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugHover.java new file mode 100644 index 0000000..9b41956 --- /dev/null +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugHover.java @@ -0,0 +1,240 @@ + +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package net.sourceforge.phpdt.internal.debug.ui; + + +import org.eclipse.core.runtime.IAdaptable; +//import org.eclipse.core.runtime.Platform; +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.model.IValue; +import org.eclipse.debug.core.model.IVariable; +import org.eclipse.debug.ui.IDebugUIConstants; +//import org.eclipse.jdt.debug.core.IJavaStackFrame; +//import org.eclipse.jdt.debug.core.IJavaThread; +//import org.eclipse.jdt.debug.core.IJavaType; +//import org.eclipse.jdt.debug.core.IJavaValue; +import net.sourceforge.phpdt.internal.ui.text.HTMLTextPresenter; +//import org.eclipse.jdt.ui.PreferenceConstants; +//import org.eclipse.jdt.ui.text.java.hover.IJavaEditorTextHover; +import net.sourceforge.phpdt.ui.text.java.hover.IJavaEditorTextHover; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.DefaultInformationControl; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.IInformationControl; +import org.eclipse.jface.text.IInformationControlCreator; +import org.eclipse.jface.text.IRegion; +import org.eclipse.jface.text.ITextHoverExtension; +import org.eclipse.jface.text.ITextViewer; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.ISelectionListener; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; + +import net.sourceforge.phpdt.internal.debug.core.model.PHPStackFrame; +import net.sourceforge.phpdt.internal.debug.core.model.PHPValue; +import net.sourceforge.phpdt.internal.ui.text.JavaWordFinder; + + +public class PHPDebugHover implements IJavaEditorTextHover, ITextHoverExtension, ISelectionListener, IPartListener { + + protected IEditorPart fEditor; + protected ISelection fSelection = null; + + /* (non-Javadoc) + * @see org.eclipse.ui.IPartListener#partActivated(org.eclipse.ui.IWorkbenchPart) + */ + public void partActivated(IWorkbenchPart part) { + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IPartListener#partBroughtToTop(org.eclipse.ui.IWorkbenchPart) + */ + public void partBroughtToTop(IWorkbenchPart part) { + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart) + */ + public void partClosed(IWorkbenchPart part) { + if (part.equals(fEditor)) { + IWorkbenchPage page = fEditor.getSite().getPage(); + page.removeSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this); + page.removePartListener(this); + fSelection = null; + fEditor = null; + } + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IPartListener#partDeactivated(org.eclipse.ui.IWorkbenchPart) + */ + public void partDeactivated(IWorkbenchPart part) { + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IPartListener#partOpened(org.eclipse.ui.IWorkbenchPart) + */ + public void partOpened(IWorkbenchPart part) { + } + + /* (non-Javadoc) + * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) + */ + public void selectionChanged(IWorkbenchPart part, ISelection selection) { + fSelection = selection; + } + + public PHPDebugHover() { + } + + /* (non-Javadoc) + * @see org.eclipse.jdt.ui.text.java.hover.IJavaEditorTextHover#setEditor(org.eclipse.ui.IEditorPart) + */ + public void setEditor(IEditorPart editor) { + if (editor != null) { + fEditor= editor; + final IWorkbenchPage page = editor.getSite().getPage(); + page.addSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this); + page.addPartListener(this); + // initialize selection + Runnable r = new Runnable() { + public void run() { + fSelection = page.getSelection(IDebugUIConstants.ID_DEBUG_VIEW); + } + }; + PHPDebugUiPlugin.getStandardDisplay().asyncExec(r); + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.text.ITextHover#getHoverRegion(org.eclipse.jface.text.ITextViewer, int) + */ + public IRegion getHoverRegion(ITextViewer textViewer, int offset) { + return JavaWordFinder.findWord(textViewer.getDocument(), offset); + } + + /** + * Returns the stack frame in which to search for variables, or null + * if none. + * + * @return the stack frame in which to search for variables, or null + * if none + */ + protected PHPStackFrame getFrame() { + if (fSelection instanceof IStructuredSelection) { + IStructuredSelection selection = (IStructuredSelection)fSelection; + if (selection.size() == 1) { + Object el = selection.getFirstElement(); + if (el instanceof IAdaptable) { + return (PHPStackFrame)((IAdaptable)el).getAdapter(PHPStackFrame.class); + } + } + } + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.text.ITextHover#getHoverInfo(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion) + */ + public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) { + PHPStackFrame frame = getFrame(); + if (frame != null) { + try { + + IDocument document= textViewer.getDocument(); + if (document == null) + return null; + + String variableName= document.get(hoverRegion.getOffset(), hoverRegion.getLength()); + + StringBuffer buffer= new StringBuffer(); + try { + IVariable variable= frame.findVariable(variableName); + if (variable != null) { + appendVariable(buffer, variable); + } + } catch (DebugException x) { +// if (x.getStatus().getCode() != IJavaThread.ERR_THREAD_NOT_SUSPENDED) { + PHPDebugUiPlugin.log(x); +// } + } + + if (buffer.length() > 0) { + return buffer.toString(); + } + + } catch (BadLocationException x) { + PHPDebugUiPlugin.log(x); + } + } + + return null; + } + + /** + * Append HTML for the given variable to the given buffer + */ + private static void appendVariable(StringBuffer buffer, IVariable variable) throws DebugException { + + buffer.append("

"); //$NON-NLS-1$ + buffer.append("

").append(variable.getName()).append("
"); //$NON-NLS-1$ //$NON-NLS-2$ + buffer.append(" ="); //$NON-NLS-1$ + + String type= getTypeName(variable); + String value= "
" + variable.getValue().getValueString() + "
"; //$NON-NLS-1$ //$NON-NLS-2$ + + if (type == null) { + buffer.append(" null"); //$NON-NLS-1$ + } else if (type.equals("java.lang.String")) { //$NON-NLS-1$ + buffer.append(" \""); //$NON-NLS-1$ + buffer.append(value); + buffer.append('"'); + } else if (type.equals("boolean")) { //$NON-NLS-1$ + buffer.append(' '); + buffer.append(value); + } else { + buffer.append(" ("); //$NON-NLS-1$ + buffer.append("
").append(type).append("
"); //$NON-NLS-1$ //$NON-NLS-2$ + buffer.append(") "); //$NON-NLS-1$ + buffer.append(value); + } + buffer.append("

"); //$NON-NLS-1$ + } + + private static String getTypeName(IVariable variable) throws DebugException { + IValue value= variable.getValue(); + if (value instanceof PHPValue) + return((PHPValue) value).getReferenceTypeName(); + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.text.ITextHoverExtension#getInformationControlCreator() + */ + public IInformationControlCreator getInformationControlCreator() { +// if (Platform.getPlugin("org.eclipse.jdt.ui").getPluginPreferences().getBoolean(PreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE)) { //$NON-NLS-1$ + return new IInformationControlCreator() { + public IInformationControl createInformationControl(Shell parent) { + return new DefaultInformationControl(parent, SWT.NONE, + new HTMLTextPresenter(true), + PHPDebugUiMessages.getString("JavaDebugHover.16")); //$NON-NLS-1$ + } + }; +// } +// return null; + } +} -- 1.7.1 From 160d7bf3a470cd18b60f407c6e760b1e519e76a4 Mon Sep 17 00:00:00 2001 From: cperkonig Date: Sun, 28 Mar 2004 08:39:47 +0000 Subject: [PATCH 12/16] changes for VariableHover --- .../phpdt/internal/debug/ui/PHPDebugUiPlugin.java | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiPlugin.java b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiPlugin.java index 340563e..16f59ce 100644 --- a/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiPlugin.java +++ b/net.sourceforge.phpeclipse.debug.ui/src/net/sourceforge/phpdt/internal/debug/ui/PHPDebugUiPlugin.java @@ -11,6 +11,7 @@ import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.swt.widgets.Shell; import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.swt.widgets.Display; public class PHPDebugUiPlugin extends AbstractUIPlugin { public static final String PLUGIN_ID = "net.sourceforge.phpeclipse.debug.ui"; //$NON-NLS-1$ @@ -50,7 +51,20 @@ public class PHPDebugUiPlugin extends AbstractUIPlugin { return PLUGIN_ID; } return getDefault().getDescriptor().getUniqueIdentifier(); - } + } + + /** + * Returns the standard display to be used. The method first checks, if + * the thread calling this method has an associated display. If so, this + * display is returned. Otherwise the method returns the default display. + */ + public static Display getStandardDisplay() { + Display display; + display= Display.getCurrent(); + if (display == null) + display= Display.getDefault(); + return display; + } /** * Returns the active workbench shell or null if none -- 1.7.1 From cb216353f1cb352b9f0588034acd391d187f6997 Mon Sep 17 00:00:00 2001 From: cperkonig Date: Sun, 28 Mar 2004 08:46:41 +0000 Subject: [PATCH 13/16] Changes for 3.x --- net.sourceforge.phpeclipse.debug.core/.classpath | 40 ++------------------- net.sourceforge.phpeclipse.debug.core/.project | 2 +- net.sourceforge.phpeclipse.debug.ui/.classpath | 40 ++------------------- net.sourceforge.phpeclipse.debug.ui/.project | 2 +- net.sourceforge.phpeclipse.launching/.classpath | 41 ++------------------- net.sourceforge.phpeclipse.launching/.project | 2 +- 6 files changed, 15 insertions(+), 112 deletions(-) diff --git a/net.sourceforge.phpeclipse.debug.core/.classpath b/net.sourceforge.phpeclipse.debug.core/.classpath index 3b89370..275b34c 100644 --- a/net.sourceforge.phpeclipse.debug.core/.classpath +++ b/net.sourceforge.phpeclipse.debug.core/.classpath @@ -1,39 +1,7 @@ - - - - - - - - - - - - - - - - - - - - + + + + diff --git a/net.sourceforge.phpeclipse.debug.core/.project b/net.sourceforge.phpeclipse.debug.core/.project index 01597ae..375b066 100644 --- a/net.sourceforge.phpeclipse.debug.core/.project +++ b/net.sourceforge.phpeclipse.debug.core/.project @@ -3,7 +3,7 @@ net.sourceforge.phpeclipse.debug.core - net.sourceforge.phpeclipse213 + net.sourceforge.phpeclipse diff --git a/net.sourceforge.phpeclipse.debug.ui/.classpath b/net.sourceforge.phpeclipse.debug.ui/.classpath index 19bc6e5..275b34c 100644 --- a/net.sourceforge.phpeclipse.debug.ui/.classpath +++ b/net.sourceforge.phpeclipse.debug.ui/.classpath @@ -1,39 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - + + + + diff --git a/net.sourceforge.phpeclipse.debug.ui/.project b/net.sourceforge.phpeclipse.debug.ui/.project index a1c5e4a..ad08fc7 100644 --- a/net.sourceforge.phpeclipse.debug.ui/.project +++ b/net.sourceforge.phpeclipse.debug.ui/.project @@ -3,9 +3,9 @@ net.sourceforge.phpeclipse.debug.ui + net.sourceforge.phpeclipse net.sourceforge.phpeclipse.debug.core net.sourceforge.phpeclipse.launching - net.sourceforge.phpeclipse213 diff --git a/net.sourceforge.phpeclipse.launching/.classpath b/net.sourceforge.phpeclipse.launching/.classpath index 76db8ee..275b34c 100644 --- a/net.sourceforge.phpeclipse.launching/.classpath +++ b/net.sourceforge.phpeclipse.launching/.classpath @@ -1,40 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + diff --git a/net.sourceforge.phpeclipse.launching/.project b/net.sourceforge.phpeclipse.launching/.project index 515d5a4..f147bcf 100644 --- a/net.sourceforge.phpeclipse.launching/.project +++ b/net.sourceforge.phpeclipse.launching/.project @@ -3,8 +3,8 @@ net.sourceforge.phpeclipse.launching + net.sourceforge.phpeclipse net.sourceforge.phpeclipse.debug.core - net.sourceforge.phpeclipse213 -- 1.7.1 From 2886b1c517878abedb1271b6c5544cfb9592e51d Mon Sep 17 00:00:00 2001 From: khartlage Date: Fri, 2 Apr 2004 18:37:51 +0000 Subject: [PATCH 14/16] misc parser changes --- .../phpdt/internal/compiler/parser/Parser.java | 341 +++++++++++++------- .../phpdt/internal/compiler/parser/Scanner.java | 4 + .../phpeclipse/phpeditor/EditorUtility.java | 2 +- 3 files changed, 222 insertions(+), 125 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java index c9b73cf..12b9245 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java @@ -23,7 +23,6 @@ import net.sourceforge.phpeclipse.internal.compiler.ast.CompilationUnitDeclarati import net.sourceforge.phpeclipse.internal.compiler.ast.MethodDeclaration; import net.sourceforge.phpeclipse.internal.compiler.ast.SingleTypeReference; import net.sourceforge.phpeclipse.internal.compiler.ast.TypeDeclaration; - import org.eclipse.core.resources.IFile; public class Parser //extends PHPParserSuperclass implements ITerminalSymbols, CompilerModifiers, ParserBasicInformation { @@ -554,78 +553,78 @@ public class Parser //extends PHPParserSuperclass // } catch (CoreException e) { // } // } -// public void phpParserTester(String s, int rowCount) { -// this.str = s; -// if (s == null) { -// if (phpList.size() != 0) { -// this.str = ((PHPString) phpList.get(currentPHPString++)).getPHPString(); -// } -// } -// this.token = TokenNameEOF; -// // this.chIndx = 0; -// // this.rowCount = rowCount; -// // this.columnCount = 0; -// this.phpEnd = false; -// this.phpMode = true; -// scanner.setSource(s.toCharArray()); -// scanner.setPHPMode(true); -// getNextToken(); -// do { -// try { -// if (token != TokenNameEOF && token != TokenNameERROR) { -// statementList(); -// } -// if (token != TokenNameEOF) { -// if (token == TokenNameERROR) { -// throwSyntaxError("Scanner error (Found unknown token: " -// + scanner.toStringAction(token) + ")"); -// } -// if (token == TokenNameRPAREN) { -// throwSyntaxError("Too many closing ')'; end-of-file not reached."); -// } -// if (token == TokenNameRBRACE) { -// throwSyntaxError("Too many closing '}'; end-of-file not reached."); -// } -// if (token == TokenNameRBRACKET) { -// throwSyntaxError("Too many closing ']'; end-of-file not reached."); -// } -// if (token == TokenNameLPAREN) { -// throwSyntaxError("Read character '('; end-of-file not reached."); -// } -// if (token == TokenNameLBRACE) { -// throwSyntaxError("Read character '{'; end-of-file not reached."); -// } -// if (token == TokenNameLBRACKET) { -// throwSyntaxError("Read character '['; end-of-file not reached."); -// } -// throwSyntaxError("End-of-file not reached."); -// } -// return; -// } catch (SyntaxError err) { -// if (s != null) { -// throw err; -// } else { -// // setMarker(err.getMessage(), err.getLine(), ERROR); -// // setMarker(err.getMessage(), -// // scanner.getCurrentTokenStartPosition(), -// // scanner.getCurrentTokenEndPosition(), ERROR); -// } -// // if an error occured, -// // try to find keywords 'class' or 'function' -// // to parse the rest of the string -// while (token != TokenNameEOF && token != TokenNameERROR) { -// if (token == TokenNameabstract || token == TokenNamefinal -// || token == TokenNameclass || token == TokenNamefunction) { -// break; -// } -// getNextToken(); -// } -// if (token == TokenNameEOF || token == TokenNameERROR) { -// return; -// } -// } -// } while (true); -// } + // public void phpParserTester(String s, int rowCount) { + // this.str = s; + // if (s == null) { + // if (phpList.size() != 0) { + // this.str = ((PHPString) phpList.get(currentPHPString++)).getPHPString(); + // } + // } + // this.token = TokenNameEOF; + // // this.chIndx = 0; + // // this.rowCount = rowCount; + // // this.columnCount = 0; + // this.phpEnd = false; + // this.phpMode = true; + // scanner.setSource(s.toCharArray()); + // scanner.setPHPMode(true); + // getNextToken(); + // do { + // try { + // if (token != TokenNameEOF && token != TokenNameERROR) { + // statementList(); + // } + // if (token != TokenNameEOF) { + // if (token == TokenNameERROR) { + // throwSyntaxError("Scanner error (Found unknown token: " + // + scanner.toStringAction(token) + ")"); + // } + // if (token == TokenNameRPAREN) { + // throwSyntaxError("Too many closing ')'; end-of-file not reached."); + // } + // if (token == TokenNameRBRACE) { + // throwSyntaxError("Too many closing '}'; end-of-file not reached."); + // } + // if (token == TokenNameRBRACKET) { + // throwSyntaxError("Too many closing ']'; end-of-file not reached."); + // } + // if (token == TokenNameLPAREN) { + // throwSyntaxError("Read character '('; end-of-file not reached."); + // } + // if (token == TokenNameLBRACE) { + // throwSyntaxError("Read character '{'; end-of-file not reached."); + // } + // if (token == TokenNameLBRACKET) { + // throwSyntaxError("Read character '['; end-of-file not reached."); + // } + // throwSyntaxError("End-of-file not reached."); + // } + // return; + // } catch (SyntaxError err) { + // if (s != null) { + // throw err; + // } else { + // // setMarker(err.getMessage(), err.getLine(), ERROR); + // // setMarker(err.getMessage(), + // // scanner.getCurrentTokenStartPosition(), + // // scanner.getCurrentTokenEndPosition(), ERROR); + // } + // // if an error occured, + // // try to find keywords 'class' or 'function' + // // to parse the rest of the string + // while (token != TokenNameEOF && token != TokenNameERROR) { + // if (token == TokenNameabstract || token == TokenNamefinal + // || token == TokenNameclass || token == TokenNamefunction) { + // break; + // } + // getNextToken(); + // } + // if (token == TokenNameEOF || token == TokenNameERROR) { + // return; + // } + // } + // } while (true); + // } public void init(String s) { this.str = s; this.token = TokenNameEOF; @@ -633,7 +632,7 @@ public class Parser //extends PHPParserSuperclass // this.rowCount = 1; // this.columnCount = 0; this.phpEnd = false; -// this.phpMode = false; + // this.phpMode = false; /* scanner initialization */ scanner.setSource(s.toCharArray()); scanner.setPHPMode(false); @@ -647,7 +646,7 @@ public class Parser //extends PHPParserSuperclass // this.rowCount = 1; // this.columnCount = 0; this.phpEnd = false; -// this.phpMode = phpMode; + // this.phpMode = phpMode; scanner.setPHPMode(phpMode); } /** @@ -1130,7 +1129,9 @@ public class Parser //extends PHPParserSuperclass } else { throwSyntaxError("'as' expected after 'foreach' exxpression."); } - variable(); +// variable(); + foreach_variable(); + foreach_optional_arg(); if (token == TokenNameEQUAL_GREATER) { getNextToken(); variable(); @@ -1208,7 +1209,7 @@ public class Parser //extends PHPParserSuperclass getNextToken(); } return; - }else if (token == TokenNameunset) { + } else if (token == TokenNameunset) { getNextToken(); if (token == TokenNameLPAREN) { getNextToken(); @@ -1240,19 +1241,19 @@ public class Parser //extends PHPParserSuperclass return; } else if (token == TokenNametry) { getNextToken(); -if (token != TokenNameLBRACE) { + if (token != TokenNameLBRACE) { throwSyntaxError("'{' expected in 'try' statement."); } getNextToken(); statementList(); -if (token != TokenNameRBRACE) { + if (token != TokenNameRBRACE) { throwSyntaxError("'}' expected in 'try' statement."); } -getNextToken(); + getNextToken(); return; } else if (token == TokenNamecatch) { -getNextToken(); -if (token != TokenNameLPAREN) { + getNextToken(); + if (token != TokenNameLPAREN) { throwSyntaxError("'(' expected in 'catch' statement."); } getNextToken(); @@ -1261,33 +1262,29 @@ if (token != TokenNameLPAREN) { throwSyntaxError("Variable expected in 'catch' statement."); } getNextToken(); - - if (token != TokenNameRBRACE) { + if (token != TokenNameRPAREN) { throwSyntaxError("')' expected in 'catch' statement."); } getNextToken(); -getNextToken(); -if (token != TokenNameLBRACE) { + if (token != TokenNameLBRACE) { throwSyntaxError("'{' expected in 'catch' statement."); } getNextToken(); statementList(); -if (token != TokenNameRBRACE) { + if (token != TokenNameRBRACE) { throwSyntaxError("'}' expected in 'catch' statement."); } -getNextToken(); + getNextToken(); additional_catches(); return; } else if (token == TokenNamethrow) { getNextToken(); - expr(); if (token == TokenNameSEMICOLON) { getNextToken(); } else { throwSyntaxError("';' expected after 'throw' exxpression."); } - return; } else if (token == TokenNamefinal || token == TokenNameabstract || token == TokenNameclass || token == TokenNameinterface) { @@ -1347,12 +1344,10 @@ getNextToken(); throwSyntaxError("Variable expected in 'catch' statement."); } getNextToken(); - - if (token != TokenNameRBRACE) { + if (token != TokenNameRPAREN) { throwSyntaxError("')' expected in 'catch' statement."); } getNextToken(); - getNextToken(); if (token != TokenNameLBRACE) { throwSyntaxError("'{' expected in 'catch' statement."); } @@ -1364,7 +1359,24 @@ getNextToken(); getNextToken(); } } - + + private void foreach_variable() { + // w_variable + //| '&' w_variable + if (token == TokenNameAND) { + getNextToken(); + } + w_variable(); + } + private void foreach_optional_arg() { + // /* empty */ + //| T_DOUBLE_ARROW foreach_variable + if (token == TokenNameEQUAL_GREATER) { + getNextToken(); + foreach_variable(); + } + } + private void global_var_list() { // global_var_list: // global_var_list ',' global_var @@ -1607,7 +1619,8 @@ getNextToken(); } while (token == TokenNamepublic || token == TokenNameprotected || token == TokenNameprivate || token == TokenNamestatic || token == TokenNameabstract || token == TokenNamefinal - || token == TokenNamefunction || token == TokenNamevar); + || token == TokenNamefunction || token == TokenNamevar + || token == TokenNameconst); } private void class_statement() { // class_statement: @@ -1624,6 +1637,12 @@ getNextToken(); compilationUnit.compilationResult); getNextToken(); class_variable_declaration(); + } else if (token == TokenNameconst) { + class_constant_declaration(); + if (token != TokenNameSEMICOLON) { + throwSyntaxError("';' expected after class const declaration."); + } + getNextToken(); } else { boolean hasModifiers = member_modifiers(); if (token == TokenNamefunction) { @@ -1658,6 +1677,30 @@ getNextToken(); // throwSyntaxError("'function' or 'var' expected."); // } } + private void class_constant_declaration() { + // class_constant_declaration ',' T_STRING '=' static_scalar + // | T_CONST T_STRING '=' static_scalar + if (token != TokenNameconst) { + throwSyntaxError("'const' keyword expected in class declaration."); + } else { + getNextToken(); + } + while (true) { + if (token != TokenNameIdentifier) { + throwSyntaxError("Identifier expected in class const declaration."); + } + getNextToken(); + if (token != TokenNameEQUAL) { + throwSyntaxError("'=' expected in class const declaration."); + } + getNextToken(); + static_scalar(); + if (token != TokenNameCOMMA) { + break; // while(true)-loop + } + getNextToken(); + } + } // private void variable_modifiers() { // // variable_modifiers: // // non_empty_member_modifiers @@ -1757,6 +1800,7 @@ getNextToken(); getNextToken(); } private void functionDefinition(MethodDeclaration methodDecl) { + boolean isAbstract = false; if (astPtr == 0) { compilationUnit.types.add(methodDecl); } else { @@ -1776,9 +1820,22 @@ getNextToken(); newMethods[0] = methodDecl; typeDecl.methods = newMethods; } + if ((typeDecl.modifiers & AccAbstract) == AccAbstract) { + isAbstract = true; + } else if ((typeDecl.modifiers & AccInterface) == AccInterface) { + isAbstract = true; + } } } functionDeclarator(methodDecl); + if (token == TokenNameSEMICOLON) { + if (!isAbstract) { + throwSyntaxError("Body declaration expected for method: " + + new String(methodDecl.selector)); + } + getNextToken(); + return; + } functionBody(methodDecl); } private void functionDeclarator(MethodDeclaration methodDecl) { @@ -1797,7 +1854,7 @@ getNextToken(); throwSyntaxError("'(' expected in function declaration."); } if (token != TokenNameRPAREN) { - parameterList(); + parameter_list(); } if (token != TokenNameRPAREN) { throwSyntaxError("')' expected in function declaration."); @@ -1814,16 +1871,54 @@ getNextToken(); } } // - private void parameterList() { - //parameter-declaration - //parameter-list ',' parameter-declaration - do { - parameterDeclaration(); - if (token != TokenNameCOMMA) { - break; + private void parameter_list() { + // non_empty_parameter_list + // | /* empty */ + non_empty_parameter_list(true); + } + private void non_empty_parameter_list(boolean empty_allowed) { + // optional_class_type T_VARIABLE + // | optional_class_type '&' T_VARIABLE + // | optional_class_type '&' T_VARIABLE '=' static_scalar + // | optional_class_type T_VARIABLE '=' static_scalar + // | non_empty_parameter_list ',' optional_class_type T_VARIABLE + // | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE + // | non_empty_parameter_list ',' optional_class_type '&' T_VARIABLE '=' + // static_scalar + // | non_empty_parameter_list ',' optional_class_type T_VARIABLE '=' + // static_scalar + if (token == TokenNameIdentifier || token == TokenNameVariable + || token == TokenNameAND) { + while (true) { + if (token == TokenNameIdentifier) { + getNextToken(); + } + if (token == TokenNameAND) { + getNextToken(); + } + if (token == TokenNameVariable) { + getNextToken(); + if (token == TokenNameEQUAL) { + getNextToken(); + static_scalar(); + } + } else { + throwSyntaxError("Variable expected in parameter list."); + } + if (token != TokenNameCOMMA) { + break; + } + getNextToken(); } - getNextToken(); - } while (true); + return; + } + if (!empty_allowed) { + throwSyntaxError("Identifier expected in parameter list."); + } + } + private void optional_class_type() { + // /* empty */ + //| T_STRING } private void parameterDeclaration() { //variable @@ -2491,8 +2586,7 @@ getNextToken(); // | expr '?' expr ':' expr case TokenNameinstanceof : getNextToken(); - throwSyntaxError("not yet implemented (class_name_reference)"); - // class_name_reference(); + class_name_reference(); break; case TokenNameQUESTION : getNextToken(); @@ -2653,16 +2747,16 @@ getNextToken(); } } } -// private void variableList() { -// do { -// variable(); -// if (token == TokenNameCOMMA) { -// getNextToken(); -// } else { -// break; -// } -// } while (true); -// } + // private void variableList() { + // do { + // variable(); + // if (token == TokenNameCOMMA) { + // getNextToken(); + // } else { + // break; + // } + // } while (true); + // } private void variable_without_objects() { // variable_without_objects: // reference_variable @@ -2739,12 +2833,12 @@ getNextToken(); getNextToken(); w_variable(); } else { -// if (token == TokenNameIdentifier || token == TokenNameVariable -// || token == TokenNameDOLLAR) { -// variable(); -// } else { - expr_without_variable(true); -// } + // if (token == TokenNameIdentifier || token == TokenNameVariable + // || token == TokenNameDOLLAR) { + // variable(); + // } else { + expr_without_variable(true); + // } } if (token != TokenNameCOMMA) { break; @@ -2944,7 +3038,6 @@ getNextToken(); } getNextToken(); } else { - if (token != TokenNameLBRACE) { throwSyntaxError("'{' expected in variable name."); } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java index ff11fa1..1ae5d16 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java @@ -3494,6 +3494,8 @@ public class Scanner implements IScanner, ITerminalSymbols { return "case"; //$NON-NLS-1$ case TokenNameclass : return "class"; //$NON-NLS-1$ + case TokenNamecatch : + return "catch"; //$NON-NLS-1$ case TokenNameclone : //$NON-NLS-1$ return "clone"; @@ -3546,6 +3548,8 @@ public class Scanner implements IScanner, ITerminalSymbols { return "include"; //$NON-NLS-1$ case TokenNameinclude_once : return "include_once"; //$NON-NLS-1$ + case TokenNameinstanceof : + return "instanceof"; //$NON-NLS-1$ case TokenNameinterface : return "interface"; //$NON-NLS-1$ case TokenNameisset : diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/EditorUtility.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/EditorUtility.java index b874f4f..097261a 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/EditorUtility.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/phpeditor/EditorUtility.java @@ -67,7 +67,7 @@ public class EditorUtility { IEditorInput input= null; try { - input= getEditorInput(inputElement); + input = getEditorInput(inputElement); } catch (JavaModelException x) { PHPeclipsePlugin.log(x.getStatus()); } -- 1.7.1 From 316002b7eecbabe70db2f63228c964db2bb113c2 Mon Sep 17 00:00:00 2001 From: khartlage Date: Fri, 16 Apr 2004 17:30:27 +0000 Subject: [PATCH 15/16] misc changes --- .../internal/corext/template/default-templates.xml | 34 +++++++++++++++++++- 1 files changed, 33 insertions(+), 1 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/default-templates.xml b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/default-templates.xml index 8f2f29c..2ab2143 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/default-templates.xml +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/default-templates.xml @@ -464,6 +464,38 @@ ${cursor} - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- 1.7.1 From 1efc03c75342d181eba38eaf9c6722b5f19758f7 Mon Sep 17 00:00:00 2001 From: khartlage Date: Fri, 16 Apr 2004 19:15:53 +0000 Subject: [PATCH 16/16] initial quantum version --- .../.classpath | 9 + .../.cvsignore | 2 + .../.project | 17 + .../net.sourceforge.phpeclipse.quantum.sql/README | 78 +++ .../build.properties | 10 + .../doc/Custom Copy.html | 99 ++++ .../doc/Structure.html | 98 ++++ .../doc/book.css | 1 + .../doc/connect.html | 71 +++ .../doc/developers.html | 301 +++++++++++ .../doc/getting_started_connections.html | 77 +++ .../doc/getting_started_perspective.html | 28 + .../doc/images/logo.gif | Bin 0 -> 9740 bytes .../doc/images/newbookmark_menu.gif | Bin 0 -> 4120 bytes .../doc/images/newbookmark_wizard.gif | Bin 0 -> 8861 bytes .../doc/images/open_perspective.gif | Bin 0 -> 32416 bytes .../doc/images/quantum_perspective.gif | Bin 0 -> 27548 bytes .../doc/images/select_perspective_dialog.gif | Bin 0 -> 8360 bytes .../doc/index.html | 17 + .../doc/structure.gif | Bin 0 -> 3882 bytes .../doc/toc.xml | 9 + .../icons/.xvpics/fulldata-disabled.gif | 5 + .../icons/add.gif | Bin 0 -> 238 bytes .../icons/add_schema.gif | Bin 0 -> 154 bytes .../icons/append.gif | Bin 0 -> 164 bytes .../icons/autocommit.gif | Bin 0 -> 207 bytes .../icons/bigtable.gif | Bin 0 -> 242 bytes .../icons/bookmarkfile.gif | Bin 0 -> 933 bytes .../icons/bookmarks.gif | Bin 0 -> 238 bytes .../icons/clear.gif | Bin 0 -> 162 bytes .../icons/close.gif | Bin 0 -> 155 bytes .../icons/column.gif | Bin 0 -> 219 bytes .../icons/commit.gif | Bin 0 -> 252 bytes .../icons/connect.gif | Bin 0 -> 902 bytes .../icons/connected.gif | Bin 0 -> 152 bytes .../icons/copy.gif | Bin 0 -> 288 bytes .../icons/cut.gif | Bin 0 -> 652 bytes .../icons/delete.gif | Bin 0 -> 143 bytes .../icons/disconnect.gif | Bin 0 -> 919 bytes .../icons/edit.gif | Bin 0 -> 441 bytes .../icons/entitygroup.gif | Bin 0 -> 169 bytes .../icons/export.gif | Bin 0 -> 143 bytes .../icons/filter.gif | Bin 0 -> 159 bytes .../icons/fulldata.gif | Bin 0 -> 111 bytes .../icons/greentable.gif | Bin 0 -> 120 bytes .../icons/grid.gif | Bin 0 -> 152 bytes .../icons/group.gif | Bin 0 -> 217 bytes .../icons/import.gif | Bin 0 -> 141 bytes .../icons/key.gif | Bin 0 -> 156 bytes .../icons/keycolumn.gif | Bin 0 -> 251 bytes .../icons/log.gif | Bin 0 -> 164 bytes .../icons/missingtable.gif | Bin 0 -> 256 bytes .../icons/next.gif | Bin 0 -> 183 bytes .../icons/paste.gif | Bin 0 -> 298 bytes .../icons/play.gif | Bin 0 -> 186 bytes .../icons/previous.gif | Bin 0 -> 183 bytes .../icons/qmodel.gif | Bin 0 -> 941 bytes .../icons/quantum-ng.gif | Bin 0 -> 591 bytes .../icons/refresh.gif | Bin 0 -> 937 bytes .../icons/rollback.gif | Bin 0 -> 201 bytes .../icons/sample.gif | Bin 0 -> 983 bytes .../icons/schema.gif | Bin 0 -> 152 bytes .../icons/script.gif | Bin 0 -> 677 bytes .../icons/sequence.gif | Bin 0 -> 118 bytes .../icons/statement.gif | Bin 0 -> 152 bytes .../icons/stop.gif | Bin 0 -> 254 bytes .../icons/subset.gif | Bin 0 -> 156 bytes .../icons/success.gif | Bin 0 -> 661 bytes .../icons/table.gif | Bin 0 -> 237 bytes .../icons/torque.gif | Bin 0 -> 1044 bytes .../icons/unused/Thumbs.db | Bin 0 -> 9216 bytes .../icons/unused/bluegroup.gif | Bin 0 -> 157 bytes .../icons/unused/green_group.gif | Bin 0 -> 159 bytes .../icons/unused/green_schema.gif | Bin 0 -> 152 bytes .../icons/unused/green_view_group.gif | Bin 0 -> 254 bytes .../icons/unused/key.gif | Bin 0 -> 155 bytes .../icons/unused/key2.gif | Bin 0 -> 153 bytes .../icons/unused/margarita.gif | Bin 0 -> 152 bytes .../icons/unused/quantum.gif | Bin 0 -> 93 bytes .../icons/unused/sequence_group.gif | Bin 0 -> 248 bytes .../icons/unused/subset.gif | Bin 0 -> 621 bytes .../icons/unused/table_group.gif | Bin 0 -> 252 bytes .../icons/unused/view.gif | Bin 0 -> 149 bytes .../icons/unused/view_group.gif | Bin 0 -> 254 bytes .../icons/user.gif | Bin 0 -> 134 bytes .../icons/view.gif | Bin 0 -> 148 bytes .../icons/xml.gif | Bin 0 -> 159 bytes .../install.txt | 24 + .../lib/junit.jar | Bin 0 -> 121070 bytes .../plugin-3.0.xml | 300 +++++++++++ .../plugin.properties | 15 + .../plugin.xml | 303 +++++++++++ .../schema/data.exsd | 107 ++++ .../schema/metadata.exsd | 107 ++++ .../src-test/com/quantum/util/StringUtilTest.java | 71 +++ .../src/com/quantum/IQuantumConstants.java | 26 + .../src/com/quantum/Messages.java | 41 ++ .../src/com/quantum/QuantumPlugin.java | 310 ++++++++++++ .../src/com/quantum/QuantumResources.properties | 286 +++++++++++ .../com/quantum/actions/AddToQuickListAction.java | 56 ++ .../src/com/quantum/actions/BaseSQLAction.java | 25 + .../com/quantum/actions/BaseSequenceAction.java | 53 ++ .../src/com/quantum/actions/CloseTableAction.java | 40 ++ .../src/com/quantum/actions/ConnectAction.java | 115 +++++ .../src/com/quantum/actions/CustomCopyAction.java | 73 +++ .../com/quantum/actions/DeleteAllRowsAction.java | 77 +++ .../com/quantum/actions/DeleteBookmarkAction.java | 59 +++ .../com/quantum/actions/DeleteColumnAction.java | 63 +++ .../com/quantum/actions/DeleteObjectAction.java | 77 +++ .../com/quantum/actions/DeleteSubsetAction.java | 55 ++ .../src/com/quantum/actions/DisconnectAction.java | 81 +++ .../src/com/quantum/actions/ExecuteAction.java | 142 ++++++ .../com/quantum/actions/ExecuteAgainstAction.java | 184 +++++++ .../com/quantum/actions/ExportBookmarksAction.java | 42 ++ .../src/com/quantum/actions/ExportQueryAction.java | 83 +++ .../src/com/quantum/actions/ExportXMLAction.java | 130 +++++ .../com/quantum/actions/ImportBookmarksAction.java | 88 ++++ .../src/com/quantum/actions/ImportQueryAction.java | 80 +++ .../src/com/quantum/actions/NewBookmarkAction.java | 32 ++ .../src/com/quantum/actions/NewSubsetAction.java | 53 ++ .../com/quantum/actions/NextSequenceAction.java | 42 ++ .../src/com/quantum/actions/OpenQueryAction.java | 43 ++ .../com/quantum/actions/PrevSequenceAction.java | 44 ++ .../com/quantum/actions/RefreshBookmarkAction.java | 37 ++ .../com/quantum/actions/RefreshTableAction.java | 40 ++ .../quantum/actions/RemoveFromQuickListAction.java | 56 ++ .../src/com/quantum/actions/ViewTableAction.java | 59 +++ .../quantum/actions/ViewTableDetailsAction.java | 66 +++ .../src/com/quantum/adapters/AdabasDAdapter.java | 11 + .../src/com/quantum/adapters/AdapterFactory.java | 93 ++++ .../src/com/quantum/adapters/DB2AS400Adapter.java | 15 + .../src/com/quantum/adapters/DB2Adapter.java | 21 + .../src/com/quantum/adapters/DatabaseAdapter.java | 198 ++++++++ .../src/com/quantum/adapters/DriverInfo.java | 57 +++ .../com/quantum/adapters/FeatureNotSupported.java | 7 + .../src/com/quantum/adapters/GenericAdapter.java | 20 + .../src/com/quantum/adapters/MySQLAdapter.java | 9 + .../quantum/adapters/NoSuchAdapterException.java | 9 + .../src/com/quantum/adapters/OracleAdapter.java | 67 +++ .../src/com/quantum/adapters/PostgresAdapter.java | 70 +++ .../src/com/quantum/adapters/RedBrickAdapter.java | 23 + .../src/com/quantum/editors/ColorManager.java | 28 + .../editors/NonRuleBasedDamagerRepairer.java | 135 +++++ .../src/com/quantum/editors/SQLColorConstants.java | 13 + .../src/com/quantum/editors/SQLConfiguration.java | 89 ++++ .../com/quantum/editors/SQLDocumentProvider.java | 35 ++ .../src/com/quantum/editors/SQLEditor.java | 59 +++ .../com/quantum/editors/SQLPartitionScanner.java | 225 +++++++++ .../com/quantum/extensions/ExtensionAction.java | 132 +++++ .../src/com/quantum/extensions/IDataExtension.java | 21 + .../com/quantum/extensions/IMetadataExtension.java | 21 + .../com/quantum/extensions/IQuantumExtension.java | 13 + .../quantum/extensions/ProcessServiceMembers.java | 281 +++++++++++ .../src/com/quantum/model/Bookmark.java | 525 ++++++++++++++++++++ .../src/com/quantum/model/BookmarkCollection.java | 312 ++++++++++++ .../src/com/quantum/model/BookmarkHolder.java | 17 + .../src/com/quantum/model/Column.java | 21 + .../src/com/quantum/model/ColumnImpl.java | 148 ++++++ .../src/com/quantum/model/ConnectionException.java | 56 ++ .../src/com/quantum/model/Constraint.java | 8 + .../src/com/quantum/model/Database.java | 214 ++++++++ .../src/com/quantum/model/Entity.java | 40 ++ .../src/com/quantum/model/EntityFactory.java | 36 ++ .../src/com/quantum/model/EntityHolder.java | 8 + .../src/com/quantum/model/EntityImpl.java | 182 +++++++ .../src/com/quantum/model/ForeignKey.java | 15 + .../src/com/quantum/model/HasMetaData.java | 24 + .../src/com/quantum/model/Index.java | 13 + .../src/com/quantum/model/IndexImpl.java | 69 +++ .../com/quantum/model/NotConnectedException.java | 8 + .../src/com/quantum/model/PasswordFinder.java | 15 + .../src/com/quantum/model/Schema.java | 109 ++++ .../src/com/quantum/model/SchemaHolder.java | 8 + .../src/com/quantum/model/Sequence.java | 8 + .../src/com/quantum/model/SequenceImpl.java | 13 + .../src/com/quantum/model/Table.java | 11 + .../src/com/quantum/model/TableImpl.java | 31 ++ .../src/com/quantum/model/View.java | 11 + .../src/com/quantum/model/ViewImpl.java | 25 + .../com/quantum/model/xml/ModelToXMLConverter.java | 150 ++++++ .../src/com/quantum/model/xml/TorqueConverter.java | 90 ++++ .../src/com/quantum/perspective/DBPerspective.java | 30 ++ .../com/quantum/preferences/CopyPreferences.java | 37 ++ .../quantum/preferences/CustomCopyPreferences.java | 46 ++ .../preferences/CustomCopyPreferences2.java | 46 ++ .../preferences/CustomCopyPreferences3.java | 46 ++ .../com/quantum/preferences/GlobalPreferences.java | 49 ++ .../quantum/preferences/SQLEditorPreferences.java | 339 +++++++++++++ .../quantum/properties/BookmarkPropertyPage.java | 284 +++++++++++ .../DatabaseInformationPropertyPage.java | 60 +++ .../com/quantum/properties/EntityPropertyPage.java | 187 +++++++ .../com/quantum/properties/SchemaPropertyPage.java | 256 ++++++++++ .../src/com/quantum/sql/ConnectionEstablisher.java | 19 + .../src/com/quantum/sql/FilterSort.java | 83 +++ .../src/com/quantum/sql/MultiSQLServer.java | 426 ++++++++++++++++ .../src/com/quantum/sql/SQLHelper.java | 73 +++ .../src/com/quantum/sql/SQLParser.java | 62 +++ .../src/com/quantum/sql/SQLResults.java | 139 ++++++ .../src/com/quantum/sql/TableRow.java | 60 +++ .../sql/metadata/MetaDataJDBCInterface.java | 195 ++++++++ .../quantum/sql/metadata/MetaDataXMLInterface.java | 191 +++++++ .../com/quantum/sql/metadata/ObjectMetaData.java | 204 ++++++++ .../src/com/quantum/sql/parser/SQLLexx.java | 166 ++++++ .../src/com/quantum/sql/parser/StringPointer.java | 62 +++ .../src/com/quantum/sql/parser/Token.java | 57 +++ .../quantum/ui/dialog/BookmarkSelectionDialog.java | 110 ++++ .../quantum/ui/dialog/ExceptionDisplayDialog.java | 281 +++++++++++ .../src/com/quantum/ui/dialog/PasswordDialog.java | 122 +++++ .../src/com/quantum/util/NthLevelConverter.java | 145 ++++++ .../src/com/quantum/util/OneLevelConverter.java | 77 +++ .../src/com/quantum/util/QuantumUtil.java | 47 ++ .../src/com/quantum/util/StringMatrix.java | 352 +++++++++++++ .../src/com/quantum/util/StringUtil.java | 33 ++ .../quantum/util/connection/ConnectionUtil.java | 46 ++ .../src/com/quantum/util/io/InputStreamHelper.java | 18 + .../src/com/quantum/util/sql/TypesHelper.java | 59 +++ .../quantum/util/versioning/VersioningHelper.java | 49 ++ .../src/com/quantum/util/xml/XMLHelper.java | 73 +++ .../src/com/quantum/view/CopyAction.java | 40 ++ .../src/com/quantum/view/LogConstants.java | 9 + .../src/com/quantum/view/LogProxy.java | 34 ++ .../src/com/quantum/view/SQLLogView.java | 109 ++++ .../src/com/quantum/view/SQLQueryView.java | 517 +++++++++++++++++++ .../src/com/quantum/view/ViewHelper.java | 101 ++++ .../com/quantum/view/bookmark/AddSchemaAction.java | 58 +++ .../com/quantum/view/bookmark/AddSchemaDialog.java | 86 ++++ .../quantum/view/bookmark/BookmarkClipboard.java | 13 + .../view/bookmark/BookmarkContentProvider.java | 40 ++ .../view/bookmark/BookmarkLabelProvider.java | 74 +++ .../quantum/view/bookmark/BookmarkListNode.java | 120 +++++ .../com/quantum/view/bookmark/BookmarkNode.java | 167 +++++++ .../com/quantum/view/bookmark/BookmarkView.java | 269 ++++++++++ .../view/bookmark/BookmarkViewActionGroup.java | 266 ++++++++++ .../src/com/quantum/view/bookmark/ColumnNode.java | 64 +++ .../src/com/quantum/view/bookmark/CopyAction.java | 109 ++++ .../src/com/quantum/view/bookmark/EntityNode.java | 128 +++++ .../src/com/quantum/view/bookmark/GroupNode.java | 92 ++++ .../view/bookmark/LabelDecorationInstructions.java | 39 ++ .../src/com/quantum/view/bookmark/PasteAction.java | 46 ++ .../com/quantum/view/bookmark/QueryListNode.java | 76 +++ .../src/com/quantum/view/bookmark/QueryNode.java | 64 +++ .../com/quantum/view/bookmark/QuickListNode.java | 98 ++++ .../com/quantum/view/bookmark/RenameAction.java | 52 ++ .../src/com/quantum/view/bookmark/SchemaNode.java | 81 +++ .../src/com/quantum/view/bookmark/TreeNode.java | 124 +++++ .../src/com/quantum/view/subset/EntitySubset.java | 86 ++++ .../src/com/quantum/view/subset/ObjectNode.java | 167 +++++++ .../quantum/view/subset/SubsetContentProvider.java | 158 ++++++ .../quantum/view/subset/SubsetLabelProvider.java | 61 +++ .../src/com/quantum/view/subset/SubsetNode.java | 162 ++++++ .../src/com/quantum/view/subset/SubsetRoot.java | 41 ++ .../src/com/quantum/view/subset/SubsetView.java | 354 +++++++++++++ .../com/quantum/view/tableview/DefaultSizes.java | 6 + .../com/quantum/view/tableview/TableAdapter.java | 269 ++++++++++ .../src/com/quantum/view/tableview/TableView.java | 283 +++++++++++ .../view/tableview/TableViewMenuListener.java | 138 +++++ .../quantum/view/tableview/TableViewToolBar.java | 246 +++++++++ .../src/com/quantum/wizards/BaseSQLPage.java | 49 ++ .../src/com/quantum/wizards/BookmarkWizard.java | 297 +++++++++++ .../src/com/quantum/wizards/DeleteRowPage.java | 139 ++++++ .../com/quantum/wizards/ExportBookmarkWizard.java | 34 ++ .../quantum/wizards/ExportBookmarkWizardPage.java | 283 +++++++++++ .../com/quantum/wizards/ExportTorqueWizard.java | 20 + .../src/com/quantum/wizards/InsertRowPage.java | 120 +++++ .../src/com/quantum/wizards/SQLPage.java | 11 + .../src/com/quantum/wizards/SQLRowWizard.java | 28 + .../src/com/quantum/wizards/SortFilterPage.java | 180 +++++++ .../src/com/quantum/wizards/UpdateRowPage.java | 166 ++++++ 268 files changed, 18929 insertions(+), 0 deletions(-) create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/.classpath create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/.cvsignore create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/.project create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/README create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/build.properties create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/doc/Custom Copy.html create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/doc/Structure.html create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/doc/book.css create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/doc/connect.html create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/doc/developers.html create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/doc/getting_started_connections.html create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/doc/getting_started_perspective.html create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/doc/images/logo.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/doc/images/newbookmark_menu.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/doc/images/newbookmark_wizard.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/doc/images/open_perspective.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/doc/images/quantum_perspective.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/doc/images/select_perspective_dialog.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/doc/index.html create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/doc/structure.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/doc/toc.xml create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/.xvpics/fulldata-disabled.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/add.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/add_schema.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/append.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/autocommit.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/bigtable.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/bookmarkfile.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/bookmarks.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/clear.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/close.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/column.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/commit.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/connect.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/connected.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/copy.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/cut.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/delete.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/disconnect.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/edit.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/entitygroup.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/export.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/filter.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/fulldata.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/greentable.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/grid.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/group.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/import.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/key.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/keycolumn.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/log.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/missingtable.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/next.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/paste.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/play.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/previous.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/qmodel.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/quantum-ng.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/refresh.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/rollback.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/sample.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/schema.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/script.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/sequence.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/statement.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/stop.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/subset.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/success.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/table.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/torque.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/Thumbs.db create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/bluegroup.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/green_group.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/green_schema.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/green_view_group.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/key.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/key2.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/margarita.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/quantum.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/sequence_group.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/subset.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/table_group.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/view.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/view_group.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/user.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/view.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/icons/xml.gif create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/install.txt create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/lib/junit.jar create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/plugin-3.0.xml create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/plugin.properties create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/plugin.xml create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/schema/data.exsd create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/schema/metadata.exsd create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src-test/com/quantum/util/StringUtilTest.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/IQuantumConstants.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/Messages.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/QuantumPlugin.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/QuantumResources.properties create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/AddToQuickListAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/BaseSQLAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/BaseSequenceAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/CloseTableAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ConnectAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/CustomCopyAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteAllRowsAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteBookmarkAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteColumnAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteObjectAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteSubsetAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DisconnectAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExecuteAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExecuteAgainstAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExportBookmarksAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExportQueryAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExportXMLAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ImportBookmarksAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ImportQueryAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/NewBookmarkAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/NewSubsetAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/NextSequenceAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/OpenQueryAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/PrevSequenceAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/RefreshBookmarkAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/RefreshTableAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/RemoveFromQuickListAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ViewTableAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ViewTableDetailsAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/AdabasDAdapter.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/AdapterFactory.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DB2AS400Adapter.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DB2Adapter.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DatabaseAdapter.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DriverInfo.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/FeatureNotSupported.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/GenericAdapter.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/MySQLAdapter.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/NoSuchAdapterException.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/OracleAdapter.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/PostgresAdapter.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/RedBrickAdapter.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/ColorManager.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/NonRuleBasedDamagerRepairer.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLColorConstants.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLConfiguration.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLDocumentProvider.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLEditor.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLPartitionScanner.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/ExtensionAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/IDataExtension.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/IMetadataExtension.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/IQuantumExtension.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/ProcessServiceMembers.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Bookmark.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/BookmarkCollection.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/BookmarkHolder.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Column.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/ColumnImpl.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/ConnectionException.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Constraint.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Database.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Entity.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/EntityFactory.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/EntityHolder.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/EntityImpl.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/ForeignKey.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/HasMetaData.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Index.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/IndexImpl.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/NotConnectedException.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/PasswordFinder.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Schema.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/SchemaHolder.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Sequence.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/SequenceImpl.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Table.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/TableImpl.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/View.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/ViewImpl.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/xml/ModelToXMLConverter.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/xml/TorqueConverter.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/perspective/DBPerspective.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/CopyPreferences.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/CustomCopyPreferences.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/CustomCopyPreferences2.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/CustomCopyPreferences3.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/GlobalPreferences.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/SQLEditorPreferences.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/properties/BookmarkPropertyPage.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/properties/DatabaseInformationPropertyPage.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/properties/EntityPropertyPage.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/properties/SchemaPropertyPage.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/ConnectionEstablisher.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/FilterSort.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/MultiSQLServer.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/SQLHelper.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/SQLParser.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/SQLResults.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/TableRow.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/metadata/MetaDataJDBCInterface.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/metadata/MetaDataXMLInterface.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/metadata/ObjectMetaData.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/parser/SQLLexx.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/parser/StringPointer.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/parser/Token.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/ui/dialog/BookmarkSelectionDialog.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/ui/dialog/ExceptionDisplayDialog.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/ui/dialog/PasswordDialog.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/NthLevelConverter.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/OneLevelConverter.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/QuantumUtil.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/StringMatrix.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/StringUtil.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/connection/ConnectionUtil.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/io/InputStreamHelper.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/sql/TypesHelper.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/versioning/VersioningHelper.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/xml/XMLHelper.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/CopyAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/LogConstants.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/LogProxy.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/SQLLogView.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/SQLQueryView.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/ViewHelper.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/AddSchemaAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/AddSchemaDialog.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkClipboard.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkContentProvider.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkLabelProvider.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkListNode.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkNode.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkView.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkViewActionGroup.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/ColumnNode.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/CopyAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/EntityNode.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/GroupNode.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/LabelDecorationInstructions.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/PasteAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/QueryListNode.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/QueryNode.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/QuickListNode.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/RenameAction.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/SchemaNode.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/TreeNode.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/EntitySubset.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/ObjectNode.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetContentProvider.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetLabelProvider.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetNode.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetRoot.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetView.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/DefaultSizes.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/TableAdapter.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/TableView.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/TableViewMenuListener.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/TableViewToolBar.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/BaseSQLPage.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/BookmarkWizard.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/DeleteRowPage.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/ExportBookmarkWizard.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/ExportBookmarkWizardPage.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/ExportTorqueWizard.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/InsertRowPage.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/SQLPage.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/SQLRowWizard.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/SortFilterPage.java create mode 100644 archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/UpdateRowPage.java diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/.classpath b/archive/net.sourceforge.phpeclipse.quantum.sql/.classpath new file mode 100644 index 0000000..5074f04 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/.cvsignore b/archive/net.sourceforge.phpeclipse.quantum.sql/.cvsignore new file mode 100644 index 0000000..ce087de --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/.cvsignore @@ -0,0 +1,2 @@ +bin +com.quantum diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/.project b/archive/net.sourceforge.phpeclipse.quantum.sql/.project new file mode 100644 index 0000000..68fc1de --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/.project @@ -0,0 +1,17 @@ + + + net.sourceforge.phpeclipse.quantum.sql + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/README b/archive/net.sourceforge.phpeclipse.quantum.sql/README new file mode 100644 index 0000000..7212fda --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/README @@ -0,0 +1,78 @@ +Changes: Changes from 2.2.3 + +Most changes to this version are trivial, and fall +into two main categories: + +- JDK 1.3 should now be supported. + +- Eclipse 3.0 M5/M6 should be supported (although + there's a different jar to install + +In addition: + +- Schema handling has been revised. + + + + + +Changes: Changes from 2.2.2 + +Most of the changes to the code are structural and +won't have an effect on the use of the plug-in. Some +of the changes that you will see include: + +- Better refresh support (Issuing a refresh on the + bookmark list does not collapse any previously-open + selections. + +- Properties available for items in the bookmark list + +- Key mapping (Ctl-Shift-Q) to execute queries in the + Query view + +- Bug fix for mixed-case tables in PostGres + +- Bug fix for SQL Queries on Oracle with column type + of CHAR + +- Added an explicit checkbox to indicate that you want + to be prompted for a password at connection time. + +- When you've selected multiple nodes at the same time, + you can perform the same action on each of them. + +- The status line from the Bookmark View now appears in + the standard status line window area. + +- Queries are persisted so that you can keep a list of + queries. + +Changes: Changes from 2.2.1 + +- Now you can leave blank the password field in the bookmark, + as suggested by Erik Dick in the Forum. You will be asked for + its value when trying to connect. There is a property + (Window->Properties->QuantumDB) to modify in case you use + blank passwords and don't want to be pestered with dialogs. + In this case, change the default (nothing) to a string + (e.g. "") and only when you use that string as bookmark + password you'll be asked for a new password. + +- The Query History View now registers all the queries, even + before being activated, fixing bug #773726. + +- The case sensitivity when using Postgres in Windows should + go now (bug #804353). + +- Fixed bug #811591, the Copy/Paste of bookmarks wasn't properly + initialized. + +- Now if the connection is implicit (created when using the SQL + Editor before opening the bookmark), the bookmark is connected + but the tables and views are not loaded till you try to expand + the node. + +- Fixed (really avoided) the problem with the Oracle jdbc driver + and its bug with getIndexInfo(). Bug reference #819846. + \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/build.properties b/archive/net.sourceforge.phpeclipse.quantum.sql/build.properties new file mode 100644 index 0000000..c1c75db --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/build.properties @@ -0,0 +1,10 @@ +bin.includes = icons/,\ + doc/,\ + *.jar,\ + plugin.xml,\ + plugin.properties,\ + install.txt,\ + .classpath,\ + .project,\ + +source.quantum.jar = src/ diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/doc/Custom Copy.html b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/Custom Copy.html new file mode 100644 index 0000000..e9b8ee4 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/Custom Copy.html @@ -0,0 +1,99 @@ + +

Author: jparrai
+ Date: 26-08-2003
+ Subject: Using the Custom Copy facility
+

+

The "Custom Copy" feature is meant to allow the user to customize the copy + format of tables and columns.

+

How to use : You are in the Bookmarks View, or the Subset View. You + select the tables, views and columns that you want to copy. Be sure that only + tables, views and columns are selected. Then you select "Custom Copy" in the + context menu. By default, a blank sub-menu will appear. You have to customize + it to do something.

+

How to customize : You go to the Window->Preferences , then QuantumDB->Copy->Custom + Copy 1. You can have up to three different templates, that will appear in + the sub-menu with the names you give to them. So you start the Custom Copy 1 + preferences page.

+

There you have some boxes to fill up. The idea is that you will have a list + of tables (from now on, tables will mean "tables and views"). This list of tables + is composed of the directly selected tables plus the implicitely selected (because + a column of it is selected). You choose a general template format, and the formats + of the lists and items. The possible variables you have to play are:

+
+

${schema} The schema of the table or column. Valid in all format specifiers + except Template.

+

${table} The table name, without schema. Valid in all format specifiers + except Template.

+

${qualified} Same as ${schema}.${table} Valid in all format specifiers + except Template.

+

${column} The column name. Only valid for Column specifiers.

+

${column_list} The list of all columns. Only valid for Table specifiers. +

+

${table_list} The list of all tables. Only valid in Template. This + is the only variable that can be used in Template.

+

\n Inserts a new line

+

\t Inserts a tab character

+
+

It's faster to explain by example. Suppose I select the columns ENAME and JOB + from the table BONUS in schema SCOTT, and also the entire table DEPT from same + schema.

+
+

 

+ + + + + + + + + + + + + + + + + + + + + +
BONUS (implicit)ENAME (selected)
 JOB (selected)
DEPT (selected)DEPTO (implicit)
 DNAME (implicit)
 LOC (implicit)
+
+

Now I have the specifiers :

+
    +
  • Name: AnyName
  • +
  • Table Item: Call_Func(${column_list})
  • +
  • Table Separator: \n
  • +
  • Column Item:${column}
  • +
  • Column Separator: ,
  • +
  • Template: //Generated code\n${table_list}\n//End of generated code +
  • +
+

The result will be:

+
+
+

// Generated code

+

Call_Func(ENAME, JOB)

+

Call_Func(DEPTNO, DNAME, LOC)

+

//End of generated code

+
+
+

If I want only a list of columns, I can set:

+
    +
  • Name: AnyName
  • +
  • Table Item: ${column_list}
  • +
  • Table Separator:,
  • +
  • Column Item:${qualified}.${column}
  • +
  • Column Separator: ,
  • +
  • Template: (${table_list})
  • +
+

The result will be:

+
+
+

(SCOTT.BONUS.ENAME, SCOTT.BONUS.JOB, SCOTT.DEPT.DEPTNO, SCOTT.DEPT.DNAME, + SCOTT.DEPT.LOC)

+
+
diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/doc/Structure.html b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/Structure.html new file mode 100644 index 0000000..b2f04d1 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/Structure.html @@ -0,0 +1,98 @@ + + + + + + + + + + + +Author: jparrai
+Date: 28-06-2003
+Subject: Highlights of the structure of data in Quantum.
+

Quantum program data structure

+

After loading the Quantum plug-in, the saved-state file (an xml file) is loaded + up. Bookmarks are loaded into the BookmarkContentProvider + and the SubsetContentProvider + classes, where they are stored in the form of a vector of BookmarkNode + and SubsetNode respectively.

+

A SubsetNode has a number of + children, objects of class ObjectNode. + Each ObjectNode has an ObjectMetaData + instance that will hold the metadata (columns names, sizes and that stuff) of + the table or view that it (the ObjectNode) + references. That metadata is loaded from the saved-state file also on load-up + of the plug-in (three hypen-words in a single-sentence, wow! :)

+

A BookmarkNode represents a + connection with a database. It will be displayed by the BookmarView + view. When you double-click on one of the bookmarks, the function MultiSQLServer.connect(current) + willl be called. MultiSQLServer + is a Singleton (a class that will have a single instance), so we can get the + instance of it with MultiSQLServer.getInstance().

+

The connect() function will + use the JDBC driver and connect to the database. After that, the BookmarkNode + will have its con member assigned + (not null). After the connection, the function that is answering your double-clicking + (ConnectAction.run()), will try + to get the tables, views, etc from that connection. To do that, it will call + BookmarkView.refreshBookmarkData(), + that will query the database. As the procedure to get the tables may be different + for each database, the actual querying is delegated to another class SQLHelper, + that will centralize that kind of procedures (the ones that depend on the type + of the database). The called function in this case is getTableList(). + SQLHelper is not a Singleton, + although it could be, but we don't really need an instance because the functions + are all static.

+

The getTableList() will try + to get the tables from the function MultiSQLServer.listTables(), + if the jdbc adapter of the bookmark is generic. listTables will ask the jdbc + driver directly for the list of tables, using the DatabaseMetadata.getTables() + call. If the adapter is not generic, it will use a SQL statement to get + the list of table names. This SQL statement will be of course different in every + database, so it will come from the DatabaseAdapter + class.

+

The DatabaseAdapter class is + the one where you should put all the functions that will be different for each + database. Then for each database, you create an "adapter" class derived + from DatabaseAdapter, and implement + all the necessary abstract functions. So you get a proper adapter using DatabaseAdapter + adapter = AdapterFactory.getInstance().getAdapter(current.getType()), + and the returned adapter will have the proper type (always a derived type from + DatabaseAdapter). Then calls + to the adapter object will be redirected to the proper function.

+

The TableNode objects generated + will have metadata, i.e. columns. That information is saved in an object of + class ObjectMetaData in the TableNode + object. This ObjectMetaData class is part of the metadata package, that has + basically four classes:

+

MetaDataJDBCInterface : Basically + takes care (through static functions) of passing the metadata from the jdbc + driver to the ObjectMetadata class.

+

MetaDataXMLInterface : Handles + interface between an ObjectMetaData and XML storage. It can write an existing + metadata object to XML and generate a new ObjectMetaData from existing XML.

+

ObjectMetaData : The class that + has all the metadata. Rather underdeveloped, one must add functions as needed. + The metadata is saved in the form of StringMatrix objects.

+

StringMatrix : A matrix of strings. + Saves the results from the jdbc driver, usually given as ResultSet objects, + that are very similar in structure but sequential in nature (you access the + records one at a time). The first line of the matrix are the names of the columns, + and the rest hold the values.

+

 

+

+


+

+

 

+ + \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/doc/book.css b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/book.css new file mode 100644 index 0000000..b6da4c8 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/book.css @@ -0,0 +1 @@ +P.Code { display: block; text-align: left; text-indent: 0.00pt; margin-top: 0.000000pt; margin-bottom: 0.000000pt; margin-right: 0.000000pt; margin-left: 15pt; font-size: 10.000000pt; font-weight: medium; font-style: Regular; color: #4444CC; text-decoration: none; vertical-align: baseline; text-transform: none; font-family: "Courier New"; } H6.CaptionFigColumn { display: block; text-align: left; text-indent: 0.000000pt; margin-top: 3.000000pt; margin-bottom: 11.000000pt; margin-right: 0.000000pt; margin-left: 0.000000pt; font-size: 9.000000pt; font-weight: medium; font-style: Italic; color: #000000; text-decoration: none; vertical-align: baseline; text-transform: none; font-family: "Arial"; } P.Note { display: block; text-align: left; text-indent: 0pt; margin-top: 19.500000pt; margin-bottom: 19.500000pt; margin-right: 0.000000pt; margin-left: 30pt; font-size: 11.000000pt; font-weight: medium; font-style: Italic; color: #000000; text-decoration: none; vertical-align: baseline; text-transform: none; font-family: "Arial"; } EM.UILabel { font-weight: Bold; font-style: Regular; text-decoration: none; vertical-align: baseline; text-transform: none; } EM.CodeName { font-weight: Bold; font-style: Regular; text-decoration: none; vertical-align: baseline; text-transform: none; font-family:"Courier New"; } /* following font face declarations need to be removed for DBCS */ body, h1, h2, h3, h4, ,h5, h6, p, table, td, caption, th, ul, ol, dl, li, dd, dt {font-family: Arial, Helvetica, sans-serif; color: #000000} pre { font-family: Courier, monospace} /* end font face declarations */ /* following font size declarations should be OK for DBCS */ body, h1, h2, h3, h4, h5, h6, p, table, td, caption, th, ul, ol, dl, li, dd, dt {font-size: 10pt; } pre { font-size: 10pt} /* end font size declarations */ body { background: #FFFFFF} h1 { font-size: 18pt; margin-top: 5; margin-bottom: 1 } h2 { font-size: 14pt; margin-top: 25; margin-bottom: 3 } h3 { font-size: 11pt; margin-top: 20; margin-bottom: 3 } h4 { font-size: 10pt; margin-top: 20; margin-bottom: 3; font-style: italic } p { margin-top: 10px; margin-bottom: 10px } pre { margin-left: 6; font-size: 9pt } a:link { color: #0000FF } a:hover { color: #000080 } a:visited { text-decoration: underline } ul { margin-top: 0; margin-bottom: 10 } li { margin-top: 0; margin-bottom: 0 } li p { margin-top: 0; margin-bottom: 0 } ol { margin-top: 0; margin-bottom: 10 } dl { margin-top: 0; margin-bottom: 10 } dt { margin-top: 0; margin-bottom: 0; font-weight: bold } dd { margin-top: 0; margin-bottom: 0 } strong { font-weight: bold} em { font-style: italic} var { font-style: italic} div.revision { border-left-style: solid; border-left-width: thin; border-left-color: #7B68EE; padding-left:5 } th { font-weight: bold } \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/doc/connect.html b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/connect.html new file mode 100644 index 0000000..b6b8e63 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/connect.html @@ -0,0 +1,71 @@ + + + + + Making a Quantumdb connexion (bookmark) + + +Author: jparrai
+Date: 28-03-2003
+Subject: Making a Quantumdb connexion
+
+To connect to a database (create a bookmark in quantum) you use the New Bookmark menu item that appears +when right-clicking on the blank space in the Database Bookmarks view.
+
+The data that the form asks of you is:
+
+
    +
  • Bookmark name: Is your private name of the bookmark you + are creating. It will appear in the view after is created. For example Test.
  • +
  • Username: The username for accessing the database. For + example SCOTT for the classical Oracle + examples.
  • +
  • Password: The password for that username. For example + TIGER for the SCOTT user. If you leave the + password blank, it'll ask you for it when connection is attempted.This behaviour + can be customized.
  • +
  • Schema: (optional): The schema of the user. We can leave + it blank.
  • +
  • Connect: Connect string, the format is (for Oracle) jdbc:[database]:[type]:@[host]:[port]:[database], + for example, for an Oracle database called DEV based on the same computer + you could put jdbc:oracle:thin:@localhost:1521:DEV.
  • +
  • Driver: The driver name, it should be in the documentation + of the JDBC driver. For Oracle, is usually oracle.jdbc.OracleDriver or oracle.jdbc.driver.OracleDriver (Oracle before + version 9)
  • +
  • Type: The type of the database. It will be used by Quantum + to adapt the SQL queries to the particular incompatibilites of each. The generic + should work for most of the features, so if you don't find your database on + the drop-down, use the Generic SQL.
    +
  • +
  • Driver Filename: You can select the .jar or .zip file where the driver is located. For + example in Oracle is usually at C:\Oracle\jdbc\lib\classes12.jar, being C:\Oracle + the installation directory of oracle.
  • +
+
+Other examples (only as orientation, your particular data may be +different)
+
+For MySql (in Windows):
+
Connect: jdbc:mysql://localhost/test
Driver: com.mysql.jdbc.Driver
Driver Filename: C:\mysql\jdbc\mysql-connector-java-2.0.4-bin.jar

For PostgreSql (in Linux):

Connect: jdbc:postgresql://localhost/emsdevel
Driver: org.postgresql.Driver
driver filename: /opt/postgresql/share/java/postgresql.jar


+
+ + diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/doc/developers.html b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/developers.html new file mode 100644 index 0000000..34724ed --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/developers.html @@ -0,0 +1,301 @@ + + + + + Tutorial of developing and changing QuantumDb + + +Author: jparrai
+Date: 28-03-2003
+Subject: Tutorial of developing and changing QuantumDb
+
+To modify the quantumdb plug-in, first you get it to a development +system, usually Eclipse itself.
+

1. Getting the project from CVS.
+

+First you go to Open a Perspective +and open the CVS repository exploring +perspective. It can be in the Others.... +You get a perspective. You right-click on the CVS Repositories view and create a New -> Repository Location...
+The data to access quantum is:
+
+Host: cvs.sourceforge.net
+Repository Path: /cvsroot/quantum
+User: anonymous
+Password:
+
+There is no password for anonymous. +You can substitute the User and Password for you own, if you are +registered in sourcefoge.net. If +you want developer access, remember to use extssh as the connexion type, so as +to be able to update the cvs repository with your changes (that need a +ssh connection in sourceforge)
+
+After that, if you are connected to the Net, you will be able to get +the project files. You will see a HEAD +sub-item, a Branches, and a Versions. You select the HEAD, and then right-click onto quantum-plugin. Then select Check Out As.... You cannot check it +out as a Project, because some files are not present, mainly the .project and .classpath.
+
+

2. Configuring the project.
+

+So you "Check Out As..." and select an Plug-In project, call it as you +wish, (I will use "com.quantum") and then select an Empty Plug In. If +everything goes ok, you should end with a new project and about 1600 +errors. The errors are caused because you have now a default classpath, +and the quantumdb project uses some plug-ins, so these plug-ins +directories must be referenced.
+
+My classpath for Eclipse 2.0 is as follows:
+
+ <?xml version="1.0" +encoding="UTF-8"?>
+ <classpath>
+     +<classpathentry kind="src" path="src"/>
+     +<classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" +sourcepath="JRE_SRC"/>
+     +<classpathentry kind="lib"
+ +        +path="C:/Parsec/eclipse/plugins/org.eclipse.core.boot_2.0.2/boot.jar" +sourcepath="C:/Parsec/eclipse/plugins/org.eclipse.platform.source_2.0.2/src/org.eclipse.core.boot_2.0.2/bootsrc.zip"/>
+     +<classpathentry kind="lib"
+ +        +path="C:/Parsec/eclipse/plugins/org.eclipse.core.runtime_2.0.2/runtime.jar" +sourcepath="C:/Parsec/eclipse/plugins/org.eclipse.platform.source_2.0.2/src/org.eclipse.core.runtime_2.0.2/runtimesrc.zip"/>
+     +<classpathentry kind="lib"
+ +        +path="C:/Parsec/eclipse/plugins/org.eclipse.core.resources_2.0.1/resources.jar" +sourcepath="C:/Parsec/eclipse/plugins/org.eclipse.platform.source_2.0.2/src/org.eclipse.core.resources_2.0.1/resourcessrc.zip"/>
+     +<classpathentry kind="lib"
+ +        +path="C:/Parsec/eclipse/plugins/org.eclipse.swt.win32_2.0.2/ws/win32/swt.jar" +sourcepath="C:/Parsec/eclipse/plugins/org.eclipse.platform.win32.source_2.0.2/src/org.eclipse.swt.win32_2.0.2/ws/win32/swtsrc.zip"/>
+     +<classpathentry kind="lib"
+ +        +path="C:/Parsec/eclipse/plugins/org.eclipse.ui_2.0.2/workbench.jar" +sourcepath="C:/Parsec/eclipse/plugins/org.eclipse.platform.source_2.0.2/src/org.eclipse.ui_2.0.2/workbenchsrc.zip"/>
+     +<classpathentry kind="lib"
+ +        +path="C:/Parsec/eclipse/plugins/org.eclipse.ui.win32_2.0.0/workbenchwin32.jar"
+ +        rootpath="" +sourcepath="C:/Parsec/eclipse/plugins/org.eclipse.platform.win32.source_2.0.2/src/org.eclipse.ui.win32_2.0.0/workbenchwin32src.zip"/>
+     +<classpathentry kind="output" path="bin"/>
+ </classpath>
+
+Where, as you can see, my Eclipse home is C:\Parsec\eclipse. In any case, +you need to reference those plug-ins you see below, from org.eclipse:
+
    +
  • core.boot
  • +
  • core.runtime
  • +
  • core.resources
  • +
  • ui
  • +
  • swt.win32 (substitute by your platform)
  • +
  • ui.win32 (substitute by your platform)
  • +
+


+ Remember after changing manually the .classpath + file that you have to Refresh the project + to take the changes in.
+
+ If you want to reference those plug-ins using the workspace, select Properties from the newly created com.quantum project and go to Java Build Path, then Libraries tab, and select the .jar files the project needs.
+
+ It should now build without errors.
+
+ In Eclipse 2.1 that won't work. Dependencies amongs plug-ins have changed and + instead of redoing all of them again I chose to use the new "classpath container" + facility. When I say that won't work I mean if linking against the 2.1 libraries. + If you link against the 2.0 libraries will work all right.
+

+

The libraries for 2.1 are as follows (I copy my classpath) :

+

<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="var"
+ path="ECLIPSE_HOME/plugins/org.eclipse.core.boot_2.1.0/boot.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.core.boot_2.1.0/bootsrc.zip"/>
+ <classpathentry kind="var"
+ path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime_2.1.0/runtime.jar" + sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.core.runtime_2.1.0/runtimesrc.zip"/>
+ <classpathentry kind="var"
+ path="ECLIPSE_HOME/plugins/org.eclipse.core.resources_2.1.0/resources.jar" + sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.core.resources_2.1.0/resourcessrc.zip"/>
+ <classpathentry kind="var"
+ path="ECLIPSE_HOME/plugins/org.eclipse.swt.win32_2.1.0/ws/win32/swt.jar" + sourcepath="ORG_ECLIPSE_PLATFORM_WIN32_SOURCE_SRC/org.eclipse.swt.win32_2.1.0/ws/win32/swtsrc.zip"/>
+ <classpathentry kind="var"
+ path="ECLIPSE_HOME/plugins/org.eclipse.ui_2.1.0/ui.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.ui_2.1.0/uisrc.zip"/>
+ <classpathentry kind="var"
+ path="ECLIPSE_HOME/plugins/org.eclipse.text_2.1.0/text.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.text_2.1.0/textsrc.zip"/>
+ <classpathentry kind="var"
+ path="ECLIPSE_HOME/plugins/org.eclipse.jface_2.1.0/jface.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.jface_2.1.0/jfacesrc.zip"/>
+ <classpathentry kind="var"
+ path="ECLIPSE_HOME/plugins/org.eclipse.jface.text_2.1.0/jfacetext.jar" + sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.jface.text_2.1.0/jfacetextsrc.zip"/>
+ <classpathentry kind="var"
+ path="ECLIPSE_HOME/plugins/org.eclipse.ui.views_2.1.0/views.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.ui.views_2.1.0/viewssrc.zip"/>
+ <classpathentry kind="var"
+ path="ECLIPSE_HOME/plugins/org.eclipse.ui.workbench_2.1.0/workbench.jar" + sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.ui.workbench_2.1.0/workbenchsrc.zip"/>
+ <classpathentry kind="var"
+ path="ECLIPSE_HOME/plugins/org.eclipse.ui.win32_2.1.0/workbenchwin32.jar" + sourcepath="ORG_ECLIPSE_PLATFORM_WIN32_SOURCE_SRC/org.eclipse.ui.win32_2.1.0/workbenchwin32src.zip"/>
+ <classpathentry kind="var"
+ path="ECLIPSE_HOME/plugins/org.eclipse.ui.workbench.texteditor_2.1.0/texteditor.jar" + sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.ui.workbench.texteditor_2.1.0/texteditorsrc.zip"/>
+ <classpathentry kind="var"
+ path="ECLIPSE_HOME/plugins/org.eclipse.ui.editors_2.1.0/editors.jar" + sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.ui.editors_2.1.0/editorssrc.zip"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+ </classpath>
+
+

+

3. Running the project.
+

+First go to Window -> Preferences +-> Plug-in Development -> Target Platform and to select all +the plug-ins that should be used when running a platform from the +plug-in development. I select all of them not in the workspace because I +don't want to resolve all the cross-references.
+
+Then go to Run -> Run As -> +Run-time Workbench. If all is well, a new workbench should +appear, that has you just-compiled quantum plug-in installed. To check +it, open the quantumdb perspective (Perspective +Button -> Others... ->QuantumDb Perspective), and see if +it appears. This is not
+the usual QuantumDb perspective, but the one you are developing. Of +course, if you have made no change to the standard source, there is no +difference.
+
+

4. Making a small change.
+

+To check that we are really using our modified QuantumDb, and not the +standard, let's make a change. Open the QuantumResources.properties file, +(in the com.quantum package), +and modify the line
+
+ bookmarkview.newBookmark = +New Bookmark...
+
+to
+
+ bookmarkview.newBookmark = +Add New Bookmark...
+
+(for example)
+
+Then Run the testing workbench again, you can now use simply Ctrl+F11 to run the last launched +environment. Now, in the bookmark view, when you right-click on it, it +should show your modified string. So you are now ready to change the +plug-in.
+

5. Creating a .jar file.
+

+

You may simply want to make a .jar + file from some configuration taken from the CVS, so as to have the latest version + available to you. You have to follow the same instructions as before for installation. + When it's installed and built, select the com.quantum + project, right-click on it and select Export.
+
+ In Eclipse 2.0: Select jar File and + then choose a directory. The name of the jar file should be Quantum.jar as that's the name stated in the + plugin.xml file.
+
+ To install this jar file as a plug-in, create a directory called com.quantum in the directory plugins under your local Eclipse installation + directory. Copy the jar file to that directory, and uncompress it (without deleting + it) into that same directory. In fact, I think you only need the icons + directory and the plugin.xlm, but you + can leave the rest of the files so they feel not so alone.
+
+ You close your Eclipse IDE and open it up again, and the QuantumDB perspective + should be available.
+

+

6. Uploading the change to CVS.

+

(I copy directly from the Eclipse Help, so as to have all the info in the same + place)

+

Synchronizing with a CVS repository

+


+ In the CVS team programming environment, there are two distinct processes involved + in synchronizing resources: updating with the latest changes from a branch and + committing to the branch.

+

When you make changes in the Workbench, the resources are saved locally. Eventually + you will want to commit your changes to the branch so others can have access + to them. Meanwhile, others may have committed changes to the branch. You will + want to update your Workbench resources with their changes.

+

Important!: It is preferable to update before committing, in case there are + conflicts with the resources in your Workbench and the resources currently in + the branch.

+

The synchronize view contains filters to control whether you want to view only + incoming changes or outgoing changes. Incoming changes come from the branch. + If accepted, they will update the Workbench resource to the latest version currently + committed into the branch. Outgoing changes come from the Workbench. If committed, + they will change the branch resources to match those currently present in the + Workbench.

+

Regardless of which mode (filter) you select, the Synchronize view always shows + you conflicts that arise when you have locally modified a resource for which + a more recent version is available in the branch. In this situation you can + choose to do one of three things: update the resource from the branch, commit + your version of the resource to the branch ,or merge your work with the changes + in the branch resource. Typically you will want to merge, as the other two options + will result in loss of work.

+

(End of copy from Eclipse Help, there are lots more, just go there and have + a look) Basically to get all the changes since the last time you took the sources, + then accept all the files that have changed in the CVS and you haven't touched. + If there are some that you have touched and are also touched by someone else + at CVS then you have to inspect the changes, see if they conflict with yours, + and merge both until you have a working set. Then you can upload that "working" + set to CVS. That's more or less the idea.

+ + diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/doc/getting_started_connections.html b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/getting_started_connections.html new file mode 100644 index 0000000..c14d6aa --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/getting_started_connections.html @@ -0,0 +1,77 @@ + + + + + Creating a QuantumDB Bookmark + + + +

Creating a QuantumDB Bookmark

+

Author: jparrai
+Date: 28-03-2003
+

To connect to a database (create a bookmark in quantum) you use the New Bookmark menu item that appears +when right-clicking on the blank space in the Database Bookmarks view.

+ + + +

Once this menu item is selected, you will see the "New Bookmark" wizard:

+ + + +

The data that the form asks of you is: +

    +
  • Bookmark name: Is your private name of the bookmark you + are creating. It will appear in the view after is created. For example Test.
  • +
  • Username: The username for accessing the database. For + example SCOTT for the classical Oracle + examples.
  • +
  • Password: The password for that username. For example + "TIGER" for the "SCOTT" user.
  • +
  • Prompt for Password: Check this box if you want to be prompted for a password + every time you try to connect to the database.
  • +
  • Schema: (optional): The schema of the user. We can leave + it blank.
  • +
  • Connect: Connect string, the format is (for Oracle) jdbc:[database]:[type]:@[host]:[port]:[database], + for example, for an Oracle database called DEV based on the same computer + you could put jdbc:oracle:thin:@localhost:1521:DEV.
  • +
  • Driver: The driver name, it should be in the documentation + of the JDBC driver. For Oracle, is usually oracle.jdbc.OracleDriver or oracle.jdbc.driver.OracleDriver (Oracle before + version 9)
  • +
  • Type: The type of the database. It will be used by Quantum + to adapt the SQL queries to the particular incompatibilites of each. The generic + should work for most of the features, so if you don't find your database on + the drop-down, use the Generic SQL.
    +
  • +
  • Driver Filename: You can select the .jar or .zip file where the driver is located. For + example in Oracle is usually at C:\Oracle\jdbc\lib\classes12.jar, being C:\Oracle + the installation directory of oracle.
  • +
+

Other examples (only as orientation, your particular data may be +different)
+

+For MySql (in Windows):

+
Connect: jdbc:mysql://localhost/test
Driver: com.mysql.jdbc.Driver
Driver Filename: C:\mysql\jdbc\mysql-connector-java-2.0.4-bin.jar
+
+

For PostgreSql (in Linux):

+
+ 
Connect: jdbc:postgresql://localhost/emsdevel
Driver: org.postgresql.Driver
driver filename: /opt/postgresql/share/java/postgresql.jar
+ + diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/doc/getting_started_perspective.html b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/getting_started_perspective.html new file mode 100644 index 0000000..442ceb9 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/getting_started_perspective.html @@ -0,0 +1,28 @@ + + + + + + Opening the Quantum DB Perspective + + + + +

Opening the Quantum DB Perspective

+

Typically, the first thing you do with the Quantum plug-in is to open the Quantum DB Perspective. +Go to Window -> Open Perspective -> Other... to get the "Select Perspective" +dialog.

+ + + +

Choose the "Quantum DB Perspective" option from the list:

+ + + +

The Quantum DB Perspective looks like this:

+ + + +

The first time you open the Quantum DB perspective, you won't see any bookmarks defined. + + \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/doc/images/logo.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/images/logo.gif new file mode 100644 index 0000000000000000000000000000000000000000..969a593172fa155c90bd65d2e50bc7747e7f3926 GIT binary patch literal 9740 zcmWldbyU+27skKqjogqJrK1}Lf{fD98#w`KkP;9${2;?{ObC009H~^Tpc(n&w-N_l2XLt2_PwLJ_Q3oT_q(Y85J!>yqc0G zK|@hhTj{u_rhyQ_OhMm7OV0R|n%xOKlCF+}DA88j%u(6MQqIyvnc}HoWTR!`AYtPr z=NKsO5k{~M&~!L|!YxwK_ll->j2WP01yVN?(slyWoPZM!f(E7vy2f~YAHcvy+|o_R z)Jnm~QqA35%fejO-cixqLHdk?y0wdzqqUB&yRxtAN#7vA*k8org4mhMfW=kN=|~|5 zKRN3_Mf-Ca?osltA##Dfdj7t;kx|OtVOr;72;pYN?&jn`V@imrW0a%W1s8I-qkWvW zQOG%y$Z*40<)9?x&>ZFHB8}h_o$!nkmy0#y?pV2}I=g0hc;uP+W|@bS7)9rj;_{vS zN=VUl*70qw7pm+d?mESE`demQvMunoPe12c7;BMz#WpY0sr0hj9WU>)fb$Lhm)g9k z&F7*XUG}cO64V_Y`ZywT;6&mrmE@WeskMZx`+5ak)`^9V>17r(GwbwAy5({nYL<7N zs$=T6rkZ5YP8SuD%dgwkU30jb>DFFm-JEykUa3Q8vTsMFQAMpuU7clT^_kvw)2{15 zBM-^_lR)AiU($0><{QDPA*CCG`0{bh#(u5)FO-{KtF*F@-+e{6zYJVk2l76N-}@%i zd??iULGs=g$@{yw<|Sg+s(tUOYu~ExKzd`>_12#J_T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Ee-ILGR}$(H4Bg1nd%Jg1b75GZTOb7Qa;-ZlYh)DlQ{^ z&|zXI4iQD27*3fODV!Lso*3(x7$2ONn46efotWC2n1)WW`6r)ATTi=B%;uyII9T`j zS+o2s;~67(=R^T3pqGmV1e%KWVa(7yU+p;#KO3RW)6$lur&ctl-kVIVI!vwkO|3^v zeMp(wD4g1?p4#e|+8&(xI5+iab!sIA(KUyNWIz=L^Ms-$1e_C<6Z=Rwgv$(~d8hXq z&{RtM@Bd5-Vov`VoDN!={0-g;qWkb)fVdvQJNH!vsjl97|)v!4_ z*_=acu6Z{18k~1~UpZGm4!vN<%Zs^L7Yp zI~jqdNG$7d9BO{Vv=D0(TtB_3X=?x5Z}vpwtaj=w;l`{^&8%+ctlrS9{`{=L+U&{w z*;BANqQIPCv%QvLfWp)k$nlfy;UoMnx}r4fXwj7E&~Aj~Ttpbqg>&wK9ApM@=W2{`uk zbE}*N*$raI=wa`33;vM{0jUd}9qADVa8e~S961&^zYwyvaB+X(5^Rwwuox<{7^bxt yZn_w8W-;>I;^oN2sMN*i8;dbDi&r`qV}};w<`?7F78CXtufm?wBC}`!p!YwRApSZ4 literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/doc/images/newbookmark_menu.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/images/newbookmark_menu.gif new file mode 100644 index 0000000000000000000000000000000000000000..f6014e299eabb08d44699139e1bf890af4e3c3e2 GIT binary patch literal 4120 zcmeH}`#%$o_s7>ZGq;+O%c7=oNfEhD#oUP{#3Xl``z_2pbKOX}-^bh~D)-A=vgAIg zTymG(BDtGOv`_CpzOJk)0c2ZL6)^ed%%Aujk#{ckF!+1Z!VzI8Su6}-gfq{VlKqL}LLYk3~L9Iwq zD>gGT5&$3}k*!E1IaGNDiDUo(jDMMI^%DOyB?^}l7epq9&XScGv&syH^2?Vm@ucvG z+^B?vgtWA@?CfkZnVgf8pP5;mRYxM{H5Di0-)2VD=EhXK%6$KxTwY#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net.sourceforge.phpeclipse.quantum.sql/doc/images/newbookmark_wizard.gif new file mode 100644 index 0000000000000000000000000000000000000000..30f148a8c2c05a5cc5cb98d4f538a5563c29ba71 GIT binary patch literal 8861 zcmV;OB4XV~Nk%w1VYUJ20fztp0000002~ew5DE$}001@&3^WW3K@1E`5(Pvb3rZUe zP#h9N8xl+z5L6u#SpfiU7Xx@19%>yTQYH*kBpFR46;vk`TO%1(CLLHQ7ga11TrC+_ zDjr)j6<8@3Wh5JRG8bhx8g?upOfDo`H7rUnBUv;pS3M$MI5Jl!DQGMtVY&#%)IXr7LHFhyQd`2D`Qzal>4|+vDK|(uOK`nPhGh{_Fd__BVMLc{lNI+3cPEbxzQd3l0S6N?KSYJ*;V@*YQQb%Y}NMl$_d17N{ zW@c_@Xm4m{Zf0hFYixFJadmNTWN~tO7yy7PB7i?XiA5HUNhOC!I)+O-kWn^*T{Dn_*Frd0U=gS)pTGtYluZe0zg@eu;N?l6G>NW@4vjZ@q7Eym57@ zU}eH?c*1RU*Kc^+aeUQsecWt%;B$TBb${r0gXMRF>v)CldWrO=IYg>FRm4rLm-=zN@FSsHeZGskEu9x~{Ocv8}qYvA&3z{g|fxqK46_ zn9#M1#JPjpx|_|mmglXk#j~}>v9rjwxX8G-&%3$ByS&Y$rS`qR&g+}00000A^8LV00930EC2ui0JZ_>0RRa90Q(6PIHjP$g9sBUT*$DY!-o(fN}Ncs zqQ#3CGiuz(v7^V28Rv-9bew9lX1E^XlEpx3Ay7fCCF2Ot`S&!-x|rUd*_$({Vj%brcUw(Z-vbL-w68y&lPms8D~0<5kyXhf4MU(UR_ z^XJf`OJ^P{lJ)D@vs;hljM{Ht1+BgRgXXKe`Sa-0t6$H)z5Dm@7zP=Ob;7HjOW$R?}o zvdlK??6c5DEA6z@R%`9G*k-Hkw%m3LZ6uv^66y>yTx0IJ*N}@1Dd9#^tU0niBd@Ix zw86|W&4i*x7do&2!UP+5A@9Hh7i{ps2q&!Y!VEX;@WT*CEb+t?S8Vac7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TkKIRVM9~v3y!BZy9w_ z_Hu!{9A?FVnasm7^O;+fW;Hu)%xwl6o8i3TH_th1a<+4q@SJBI*O|{z+w-3rD`$UvBiJr)+6WmpRj&hA$>T?P*SrI&6?O^|wBq z>IaLO)p1_+tJfTBS-ZK^wWb=XaXlkl@A^f(_H~PZ9c(Yrn%G<#_OWkdY-L-G+0C9( zvZ39!XHQ#ex3)HvtDS90yPDhLO-YZ%J#KQB+uY|yce>TRZg#i3+>S|XyyZP_dJj_C z-*zOn@g3?i?pxdX_P3b-0Uq#H_nY7tyZ6EIHgJUpnc)pL@wOqJC5cbGMhQ1%_%yz8 zj(6PS9|!qF=KbT6R6Mvhe5V!cLYvpNyk#23cqv2Ya++J{Co7k66-n;Tho5=oZ^Jo) zU~Y2W{(NvM7kSR#X4syS+31!-dU=(8bf$az&rb(Tbp;&th)5VTT5ssiNkjD8V*MlJ zT2@w>a`U8{Ap;+{z zCZP*`d^$Z6c&qc7@X*O8o!4a6zx$f`-4nS4+QjzTcDdO`X;7!COwU%hvZ9X}xL`4Ey36pT5Yy z{zxd#`>W5M_9%7zf_)Nu?_>V))9)&GwSW55hw}OBt3K3sPsu{RzboImoiyz*-${S!I@^gk>M9d}bV3Dmg;bTj}UvJd>g zmBYYwqrl3`Gmt~U6jZ?#v@8^pnDqrn}7F&*^5ZsWcn zjFa{w!XYWZBcwJURKk>D!X~U4G7<)qpu#G&!YjnWEY!j+5FFciZvB*QW^ z!!ty~G*rWSHDtp!WJ6z2nSJO7Ih?~ftV24KLp-#@JQN5%yu&`+!$8!-K?FoX{KG@^ z!$cIsLS#flTtr7SL`96mN0h`ytVBq(L`u}eN#w*#>_kii#Y+^$P4vW43`J5r#ZMeX fRSd*Bbi-GK#aNWZS)|2Uw8dM*#avXwfB*nHo-ZK3 literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/doc/images/open_perspective.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/images/open_perspective.gif new file mode 100644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spBQpX;q(v=}xr6ODTN?Ky-l(obq8Dn`yj^)yq@VVtL zg{hce4%3+ONhB{1cT8qNrI^ixrbnI`O=@QUWSZ5a<~6YiO>J(InceiJF~J#5VUClW zzBK1KahXna(vqF+bmcqYiAs6Sla%$eCn)imPfqTWpO^IKKP4GZfijYy1vTVB5$ecf zZfuzgt))UCI!1|3REHI{=m0UA(LgqIWmx1WJv}PEMTRt$8#O7{P?}P$t(2vn9BBz( zs?V54rXM%OX-;*zQ=azJr#}U1P=z{Fq88PtM@4Es;}=SHAYu zuTcHyUj;i@!rE1@g+**)6$@5bF4nRCkA*DUlo?sdR(7$6wQOcJOIOTp*0Y~AYiB__ zTGBFhvZY0BYE2te)wb5PfF~Dq3+u#n@xWGN_ zah0ps-Y(a+rAO2l$X$K720-uDwrL}Lv0=(G; zf40FUd9YyRyVVFwmbIU)Fj<9jk_~T|tQXElhPPTAv6?um9sb>fH5=j(|N>oHdlg4OXDu1 zM9F~Gs+jX^XdCm{#B=6qo6V@@8OK@9Ha0V&v8w1rr@73IX0)2^Ea=e^`p8uFw5Ef6 zX9NEj%6rE2t5L1$V38WMrnW4n3H)CPQyR`qW-zNA4D4Oo8pM{atgeG?>>?A}v&yzG zuRR>tV>^4Z(0;bGW9;kv{=*mF26wo{J#KQB+uY|y_qc_PVQXib*%W?3yyZP_de__D z_r`a=^?h#_dpq6#26(`Q1rBa)51HBm)^5TTzHo-WWZw^mc*G@M?{`1f;(KlG#WjA` zjBniIV(s|HMZVRLkKE)|E&0h+Uh$Q;e6iy yg+6qm7v1PbM|#qgzI3KH-RVz + + + + + Quantum DB User's Guide + + + + + +

QuantumDB User's Guide

+

Quantum is a database access plugin for Eclipse. +It can be used to connect to databases, list tables and views, and issue ad-hoc queries. +

The Quantum home page is hosted by Sourceforge. + + \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/doc/structure.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/structure.gif new file mode 100644 index 0000000000000000000000000000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MxoqWy(o(;l-Q^IyBOk6+Sm$M3-}dv~IQe zlun5@mdSn)Y67j(ZX@cH$Wl*5)oE7AR};b{J*RgA2YKHIqF}X{YPoz9R#kZCTxH3V zTV|nQ^>;fuaey~fIr?$@wU*n1RURjnMQVaGieOs#mr(SSZ^2tT`J=t6oiZsC zyjl^uI*iB)l?w)9$2qJO$)3~{D={{$&=jr6Rji|epaYt%v|60tnV{dQgSEPy<4Uer zx2;j>t?8<+=E|=9IiKXntRD(&LZ__2Sg-oGZ|&-?{PLXQ>aYL0KmjYD@=CD83a>Hv zpb1NZ279gp>#&#vvGGcN`Pz&7dUE}WuoD}C3wy67hq1b-u?NVp7dx-vShAMdlHuvG s6uYhr>#{F9F4sCM7-_T5M6)fJv(u4YJRHUIzs literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/doc/toc.xml b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/toc.xml new file mode 100644 index 0000000..5af310f --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/doc/toc.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/.xvpics/fulldata-disabled.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/.xvpics/fulldata-disabled.gif new file mode 100644 index 0000000..ac825ff --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/.xvpics/fulldata-disabled.gif @@ -0,0 +1,5 @@ +P7 332 +#IMGINFO:16x16 Greyscale (883 bytes) +#END_OF_COMMENTS +16 16 255 +I$IIÛ¶¶¶IH%IÛ¶¶ÚI$IIÛ¶¶¶IH%IÛ¶¶ÚI$IImIIIIHJl%Û¶¶I$II¶’’¶‘’¶’$Û¶ÛÛ¶¶H“H%H%IH“HI$IÛ¶¶H“µ’’¶’’‘II$IÛ¶¶H“H%H%IH“HI$IÛ¶¶H“µ’’¶’’‘II$II$II¶%H%H%I¶$Û¶ÛI$II¶’’¶‘’¶’$Û¶ÛI$II¶%H%H%I¶$Û¶ÛI$II¶’’¶‘’¶’$Û¶ÛÛ¶¶H“H%H%IH“HI$IÛ¶¶H“µ’’¶’’‘II$IÛ¶¶HI%IHÛ¶·¶H%IHÛ¶¶¶I$IIÛ¶¶Ú%H%I \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/add.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/add.gif new file mode 100644 index 0000000000000000000000000000000000000000..0fc47e193cf88cea7e6718e602e71f560cfad5cd GIT binary patch literal 238 zcmZ?wbhEHb6krfw*!-X2|NsBbp8bFN6o~$vIrIO_nWtN}oY}nj%!=g)mn}Qc-Myr{ zYjH!vOa=yq0|yQONyVQmj0_BX3_3tI&;$Vn2NsVDCq1=u7c5DrI3Sv4&~`~6fuo}1 z@}Bps=clP?NquKpb$x5ERD#Erk69j~g)@RC7Ie;KW&Uc~JKK+4^OMiIb&(es5AaN$ zlFY)O_|M-tzo4=xGd-h3!N|bCKq0A8A-FV8!8bFxD8IO}xFj{VSVzG#FIi8)F(*eM m2&AxBAt<#twWusLMUR)u%g0T@JxC!ewMfBG&w!VU!5RS7JYcT? literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/add_schema.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/add_schema.gif new file mode 100644 index 0000000000000000000000000000000000000000..dbbb9cf9d12173169650b52a838ef22c229783f0 GIT binary patch literal 154 zcmZ?wbhEHb6krfw*vtR||NsBLb?5GdOP3EEI&2$c=aOJ%>a4fs*0j(HXP^{V34&1k z$->CMz{Q{g5(1gQz~UZo(o@^lBD-ed{{$tUPFKmt%hcK&H8?etPkub~Eak?eYya%$ rJ#o;H;%|-4pW1y^gx&jOiA0Ez{fdoB5*2H^8qdyN9CG?82ZJ>L+TAx- literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/append.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/append.gif new file mode 100644 index 0000000000000000000000000000000000000000..2dbb07370b4403f107b44de031079c9ba3982659 GIT binary patch literal 164 zcmZ?wbhEHb6krfw*vtR||Ns9tFi5nu&6_y!(7bu)ck=SC;^qA#Dth|l$t#yHzk2lw zr~s@GL@54bVPs(7VbB3_KxQzo1Wq{VsqK0qtL^N%8-^UonjR6e*ccD;aW7xy7O=tT zjD%adjA=MSnPZ2?iHVC|XnJr=Iyi|b#X-`qEy2n%asEY@qb_0{+TB}{=6bBL|F9!Q In32I60Jj4>5C8xG literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/autocommit.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/autocommit.gif new file mode 100644 index 0000000000000000000000000000000000000000..32b77eee23246aea9b62b83c954d325b0fcc14b2 GIT binary patch literal 207 zcmZ?wbhEHb6krfwSoELa|NsAI&YVe0o0*oD#=yXE;J^VO2?UBiSr{1@SQ&Ic9FSTD zX2*zKcdP`2jw;SgSU;E1LI-S4U18C|$f9L#y%A(Blj1mPS0|Ntvq)LV0(mVy<%;ci{;>zNZ z)ZAhn1<$->Jq5>{9EBi|!eWJ>)Z)~lveXnkUM?>mHwE_~g|O5j1w%apUM>b}0RJ^a A3IG5A literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/bigtable.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/bigtable.gif new file mode 100644 index 0000000000000000000000000000000000000000..b90c043b856311e3a5aad26a4fbf5dc63d66544d GIT binary patch literal 242 zcmZ?wbhEHb6krfwXl4L`|Ns9R7$n--=1rVfta-~d<>g$OUTRQ$=p z%)r3Np!hGqIlrK?C^J2yM8U|wz(66XQX#lBPr)}cxhTK5vbZEQw^&EPGcQ?B!7(RC zAqb?fSRp92IJKxOHARn?%ge`2!97SJEVW3%P|tvui-AE0WEsd^3@qLTCp=fnFugu= zT;#lSi>rklQ_)1V-#l3t&PKmsZ3*$HWbkH^_1D;ZF=L}b-wp5B8As;lI6uA7)_C{Q Y^p>>7V_K$S4l~Zb*qrLy$-rO@0P&Dd8~^|S literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/bookmarkfile.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/bookmarkfile.gif new file mode 100644 index 0000000000000000000000000000000000000000..0684ffb91062132cd8c087c4d03fb8ea5d5060ec GIT binary patch literal 933 zcmZ?wbhEHb6krfwXlDR{sHmu*;wT1&27CMc3=IEUfM8C`93a>_XYbyxlf-y{r~?TtZ$SU4S^va0*XIbfPVPTpab#=C{HkOG%+Z1h-5G{G&Xav zYxM*OG&nIciV2mx2vA^R7i4F;!NG8-xr>XbBjkmE6APO>yV;2q9~r%-h=%Lwyx6qN zc_x!(-WpEf^mDB2EDR4g4?I7=z`1%;4?}_@(*h@Rw+|~PCo?cJg$qd>n7XiOeZoOE aoefhLp4gmWEGD6_ajgSWo+uj&gEatg|4_C7 literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/bookmarks.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/bookmarks.gif new file mode 100644 index 0000000000000000000000000000000000000000..137b3ca6c0de8741b010c454c28b4397306a849c GIT binary patch literal 238 zcmZ?wbhEHb6krfw*!-UX2>$>7A6^{UFsG?`UhAx_bCw@kx%2AoV~z4jcd~R{Y7r$iTqIpaaqgGJ}D|cPe| z-X=UfB*je|NsB*2eRhRZ)j)$vN3_;PZmZ7 z27U$|1|R^L!NB7G;iTtkQ>E95OBGx_cs$a17J8J$TX7w4-L)iftCkMGjlRORQ|%56 w3~Y@NPhCv->KspPsPH*8%l$=eLP^y2y*wK}^UPrGn2}g(q2M*Qf`!2v0Iirzp#T5? literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/close.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/close.gif new file mode 100644 index 0000000000000000000000000000000000000000..fed9c3baf7e637fc77f82a7fa9337d13b6082212 GIT binary patch literal 155 zcmV;M0A&A1Nk%w1VGsZi0OJ4vx3{xw-%U|NsC0EC2ui01yBW000C~5Xebu03z$XuLxi$dgNf9C`J-Q!Llx) zszzZO^*w*bVgH5RE`TTki-=)j30x+I3I)&>9WH*0t8Fo4FbZBTm@#aa&*)ucz2mqu Jqj)?506R42Nvr?> literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/column.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/column.gif new file mode 100644 index 0000000000000000000000000000000000000000..1c1e2d4dd081627b1cd93787ef5f583282400fca GIT binary patch literal 219 zcmZ?wbhEHb6krfwXl4L`|Ns9R7$n--=1rVfta-~dnxOn}rtK?8&0 zPZnkd21W+Oe*w<<1(ija=@}&oMg|533Q3g;!KHZ$zM08I`NfsRC8@c^Itre7$$AQo zIXMbJAce&WL8-;5MP;cedc0g-K5h!`K?-51MGA&`2E1Gh3_2iNK<;8-F)=vdxq5BV zlj!5sOox0AnRg^F$b6yUk-o}n;ha=m^9w(}uChJ7YTB=(LAx0)Zsm#+2uRmrVz34P DWNJqK literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/commit.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/commit.gif new file mode 100644 index 0000000000000000000000000000000000000000..2d31c8b2ccd48d32acf35dccf6c5689a38a04a36 GIT binary patch literal 252 zcmZ?wbhEHb6krfw*!-UX2>$>7|LN1G^XJbWI&>&6FE24Mk(ZbEz<~oGISioqlZBCi zfrCK@Bm**ofhA1fq-VA*!)u*&8cq`!8w*M{0EOIEKL7v# literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/connect.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/connect.gif new file mode 100644 index 0000000000000000000000000000000000000000..41ca0bc9b1ceca98ebbc9f48a2018f531130b641 GIT binary patch literal 902 zcmZ?wbhEHb6krfwXlG#H;o%7l4J|J(Pn$V&+O%mi&zw2)|Nn#gj~Pb6Xb6me5K#Qd z!py+H&Y%PGD=1Gea3nKuvsgH6Sm4+U%pEo-CL|nc<>j|y5m=CPgqewn#~@)r!+~xF zE*=R>A%`OqRM>5DIyNn7oG8G}q%djJA5KU}sV6X-Nm%}vF literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/connected.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/connected.gif new file mode 100644 index 0000000000000000000000000000000000000000..f97ce626da0dedbba3daaf6850090956c2e0d3a7 GIT binary patch literal 152 zcmZ?wbhEHb6krfwXl7vG;NS=^u?Zkf|EXX~7$$JXw>w)fccb3pJP8&Leo!oa}r zpFsym0!POe#dY}KkGD^?s@x^&;7MZ4!O*g13N zCI$wE0|yQONeEE<$->CMAj6;o;)3jSVD(Z^?@O`FYiQOAS&*l?Dz_xJi=knc$F&7Z zX1!H&iVf(MWENu%DC4`%SaCXX?U6Sxz4j^wUVCSzkbIHBchlvkLfpZ7ly9ljWOphu zDE{+z&M&Ae%1qBFQ7|$vFi=RUR0uB3Q}E49F3K;iEG|jSE!I)+%uCi&aLmb32m&cA jRtQQhPAw`+P0{1!^73(0a1T-lOD$3`)HC4aVz34PxRisX literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/cut.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/cut.gif new file mode 100644 index 0000000000000000000000000000000000000000..14b73a8577fa6d300ddf6ea8b1f999ee214f822f GIT binary patch literal 652 zcmZ?wbhEHb6krfw*!-UX2>$>7f8f9Y1A~bb6<0oe`ZRs|^scThUS3|190pMQ$->CM zz{H>fk^z~)z~U2d!c&`dMF30F*_kX^q2&@m*CU&xW@yZoJbt3Z&fz(Z7ByO z1ey5?m=t(8wA4#99k?d#JZO4kirf6vC%rW#+BF*w8TmflsKj9X_S)5#ckjHvdGqFy zB};HQ1MV(}dl-@2!&Z8rp}<3jFZ;xjO<`*;&by$#m`%aTP~GRvR43on?ovL-E~bPm zT0eDJ=hhh23GT9KxkigapE`?M>1(Q~D2mC}GMe&qb$5rjdr$DGW0*2^8be+}Q#C{^ez5 ze}4ad_xA0+y?cQn{QLLsZ{NNFgZJ*;yX)7lcX4rncn#uy1|;{hPiv@eYHn#|s4wRi z?CR<6>!=qLnJgkOb*ccrz=ZO=n&AB0vV7Juc2<@NRrw2Q%IfQut;n9Uc73^0-RA05 z`Rh8Al%?vjt5=qH?B8)nUaXGAWz}{iIjOUf;&ppYlrO12BX;9f>8hn$uHURKy?CcA zo0Yx((JPnARqxr4ZunB^G-ugSJ^{rI>*VD;T7~#_F+b=#+%BNZ#>Alb&)+$}pt2}4 zJ)=ay$iTorA*oU!xHM0}H#4~?zqqovBsI5KN5L~MSx><+Cr2R&q_9{aD784Xs4O)_ ZkC)5K$4$XKNFgk>NWoCgfR~HG8UX#k=(GR; literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/delete.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/delete.gif new file mode 100644 index 0000000000000000000000000000000000000000..7f506218aef6a12446aded5188db5c782cb61e05 GIT binary patch literal 143 zcmZ?wbhEHb6krfwXl7t&VPKeJX}Qw9(9B5?Z z=Vr19Sdi?_ASs;lC4wR4#6)?{7Lk{N42;a$ybKyYH!Wabmf+vj;u+A;)S|}w$>)J_ t;_*5B-AWlVFETJL_K`pJ#KY)?<4hH9h1wq?4cA+korNT<%aR=!tN}KeJwgBg literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/edit.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/edit.gif new file mode 100644 index 0000000000000000000000000000000000000000..f56a27e18cb6b099a14306d402269b5fe080e49a GIT binary patch literal 441 zcmV;q0Y?5uNk%w1VGsZi0M-8h00030|NpT;RK8AOz`(%T*Zj)J?9R;a&CBo1%I@3Q z{n^+1$HnT)$?n$F`PbF@ySm}U#O%k$?ZLq2zrN(Yz2n5g>BGY3&(8GJ)A-WS_Rr7% zuCCUyve~h**uTH$!NKUm!|Kq`_Mf22p`y&Gs?@c%;Iy^gva{T;u-CY`;g^}iqNL5J zs?){BM$*$$xs6TPudU|1y7Kb!!^6Y2wziLtkBf_oC@3f!8ygJ`4FCWD0000000000 z00000A^8LW000C4EC2ui01yBW000JqK!R{cED8ZSq*7O-<#4xvP&W%ytAIca7sJht zfmLgS0&DrSsf7+8V!t& zY=jaM83_u2cY|OT4hWwwp+!^=2L%k5k3?Aq3l^|es!M=5HdRJeRyb={Mntj2$i+bb zA^uN8Z*X~XX=iA3ATls8Fd$-iAX9a2AWdmwa&L2ab97~Gb1Wc9ZeuPWL2PUwQfX&s jbaNn5Wpib6c4cHP4GKz3Mj%I0AXa5^ATcg54GI7|8{5iM literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/entitygroup.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/entitygroup.gif new file mode 100644 index 0000000000000000000000000000000000000000..8bfe5933f4c3f35913b6c76381df7057b1b45518 GIT binary patch literal 169 zcmZ?wbhEHb6krfwXl7tAG)%U%%nmA!ii)xX;+7VMDN~NknNvMy&bhsFEbr~L{C{uG z|NlS)1&Tje7#JA-Gw1+Gpa}vD3@l+API_kZGQ8%=&}>jpSft1%ywSi>bCT0_k=KWE zXN4GO-;xk&adCTmvc?e`U)EDY8FAcRN& literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/export.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/export.gif new file mode 100644 index 0000000000000000000000000000000000000000..c501e517774083e6f7de72163e008ff5ac843a3d GIT binary patch literal 143 zcmZ?wbhEHb6krfwXl4L{7E8-HmQiyotM^*Y*}M1N-v4-k;!hT41_m|;9gtR#84N5o z7fyJt-g~2o*XZfI5T57=j-ctHjjDUrc6hB9;9wElEVAx#M7#h1 literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/filter.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/filter.gif new file mode 100644 index 0000000000000000000000000000000000000000..1492b4efae265051c43c5f2870c1f71f97c899e3 GIT binary patch literal 159 zcmZ?wbhEHb6krfw*v!CSZy#S@Z~y=Q{QLL!|G#g4f4+Tvy#4+Q8p}12WsEYxhqZ46z5UO4 xC{IX5qW?tG!t@NQxhzk8CmDO_&kQNvl+j$RV9uyFP1Eu=fc2X4FC}0Hs=5U literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/fulldata.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/fulldata.gif new file mode 100644 index 0000000000000000000000000000000000000000..3d1c062dfcf4c8a5408d29245e3d9ab910fce173 GIT binary patch literal 111 zcmZ?wbhEHb6krfwSj50!A75`@KmY&#{|yZd@$vCM1_Kx<{$ycfU|?m?0r5a;8JJBX zcHQ}xf5Ng;TIqF;G@kTUdp?UMphZjfw2LlEM2F0H&j0_BH3_3tIP^AC^ z1G8<$t~>t>_A#tjdw|i2O*|&RTb!dTv41gEpJy Ve8<_M(yc2>v{pu~?`C1J1^~LkD@*_Y literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/grid.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/grid.gif new file mode 100644 index 0000000000000000000000000000000000000000..10b0d034e4ad380335c6a20ad3dec1a6dec72b83 GIT binary patch literal 152 zcmZ?wbhEHb6krfw*vtR||Ns9tFi5nu&6_y!(7bu)PoF$_+R#l(Mep;RJ(!GAx14jRm(BENX9xGEFLs)=RRnv*5b9 h!K%lio6VZzh~s)|mKWa}4m=nCSFhL9tfI(Z4FD7vOr-z- literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/import.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/import.gif new file mode 100644 index 0000000000000000000000000000000000000000..2191d137185daf69bc228709faa765cfe339a6a6 GIT binary patch literal 141 zcmZ?wbhEHb6krfwXl4L{7E8-HmQiyotM^*Y*}M1N-v4-k;!hT41_m|;9gtR#84N5| z7fyJt-Ww)TbNJa*wy=91oepXo2Td4OZrsG=xJ5|jdb#X_U9k(wnSa)}J<2($a%)~d PM#Ih5EYPI!8FG&D5i0ArIhbN~PV literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/keycolumn.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/keycolumn.gif new file mode 100644 index 0000000000000000000000000000000000000000..65564f8d900bf089ff2726e50cf03a397dcd5fe7 GIT binary patch literal 251 zcmZ?wbhEHb6krfwXl4L`|Ns9R7$n--=1rVfta-~dnxOn}rtK?8&0 zPZnkd21W+Oe*w<<1(ija=@}&oMg|533Q3g;!KHZ$zM08I`NfsRC8@c^Itre7$$AQo zIXMbJAce&WL8-;5MP;cedc0g-K5h!`K?-51MGA&`2E1Gh3_2iNK<;8-2{B*^&QdhW zZvM=BNFdEEv*_Rl8z!Z>YHDkmtq-oyxRv2{Vv^L!PoADpvz!)iT)L^^_3Xiqm?-0> k1k+odtrOu1rbDYF=o;(BkZ3Nly&0C-(fmH+?% literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/log.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/log.gif new file mode 100644 index 0000000000000000000000000000000000000000..07fdb5afb6c4d004bbd366a4710e7e48ebc91e2a GIT binary patch literal 164 zcmZ?wbhEHb6krfwnE0RJ|Ns9C3=9Vj8~~DvKUo+V7?>DzfNY?w0FbRTrGMq>hy2Y< zTcR2k&HJ9lTNwMbvCkr@{pW(@%w4k1*S#4T6#w}<=ND8KWu|A8C>R+S7$_uFDg>A2 zDfnh47v&dM7MG;v7V9W@<|XSXIOgOi1c4M5D+Hw$rxul^rs(lKX8IF<1itb$>Nd literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/missingtable.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/missingtable.gif new file mode 100644 index 0000000000000000000000000000000000000000..f9cce7151f542953e397a92ea6a1b27a90436cdb GIT binary patch literal 256 zcmZ?wbhEHb6krfwXl7tAG)%U%%nmBHthThAGUeFPrPuaaTJDXCI(F>Xy}f(?Gcf$G zuKte%6#oS{=ND8KWu|A8C>R+S7$_uFDg>A2Dfnh47v&dM7MG;v7V9W@<|XSXIOgOi z1c4M5D+Hw$rxul^rs(lKX8IF)-*b00GE73@nKgPI|89VR(J! zFiVp|i>n0}L(xPvZ5FM|XQSU3wuE?CGJ7+~`fF^yn6auQai`Cl0*9%M8v}GC+U|W$ v-yyf6d2z@`TMf4Ja?{Tk@NWrRBfjUN$I39Br1STUr!Y6Naf%5GGFSrux>930 literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/next.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/next.gif new file mode 100644 index 0000000000000000000000000000000000000000..d25a3f956f88b2044da971544cb110250a9aed9f GIT binary patch literal 183 zcmZ?wbhEHb6krfwSoELa|NsAI&itP_^9%z6!+`?_fFuMc{$ycfU|?a;0dYZU8JIOa zcHQxNyjO5hObAEy!h3U#YVMe3EiGwEYhZdSoxkDLrH2+*Eam?>I59CO{_}UvFQ_ca zOwTA$FfuSOP)Mp&2rkW2@Xbsv$}g@gE=kQT)=}`xOV(3x%*jy*0x2w32udwZEha@(Dg+pZkic;(QBGeEFs^_kskPVZTBc)M&EOD8uhozyV5r+Q9L^_14KzJ{W-w6tVH!#HDO1_p)$2Mz#9G@$sC zg^__ll0gR~4zkmMH6%f;FU2#d!AMr{V?;w|SVQ84X)_nDyTHOTL(iF+LF;gA*P8J;WME*RkW{GQdq1I hlv#QVz;|l4QFS5>n!?y>au8bK$sWMfPenZ z`303lnduoN3PuJ71`0`)3c;m$3ci`iMft^*#U-h^#X1U}dC7VTjyX9BK_G?23PGvG esYPX}DSEtIUOsLL?m-G+sYMEgdIr2)4Auan9z4|m literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/previous.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/previous.gif new file mode 100644 index 0000000000000000000000000000000000000000..f48362d71c2820bfd6d39acf401b88fb604b3c9c GIT binary patch literal 183 zcmZ?wbhEHb6krfwSoELa|NsAI&itP_^9%z6!+`?_fFuMc{$ycfU|?a;0dYZU8JIOa zcHKGmc(351m=F%_&ur7p8)6sqF8mpLYC&$!@1ln?!tW|~zwo=~5XQuy_|M-tzo4=x zGd-h3!N|bCKq0A8A-FV8!8bFxD8IO}xFj{VSVzG#FIi8)F(*eM2&AxBAt<#twWusL aMUR)u%g0T@JxC!ewMfBG&w!VU!5RQ4a6W+m literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/qmodel.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/qmodel.gif new file mode 100644 index 0000000000000000000000000000000000000000..52ab6dbd0511aeac0bec5c7d07fca294f5c19e4b GIT binary patch literal 941 zcmZ?wbhEHb6krfwXlDQcMn*;^CMGsEHhzA7QBhF?gG5`~y!iO|@Z!jXgoNbe5I&902gty3RSPbxynawz;ZvvpWB?)x{ZSHv6(})@gUhA8g?4E+GedfpOPpb!w}vAm4g%(B&?a(u8WObcDtk4 z-wm~fAz1;H#T?d3*s!@uv%K5=+3S^l{5G9E+uTV(L`9OoD{5=6(d}*3yRy@f%T0^X zG*%H6Q?)z1)nJP@4U~j<1&Nkm^F~E4)=i_8WQ7FK0x&4aRCs$wXzOZKDB2`N*PzG) zBLR*8RbljPRQkr%OwrQB6359jkS#EhKsUiakT5{#{kI_T*S`y*e=|*FvQqB(i+tX- zFYDgl=jlH%aB%RD_wW&4=BRh**zoZae*ehm$y28Zm-o!sv4Qb(6M?|_3!aO_C5B6z?G{r*T9u=&t9Jng>T%PBX7-1x2LE(pC%UW(u+&E$$OD#$iEbe#g`MgmDT&v zN$V1Po%%jx0y#9gj8+;ukHlJ=d`pd%1Fji>$}gMyAz@{1&MS4Gc|<@$6en48)R7&B{x^ M)zf_?*MY$r0I;n>?*IS* literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/rollback.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/rollback.gif new file mode 100644 index 0000000000000000000000000000000000000000..8fdd814c2f412a1d3de25534f056137fc26f8f1e GIT binary patch literal 201 zcmZ?wbhEHb6krfwSj52a|Ns9pXa3Ked4_?3;lP0dKoSBJf3h$#Ft9M_fVd#F49wOZ zyYAe3d{R(#p-Br@`!%N%nsEa2lv226a2U+vX1KyVySetI_nD}@qHUi()CTc!bsbH< z(02A%4%Zqr1_s4{{?7RYl|`B986^rv1_lNSNtFu0rFjaznaM@@#g)Y+sky~E3Z8k% sdJ2v?ISN4_g~bX%sl};9WvMB8yj)&BZVK)}3Sp^53Wj{0H3u&+5i9m literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/sample.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/sample.gif new file mode 100644 index 0000000000000000000000000000000000000000..34fb3c9d8cb7d489681b7f7aee4bdcd7eaf53610 GIT binary patch literal 983 zcmZ?wbhEHb6krfw_|CxKYUg-n!?izO{@9*?jxd%4aX0yzy`dymabz zw#(eg=y~&N&n)dZv2xzduG}5lraiApo3(c4*{Ylg5#|$JO_EEZ<^|a2`Z*=9ns7DV zy=TR&gYw*7f%auV?ip3tvjRPmcdoho{K?x$_vR?C#t5&<;~V}S*>OMCr>h}%%bLZ9 zmo3`hYEwTICo-TTCZwgTsC&VjZRgJ1eE#fBa^%9R zmmfWS@;bnyJ27HWY}kxYzv(Hl>yu;FCPlAEh+34Muq-8Rb6C)<8qA3{r2e5 z`$vyngh#H=FWlqqvnapfc5%(!sQ4v?r7J61-&eJNEN^;KTK}T7{#i-gJh%G*9vcYdwv_*~xdw!Gz4Va?T!sXyyF@8?w<>X`X=#j%uHV4GRvj@+tE@ zQ%F!a)GKcn^~8abN>4la1UNXVL;{ZWi)lEwyeatDu%Lr6;aASiLrXXW zQm#H|%L^t(99R>iC{eMurC^4ap1%@$>7f8fA@34PlaFFZGO^6rNERrPhtr%gT5*1CSy%;OXK zceS;ynK$>;)G7OWd$#s;Z=N=F|DuKGCQsV6VE(E3^G?p0ePrg00~04~+rI7TvZWX1 z%s#wg`Nd^R&(E8CbmNBG>(<^_wes?^rRSC`KD}t+$=S0GY}$Bx?V77wx7=H^`ttT| z_gAhsw|m#)O&f3Q+5LFk+Dkik+&^{lLwozy>guH}EgSm#_jY&hm^g8NN5`hAQxA1_ zZ*6biFk!;3o}R7q=bxE5^T>=Dhv&>WK6UE8<;$-uSa5pQtRssSot-!D#PsR=dwMob zo3?kwic8CuU0AZ@?5b5)_Uw7Ne*MkWtFIh8_GRCuwZcJ zO)%lJatFo%$%OY2Sjf$+DV%ppGyhzJo>tkk? z(C`dma$XkA)T4T9g@>@BA)`YVPv^x6CmkCZ7!?2cJLeZv7Gr%@o#UnC*B%^NjsP->pTQK2imx$_?CCjEA QzB`L8e#(*$stgR)0M05bwg3PC literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/statement.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/statement.gif new file mode 100644 index 0000000000000000000000000000000000000000..1c65a3b1a7182f1461315032faa66b360bb361e0 GIT binary patch literal 152 zcmZ?wbhEHb6krfwXl4L`76yi6$BzAHVE8Y=@V}+y|F8defZ|UUW(Ed!1|5)2kQodt zt{+Z#X0uu(clZ96b6`wxm~z}IS? b(|OO6jD_y;p`+)o#9$2o$>7zmS1p9WU=rH@9QK!5ib__vPeV?CZNXd-kVKpLltB z4;(lEQU?Z#KUo+V7>x zo+hK_+grL04xcQq^yw|`JD9DQeK7IN4{I%7-}@T{RIjB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0!bVLk05cys7!-%MII4ng1_cvCeX|9FVfAHxaPvp`wLfKNP81O1a{&! z&F#`Bi#>E)-FfXvKoicH>H4@`KL{wwG|!_$79IyaEhzTZK9XpMC}GvK@+9A-pWUMB71}9LO1hNPyd?w&|KV9^UdwyTBP>u#ez8b)>7@@#MJcys&45C# zFP&(F&jC92mC94DJ?1?evr0wmr(5X9llH!G&YU`^u)d^zEVgLl`z-37D0M}h*Bk8& zL*Lg#u-crV7t-HV?#^Cd6CFW3AgUk6T{AtLoqsau3Sybn??5yt5WxP-Ga86&pl|se zv!VNv0-dK)bYKW;q22DCxW$-D!DA*J`e0~J<@hXx1-T^#cHca&|3M4=IY)v@djZ6# z2g-vg3*)`WjgM?p>BKjK=*~#==x(Yq`u!pimJCIhrF_+%BCRqmNY)oP;>$zhC=I)BoWkLNFbZa z0fX)2M2#AoD3J$j`eQ~#tqfYlMGo9px++Se#7L`^k)#OsgMYL9pSJ%3 DM5-^g literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/bluegroup.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/bluegroup.gif new file mode 100644 index 0000000000000000000000000000000000000000..105d9373d737c341a884de916d978d7ae86ca299 GIT binary patch literal 157 zcmZ?wbhEHb6krfw*vtR||NsBLb?5GdOP3EEI_#5IYY`Y@Qrw$6Z*$l2heDysCywm{ zDgY}45sE)q7#SFN7<51!kQodtUK37wuHL&nqcQ!X_jgs5#hGo6qA9P{mVH0Rny$1t znrBksleMw$8xB0>v1xnnpkr0Yc4&gjI(pM%o1W`um%7w CuRsU@ literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/green_group.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/green_group.gif new file mode 100644 index 0000000000000000000000000000000000000000..67f2f04af91c3ae19f1d556a69b1e4c6ebff58b6 GIT binary patch literal 159 zcmZ?wbhEHb6krfw*vtR||NsBLb?5GdOP3EEIxG~b?2=%X(hyd^D6e~C<(ga5LMxn4 z9NPy}16IqR_>+Z^fq|Dn2gC)L!NB6P;iTv4z2%vW&p-Km*GyTQ+2*L5@>*-z_jBCo zYMXcSOlo|h%e+3(LZ!em@qK}V%zXFO#tkV^>pNDu6nItcWqlQ9pfQ~@qa^+8G8YC0 FYXA;1Kt})o literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/green_schema.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/green_schema.gif new file mode 100644 index 0000000000000000000000000000000000000000..621f5000daf9f4deb4052d4f7aa518d53406bcb4 GIT binary patch literal 152 zcmZ?wbhEHb6krfw*vtR||NsBLb?5GdOP3EEI&2$c=aOJ%>a4fs*0j(HXP^{V34&1k z$->CMz{Q{g5(1gQz~UNk(o@^lBD-ed{{$tUPFKmt%hcK&H8?etPkub~Eak?eYya%$ pJ#o;H;%|-4U;6Tl9cQZM@`8y52i62BN>uD^DVX7<=dZ+I4FGtGHMRf% literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/green_view_group.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/green_view_group.gif new file mode 100644 index 0000000000000000000000000000000000000000..c3fcef0a19af268b722238af0dae08c7a1098a2c GIT binary patch literal 254 zcmZ?wbhEHb6krfwIKlt||Ns9tFi5nu&AWBy?uAR24;(tY?8K>)A3yK7dw=KE-NzoC zsGnSY;@G~E({;|xF+4g!YhJG4p&qq0DI$BbW%>E}f!e{wU?&uRvM@3*h%xAZq(OEv zuvRZn?Mtz=>wheu_A`Pb$u zQlMnFw@V9yr-~LAWAa%E4TeWfmC-+|SRZ;gE;3~nYv2~;G_0zr_3>s%;}m3TXRqy< f+{a=sEG#%{_AF*LF_wj_ix;ykTW+>ek--`O#{XBS literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/key.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/key.gif new file mode 100644 index 0000000000000000000000000000000000000000..6ab7f3481a184cc9b9bef1773ada217f290d37c7 GIT binary patch literal 155 zcmZ?wbhEHb6krfw*v!DtFsEtO);T+`?mqVDL_+| zz`((v1Cj!n!NB4n;F%mS(c--2x^tn15_hL}J`R}GsxaYI6h5EYPBb($my933+@+gGjPZmZ7 z22KVYkSNFu1{ODilb+eG8j{tjO483WkBE1%1+Ge;x=yPwB0omtmCx006L+tQK4*Tx mx2A>ZlYs;W!&KGFng&4~K8~SNW@N3Mb9j0+>ttO)25SI->@t1; literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/margarita.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/margarita.gif new file mode 100644 index 0000000000000000000000000000000000000000..77cd2a3f5c9e9411cdfd5966181cb253ba3ccb73 GIT binary patch literal 152 zcmZ?wbhEHb6krfw*vtR||NsC0x%2j7??sKa4L^7O`1ki8Gcz+#5G;vKDE?$&WMJT6 z&;dz+%wS+~6*%d+dhN4QHoltE6(we>b4>pr`h4ZqHwTpt2W)lMyRt`j<*GXk20B4D kZOkj5&z=*ZeUJBsQ{;;M*Gg4??pPMQI?ZRF3j>2S051MFJOBUy literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/quantum.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/quantum.gif new file mode 100644 index 0000000000000000000000000000000000000000..e964a2fd7aa3f316e6a7221241ca9cdaa289963f GIT binary patch literal 93 zcmZ?wbhEHb6k!lySjYeZdl{UvGuLKkZq)(tK;jHcW-W%xPrucj$5QB|x@oD}YuU=F ss(sM{H36NAmhR-q-5_~*?zIzZ{l4G5`G?PdU0|`dU6<*yO$-dy017c6e*gdg literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/sequence_group.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/sequence_group.gif new file mode 100644 index 0000000000000000000000000000000000000000..16b07bb143cb4ec318a8e55d49cf77805b077a94 GIT binary patch literal 248 zcmZ?wbhEHb6krfwIKlt||NsBDwavSA=kA3|mk%5|oY|cdUL5)F&&=PSdjGv^`S+yc z#Ib$fF6aEYm~?Ww&bc{;M<-~_%N0D-qqZhRWN)@CP&?Qd?1bV^7DfgJF$NuwG{{Z{ z*3t#4eJPes7e4c-aYlM3x%y=9_2`QTj{hqvs3K-8!*^tcs)deJ|4EnB4*^H|jysn8 ziV)b?vLZzwQ-HmB!wiAK8N%luZB$hBxx;+;^Md2o-t+QCuroI^3$ZpdCNvdyFgu8d Z2u+zfg^5)xBa>w=3+sY~W{VXWtN|A$TnhjI literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/subset.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/subset.gif new file mode 100644 index 0000000000000000000000000000000000000000..ae12ef235046b75550c60684ce077994b81edc53 GIT binary patch literal 621 zcmb7>>q}E%0LEWUGKkP5N+<}s5#)8kBJ66uE^sIC8?hlhvXm*@HNoGp}!a}~)T8AJe> z^043Mml)b@GWjhQ-elrzHfr3AG(+^zFg2Q3|$M<)EvczA&a0837|zc zzd#EMv>(Ii8J3Sgp1{aF!(+&YAun)VA3Hrm3sFW<>riwGL9Y*DqQhi_5FJ7~5(9`a zB*cjj42780RlKsy;4maehhw(zAw~#B0e+ifek^mLAWIO$h!H{*AEYAD@c=#hm71U9 z2;%r4x3awS=bym;DD7858~_aO**Q5GS6ZJp ziN*POCl4Pwt$HacC@eg8wYXSb)h8048aQ83Sy`cY)Y_b@Eh@Vvlh@w4AE!KW^!SP5 zn$nB1I?sbMn-Z!eHzk*9E|g#Q)J^T*r#x`%Vae_K`Wu&br=@Pd%7f|mq<3#g<2NU5 z+xU|=mnp!+tDVWet9s>qc6Cz9jy>*dg)KgDSCLqT8}l1mwwI=ZycD~7-PY81)t#t7 b`a-q7RzAw^ZRu8RdE7f&ZZAn`1VHi^WEWog literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/table_group.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/table_group.gif new file mode 100644 index 0000000000000000000000000000000000000000..0a852e085c02cc6c08bf590c79e2fcf95d2d8e52 GIT binary patch literal 252 zcmZ?wbhEHb6krfwIKlt||Ns9tFi5nu&6_y!(7bu)Z{4|j;nL*;hYp7qNB;XW^Y^FT zfA3oUJt;YHY~Q!bIe#uDot&<7ZjRy630m`V1rPP8tw|Btn=K181Z)^Oq4<-9k%2*i zK?fuOvXgFzv2^J+;x(g4j*;ckYmK!-K}^i zKuxG6`ytm^Sa91?8v*%vP4ShCb?xgvu#08+DHE&u=k literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/view.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/unused/view.gif new file mode 100644 index 0000000000000000000000000000000000000000..649207f2ec78aa50ce544e89e9c7a3ccbae105c6 GIT binary patch literal 149 zcmZ?wbhEHb6krfw*v!CSV325Qo451o?qiQm)K9Md^Xu3D|Nj{n7$78&fd&+RvM@3* za4_hA#6e~-us8{v^jy8y;8frVDnH2#h)yU z3=EPCIv`PyoeZqi32J>QmTrP9f@+efU6VZhXYVbX6S(JT^dgTuj}V4d%QLPk&qQ)e zc=*)8HepV{u_Q}@lHF%H9WO;B@HMqq8E(*0WBnxd`775UR)EXEv(^v-Z~e*Qd9} uD>PhIpOLX@ZTjurG~Mj4TE`>zecpLMf7#&zD}#p+|z`((v z1Cjul!NB4uaME-2UW?bd{T~-Jc3w@aJ*=?ejr&X{#q-QbER!wHY;KU*!KZXg`AVL! ef7VfvnkLKB3j-$9t(*5s^}t&v%LE@525SJ7f-pV+ literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/icons/xml.gif b/archive/net.sourceforge.phpeclipse.quantum.sql/icons/xml.gif new file mode 100644 index 0000000000000000000000000000000000000000..1dff5505c85ed0f0619887499c8699a8c2080677 GIT binary patch literal 159 zcmZ?wbhEHb6krfw*v!B%Z{GP8D{k)D^LD|JRa$Oe)Sp!k!8k%57SK?lSInZdx~Ght(ER;-ctmP!9Pml;k^n)S#d&gnJR%WW(r zvB$+1ym#0W+q&R_dz4JyiN)`eGOVU|Pv_2B{m5dE?8Qw2RSR1-MAXFcoO^Nb+M#s@ HN(|Njq(Vp( literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/install.txt b/archive/net.sourceforge.phpeclipse.quantum.sql/install.txt new file mode 100644 index 0000000..b05046b --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/install.txt @@ -0,0 +1,24 @@ +Quick and Dirty Install Instructions: +1. Download and unpack eclipse 2.1.1 into a directory [e.g. C:\Test\eclipse] +2. Download Quantum +3. Unzip quantum into the parent directory of eclipse [e.g. C:\Test]. The zip file has the relative path + eclipse/plugins/com.quantum.Quantum_2.2.0 So if you have called the eclipse directory by any other + name you should unzip into a temporary directory, take the com.quantum.Quantum_2.2.0 directory, + and copy it into your plugins directory. +4. Launch eclipse. You need java 1.4 or higher to run Quantum. So if you don't have it installed, + you can install it to use only with Eclipse. Install it into some directory, and run eclipse with + the -vm parameter: + + Eclipse.exe -d C:\Test\workspace -vm C:\java\jre1.4.2\bin\javaw.exe + + or + + Eclipse.exe -d /home/panic/workspace -vm /usr/java/bin/ + +5. Open the Quantum DB Perspective [Go to Windows -> Open Perspective -> Other and select Quantum DB Perspective] +6. Right click any where on the Bookmark view and select "New Bookmark..." +7. If you need more instructions, check the documentation (/doc directory under com.quantum.Quantum_2.2.0), and + the online documentation in the sourceforge page (http://sourceforge.net/docman/?group_id=7746). + +8. If you update to Quantum 2.2.3 from a previous version, you may get warnings about not being able + to restore some views. Close your Quantum perspective and re-open it. \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/lib/junit.jar b/archive/net.sourceforge.phpeclipse.quantum.sql/lib/junit.jar new file mode 100644 index 0000000000000000000000000000000000000000..674d71e89ea154dbe2e3cd032821c22b39e8fd68 GIT binary patch literal 121070 zcmbrk1CV6hwk_Oc+qP}nwr$(4E_d0sZC7>Kwr$&d{hf2}dG~%1??n9fPwdQyHFD?7 zHTIlyry!qDw;?Jv$h_V2Ugsdo?{2v(d5AZ+tzr&FKJ4{AE zRzg%nNtsqg^j>CSTw02Tb{0m8hH`3Rx`vK%D>l%>QxnzcUK;Unggx zWv6BMN5uc6{_k^)_g_G|f6lRhp`DAfu!VuOof$C$t&z2Xlar6Ujue&vG7p*nXI~-i5u%&4#^6t_YK&C*e^HIJaGnC=x3uT zj^~L_FF&tP>Ze+fQn@*K3pwpmWsgmT#4{q2fRoCmYk%;fU#XCE@VjZxHq3EduCXM{ zHYpt0nPc)^I(il47Zt+e@gSB!&Lr;Q3 zQ?aqSIKKhUlZb)*0VkVCd5 ztmc=Psm2>G`k+`OZz;v8>jL=O87@2*1jL$kR$~ftP#yqu9)R8yX44c13ANCto}IQD z@N(>~!FS=`p-&a`rMf4`eDTMls*zrfxq1)Rhp=;f-h6-iZS& z`&i%&)$c;*#?`_W(gQgS!W!|c{m8vn3x1{-HgncNIgy3qgxJrYLWRiZtuWL@CXx5i z%TOCq1b|dB4rtAxF8AuFwX$_uDcIE?KC~|GRx969W2gdRFy1F0RuI#(&W5tk3@1GK z6Ns&SwSNe{YU+M;@D8GjGobsNM&Zb%uBZmI#G2|C61?L@5v;iawvf>l&1JmgU5ZCB zq^dR3Y!naj$hnu!yc+y)u6e^UhAFlCxy49`EH=tjtZtHDq&6T4HXX)ymK`*9Dj7u% zZFP`ltit-sWpcCUDAG|>)k#V&tXuz>tw6Rzj)jP2ozH}vF0e9tYmv!odzMg6%p$X1@Iy&<6 zeeU@7`~G^`u5p`<#PuetbQyZ={Ha zpxyv~pguYVgZY}sAcPL737oz^#~Q{8Q)P}8M!N#b(QKvOtf5$|h(CedmC@4z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}rf1d)2DF}CGziZg zG%Q{hClS_!bQ9#2P^hv=oY;eg#p&)*byy;OxOf+hQeY1n7N5()o8t%qw31!41;IUN zSX}P)zB><)%OSD5XiXrc#~Q9!JdWyROd?V?!R(^L7{`CNi_m`m4cOJwpghEe-?@9l;M6v7A z33U9h%^A^L&VUH zu=6khRG+Q~nI8rt{1qFs8Fu~*j~PX1VUU&Y=Aj)(uv0wbzKfk3=$TM(su_Q9*ni1~ zPTRRr40Vn-nu|vJm*MT!6S=c&=T0K97P6x#72~4qGrOR^A50u@aNNK@8{iubrC@Bp F`9DH82$KK+ literal 0 HcmV?d00001 diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/plugin-3.0.xml b/archive/net.sourceforge.phpeclipse.quantum.sql/plugin-3.0.xml new file mode 100644 index 0000000..213fbe7 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/plugin-3.0.xml @@ -0,0 +1,300 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A wizard that exports the list of database bookmarks to a Quantum bookmark file. + + + + + A wizard that exports the database structure to a Torque-compatible XML file. + + + + + + + + + + +
diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/plugin.properties b/archive/net.sourceforge.phpeclipse.quantum.sql/plugin.properties new file mode 100644 index 0000000..b67550a --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/plugin.properties @@ -0,0 +1,15 @@ +quantum.name = Quantum DB Utility +perspective.name = Quantum DB Perspective +sqllogview.name = Quantum SQL Log +tableview.name = Quantum Table View +sqlqueryview.name = Quantum SQL Query Editor +bookmarkview.name = Database Bookmarks +bookmarkview.importboomarks = Import Bookmarks +bookmarkview.exportbookmarks = Export Bookmarks +subsetview.name = Subsets +category.name = QuantumDB +category.description = Quantum Database Tools +scope.name = Quantum UI Scope +scope.description = Quantum UI Scope +command.execute.name = Execute SQL +command.execute.description = Execute the SQL statements against a database bookmark diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/plugin.xml b/archive/net.sourceforge.phpeclipse.quantum.sql/plugin.xml new file mode 100644 index 0000000..e8df2c8 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/plugin.xml @@ -0,0 +1,303 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A wizard that exports the list of database bookmarks to a Quantum bookmark file. + + + + + A wizard that exports the database structure to a Torque-compatible XML file. + + + + + + + + + + + diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/schema/data.exsd b/archive/net.sourceforge.phpeclipse.quantum.sql/schema/data.exsd new file mode 100644 index 0000000..765ec41 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/schema/data.exsd @@ -0,0 +1,107 @@ + + + + + + + + + This extension point allow other plug-ins to act on data information extracted by Quantum. +For each registered extension, Quantum will add a menu entry in the context menu of the Table View. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The label of the dataActor. Will be used to appear in the context menu. + + + + + + + The class acting on the data. Will be supplied by the external plug-in, not by Quantum. + + + + + + + + + + + + 2.3 + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + + + + + + + + + diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/schema/metadata.exsd b/archive/net.sourceforge.phpeclipse.quantum.sql/schema/metadata.exsd new file mode 100644 index 0000000..25ea75f --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/schema/metadata.exsd @@ -0,0 +1,107 @@ + + + + + + + + + This extension point allow other plug-ins to act on metadata information extracted by Quantum. +For each registered extension, Quantum will add a menu entry in the context menu of the Bookmarks View. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The label of the metadataActor. Will be used to appear in the context menu. + + + + + + + The class acting on the metadata. Will be supplied by the external plug-in, not by Quantum. + + + + + + + + + + + + 2.3 + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + + + + + + + + + diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src-test/com/quantum/util/StringUtilTest.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src-test/com/quantum/util/StringUtilTest.java new file mode 100644 index 0000000..8e9670f --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src-test/com/quantum/util/StringUtilTest.java @@ -0,0 +1,71 @@ +/* Created on Jan 19, 2004 */ +package com.quantum.util; + +import java.lang.reflect.Method; + +import junit.framework.TestCase; + +/** + * @author holmesbc + */ +public class StringUtilTest extends TestCase { + public void testSubstituteString() throws Exception { + + String sample = "This is a test of ${variable} substitution."; + String replaceAll = replaceAll(sample, "\\$\\{variable\\}", "parameter"); + + assertEquals("replaceAll", "This is a test of parameter substitution.", replaceAll); + System.out.println(StringUtil.substituteString(sample, "${variable}", "parameter")); + assertEquals("substitute String", replaceAll, StringUtil.substituteString(sample, "${variable}", "parameter")); + } + + public void testSubstituteStringAtEnd() throws Exception { + + String sample = "Substitute ${variable}"; + String replaceAll = replaceAll(sample, "\\$\\{variable\\}", "parameter"); + + System.out.println(StringUtil.substituteString(sample, "${variable}", "parameter")); + assertEquals("substitute String", replaceAll, StringUtil.substituteString(sample, "${variable}", "parameter")); + } + + public void testSubstituteStringAtBeginning() throws Exception { + + String sample = "${variable} substitution"; + String replaceAll = replaceAll(sample, "\\$\\{variable\\}", "parameter"); + + System.out.println(StringUtil.substituteString(sample, "${variable}", "parameter")); + assertEquals("substitute String", replaceAll, StringUtil.substituteString(sample, "${variable}", "parameter")); + } + + public void testSubstituteStringMultipleTokens() throws Exception { + + String sample = "${variable}${variable}"; + String replaceAll = replaceAll(sample, "\\$\\{variable\\}", "parameter"); + + System.out.println(StringUtil.substituteString(sample, "${variable}", "parameter")); + assertEquals("substitute String", replaceAll, StringUtil.substituteString(sample, "${variable}", "parameter")); + } + + public void testSubstituteStringZeroLength() throws Exception { + + String sample = "This is a test of ${variable} substitution."; + String replaceAll = replaceAll(sample, "\\$\\{variable\\}", ""); + + System.out.println(StringUtil.substituteString(sample, "${variable}", "")); + assertEquals("substitute String", replaceAll, StringUtil.substituteString(sample, "${variable}", "")); + } + + public void testSubstituteStringSpecialChars() throws Exception { + + String sample = "This is a test of \r substitution."; + String replaceAll = replaceAll(sample, "\r", ""); + + System.out.println(StringUtil.substituteString(sample, "\r", "")); + assertEquals("substitute String", replaceAll, StringUtil.substituteString(sample, "\r", "")); + } + + private String replaceAll(String original, String regex, String newValue) throws Exception { + Method method = String.class.getMethod("replaceAll", new Class[] { String.class, String.class } ); + return (String) method.invoke(original, new Object[] { regex, newValue } ); + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/IQuantumConstants.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/IQuantumConstants.java new file mode 100644 index 0000000..3f5dc51 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/IQuantumConstants.java @@ -0,0 +1,26 @@ +/* + * Created on 12-jul-2003 + * + */ +package com.quantum; + +/** + * @author panic + * + * Constants for general use in the quantum plug-in + */ +public interface IQuantumConstants { + public static final String PLUGIN_ID ="com.quantum"; //$NON-NLS-1$ + public static final String PREFIX = PLUGIN_ID+"."; //$NON-NLS-1$ + + public static final String ADD_SCHEMA_DIALOG_CONTEXT = PREFIX+"add_schema_dialog_context"; //$NON-NLS-1$ + + //Constants for specifying Tables, Views and Sequences to the JDBC driver + public static final String Table = "TABLE"; + public static final String View = "VIEW"; + public static final String Sequence = "SEQUENCE"; + + public static final String autoCommitTrue = "Always True"; + public static final String autoCommitFalse = "Always False"; + public static final String autoCommitSaved = "Last Saved"; +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/Messages.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/Messages.java new file mode 100644 index 0000000..ed81afc --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/Messages.java @@ -0,0 +1,41 @@ +package com.quantum; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Messages { + + private static final String BUNDLE_NAME = "com.quantum.QuantumResources"; //$NON-NLS-1$ + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + private Messages() { + } + + public static String getString(Class resourceClass, String key) { + return getString( + createKey(resourceClass, key)); + } + + private static String createKey(Class resourceClass, String key) { + return resourceClass.getName() + (key.startsWith(".") ? key : "." + key); + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } + + public static String getString(Class resourceClass, String key, Object[] arguments) { + return getString(createKey(resourceClass, key), arguments); + } + + public static String getString(String key, Object[] arguments) { + String string = getString(key); + return MessageFormat.format(string, arguments); + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/QuantumPlugin.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/QuantumPlugin.java new file mode 100644 index 0000000..154604a --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/QuantumPlugin.java @@ -0,0 +1,310 @@ +package com.quantum; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileWriter; +import java.io.IOException; +import java.net.URL; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import com.quantum.model.BookmarkCollection; +import com.quantum.util.xml.XMLHelper; +import com.quantum.view.subset.SubsetContentProvider; + +import org.eclipse.core.resources.ISaveContext; +import org.eclipse.core.resources.ISaveParticipant; +import org.eclipse.core.resources.ISavedState; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IPluginDescriptor; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferenceConverter; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.xml.sax.SAXException; + +/** + * @author root + * Main class of the quantum plugin, sets defaults, saves and recovers state. + */ +public class QuantumPlugin extends AbstractUIPlugin { + + private static QuantumPlugin plugin; + private Clipboard sysClip; + + + public QuantumPlugin(IPluginDescriptor descriptor) { + super(descriptor); + plugin = this; + } + + public static QuantumPlugin getDefault() { + return plugin; + } + /** + * Reads the Quantum Plugin state from a file. The file has been created with writeImportantState + * @param target + */ + protected void readStateFrom(File target) { + String fileName = target.getName(); + if (!fileName.endsWith(Messages.getString("QuantumPlugin.saveFileExtension"))){ //$NON-NLS-1$ + try { + // It's the 2.0 format for preferences + BookmarkCollection.getInstance().load(target); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + //It's the 2.1 format for preferences and subsets + FileInputStream source = null; + try { + source = new FileInputStream(target); + } catch (FileNotFoundException e1) { + e1.printStackTrace(); + return; + } + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder parser; + try { + parser = factory.newDocumentBuilder(); + Document doc = parser.parse(source); + + Element root = doc.getDocumentElement(); + BookmarkCollection.getInstance().importXML(root); + BookmarkCollection.getInstance().setChanged(false); + SubsetContentProvider.getInstance().importXML(root); + + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } catch (SAXException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.Plugin#startup() + */ + public void startup() throws CoreException { + super.startup(); + ISaveParticipant saveParticipant = new QuantumSaveParticipant(); + ISavedState lastState = + ResourcesPlugin.getWorkspace().addSaveParticipant( + this, + saveParticipant); + if (lastState != null) { + IPath location = lastState.lookup(new Path(Messages.getString("QuantumPlugin.saveDir"))); //$NON-NLS-1$ + if (location != null) { + // the plugin instance should read any important state from the file. + File f = getStateLocation().append(location).toFile(); + readStateFrom(f); + + } + } + sysClip = new Clipboard(null); + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.Plugin#shutdown() + */ + public void shutdown() throws CoreException { + super.shutdown(); + sysClip.dispose(); + } + + /** + * Write the bookmarks and subsets to a file, saving them for next use of the quantum plugin + * @param target + */ + protected void writeImportantState(File target) { + try { + Document document = XMLHelper.createEmptyDocument(); + + Element root = (Element) document.appendChild( + document.createElement(Messages.getString("ExportXMLAction.SavedData"))); //$NON-NLS-1$ + + BookmarkCollection.getInstance().exportXML(root); + SubsetContentProvider.getInstance().exportXML(root); + + FileWriter writer = new FileWriter(target); + try { + XMLHelper.createDOMSerializer(writer).serialize(document); + } finally { + writer.close(); + } + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * Gets an image descriptof from a file in the icons directory + * @param name of the file to get + * @return ImageDescriptor or null if not found + */ + public static ImageDescriptor getImageDescriptor(String name) { + ImageDescriptor descriptor = null; + try { + URL installURL = + QuantumPlugin.getDefault().getDescriptor().getInstallURL(); + URL url = new URL(installURL, Messages.getString("QuantumPlugin.iconsDir") + name); //$NON-NLS-1$ + descriptor = ImageDescriptor.createFromURL(url); + } catch (Exception e) { + e.printStackTrace(); + } + return descriptor; + } + public static Image getImage(String name) { + ImageDescriptor imageDescriptor = getImageDescriptor(name); + return imageDescriptor == null ? null : imageDescriptor.createImage(); + } + + protected void initializeDefaultPluginPreferences() { + RGB BACKGROUND = new RGB(255, 255, 255); + RGB COMMENT = new RGB(88, 148, 64); + RGB KEYWORD = new RGB(126, 0, 75); + RGB STRING = new RGB(0, 0, 255); + RGB NUMERIC = new RGB(255, 0, 0); + RGB DEFAULT = new RGB(0, 0, 0); + IPreferenceStore store = getPreferenceStore(); + PreferenceConverter.setDefault(store, + "quantum.background.color", BACKGROUND); //$NON-NLS-1$ + PreferenceConverter.setDefault(store, + "quantum.text.color", DEFAULT); //$NON-NLS-1$ + PreferenceConverter.setDefault(store, + "quantum.keyword.color", KEYWORD); //$NON-NLS-1$ + PreferenceConverter.setDefault(store, + "quantum.comment.color", COMMENT); //$NON-NLS-1$ + PreferenceConverter.setDefault(store, + "quantum.string.color", STRING); //$NON-NLS-1$ + PreferenceConverter.setDefault(store, + "quantum.numeric.color", NUMERIC); //$NON-NLS-1$ + getPreferenceStore().setDefault("quantum.text.bold", false); //$NON-NLS-1$ + getPreferenceStore().setDefault("quantum.keyword.bold", true); //$NON-NLS-1$ + getPreferenceStore().setDefault("quantum.string.bold", false); //$NON-NLS-1$ + getPreferenceStore().setDefault("quantum.comment.bold", false); //$NON-NLS-1$ + getPreferenceStore().setDefault("quantum.numeric.bold", false); //$NON-NLS-1$ + PreferenceConverter.setDefault(getPreferenceStore(), "quantum.font", (FontData) null); //$NON-NLS-1$ + getPreferenceStore().setDefault("com.quantum.model.Bookmark.queryHistorySize", 20); //$NON-NLS-1$ + } + // Returns the active page + public IWorkbenchPage getActivePage() + { + IWorkbench workbench = getWorkbench(); + IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); + if (window == null) return null; + IWorkbenchPage page = window.getActivePage(); + return page; + } + /** + * returns a view in the active page, creating it if needed + * @param view, the name of the view (e.g com.quantum.view.tableview) + * @return true if successful, false if not + */ + public IViewPart getView(String view) + { + IViewPart tableView = null; + try { + IWorkbenchPage page = QuantumPlugin.getDefault().getActivePage(); + tableView = page.findView(view); + if (tableView == null){ + // showView will give focus to the created view, we don't want that + // so we save the active part + IWorkbenchPart part = page.getActivePart(); + tableView = page.showView(view); + // and return the focus to it + page.activate(part); + } + } catch (PartInitException e) { + e.printStackTrace(); + } + return tableView; + } + + + + class QuantumSaveParticipant implements ISaveParticipant { + /** + * @see org.eclipse.core.resources.ISaveParticipant#doneSaving(ISaveContext) + */ + public void doneSaving(ISaveContext context) { + } + /** + * @see org.eclipse.core.resources.ISaveParticipant#prepareToSave(ISaveContext) + */ + public void prepareToSave(ISaveContext context) throws CoreException { + } + + /** + * @see org.eclipse.core.resources.ISaveParticipant#rollback(ISaveContext) + */ + public void rollback(ISaveContext context) { + } + + /** + * @see org.eclipse.core.resources.ISaveParticipant#saving(ISaveContext) + */ + public void saving(ISaveContext context) throws CoreException { + switch (context.getKind()) { + case ISaveContext.FULL_SAVE : + QuantumPlugin quantumPluginInstance = QuantumPlugin.getDefault(); + // save the plug in state + if (BookmarkCollection.getInstance().isAnythingChanged() + || SubsetContentProvider.getInstance().hasChanged()) { + + int saveNumber = context.getSaveNumber(); + String saveFileName = Messages.getString("QuantumPlugin.saveDir") + "-" + Integer.toString(saveNumber) + Messages.getString("QuantumPlugin.saveFileExtension"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + File f = quantumPluginInstance.getStateLocation().append(saveFileName).toFile(); + + // if we fail to write, an exception is thrown and we do not update the path + quantumPluginInstance.writeImportantState(f); + + context.map(new Path(Messages.getString("QuantumPlugin.saveDir")), new Path(saveFileName)); //$NON-NLS-1$ + context.needSaveNumber(); + + } else { + System.out.println("Not saving unchanged bookmarks"); //$NON-NLS-1$ + } + break; + case ISaveContext.PROJECT_SAVE : + // get the project related to this save operation + //IProject project = context.getProject(); + // save its information, if necessary + break; + case ISaveContext.SNAPSHOT : + // This operation needs to be really fast because + // snapshots can be requested frequently by the + // workspace. + break; + } + } + } + /** + * @return + */ + public Clipboard getSysClip() { + return sysClip; + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/QuantumResources.properties b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/QuantumResources.properties new file mode 100644 index 0000000..d0a7e30 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/QuantumResources.properties @@ -0,0 +1,286 @@ +bookmarkview.done = Done +bookmarkview.editBookmark = Edit Bookmark... +bookmarkview.refresh = Refresh +bookmarkview.viewTableDetails = View Table Details +bookmarkview.exportXML = Export XML +bookmarkview.noSequence = Database type does not support sequences +bookmarkview.noViews = Database type does not support views +bookmarkview.noTables = Database type does not support tables +bookmarkview.retrieveDbElementData = Retrieving data of type +bookmarkview.retrieveEntities = Retrieving table/view/sequence information +bookmarkview.done = Done +bookmarkview.metaDataError = Error while retrieving metadata +bookmarkview.confirm = Are you sure you want to delete bookmark +bookmarkview.disconnect = Disconnecting from +bookmarkview.deleteAllRows = Delete all rows from +bookmarkview.deleteRowsAction = Delete all rows +bookmarkview.customCopyAction = Custom Copy +bookmarkview.confirmDeleteAllRows = Are you sure you want to delete all the rows from this table? +sqlqueryview.executeQuery = Execute Query (Ctrl+Shift+Q) +sqlqueryview.importQuery = Import Query +sqlqueryview.exportQuery = Export Query +sqlqueryview.clear = Clear +sqlqueryview.copy = Copy +sqlqueryview.paste = Paste +sqlqueryview.done = Done +tableview.refresh = Refresh Table +tableview.copy = Copy Table Selection To Clipboard +tableview.selectAll = Select All Table Rows +tableview.close = Close Table +tableview.update = Update... +tableview.insert = Insert... +tableview.delete = Delete... +tableview.filterSort = Sort or Filter Table... +tableview.showAll = Toggle Show All Table Rows +tableview.defaultEncoding = Set Default Encoding +tableview.UTF8Encoding = Set UTF-8 +tableview.UTF16Encoding = Set UTF-16 +tableview.QuantumTableViewName=Quantum Table View +tableview.ViewNameFinalDecoration=) +tableview.BookmarkSeparator=: +tableview.ViewNameInitialDecoration=\ ( +filedialog.preferences = Preferences (*.ini) +filedialog.allfiles = All Files (*.*) +filedialog.sqlFiles = SQL query (*.sql) +filedialog.ddlFiles = SQL query (*.ddl) +filedialog.exportxml.name = XML files (*.xml) +filedialog.exportxml.filter = *.xml +filedialog.exportxml.name = XML files (*.xml) +filedialog.exportxml.filter = *.xml +filedialog.exportxml.name = XML files (*.xml) +filedialog.exportxml.filter = *.xml +filedialog.allfiles.name = All Files (*.*) +filedialog.allfiles.filter = *.* +filedialog.message.CannotOpenFileTitle=Cannot open file +filedialog.message.CannotOpenFileMessage=Cannot open file to write : +filedialog.message.CannotOpenFileExplain=\n\nProbably is\'t read-only or used by another process. +filedialog.options.ConfirmOverwrite = y +filedialog.message.ConfirmOverwriteTitle = Confirm Overwrite +filedialog.message.ConfirmOverwriteMessage = This file already exists : +filedialog.message.ConfirmOverwriteQuestion= \n\nDo you want to overwrite it? +adapters.generic = Generic JDBC +adapters.oracle = Oracle +adapters.postgres = Postgres +adapters.mysql = MySQL +adapters.db2 = DB2 +adapters.db2as400 = DB2 for AS400 +adapters.adabasd = Adabas-D +adapters.informix = Informix +adapters.redbrick = Red Brick +adapters.sybase = Sybase +QuantumPlugin.save_2=save +QuantumPlugin.icons_3=icons/ +QuantumPlugin.quantum.keyword.color_6=quantum.keyword.color +QuantumPlugin.quantum.string.bold_12=quantum.string.bold +QuantumPlugin.save_espace=save +QuantumPlugin.Not_saving_unchanged_bookmarks_18=Not saving unchanged bookmarks +QuantumPlugin.iconsDir=icons/ +QuantumPlugin.saveDir=save +QuantumPlugin.saveFileExtension=.xml +ExecuteAction.Executing_Query3=Executing Query... +ExecuteAction.Executing_Query2=Executing Query.. +ExecuteAction.Parsing_sql_script3=Parsing sql script... +ExecuteAction.QueriesExecuted=\ queries executed, +ExecuteAction.RowsUpdated=\ rows updated, +ExecuteAction.Errors=\ errors, +ExecutAction.TimeExec=\ seconds +ExecuteAction.Done=Done +ExecuteAction.RowUpdated=\ rows updated, +ExecuteAction.ResultsDisplayed=\ results displayed, +ExportXMLAction.XMLExporting=XML struct: Exporting to file: +ExportXMLAction.Metadata=Metadata +ExportXMLAction.Author=Author +ExportXMLAction.Quantum=Quantum +ExportXMLAction.Version=Version +ExportXMLAction.XMLVersionNumber=0.4 +ExportXMLAction.Table=TABLE +ExportXMLAction.View=VIEV +ExportXMLAction.TableName=NAME +ExportXMLAction.SchemaName=SCHEMA +ExportXMLAction.OtherSchemas=Other_Schemas +ExportXMLAction.BookmarkName=BOOKMARK +ExportXMLAction.Subsets=SUBSETS +ExportXMLAction.Subset=SUBSET +ExportXMLAction.SubsetName=NAME +ExportXMLAction.SavedData=SAVED_DATA +ExportXMLAction.TableColumn=COLUMN +ExportXMLAction.ColumnName=NAME +ExportXMLAction.UNKNOWN=UNKNOWN +ExportXMLAction.NO=NO +ExportXMLAction.YES=YES +ExportXMLAction.ColumnNullable=Nullable +ExportXMLAction.ColumnAutoIncrement=Auto_Increment +ExportXMLAction.PrimaryKey=Primary_Key +ExportXMLAction.PKName=Name +ExportXMLAction.PKColumn=Column +ExportXMLAction.PKColumnName=Name +ExportXMLAction.PKSequence=Sequence +ExportXMLAction.ForeignKey=Foreign_Key +ExportXMLAction.FKName=Name +ExportXMLAction.FKType=Type +ExportXMLAction.FKImported=Imported +ExportXMLAction.FKExported=Exported +ExportXMLAction.FKCascadeUpdate=Cascade_Update +ExportXMLAction.FKCascadeDelete=Cascade_Delete +ExportXMLAction.FKColumn=Column +ExportXMLAction.FKSequence=Sequence +ExportXMLAction.FKPrimarySchema=Primary_Schema +ExportXMLAction.FKPrimaryTable=Primary_Table +ExportXMLAction.FKPrimaryColumn=Primary_Column +ExportXMLAction.FKForeignSchema=Foreign_Schema +ExportXMLAction.FKForeignTable=Foreign_Table +ExportXMLAction.FKForeignColumn=Foreign_Column +SetSchemaAction.SetSchema=Set Schema +SetSchemaAction.PleaseEnterName=Please enter the name of new schema: +MetaDataKey=METADATA +MetaDataKeySeparator=: +NoFeature.Views=Views +NoFeature.Sequences=Sequences +Error.NoDatabase=Database not supported: +PreferencesPage.PickFont=Pick Font +PreferencesPage.DefaultFont=Default Font +PreferencesPage.BackgroundColor=Background Color +PreferencesPage.DefaultTextColor=Default Text Color +PreferencesPage.quantum.keyword.color_26=quantum.keyword.color +PreferencesPage.KeywordTextColor=Keyword Text Color +PreferencesPage.Bold=Bold +PreferencesPage.CommentTextColor=Comment Text Color +PreferencesPage.StringTextColor=String Text Color +PreferencesPage.NumericTextColor=Numeric Text Color +PreferencesPage.Font_Default=Font: default +PreferencesPage.regular=regular +PreferencesPage.bold=bold +PreferencesPage.italic=italic +PreferencesPage.boldItalic=bold italic +PreferencesPage.FontPrompt=Font: +BookmarkLabelProvider.TablePrefix= +BookmarkLabelProvider.ViewPrefix= +BookmarkLabelProvider.SequencePrefix= +DeleteColumnAction.DeleteColumns=Delete Columns... +DeleteColumnAction.ConfirmDeleteColumns=Are you sure you want to delete the selected columns? +DeleteObjectAction.DeleteSubset=Delete Subset... +DeleteObjectAction.ConfirmDeleteSubset=Are you sure you want to delete the selected subset ? +DeleteObjectAction.DeleteItems=Delete items... +DeleteObjectAction.ConfirmDeleteItems=Are you sure you want to delete the selected tables/views? +DeleteSubsetAction.DeleteSubset=Delete Subset... +DeleteSubsetAction.ConfirmDeleteSubset=Are you sure you want to delete the selected subset? +NewSubsetAction.CreatingNewSubset=Creating new subset.. +NewSubsetAction.NameOfNewSubset=Name of the new Subset +NewSubsetAction.PleaseEnterName=Please enter name +OracleAdapter.._3=. +BookmarkView.ShowTableSizes=Show Table Sizes +BookmarkView.ShowDatabaseData=Show Database Info +BookmarkView.Paste=Paste +BookmarkView.Copy=Copy +BookmarkView.CopyOf=Copy of +SQLLogView.ClearLog=Clear Log +SQLQueryView.Commit=Commit +SQLQueryView.RollBack=RollBack +SQLQueryView.AutoCommit=AutoCommit +SubsetView.Paste=Paste +SubsetView.Delete=Delete +SubsetView.CreatesANewEmptySubset=Creates a new empty subset +SubsetView.DeletesTheSelectedColumns=Deletes the selected column +SubsetView.DeletesTheSelectedObject=Deletes the selected object +SubsetView.DeletesTheSelectedSubset=Deletes the selected subset +TableView.FilterAndSort=Filter and Sort +TableView.UpdateRow=Update Row +TableView.InsertRow=Insert Row +TableView.DeleteRow=Delete Row +TableAdapter.to=\ to +TableAdapter.of=\ of +TableAdapter.full=\ (FULL) +BookmarkWizard.NewBookmark=New Bookmark +BookmarkWizard.Testing=Testing... +BookmarkWizard.JarFiles=Jar Files (*.jar) +BookmarkWizard.ZipFiles=Zip Files (*.zip) +BookmarkWizard.AllFiles=All Files (*.*) +BookmarkWizard.BookmarkNameAst=*Bookmark Name +BookmarkWizard.UsernameAst=*Username +BookmarkWizard.PasswordAst=Password +BookmarkWizard.Schema=Schema (optional) +BookmarkWizard.ConnectAst=*JDBC URL +BookmarkWizard.DriverAst=*Driver +BookmarkWizard.TypeAst=*Type +BookmarkWizard.Prompt=Prompt for password +BookmarkWizard.DriverFilenameAst=*Driver Filename +BookmarkWizard.Browse=Browse... +DeleteRowPage.ColumnName=Column Name +DeleteRowPage.Value=Value +DeleteRowPage.IncludeIn=Include in? +DeleteRowPage.WhereClause=Where clause +DeleteRowPage.UpdatingQuery=Updating query +DeleteRowPage.WarningNoWhere=Warning: no \"where clause\" columns selected, all rows will be deleted +InsertRowPage.ColumnName=Column Name +InsertRowPage.Value=Value +UpdateRowPage.ColumnName=Column Name +UpdateRowPage.OldValue=Old Value +UpdateRowPage.NewValue=New Value +UpdateRowPage._13= +UpdateRowPage.SetValue=Set Value +ConnectAction.ConnectingTo=Connecting to +ConnectAction.ErrorConnecting=Error while connecting to +BookmarkView.SetExtraSchemas=Set Extra Schemas +BookmarkView.CopyColumnSeparator=\ +MultiSQLServer.Enter_Password=Enter Password +MultiSQLServer.PasswordNotProvided=Password not provided in Bookmark +BookmarkSelectionDialog.text=Select a bookmark +BookmarkSelectionDialog.title=Bookmark Selection +ExecuteAgainstAction.IOException=An I/O Exception was encountered while \ntrying to read the input file. +ExecuteAgainstAction.SQLException=A database error was encountered while \ntrying to execute the SQL statements. +ExecuteAgainstAction.title=Problem Encountered +ExceptionDisplayDialog.stackTrace=Stack trace: + +# Actions +com.quantum.actions.AddToQuickListAction.text=Add to Quick List +com.quantum.actions.RemoveFromQuickListAction.text=Remove from Quick List +com.quantum.actions.ConnectAction.text = Connect +com.quantum.actions.ConnectAction.singleSuccessMessage = Connected to {0} +com.quantum.actions.ConnectAction.singleFailureMessage = Could not connect to {0} +com.quantum.actions.ConnectAction.multiSuccessMessage = {0} databases successfully connected. +com.quantum.actions.ConnectAction.multiFailureMessage = {0} database(s) successfully connected. {1} error(s). +com.quantum.actions.DisconnectAction.text = Disconnect +com.quantum.actions.DisconnectAction.message = Disconnected +com.quantum.actions.ViewTableAction.text = View Table +com.quantum.actions.OpenQueryAction.text = Open +com.quantum.actions.DeleteBookmarkAction.text = Delete +com.quantum.actions.RefreshBookmarkAction.text = Refresh +com.quantum.actions.NextSequenceAction.text = Increment Sequence Value +com.quantum.actions.PrevSequenceAction.text = Current Sequence Value +com.quantum.actions.NewBookmarkAction.text = New Bookmark... +com.quantum.actions.NewBookmarkAction.toolTip = Create a new bookmark +com.quantum.actions.DeleteAllRowsAction.text = Delete All Rows +com.quantum.actions.DeleteAllRowsAction.confirmTitle = Warning +com.quantum.actions.DeleteAllRowsAction.confirmText = Are you sure you want to delete all the rows from the table {0}? +com.quantum.actions.ViewTableDetailsAction.text = View Table Details + +com.quantum.util.connection.ConnectionUtil.title = Connection Not Established +com.quantum.util.connection.ConnectionUtil.message = The bookmark could not be connected. + +com.quantum.view.bookmark.CopyAction.text = Copy +com.quantum.view.bookmark.PasteAction.text = Paste +com.quantum.view.bookmark.RenameAction.text = Rename +com.quantum.view.bookmark.QuickListNode.labelName=Quick List +com.quantum.view.bookmark.QueryListNode.labelName=Recent SQL Statements +com.quantum.view.bookmark.GroupNode.TABLE=Tables +com.quantum.view.bookmark.GroupNode.VIEW=Views +com.quantum.view.bookmark.GroupNode.SEQUENCE=Sequences + +com.quantum.preferences.GlobalPreferences.com.quantum.model.Bookmark.queryHistorySize=Maximum size of query history: + +com.quantum.wizards.ExportBookmarkWizardPage.title = Export Bookmark List +com.quantum.wizards.ExportBookmarkWizardPage.selectAll = Select All +com.quantum.wizards.ExportBookmarkWizardPage.deselectAll = Deselect All +com.quantum.wizards.ExportBookmarkWizardPage.fileName = File name: +com.quantum.wizards.ExportBookmarkWizardPage.browse = Browse +com.quantum.wizards.ExportBookmarkWizardPage.error.IOException.title = I/O Exception +com.quantum.wizards.ExportBookmarkWizardPage.error.IOException.message = A problem was encountered with the file: "{0}" + + +# Exception Dialog +com.quantum.ui.dialog.ExceptionDisplayDialog.java.sql.IOException.title=I/O Exception +com.quantum.ui.dialog.ExceptionDisplayDialog.java.sql.IOException.message=A problem was encountered while trying to access the file. +com.quantum.ui.dialog.ExceptionDisplayDialog.java.sql.SQLException.title=SQL Exception +com.quantum.ui.dialog.ExceptionDisplayDialog.java.sql.SQLException.message=An SQL Exception was encountered while trying to process your request. +BookmarkWizard.Error=Error +BookmarkWizard.bookmarkAlreadyExists=The selected bookmark name already exists. diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/AddToQuickListAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/AddToQuickListAction.java new file mode 100644 index 0000000..e773620 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/AddToQuickListAction.java @@ -0,0 +1,56 @@ +package com.quantum.actions; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import com.quantum.Messages; +import com.quantum.view.bookmark.EntityNode; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.actions.SelectionListenerAction; + +/** + *

This action takes an EntityNode and adds a copy of it to the quicklist + * of a bookmark.

+ * + * @author bcholmes + */ +public class AddToQuickListAction extends SelectionListenerAction { + private IViewPart view; + private List entities = Collections.synchronizedList(new ArrayList()); + + public AddToQuickListAction(IViewPart view) { + super(Messages.getString(AddToQuickListAction.class.getName() + ".text")); + this.view = view; + } + + public void run() { + for (Iterator i = this.entities.iterator(); i.hasNext(); ) { + EntityNode entityNode = (EntityNode) i.next(); + entityNode.getBookmark().addQuickListEntry(entityNode.getEntity()); + } + } + + /** + * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) + */ + public boolean updateSelection(IStructuredSelection selection) { + boolean enabled = super.updateSelection(selection); + this.entities.clear(); + for (Iterator i = selection.iterator(); enabled && i.hasNext(); ) { + Object object = i.next(); + if (object != null && object instanceof EntityNode) { + EntityNode node = (EntityNode) object; + enabled &= !(node.getBookmark().isInQuickList(node.getEntity())); + this.entities.add(node); + } else { + enabled = false; + } + } + + return enabled; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/BaseSQLAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/BaseSQLAction.java new file mode 100644 index 0000000..e651640 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/BaseSQLAction.java @@ -0,0 +1,25 @@ +package com.quantum.actions; + +import java.sql.Connection; + +import com.quantum.model.Bookmark; +import com.quantum.util.connection.ConnectionUtil; + +import org.eclipse.jface.action.Action; +import org.eclipse.swt.widgets.Shell; + +/** + * @author BC + */ +public abstract class BaseSQLAction extends Action { + + private ConnectionUtil connectionUtil = new ConnectionUtil(); + + protected abstract Shell getShell(); + + protected abstract Bookmark getBookmark(); + + protected Connection getConnection() { + return this.connectionUtil.getConnection(getBookmark(), getShell()); + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/BaseSequenceAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/BaseSequenceAction.java new file mode 100644 index 0000000..0e967c4 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/BaseSequenceAction.java @@ -0,0 +1,53 @@ +package com.quantum.actions; + +import java.sql.Connection; +import java.util.List; + +import com.quantum.model.Bookmark; +import com.quantum.util.connection.ConnectionUtil; +import com.quantum.view.bookmark.EntityNode; +import com.quantum.view.bookmark.TreeNode; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.actions.SelectionListenerAction; + +/** + * @author BC + */ +public abstract class BaseSequenceAction extends SelectionListenerAction { + + protected IViewPart view; + private ConnectionUtil connectionUtil = new ConnectionUtil(); + + protected BaseSequenceAction(String text, IViewPart view) { + super(text); + + } + + protected Bookmark getBookmark() { + TreeNode node = getEntityNode(); + return node.getBookmark(); + } + + protected Connection getConnection() { + return connectionUtil.getConnection(getBookmark(), getShell()); + } + + protected EntityNode getEntityNode() { + List list = getSelectedNonResources(); + return (EntityNode) list.get(0); + } + + protected Shell getShell() { + return this.view.getViewSite().getShell(); + } + + protected boolean updateSelection(IStructuredSelection selection) { + boolean enabled = super.updateSelection(selection); + return enabled && selection.size() == 1 + && (selection.getFirstElement() instanceof EntityNode) + && ((EntityNode) selection.getFirstElement()).isSequence(); + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/CloseTableAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/CloseTableAction.java new file mode 100644 index 0000000..dc99395 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/CloseTableAction.java @@ -0,0 +1,40 @@ +package com.quantum.actions; + +import com.quantum.view.tableview.TableView; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.ui.IViewActionDelegate; +import org.eclipse.ui.IViewPart; + +/** + * @author root + * + */ +public class CloseTableAction extends Action implements IViewActionDelegate { + TableView view; + /** + * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart) + */ + public void init(IViewPart view) { + this.view = (TableView) view; + } + + /** + * @see org.eclipse.ui.IActionDelegate#run(IAction) + */ + public void run(IAction action) { + run(); + } + public void run() { + view.closeCurrent(); + } + + /** + * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) + */ + public void selectionChanged(IAction action, ISelection selection) { + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ConnectAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ConnectAction.java new file mode 100644 index 0000000..05eeed9 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ConnectAction.java @@ -0,0 +1,115 @@ +package com.quantum.actions; + +import java.sql.Connection; +import java.util.Iterator; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.model.Bookmark; +import com.quantum.util.connection.ConnectionUtil; +import com.quantum.view.bookmark.BookmarkNode; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.actions.SelectionListenerAction; + +public class ConnectAction extends SelectionListenerAction { + /** + * @param text + */ + public ConnectAction(IViewPart view) { + super(Messages.getString(ConnectAction.class.getName() + ".text")); + this.view = view; + setImageDescriptor( + QuantumPlugin.getImageDescriptor("connect.gif")); //$NON-NLS-1$ + } + + private IViewPart view; + private ConnectionUtil connectionUtil = new ConnectionUtil(); + + /** + * @see IActionDelegate#run(IAction) + */ + public void run(IAction action) { + run(); + } + + /** + * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart) + */ + public void init(IViewPart view) { + this.view = view; + } + + /** + * @see org.eclipse.jface.action.IAction#run() + */ + public void run() { + + int bookmarks = 0; + int errors = 0; + String lastBookmarkName = null; + for (Iterator i = getSelectedNonResources().iterator(); i.hasNext();) { + Bookmark bookmark = ((BookmarkNode) i.next()).getBookmark(); + Connection connection = this.connectionUtil.connect(bookmark, getShell()); + if (connection == null) { + errors++; + } + bookmarks++; + lastBookmarkName = bookmark.getName(); + } + + if (bookmarks == 1 && errors == 0) { + updateStatusLine(getMessage("singleSuccessMessage", + new Object[] {lastBookmarkName})); + } else if (bookmarks == 1 && errors == 1) { + updateStatusLine(getMessage("singleFailureMessage", + new Object[] {lastBookmarkName})); + } else if (bookmarks > 1 && errors == 0) { + updateStatusLine(getMessage("multiSuccessMessage", + new Object[] {String.valueOf(bookmarks)})); + } else if (bookmarks > 1 && errors > 0) { + updateStatusLine(getMessage("multiFailureMessage", + new Object[] {String.valueOf(bookmarks - errors), + String.valueOf(errors)})); + } + } + + private String getMessage(String key, Object[] arguments) { + return Messages.getString(getClass().getName() + "." + key, arguments); + } + + /** + * Updates the message shown in the status line. + * + * @param message the message to display + */ + protected void updateStatusLine(String message) { + this.view.getViewSite().getActionBars().getStatusLineManager().setMessage(message); + } + + protected Shell getShell() { + return this.view.getSite().getShell(); + } + + /** + * + */ + protected boolean updateSelection(IStructuredSelection selection) { + boolean enabled = super.updateSelection(selection); + for (Iterator i = selection.iterator(); + enabled && i.hasNext(); + ) { + Object object = i.next(); + if (object instanceof BookmarkNode) { + BookmarkNode node = (BookmarkNode) object; + enabled &= !node.getBookmark().isConnected(); + } else { + enabled = false; + } + } + return enabled; + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/CustomCopyAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/CustomCopyAction.java new file mode 100644 index 0000000..24ea456 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/CustomCopyAction.java @@ -0,0 +1,73 @@ +/* + * Created on 11/08/2003 + * + */ +package com.quantum.actions; + +import java.util.Iterator; + +import com.quantum.QuantumPlugin; +import com.quantum.model.Column; +import com.quantum.model.EntityHolder; +import com.quantum.util.NthLevelConverter; +import com.quantum.util.QuantumUtil; +import com.quantum.util.StringUtil; +import com.quantum.view.bookmark.ColumnNode; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.actions.SelectionListenerAction; + + +public class CustomCopyAction extends SelectionListenerAction { + private final IViewPart view; + private final int ind; + /** + * @param BookmarkView + */ + public CustomCopyAction(IViewPart view, int ind) { + super(null); + this.view = view; + this.ind = ind; + } + public void run() { + String copyText = ""; + Iterator iter = getSelectedNonResources().iterator(); + NthLevelConverter converter = new NthLevelConverter(); + // Fill up the converter. We iterate the selection items + while (iter.hasNext()) { + Object current = iter.next(); + if (current instanceof ColumnNode) { + ColumnNode column = (ColumnNode) current; + if (column != null) { + converter.add(column.getColumn().getName(), + column.getColumn().getParentEntity().getCondQualifiedName(), 0); + } + } else if (current instanceof EntityHolder) { + EntityHolder currentSelec = (EntityHolder) current; + converter.add(currentSelec.getEntity().getCondQualifiedName(), null, 1); + Column[] columns = currentSelec.getEntity().getColumns(); + for (int i = 0, length = (columns == null) ? 0 : columns.length; + i < length; + i++) { + converter.add(columns[i].getName(), + currentSelec.getEntity().getCondQualifiedName(), 0); + } + } + } + IPreferenceStore store = QuantumPlugin.getDefault().getPreferenceStore(); + + + converter.convert(Integer.toString(ind)); + + String template = QuantumUtil.trasposeEscape(store.getString("customCopyTemplate" + Integer.toString(ind))); + copyText = StringUtil.substituteString(template, "${table_list}", converter.getTableList()); + + + QuantumPlugin.getDefault().getSysClip().setContents( + new Object[] { copyText }, + new Transfer[] { TextTransfer.getInstance()}); + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteAllRowsAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteAllRowsAction.java new file mode 100644 index 0000000..09f67bd --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteAllRowsAction.java @@ -0,0 +1,77 @@ +package com.quantum.actions; + +import java.sql.SQLException; + +import com.quantum.Messages; +import com.quantum.model.ConnectionException; +import com.quantum.model.Table; +import com.quantum.ui.dialog.ExceptionDisplayDialog; +import com.quantum.view.bookmark.EntityNode; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.actions.SelectionListenerAction; + +/** + * @author root + * + */ +public class DeleteAllRowsAction extends SelectionListenerAction { + private IViewPart view; + + /** + * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart) + */ + public DeleteAllRowsAction(IViewPart view) { + super(Messages.getString(DeleteAllRowsAction.class.getName() + ".text")); + this.view = view; + } + + public void run() { + try { + Table table = getTable(); + if (table != null) { + boolean flag = MessageDialog.openConfirm( + view.getSite().getShell(), + Messages.getString(DeleteAllRowsAction.class.getName() + ".confirmTitle"), + Messages.getString(DeleteAllRowsAction.class.getName() + ".confirmText", + new Object[] { table.getCondQualifiedName() })); + if (flag) { + table.deleteAllRows(); + } + } + } catch (SQLException e) { + ExceptionDisplayDialog.openError(getShell(), + Messages.getString("ExecuteAgainstAction.title"), + Messages.getString("ExecuteAgainstAction.ConnectionException"), e); + } catch (ConnectionException e) { + ExceptionDisplayDialog.openError(getShell(), + Messages.getString("ExecuteAgainstAction.title"), + Messages.getString("ExecuteAgainstAction.ConnectionException"), e); + } + } + + private Table getTable() { + EntityNode node = (EntityNode) getSelectedNonResources().get(0); + return node == null ? null : (Table) node.getEntity(); + } + + + + protected Shell getShell() { + return this.view.getViewSite().getShell(); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.actions.SelectionListenerAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection) + */ + protected boolean updateSelection(IStructuredSelection selection) { + boolean enabled = super.updateSelection(selection); + return enabled && selection.size() == 1 && + (selection.getFirstElement() instanceof EntityNode) && + ((EntityNode) selection.getFirstElement()).isTable(); + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteBookmarkAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteBookmarkAction.java new file mode 100644 index 0000000..a00c028 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteBookmarkAction.java @@ -0,0 +1,59 @@ +package com.quantum.actions; + +import java.util.Iterator; +import java.util.List; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.model.BookmarkCollection; +import com.quantum.view.bookmark.BookmarkNode; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.actions.SelectionListenerAction; + +/** + * @author root + * + */ +public class DeleteBookmarkAction extends SelectionListenerAction { + + private IViewPart view; + + public DeleteBookmarkAction(IViewPart view) { + super(Messages.getString(DeleteBookmarkAction.class.getName() + ".text")); + setImageDescriptor(QuantumPlugin.getImageDescriptor("delete.gif")); + this.view = view; + } + + /** + * @see org.eclipse.ui.IActionDelegate#run(IAction) + */ + public void run(IAction action) { + run(); + } + + public void run() { + List bookmarkNodes = getSelectedNonResources(); + boolean flag = MessageDialog.openConfirm(view.getSite().getShell(), Messages.getString("bookmarkview.deleteBookmark"), Messages.getString("bookmarkview.confirm")); //$NON-NLS-1$ //$NON-NLS-2$ + + for (Iterator i = bookmarkNodes.iterator(); flag && i.hasNext();) { + BookmarkNode bookmarkNode = (BookmarkNode) i.next(); + if (bookmarkNode != null) { + BookmarkCollection.getInstance().removeBookmark(bookmarkNode.getBookmark()); + } + } + } + + public boolean updateSelection(IStructuredSelection selection) { + boolean enabled = super.updateSelection(selection); + for (Iterator i = selection.iterator(); enabled && i.hasNext(); ) { + enabled &= (i.next() instanceof BookmarkNode); + } + + return enabled; + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteColumnAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteColumnAction.java new file mode 100644 index 0000000..37e38ff --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteColumnAction.java @@ -0,0 +1,63 @@ +package com.quantum.actions; + +import java.util.Iterator; + +import com.quantum.Messages; +import com.quantum.view.bookmark.ColumnNode; +import com.quantum.view.subset.SubsetView; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.ui.IViewActionDelegate; +import org.eclipse.ui.IViewPart; + +/** + * Deletes the selected columns from the Subset items (Tables) + * @author root + * + */ +public class DeleteColumnAction extends Action implements IViewActionDelegate { + SubsetView view; + /** + * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart) + */ + public void init(IViewPart view) { + this.view = (SubsetView) view; + } + + /** + * @see org.eclipse.ui.IActionDelegate#run(IAction) + */ + public void run(IAction action) { + run(); + } + + public void run() { + StructuredSelection selection = view.getSelection(); + Iterator iter = selection.iterator(); + if (! MessageDialog.openConfirm(view.getSite().getShell(), + Messages.getString("DeleteColumnAction.DeleteColumns"), //$NON-NLS-1$ + Messages.getString("DeleteColumnAction.ConfirmDeleteColumns") )) //$NON-NLS-1$ + return; + + while (iter.hasNext()) { + Object current = iter.next(); + if (current instanceof ColumnNode) { + ColumnNode column = (ColumnNode) current; + if (column != null) { + view.deleteColumn(column); + } + } + } + } + + /** + * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) + */ + public void selectionChanged(IAction action, ISelection selection) { + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteObjectAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteObjectAction.java new file mode 100644 index 0000000..4d83cee --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteObjectAction.java @@ -0,0 +1,77 @@ +package com.quantum.actions; + +import java.util.Iterator; + +import com.quantum.Messages; +import com.quantum.view.subset.ObjectNode; +import com.quantum.view.subset.SubsetNode; +import com.quantum.view.subset.SubsetView; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.ui.IViewActionDelegate; +import org.eclipse.ui.IViewPart; + +/** + * Deletes an entire object (Table) from the SubsetView + * @author root + * + */ +public class DeleteObjectAction extends Action implements IViewActionDelegate { + SubsetView view; + /** + * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart) + */ + public void init(IViewPart view) { + this.view = (SubsetView) view; + } + + /** + * @see org.eclipse.ui.IActionDelegate#run(IAction) + */ + public void run(IAction action) { + run(); + } + + public void run() { + Object selection = view.getCurrent(); + if (selection instanceof SubsetNode) { + SubsetNode node = (SubsetNode) selection; + if (node != null) { + boolean flag = MessageDialog.openConfirm(view.getSite().getShell(), + Messages.getString("DeleteObjectAction.DeleteSubset"), //$NON-NLS-1$ + Messages.getString("DeleteObjectAction.ConfirmDeleteSubset") + node.getName()); //$NON-NLS-1$ + if (flag) { + view.deleteCurrent(); + } + } + } else if (selection instanceof ObjectNode) { + StructuredSelection allSelected = view.getSelection(); + Iterator iter = allSelected.iterator(); + if (! MessageDialog.openConfirm(view.getSite().getShell(), + Messages.getString("DeleteObjectAction.DeleteItems"), //$NON-NLS-1$ + Messages.getString("DeleteObjectAction.ConfirmDeleteItems") )) //$NON-NLS-1$ + return; + + while (iter.hasNext()) { + Object current = iter.next(); + if (current instanceof ObjectNode) { + ObjectNode node = (ObjectNode) current; + if (node != null) { + view.deleteObject(node); + } + } + } + } + } + + /** + * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) + */ + public void selectionChanged(IAction action, ISelection selection) { + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteSubsetAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteSubsetAction.java new file mode 100644 index 0000000..086d543 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DeleteSubsetAction.java @@ -0,0 +1,55 @@ +package com.quantum.actions; + +import com.quantum.Messages; +import com.quantum.view.subset.SubsetNode; +import com.quantum.view.subset.SubsetView; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.ui.IViewActionDelegate; +import org.eclipse.ui.IViewPart; + +/** + * @author root + * Deletes a complete subset from the subset view + */ +public class DeleteSubsetAction extends Action implements IViewActionDelegate { + SubsetView view; + /** + * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart) + */ + public void init(IViewPart view) { + this.view = (SubsetView) view; + } + + /** + * @see org.eclipse.ui.IActionDelegate#run(IAction) + */ + public void run(IAction action) { + run(); + } + + public void run() { + Object selection = view.getCurrent(); + if (selection instanceof SubsetNode) { + SubsetNode node = (SubsetNode) selection; + if (node != null) { + boolean flag = MessageDialog.openConfirm(view.getSite().getShell(), + Messages.getString("DeleteSubsetAction.DeleteSubset"), //$NON-NLS-1$ + Messages.getString("DeleteSubsetAction.ConfirmDeleteSubset") + node.getName()); //$NON-NLS-1$ + if (flag) { + view.deleteCurrent(); + } + } + } + } + + /** + * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) + */ + public void selectionChanged(IAction action, ISelection selection) { + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DisconnectAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DisconnectAction.java new file mode 100644 index 0000000..7966a08 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/DisconnectAction.java @@ -0,0 +1,81 @@ +package com.quantum.actions; + +import java.util.Iterator; +import java.util.List; +import java.util.Vector; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.model.Bookmark; +import com.quantum.model.ConnectionException; +import com.quantum.view.bookmark.BookmarkNode; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.actions.SelectionListenerAction; + +/** + * Disconnects from the database + * + * @author root + */ +public class DisconnectAction extends SelectionListenerAction { + private IViewPart view; + private List selections = new Vector(); + + /** + * @param text + */ + public DisconnectAction(IViewPart view) { + super(Messages.getString(DisconnectAction.class.getName() + ".text")); + this.view = view; + setImageDescriptor( + QuantumPlugin.getImageDescriptor("disconnect.gif")); //$NON-NLS-1$ + } + + + public void run() { + for (Iterator i = this.selections.iterator(); i.hasNext();) { + Bookmark bookmark = (Bookmark) i.next(); + try { + bookmark.disconnect(); + } catch (ConnectionException e) { + e.printStackTrace(); + } + } + updateStatusLine(getMessage("message")); + } + + private String getMessage(String key) { + return Messages.getString(getClass().getName() + "." + key); + } + + /** + * Updates the message shown in the status line. + * + * @param message the message to display + */ + protected void updateStatusLine(String message) { + this.view.getViewSite().getActionBars().getStatusLineManager().setMessage(message); + } + + + /** + * + */ + public boolean updateSelection(IStructuredSelection selection) { + boolean enabled = super.updateSelection(selection); + this.selections.clear(); + for (Iterator i = selection.iterator(); enabled && i.hasNext(); ) { + Object object = i.next(); + if (object instanceof BookmarkNode) { + BookmarkNode node = (BookmarkNode) object; + this.selections.add(node.getBookmark()); + enabled &= node.getBookmark().isConnected(); + } else { + enabled = false; + } + } + return enabled; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExecuteAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExecuteAction.java new file mode 100644 index 0000000..f8c4418 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExecuteAction.java @@ -0,0 +1,142 @@ +package com.quantum.actions; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.Vector; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.model.Bookmark; +import com.quantum.sql.MultiSQLServer; +import com.quantum.sql.SQLParser; +import com.quantum.sql.SQLResults; +import com.quantum.view.LogProxy; +import com.quantum.view.SQLQueryView; +import com.quantum.view.bookmark.BookmarkNode; +import com.quantum.view.bookmark.BookmarkView; +import com.quantum.view.tableview.DefaultSizes; +import com.quantum.view.tableview.TableView; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IViewActionDelegate; +import org.eclipse.ui.IViewPart; + +/** + * @author panic + * + * Executes a query from the QueryView + */ +public class ExecuteAction extends BaseSQLAction implements IViewActionDelegate { + SQLQueryView view; + boolean flag = false; + String execute1 = Messages.getString("ExecuteAction.Executing_Query3"); //$NON-NLS-1$ + String execute2 = Messages.getString("ExecuteAction.Executing_Query2"); //$NON-NLS-1$ + + public ExecuteAction() { + setActionDefinitionId("com.quantum.actions.ExecuteAction"); + } + + public void init(IViewPart view) { + this.view = (SQLQueryView) view; + } + + public void run(IAction action) { + run(); + } + + public void run() { + BookmarkNode current = BookmarkView.getInstance().getCurrentBookmark(); + if (current == null) + { + MessageDialog.openInformation( + view.getSite().getShell(),"Sorry","Please select a bookmark to use as connection."); + return; + } + Connection con = getConnection(); + view.setStatus(execute1); + MultiSQLServer server = MultiSQLServer.getInstance(); + view.setStatus(Messages.getString("ExecuteAction.Parsing_sql_script3")); //$NON-NLS-1$ + Vector queries = new Vector(); + String viewQuery = view.getQuery(); + // We parse the executable units to send to the JDBC driver + queries = SQLParser.parse(viewQuery); + for (int i = 0; i < queries.size(); i++) { + String query = (String) queries.elementAt(i); + System.out.println(query); + } + int resultCount = 0; + int resultUpdateCount = 0; + int errorCount = 0; + int resultsDisplayed = 0; + double startTime = 0.0; // stores the time when query is started + double queryDuration= 0.0; // stores query's execution time + + for (int i = 0; i < queries.size(); i++) { + if (flag) { + view.setStatus(execute1); + } else { + view.setStatus(execute2); + } + + String query = (String) queries.elementAt(i); + System.out.println(">" + query + "<"); //$NON-NLS-1$ //$NON-NLS-2$ + if (con != null && !query.equals("")) { //$NON-NLS-1$ + + SQLResults results; + try { + startTime = System.currentTimeMillis(); // Start the measure of execution time + results = server.execute(con, query, 1, DefaultSizes.PAGE_SIZE, DefaultSizes.MAX_COLUMN_SIZE); + queryDuration = (System.currentTimeMillis() - startTime)/1000; // calculate the execution time (in seconds) + current.getBookmark().addQuery(query); + } catch (SQLException e) { + errorCount++; + LogProxy log = LogProxy.getInstance(); + log.addText( + LogProxy.ERROR, + "Error Executing: " + query + ":" + e.toString(), e); //$NON-NLS-1$ //$NON-NLS-2$ + MessageDialog.openConfirm(view.getSite().getShell(), "Database returned error", e.getLocalizedMessage()); //$NON-NLS-1$ + continue; + } + resultCount++; + if (results.isResultSet()) { + TableView.getInstance().loadQuery(current.getBookmark(), results); + resultsDisplayed++; + } else { + int count = results.getUpdateCount(); + if (count > 0) { + resultUpdateCount += results.getUpdateCount(); + } + } + } + flag = !flag; + view.setProgress(i + 1, queries.size()); + } + Image statImage = QuantumPlugin.getImage((errorCount > 0) ? "stop.gif" : "success.gif"); //$NON-NLS-1$ //$NON-NLS-2$ + view.setStatus(statImage, Messages.getString("ExecuteAction.Done") + "(" + //$NON-NLS-1$ //$NON-NLS-2$ + resultCount + Messages.getString("ExecuteAction.QueriesExecuted") + //$NON-NLS-1$ + resultUpdateCount + Messages.getString("ExecuteAction.RowsUpdated") + //$NON-NLS-1$ + resultsDisplayed + Messages.getString("ExecuteAction.ResultsDisplayed") + //$NON-NLS-1$ + errorCount + Messages.getString("ExecuteAction.Errors") + //$NON-NLS-1$ + queryDuration + Messages.getString("ExecutAction.TimeExec") + ")"); //$NON-NLS-1$ //$NON-NLS-2$ + + view.setProgress(0, 1); + } + + public void selectionChanged(IAction action, ISelection selection) { + } + protected Bookmark getBookmark() { + BookmarkNode current = BookmarkView.getInstance().getCurrentBookmark(); + return current.getBookmark(); + } + + /* (non-Javadoc) + * @see com.quantum.actions.BaseSQLAction#getShell() + */ + protected Shell getShell() { + return this.view.getViewSite().getShell(); + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExecuteAgainstAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExecuteAgainstAction.java new file mode 100644 index 0000000..c1e2486 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExecuteAgainstAction.java @@ -0,0 +1,184 @@ +package com.quantum.actions; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.io.IOException; +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import com.quantum.Messages; +import com.quantum.model.Bookmark; +import com.quantum.model.BookmarkCollection; +import com.quantum.model.ConnectionException; +import com.quantum.sql.MultiSQLServer; +import com.quantum.sql.SQLParser; +import com.quantum.sql.SQLResults; +import com.quantum.ui.dialog.BookmarkSelectionDialog; +import com.quantum.ui.dialog.ExceptionDisplayDialog; +import com.quantum.util.io.InputStreamHelper; +import com.quantum.view.tableview.DefaultSizes; +import com.quantum.view.tableview.TableView; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IObjectActionDelegate; +import org.eclipse.ui.IWorkbenchPart; + +/** + * This action can be executed against any .sql file, regardless of + * whether or not the Quantum perspective is open. + * + * @author BC + */ +public class ExecuteAgainstAction extends BaseSQLAction + implements IObjectActionDelegate, PropertyChangeListener { + + private String selectedBookmark = null; + private IFile[] files = null; + + private IWorkbenchPart workbenchPart; + + /** + * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart) + */ + public void setActivePart(IAction action, IWorkbenchPart targetPart) { + this.workbenchPart = targetPart; + } + + protected Shell getShell() { + return this.workbenchPart.getSite().getShell(); + } + + /** + * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) + */ + public void run(IAction action) { + + BookmarkSelectionDialog dialog = new BookmarkSelectionDialog(getShell()); + dialog.addPropertyChangeListener(this); + int result = dialog.open(); + + if (result == Window.OK) { + try { + executeAgainstBookmark(); + } catch (SQLException e) { + ExceptionDisplayDialog.openError(getShell(), + null, + null, e); + } catch (IOException e) { + ExceptionDisplayDialog.openError(getShell(), + Messages.getString("ExecuteAgainstAction.title"), + Messages.getString("ExecuteAgainstAction.IOException"), e); + } catch (ConnectionException e) { + ExceptionDisplayDialog.openError(getShell(), + null, + null, e); + } catch (CoreException e) { + ErrorDialog.openError(getShell(), null, null, e.getStatus()); + } + } + } + + protected Bookmark getBookmark() { + return BookmarkCollection.getInstance().find(this.selectedBookmark); + } + + private void executeAgainstBookmark() + throws SQLException, IOException, CoreException, ConnectionException { + Bookmark bookmark = getBookmark(); + if (bookmark != null) { + boolean alreadyConnected = bookmark.isConnected(); + Connection connection = getConnection(); + try { + for (int i = 0, + length = (this.files == null) ? 0 : this.files.length; + connection != null && i < length; + i++) { + executeAgainstBookmark(bookmark, connection, this.files[i]); + } + } finally { + if (!alreadyConnected && connection != null) { + bookmark.disconnect(); + } + } + } + } + + private void executeAgainstBookmark( + Bookmark bookmark, + Connection connection, + IFile file) + throws SQLException, IOException, CoreException { + executeAgainstBookmark( + bookmark, + connection, + InputStreamHelper.readIntoString(file.getContents())); + } + + private void executeAgainstBookmark( + Bookmark bookmark, + Connection connection, + String queries) + throws SQLException { + List queryList = SQLParser.parse(queries); + MultiSQLServer server = MultiSQLServer.getInstance(); + + for (Iterator i = queryList.iterator(); i.hasNext();) { + String query = (String) i.next(); + SQLResults results = + server.execute( + connection, + query, + 1, + DefaultSizes.PAGE_SIZE, + DefaultSizes.MAX_COLUMN_SIZE); + if (results.isResultSet()) { + TableView view = TableView.getInstance(); + if (view != null) { + view.loadQuery(bookmark, results); + } + } + } + } + + /** + * This method is called with a new selection has been made on one + * of the views. + * + * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) + */ + public void selectionChanged(IAction action, ISelection selection) { + if (selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = + (IStructuredSelection) selection; + List list = new ArrayList(); + + for (Iterator i = structuredSelection.iterator(); i.hasNext();) { + Object temp = i.next(); + if (temp != null && temp instanceof IFile) { + System.out.println(((IFile) temp).getName()); + list.add(temp); + } + } + this.files = (IFile[]) list.toArray(new IFile[list.size()]); + } + } + + /** + * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) + */ + public void propertyChange(PropertyChangeEvent event) { + if ("selection".equals(event.getPropertyName())) { + this.selectedBookmark = (String) event.getNewValue(); + } + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExportBookmarksAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExportBookmarksAction.java new file mode 100644 index 0000000..06be066 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExportBookmarksAction.java @@ -0,0 +1,42 @@ +package com.quantum.actions; + +import com.quantum.wizards.ExportBookmarkWizard; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.ui.IViewActionDelegate; +import org.eclipse.ui.IViewPart; + +/** + * @author root + * Asks the user for a file name and saves there the bookmarks in xml format + */ +public class ExportBookmarksAction implements IViewActionDelegate { + + private IViewPart view; + + /** + * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart) + */ + public void init(IViewPart view) { + this.view = view; + } + + /** + * @see org.eclipse.ui.IActionDelegate#run(IAction) + */ + public void run(IAction action) { + + ExportBookmarkWizard wizard = new ExportBookmarkWizard(); + WizardDialog dialog = + new WizardDialog(this.view.getSite().getShell(), wizard); + dialog.open(); + } + /** + * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) + */ + public void selectionChanged(IAction action, ISelection selection) { + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExportQueryAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExportQueryAction.java new file mode 100644 index 0000000..081897e --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExportQueryAction.java @@ -0,0 +1,83 @@ +package com.quantum.actions; + +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.StringTokenizer; + +import com.quantum.Messages; +import com.quantum.util.StringUtil; +import com.quantum.view.LogProxy; +import com.quantum.view.SQLLogView; +import com.quantum.view.SQLQueryView; +import com.quantum.view.ViewHelper; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.ui.IViewActionDelegate; +import org.eclipse.ui.IViewPart; + +public class ExportQueryAction extends Action implements IViewActionDelegate { + SQLQueryView view; + + /** + * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart) + */ + public void init(IViewPart view) { + this.view = (SQLQueryView) view; + } + + /** + * @see org.eclipse.ui.IActionDelegate#run(IAction) + */ + public void run(IAction action) { + run(); + } + + public void run() { + FileOutputStream out = ViewHelper.askSaveFile("exportquery", view.getSite().getShell(), + new String[]{"*.sql", "*.ddl", "*.*"}, + new String[]{ + Messages.getString("filedialog.sqlFiles"), + Messages.getString("filedialog.ddlFiles"), + Messages.getString("filedialog.allfiles") + }); + if (out == null) + return; + + try { + FileWriter fileWriter = new FileWriter(out.getFD()); + PrintWriter writer = new PrintWriter(fileWriter); + String output = view.getQuery(); + output = StringUtil.substituteString(output, "\r", ""); + StringTokenizer tokenizer = new StringTokenizer(output, "\n", true); //$NON-NLS-1$ + String prevToken = ""; + while (tokenizer.hasMoreElements()) { + String token = (String) tokenizer.nextElement(); + // If it's a normal line end, we won't write it, because the println() will + // adapting it to the OS (have to test that). But if it's a line end after + // another, then it's a blank line. + if (token.equals("\n")) + if (prevToken.equals("\n")) + writer.println(); // Two consecutives "\n", means a separate line + else + ; // Do nothing, the end of line is already written + else + writer.println(token); //Normal line + prevToken = token; + } + writer.close(); + } catch (IOException e) { + LogProxy.getInstance().addText(SQLLogView.ERROR, e.toString()); + e.printStackTrace(); + } + } + + /** + * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) + */ + public void selectionChanged(IAction action, ISelection selection) { + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExportXMLAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExportXMLAction.java new file mode 100644 index 0000000..2dbd6ae --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ExportXMLAction.java @@ -0,0 +1,130 @@ +package com.quantum.actions; + + +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Iterator; + +import javax.xml.parsers.ParserConfigurationException; + +import com.quantum.Messages; +import com.quantum.model.xml.ModelToXMLConverter; +import com.quantum.sql.metadata.MetaDataXMLInterface; +import com.quantum.util.xml.XMLHelper; +import com.quantum.view.ViewHelper; +import com.quantum.view.bookmark.BookmarkView; +import com.quantum.view.bookmark.EntityNode; +import com.quantum.view.bookmark.TreeNode; +import com.quantum.view.subset.SubsetView; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.ui.IViewActionDelegate; +import org.eclipse.ui.IViewPart; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * @author root + */ +public class ExportXMLAction extends Action implements IViewActionDelegate { + + IViewPart view; + /** + * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart) + */ + public void init(IViewPart view) { + this.view = view; + } + + /** + * @see org.eclipse.ui.IActionDelegate#run(IAction) + */ + public void run(IAction action) { + run(); + } + + public void run() { + + FileOutputStream out = ViewHelper.askSaveFile("exportxml", view.getSite().getShell()); + if (out == null) + return; + StructuredSelection selection = null; + if (view instanceof BookmarkView){ + BookmarkView bookmarkView = (BookmarkView) view; + selection = bookmarkView.getSelection(); + } else if (view instanceof SubsetView){ + SubsetView subsetView = (SubsetView) view; + selection = subsetView.getSelection(); + } + + try { + Document doc = XMLHelper.createEmptyDocument(); + exportXMLSelection(doc, selection); + try { + XMLHelper.write(out, doc); + } finally { + out.close(); + } + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + + } + + /** + * Exports to an XmlDocument the items selected in a StructuredSelection. + * @param doc + * @param selection + */ + public void exportXMLSelection(Document doc, StructuredSelection selection) { + Element root = (Element) doc.appendChild(doc.createElement(Messages.getString("ExportXMLAction.Metadata"))); //$NON-NLS-1$ + MetaDataXMLInterface.createElementText(root, Messages.getString("ExportXMLAction.Author"), //$NON-NLS-1$ + Messages.getString("ExportXMLAction.Quantum")); //$NON-NLS-1$ + MetaDataXMLInterface.createElementText(root, Messages.getString("ExportXMLAction.Version"), //$NON-NLS-1$ + Messages.getString("ExportXMLAction.XMLVersionNumber")); //$NON-NLS-1$ + Iterator iter = selection.iterator(); + while (iter.hasNext()) { + TreeNode current = (TreeNode) iter.next(); +// TODO: reinstate this +// if (current instanceof SubsetNode){ +// SubsetNode subset = (SubsetNode) current; +// MetaDataXMLInterface.createElementText(root, Messages.getString("ExportXMLAction.Subset"), //$NON-NLS-1$ +// subset.getName()); //$NON-NLS-1$ +// Object[] children = subset.getChildren(); +// for (int i = 0; i < children.length; i++) { +// TreeNode objectNode = (TreeNode) children[i]; +// if (objectNode instanceof SelectableNode) +// ExportXMLAction.exportObject(root, (SelectableNode)objectNode); +// } +// } else { + exportObject(root, current); +// } + } + + } + + /** + * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) + */ + public void selectionChanged(IAction action, ISelection selection) { + } + + /** + * Exports a TreeNode metadata representation to an XmlDocument, based on a an already-created root Element + * @param doc The XmlDocument to receive the metadata representation + * @param node The node with the metadata to export + * @param root The root element (already present in the XmlDocument) that will hold the metadata + */ + public void exportObject(Element root, TreeNode node) { + if (node instanceof EntityNode) { + EntityNode entityNode = (EntityNode) node; + ModelToXMLConverter.getInstance().convert(root, entityNode.getEntity()); + } + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ImportBookmarksAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ImportBookmarksAction.java new file mode 100644 index 0000000..9477bdd --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ImportBookmarksAction.java @@ -0,0 +1,88 @@ +package com.quantum.actions; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; + +import javax.xml.parsers.ParserConfigurationException; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.model.BookmarkCollection; +import com.quantum.util.xml.XMLHelper; +import com.quantum.view.bookmark.BookmarkView; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.ui.IViewActionDelegate; +import org.eclipse.ui.IViewPart; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.xml.sax.SAXException; + +/** + * @author root + * + * To change this generated comment edit the template variable "typecomment": + * Window>Preferences>Java>Templates. + * To enable and disable the creation of type comments go to + * Window>Preferences>Java>Code Generation. + */ +public class ImportBookmarksAction implements IViewActionDelegate { + BookmarkView view; + FileDialog dialog; + /** + * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart) + */ + public void init(IViewPart view) { + this.view = (BookmarkView) view; + dialog = new FileDialog(view.getSite().getShell(), SWT.OPEN); + dialog.setFilterExtensions(new String[]{"*.xml","*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ + dialog.setFilterNames(new String[]{Messages.getString("filedialog.xmlFiles"),Messages.getString("filedialog.xmlFiles")}); //$NON-NLS-1$ //$NON-NLS-2$ + + } + + /** + * @see org.eclipse.ui.IActionDelegate#run(IAction) + */ + public void run(IAction action) { + dialog.setFilterPath(QuantumPlugin.getDefault().getPreferenceStore().getString("quantum.dialogs.importbookmark.path")); + String filename = dialog.open(); + if (filename != null) { + QuantumPlugin.getDefault().getPreferenceStore().setValue("quantum.dialogs.importbookmark.path", filename); + File importFile = new File(filename); + + FileInputStream source = null; + try { + source = new FileInputStream(importFile); + } catch (FileNotFoundException e1) { + e1.printStackTrace(); + return; + } + try { + Document doc = XMLHelper.createFromInputStream(source); + Element root = doc.getDocumentElement(); + BookmarkCollection.getInstance().importXML(root); + + view.refresh(); + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } catch (SAXException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + } + } + + /** + * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) + */ + public void selectionChanged(IAction action, ISelection selection) { + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ImportQueryAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ImportQueryAction.java new file mode 100644 index 0000000..6d9654b --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ImportQueryAction.java @@ -0,0 +1,80 @@ +package com.quantum.actions; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.view.LogProxy; +import com.quantum.view.SQLLogView; +import com.quantum.view.SQLQueryView; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.ui.IViewActionDelegate; +import org.eclipse.ui.IViewPart; + +/** + * @author root + * + */ +public class ImportQueryAction extends Action implements IViewActionDelegate { + SQLQueryView view; + FileDialog dialog; + /** + * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart) + */ + public void init(IViewPart view) { + this.view = (SQLQueryView) view; + dialog = new FileDialog(view.getSite().getShell(), SWT.OPEN); + dialog.setFilterExtensions(new String[]{"*.sql", "*.ddl", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + dialog.setFilterNames(new String[]{Messages.getString("filedialog.sqlFiles"), //$NON-NLS-1$ + Messages.getString("filedialog.ddlFiles"), Messages.getString("filedialog.allfiles")}); //$NON-NLS-1$ //$NON-NLS-2$ + + } + + /** + * @see org.eclipse.ui.IActionDelegate#run(IAction) + */ + public void run(IAction action) { + run(); + } + + public void run() { + dialog.setFilterPath(QuantumPlugin.getDefault().getPreferenceStore().getString("quantum.dialogs.importquery.path")); + String filename = dialog.open(); + if (filename != null) { + QuantumPlugin.getDefault().getPreferenceStore().setValue("quantum.dialogs.importquery.path", filename); + + try { + File importFile = new File(filename); + FileReader fileReader = new FileReader(importFile); + BufferedReader reader = new BufferedReader(fileReader); + String line; + StringBuffer buffer = new StringBuffer(); + + while ((line = reader.readLine()) != null) { + buffer.append(line); + buffer.append('\n'); + } + view.setQuery(buffer.toString()); + reader.close(); + } catch (IOException e) { + LogProxy.getInstance().addText(SQLLogView.ERROR, e.toString()); + e.printStackTrace(); + } + } + } + + /** + * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) + */ + public void selectionChanged(IAction action, ISelection selection) { + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/NewBookmarkAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/NewBookmarkAction.java new file mode 100644 index 0000000..b3dbd19 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/NewBookmarkAction.java @@ -0,0 +1,32 @@ +package com.quantum.actions; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.wizards.BookmarkWizard; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.ui.IViewPart; + +/** + * @author root + * + */ +public class NewBookmarkAction extends Action { + private IViewPart view; + + public NewBookmarkAction(IViewPart view) { + this.view = view; + setText(Messages.getString(getClass().getName() + ".text")); //$NON-NLS-1$ + setToolTipText(Messages.getString(getClass().getName() + ".text")); //$NON-NLS-1$ + setImageDescriptor(QuantumPlugin.getImageDescriptor("bookmarks.gif")); //$NON-NLS-1$ + } + + public void run() { + BookmarkWizard wizard = new BookmarkWizard(); + wizard.init(); + WizardDialog dialog = + new WizardDialog(view.getSite().getShell(), wizard); + dialog.open(); + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/NewSubsetAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/NewSubsetAction.java new file mode 100644 index 0000000..8732413 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/NewSubsetAction.java @@ -0,0 +1,53 @@ +package com.quantum.actions; + +import com.quantum.Messages; +import com.quantum.view.subset.SubsetNode; +import com.quantum.view.subset.SubsetView; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.ui.IViewActionDelegate; +import org.eclipse.ui.IViewPart; + +/** + * @author root + * + */ +public class NewSubsetAction extends Action implements IViewActionDelegate { + IViewPart view; + /** + * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart) + */ + public void init(IViewPart view) { + this.view = view; + + } + + /** + * @see org.eclipse.ui.IActionDelegate#run(IAction) + */ + public void run(IAction action) { + run(); + } + public void run() { + System.out.println(Messages.getString("NewSubsetAction.CreatingNewSubset")); //$NON-NLS-1$ + InputDialog dialog = new InputDialog(view.getSite().getShell(), + Messages.getString("NewSubsetAction.NameOfNewSubset"), Messages.getString("NewSubsetAction.PleaseEnterName"), null, null); //$NON-NLS-1$ //$NON-NLS-2$ + dialog.open(); + String value = dialog.getValue(); + if (value != null) { + SubsetNode subset = new SubsetNode(value); + ((SubsetView) view).addNewSubset(subset); + } + + } + + /** + * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) + */ + public void selectionChanged(IAction action, ISelection selection) { + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/NextSequenceAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/NextSequenceAction.java new file mode 100644 index 0000000..88331d8 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/NextSequenceAction.java @@ -0,0 +1,42 @@ +package com.quantum.actions; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.adapters.AdapterFactory; +import com.quantum.adapters.DatabaseAdapter; +import com.quantum.model.Bookmark; +import com.quantum.sql.SQLResults; +import com.quantum.view.ViewHelper; +import com.quantum.view.bookmark.EntityNode; +import com.quantum.view.tableview.TableView; + +import org.eclipse.ui.IViewPart; + +public class NextSequenceAction extends BaseSequenceAction { + + /** + * @param text + * @param view + */ + public NextSequenceAction(IViewPart view) { + super(Messages.getString(NextSequenceAction.class.getName() + ".text"), view); + setImageDescriptor(QuantumPlugin.getImageDescriptor("append.gif")); + } + + public void run() { + EntityNode node = getEntityNode(); + String name = null; + if (node.isSequence()) { + EntityNode sequence = (EntityNode) node; + Bookmark bookmark = sequence.getBookmark(); + DatabaseAdapter adapter = AdapterFactory.getInstance().getAdapter(bookmark.getType()); + if (adapter == null) return; + name = sequence.getName(); + String query = adapter.getNextValue(name, sequence.getEntity().getSchema()); + + SQLResults results = ViewHelper.tryGetResults(view, getConnection(), query); + if (results != null && ! results.isError()) + TableView.getInstance().loadQuery(bookmark, results); + } + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/OpenQueryAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/OpenQueryAction.java new file mode 100644 index 0000000..8a78c6e --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/OpenQueryAction.java @@ -0,0 +1,43 @@ +package com.quantum.actions; + +import com.quantum.Messages; +import com.quantum.view.SQLQueryView; +import com.quantum.view.bookmark.QueryNode; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.actions.SelectionListenerAction; + +/** + * @author BC + */ +public class OpenQueryAction extends SelectionListenerAction { + + /** + * @param text + */ + public OpenQueryAction(IViewPart viewPart) { + super(Messages.getString(OpenQueryAction.class.getName() + ".text")); + } + + protected boolean updateSelection(IStructuredSelection selection) { + boolean enabled = super.updateSelection(selection); + enabled &= (selection.size() == 1 && + selection.getFirstElement() instanceof QueryNode); + return enabled; + } + public void run() { + SQLQueryView queryView = SQLQueryView.getInstance(); + if (queryView != null) { + queryView.setQuery(getQuery()); + } + } + private String getQuery() { + if (isEnabled()) { + QueryNode node = (QueryNode) getSelectedNonResources().get(0); + return node.getQuery(); + } else { + return null; + } + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/PrevSequenceAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/PrevSequenceAction.java new file mode 100644 index 0000000..875df6d --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/PrevSequenceAction.java @@ -0,0 +1,44 @@ +/* + * Created on 22-jul-2003 + * + */ +package com.quantum.actions; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.adapters.AdapterFactory; +import com.quantum.adapters.DatabaseAdapter; +import com.quantum.model.Bookmark; +import com.quantum.sql.SQLResults; +import com.quantum.view.ViewHelper; +import com.quantum.view.bookmark.EntityNode; +import com.quantum.view.tableview.TableView; + +import org.eclipse.ui.IViewPart; + +public class PrevSequenceAction extends BaseSequenceAction { + /** + * @param text + * @param view + */ + public PrevSequenceAction(IViewPart view) { + super(Messages.getString(PrevSequenceAction.class.getName() + ".text"), view); + setImageDescriptor(QuantumPlugin.getImageDescriptor("grid.gif")); + } + + public void run() { + EntityNode node = getEntityNode(); + if (((EntityNode) node).isSequence()) { + EntityNode sequence = (EntityNode) node; + Bookmark bookmark = sequence.getBookmark(); + DatabaseAdapter adapter = AdapterFactory.getInstance().getAdapter( + bookmark.getType()); + if (adapter == null) return; + String name = sequence.getName(); + String query = adapter.getPrevValue(name, sequence.getEntity().getSchema()); + SQLResults results = ViewHelper.tryGetResults(view, getConnection(), query); + if (results != null && ! results.isError()) + TableView.getInstance().loadQuery(bookmark, results); + } + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/RefreshBookmarkAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/RefreshBookmarkAction.java new file mode 100644 index 0000000..525503f --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/RefreshBookmarkAction.java @@ -0,0 +1,37 @@ +package com.quantum.actions; + +import java.util.Iterator; +import java.util.List; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.sql.SQLHelper; +import com.quantum.view.bookmark.BookmarkView; +import com.quantum.view.bookmark.TreeNode; + +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.actions.SelectionListenerAction; + +/** + * @author root + */ +public class RefreshBookmarkAction extends SelectionListenerAction { + SQLHelper helper = new SQLHelper(); + + BookmarkView view; + public RefreshBookmarkAction(IViewPart view) { + super(Messages.getString(RefreshBookmarkAction.class.getName() + ".text")); + this.view = (BookmarkView) view; + setImageDescriptor(QuantumPlugin.getImageDescriptor("refresh.gif")); + } + + public void run() { + List list = getSelectedNonResources(); + for (Iterator i = list.iterator(); i.hasNext(); ) { + Object object = i.next(); + if (object != null && object instanceof TreeNode) { + ((TreeNode) object).reload(); + } + } + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/RefreshTableAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/RefreshTableAction.java new file mode 100644 index 0000000..d987d8a --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/RefreshTableAction.java @@ -0,0 +1,40 @@ +package com.quantum.actions; + +import com.quantum.view.tableview.TableView; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.ui.IViewActionDelegate; +import org.eclipse.ui.IViewPart; + +/** + * @author root + * Implements the "Refresh Table" action for the TableView view + */ +public class RefreshTableAction extends Action implements IViewActionDelegate { + TableView view; + /** + * @see org.eclipse.ui.IViewActionDelegate#init(IViewPart) + */ + public void init(IViewPart view) { + this.view = (TableView) view; + } + + /** + * @see org.eclipse.ui.IActionDelegate#run(IAction) + */ + public void run(IAction action) { + run(); + } + public void run() { + view.refreshCurrent(); + } + + /** + * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) + */ + public void selectionChanged(IAction action, ISelection selection) { + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/RemoveFromQuickListAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/RemoveFromQuickListAction.java new file mode 100644 index 0000000..a677733 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/RemoveFromQuickListAction.java @@ -0,0 +1,56 @@ +package com.quantum.actions; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import com.quantum.Messages; +import com.quantum.view.bookmark.EntityNode; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.actions.SelectionListenerAction; + +/** + *

This action takes an EntityNode and adds a copy of it to the quicklist + * of a bookmark.

+ * + * @author bcholmes + */ +public class RemoveFromQuickListAction extends SelectionListenerAction { + private IViewPart view; + private List entities = Collections.synchronizedList(new ArrayList()); + + public RemoveFromQuickListAction(IViewPart view) { + super(Messages.getString(RemoveFromQuickListAction.class.getName() + ".text")); + this.view = view; + } + + public void run() { + for (Iterator i = this.entities.iterator(); i.hasNext(); ) { + EntityNode entityNode = (EntityNode) i.next(); + entityNode.getBookmark().removeQuickListEntry(entityNode.getEntity()); + } + } + + /** + * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection) + */ + public boolean updateSelection(IStructuredSelection selection) { + boolean enabled = super.updateSelection(selection); + this.entities.clear(); + for (Iterator i = selection.iterator(); enabled && i.hasNext(); ) { + Object object = i.next(); + if (object != null && object instanceof EntityNode) { + EntityNode node = (EntityNode) object; + enabled &= node.getBookmark().isInQuickList(node.getEntity()); + this.entities.add(node); + } else { + enabled = false; + } + } + + return enabled; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ViewTableAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ViewTableAction.java new file mode 100644 index 0000000..6da4e9f --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ViewTableAction.java @@ -0,0 +1,59 @@ +package com.quantum.actions; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.model.Entity; +import com.quantum.view.bookmark.EntityNode; +import com.quantum.view.tableview.TableView; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.actions.SelectionListenerAction; + +/** + * @author root + * Implements action for "View Table" +*/ +public class ViewTableAction extends SelectionListenerAction { + private IViewPart view; + private Entity entity; + + public ViewTableAction(IViewPart view) { + super(Messages.getString(ViewTableAction.class.getName() + ".text")); + this.view = view; + setImageDescriptor( + QuantumPlugin.getImageDescriptor("table.gif")); //$NON-NLS-1$ + } + + public void run() { + TableView.getInstance().loadTable(this.entity); + // TODO: reinstate this +// } else if (view instanceof SubsetView){ +// SubsetView subsetView = (SubsetView) view; +// node = (TreeNode) subsetView.getCurrent(); +// if (!(node instanceof ObjectNode)) return; +// ObjectNode objectNode = (ObjectNode) node; +// +// String query = objectNode.getQuery(); +// +// SQLResults results = ViewHelper.tryGetResults(view, objectNode.getConnection(), query); +// if (results != null && ! results.isError()) +// TableView.getInstance().loadQuery(bookmark.getBookmark(), results); +// + } + + public boolean updateSelection(IStructuredSelection selection) { + boolean enabled = super.updateSelection(selection); + enabled &= (selection.size() == 1); + + if (enabled) { + Object object = selection.getFirstElement(); + if (object != null && object instanceof EntityNode) { + EntityNode entityNode = (EntityNode) object; + this.entity = entityNode.getEntity(); + enabled &= (entityNode.isTable() || entityNode.isView()); + } + } + return enabled; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ViewTableDetailsAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ViewTableDetailsAction.java new file mode 100644 index 0000000..5215912 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/actions/ViewTableDetailsAction.java @@ -0,0 +1,66 @@ +package com.quantum.actions; + +import java.sql.Connection; +import java.util.List; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.model.Bookmark; +import com.quantum.model.Entity; +import com.quantum.sql.SQLResults; +import com.quantum.util.connection.ConnectionUtil; +import com.quantum.view.ViewHelper; +import com.quantum.view.bookmark.EntityNode; +import com.quantum.view.tableview.TableView; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.actions.SelectionListenerAction; + +public class ViewTableDetailsAction extends SelectionListenerAction { + private IViewPart view; + private ConnectionUtil connectionUtil = new ConnectionUtil(); + + public ViewTableDetailsAction(IViewPart view) { + super(Messages.getString(ViewTableDetailsAction.class, "text")); + setImageDescriptor(QuantumPlugin.getImageDescriptor("table.gif")); //$NON-NLS-1$ + this.view = view; + } + + public void run() { + Entity entity = getEntity(); + StringBuffer query = new StringBuffer(); + query.append(Messages.getString("MetaDataKey")+Messages.getString("MetaDataKeySeparator")); //$NON-NLS-1$ //$NON-NLS-2$ + query.append(entity.getQuotedTableName()); + Connection connection = connectionUtil.getConnection(getBookmark(), getShell()); + if (connection != null) { + SQLResults results = ViewHelper.tryGetResults(view, connection, query.toString()); + if (results != null && ! results.isError()) + TableView.getInstance().loadQuery(entity.getBookmark(), results); + } + } + public void selectionChanged(IAction action, ISelection selection) { + } + protected Bookmark getBookmark() { + return getEntity().getBookmark(); + } + protected Shell getShell() { + return this.view.getViewSite().getShell(); + } + protected Entity getEntity() { + List list = getSelectedNonResources(); + return ((EntityNode) list.get(0)).getEntity(); + } + + /** + * @see org.eclipse.ui.actions.SelectionListenerAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection) + */ + protected boolean updateSelection(IStructuredSelection selection) { + boolean enabled = super.updateSelection(selection); + return enabled && selection.size() == 1; + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/AdabasDAdapter.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/AdabasDAdapter.java new file mode 100644 index 0000000..42c403a --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/AdabasDAdapter.java @@ -0,0 +1,11 @@ +package com.quantum.adapters; + + +public class AdabasDAdapter extends DatabaseAdapter { + public String getShowTableQuery(String qualifier, boolean isDefault) { + return "SELECT OWNER, TABLENAME FROM TABLES WHERE OWNER = '" + qualifier.toUpperCase() + "'"; //$NON-NLS-1$ + } + public String getShowViewQuery(String qualifier, boolean isDefault) { + return "SELECT OWNER, VIEWNAME FROM VIEWS WHERE OWNER = '" + qualifier.toUpperCase() + "'"; //$NON-NLS-1$ + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/AdapterFactory.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/AdapterFactory.java new file mode 100644 index 0000000..f26b278 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/AdapterFactory.java @@ -0,0 +1,93 @@ +package com.quantum.adapters; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import com.quantum.Messages; + +/** + * @author root + * Basically this Factory is a Singleton that is used to return the proper adapter + */ +public class AdapterFactory { + public static final String GENERIC = "GENERIC"; //$NON-NLS-1$ + public static final String ORACLE = "ORACLE"; //$NON-NLS-1$ + public static final String POSTGRES = "POSTGRES"; //$NON-NLS-1$ + public static final String MYSQL = "MYSQL"; //$NON-NLS-1$ + public static final String DB2 = "DB2"; //$NON-NLS-1$ + public static final String DB2AS400 = "DB2AS400"; //$NON-NLS-1$ + public static final String ADABASD = "ADABASD"; //$NON-NLS-1$ + public static final String INFORMIX = "INFORMIX"; //$NON-NLS-1$ + public static final String REDBRICK = "REDBRICK"; //$NON-NLS-1$ + public static final String SYBASE = "SYBASE"; //$NON-NLS-1$ + + private static AdapterFactory instance; + + private ArrayList drivers; + + private AdapterFactory() { + loadDrivers(); + } + public static synchronized AdapterFactory getInstance() { + if (instance == null) { + instance = new AdapterFactory(); + } + return instance; + } + + /** + * Master list of supported drivers + */ + private void loadDrivers() { + drivers = new ArrayList(); + + DriverInfo generic = new DriverInfo(GENERIC, Messages.getString("adapters.generic"), new GenericAdapter()); //$NON-NLS-1$ + DriverInfo oracle = new DriverInfo(ORACLE, Messages.getString("adapters.oracle"), new OracleAdapter()); //$NON-NLS-1$ + DriverInfo db2 = new DriverInfo(DB2, Messages.getString("adapters.db2"), new DB2Adapter()); //$NON-NLS-1$ + DriverInfo db2as400 = new DriverInfo(DB2AS400, Messages.getString("adapters.db2as400"), new DB2AS400Adapter()); //$NON-NLS-1$ + DriverInfo postgres = new DriverInfo(POSTGRES, Messages.getString("adapters.postgres"), new PostgresAdapter()); //$NON-NLS-1$ + DriverInfo mysql = new DriverInfo(MYSQL, Messages.getString("adapters.mysql"), new GenericAdapter()); //$NON-NLS-1$ + DriverInfo adabasd = new DriverInfo(ADABASD, Messages.getString("adapters.adabasd"), new AdabasDAdapter()); //$NON-NLS-1$ + DriverInfo informix = new DriverInfo(INFORMIX, Messages.getString("adapters.informix"), new GenericAdapter()); //$NON-NLS-1$ + DriverInfo redbrick = new DriverInfo(REDBRICK, Messages.getString("adapters.redbrick"), new RedBrickAdapter()); //$NON-NLS-1$ + DriverInfo sybase = new DriverInfo(SYBASE, Messages.getString("adapters.sybase"), new GenericAdapter()); //$NON-NLS-1$ + + drivers.add(generic); + drivers.add(oracle); + drivers.add(db2); + drivers.add(db2as400); + drivers.add(postgres); + drivers.add(mysql); + drivers.add(adabasd); + drivers.add(informix); + drivers.add(redbrick); + drivers.add(sybase); + } + + public synchronized DatabaseAdapter getAdapter(String type){ + if (drivers == null) { + loadDrivers(); + } + for (int i = 0; i < drivers.size(); i++) { + DriverInfo info = (DriverInfo) drivers.get(i); + if (type.equals(info.getDriverType())) { + return info.getAdapter(); + } + } + // If its not a recognized driver, we return the generic one + for (int i = 0; i < drivers.size(); i++) { + DriverInfo info = (DriverInfo) drivers.get(i); + if (type.equals(GENERIC)) { + return info.getAdapter(); + } + } + return null; + } + + public synchronized DriverInfo[] getDriverList() { + List list = new ArrayList(this.drivers); + Collections.sort(list); + return (DriverInfo[]) list.toArray(new DriverInfo[list.size()]); + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DB2AS400Adapter.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DB2AS400Adapter.java new file mode 100644 index 0000000..ff6bf2e --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DB2AS400Adapter.java @@ -0,0 +1,15 @@ +package com.quantum.adapters; + + +public class DB2AS400Adapter extends DatabaseAdapter { + public String getShowTableQuery(String qualifier, boolean isDefault) { + return "SELECT TABLE_NAME FROM QSYS2.SYSTABLES WHERE table_schema = '" + + qualifier.toUpperCase() + + "' AND TABLE_TYPE IN ('T', 'P') AND SYSTEM_TABLE= 'N'"; //$NON-NLS-1$ //$NON-NLS-2$ + } + public String getShowViewQuery(String qualifier, boolean isDefault) { + return "SELECT TABLE_NAME FROM QSYS2.SYSTABLES WHERE table_schema = '" + + qualifier.toUpperCase() + + "' AND TABLE_TYPE IN ('V', 'L') AND SYSTEM_TABLE= 'N'"; //$NON-NLS-1$ //$NON-NLS-2$ + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DB2Adapter.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DB2Adapter.java new file mode 100644 index 0000000..ca5dd76 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DB2Adapter.java @@ -0,0 +1,21 @@ +package com.quantum.adapters; + +import com.quantum.sql.SQLHelper; + +public class DB2Adapter extends DatabaseAdapter { + public String getShowTableQuery(String qualifier, boolean isDefault) { + return "SELECT TABNAME FROM syscat.tables WHERE tabschema = '" + qualifier.toUpperCase() + "' AND TYPE='T'"; //$NON-NLS-1$ //$NON-NLS-2$ + } + public String getShowViewQuery(String qualifier, boolean isDefault) { + return "SELECT TABNAME FROM syscat.tables WHERE tabschema = '" + qualifier.toUpperCase() + "' AND TYPE='V'"; //$NON-NLS-1$ //$NON-NLS-2$ + } + public String getShowSequenceQuery(String qualifier, boolean isDefault) { + return "SELECT SEQNAME FROM sysibm.syssequences WHERE seqschema = '" + qualifier.toUpperCase() + "'"; //$NON-NLS-1$ //$NON-NLS-2$ + } + public String getNextValue(String sequence, String owner) { + return "VALUES NEXTVAL FOR " + SQLHelper.getQualifiedName(owner, sequence); //$NON-NLS-1$ + } + public String getPrevValue(String sequence, String owner) { + return "VALUES PREVVAL FOR " + SQLHelper.getQualifiedName(owner, sequence); //$NON-NLS-1$ + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DatabaseAdapter.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DatabaseAdapter.java new file mode 100644 index 0000000..d17e8b0 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DatabaseAdapter.java @@ -0,0 +1,198 @@ +package com.quantum.adapters; + +import com.quantum.sql.SQLHelper; +import com.quantum.util.StringUtil; + +/** + * Abstract base class for all the adapter classes. Most functions can be redefined in + * the adapters for the different databases. If the functions is not redefined, the base + * implementation (usually a direct call to the JDBC driver) is used. + * + * @author root + */ +public abstract class DatabaseAdapter { + + /** + * Returns the SQL Query to get a list of the tables for the current user (schema) + * @param info + * @return - A String with the SQL query + */ + public String getShowTableQuery(String schema, boolean isDefault) { + return null; + } + /** + * Returns the SQL Query to get a list of the queries for the current user (schema) + * @param info + * @return - A String with the SQL query + */ + public String getShowViewQuery(String schema, boolean isDefault) { + return null; + } + /** + * Returns the SQL Query to get a list of the sequences for the current user (schema) + * @param info + * @return - A String with the SQL query + */ + public String getShowSequenceQuery(String schema, boolean isDefault) { + return null; + } + + /** Returns the SQL Query to access all the columns of a table (SELECT) + * @param info + * @param table + * @return - A String with the SQL query + */ + public String getTableQuery( String table) { + return "SELECT * FROM " + filterTableName(table); //$NON-NLS-1$ + } + + /** + * Gets the SQL query to get the next value of a sequence, (incrementing it). + * @param sequence - The name of the sequence + * @param owner - The owner (schema) of it + * @return - A string with the SQL query + */ + public String getNextValue(String sequence, String owner) { + return null; + } + /** + * Gets the SQL query to get the actual value (previously used) of a sequence, (the sequence is not altered). + * @param sequence - The name of the sequence + * @param owner - The owner (schema) of it + * @return - A string with the SQL query + */ + public String getPrevValue(String sequence, String owner) { + return null; + } + /** + * Returns a query to get the comments on the columns of a table. + * Should return a query to generate a recordset with one row where + * the first and only column is the comment + * @param tableName - The full name of the table qualified with schema if applicable + * @param columnName - The name of the column + */ + public String getCommentsQuery(String tableName, String columnName) { + return null; + } + + /** + * @param table + * @return : A query to get an empty ResultSet (null if failed) for that table or view. + * Subclassed if needed by the different database adapters + */ + public String getEmptySetQuery(String table){ + return "SELECT * FROM " + filterTableName(table) + " WHERE (1 = 0)"; //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * Quotes a string according to the type of the column + * @param string to be quoted + * @param type according to java.sql.Types + * @return + */ + public String quote(String string, int type, String typeString) { + if (isTextType(type, typeString)) { + return "'" + StringUtil.substituteString(string, "'", "''") + "'"; + } else if (type == java.sql.Types.DATE || type == java.sql.Types.TIMESTAMP){ + string = string.trim(); + //Check if we have to strip the millisecods + String sub = string.substring(string.length() - 2, string.length() - 1); + if (string.length() > 1 && sub.equals(".")) //$NON-NLS-1$ + string = string.substring(0, string.length() - 2); // strip the milliseconds + + return "'" + string + "'"; //$NON-NLS-1$ //$NON-NLS-2$ + + } + return string; + } + + /** + * Indicates whether or not a particular type should be quoted in + * SQL statements. Some databases support non-standard types such as + * TEXT that aren't normally recognized as quoted types. + * + * @param type according to java.sql.Types + * @param typeString if the type is "Other". + * @return + */ + protected boolean isTextType(int type, String typeString) { + return SQLHelper.isText(type); + } + + + /** + * Makes an SQL insert string with the given table, names of columns and values + * @param string + * @param namesClause + * @param valuesClause + * @return + */ + public String getInsert(String tableName, String namesClause, String valuesClause) { + String query = "INSERT INTO " + filterTableName(tableName); + if (namesClause != "") { + query += " (" + namesClause + ")"; + query += " VALUES " + "(" + valuesClause; //$NON-NLS-1$ + query += " )"; //$NON-NLS-1$ + } + return query; + } + /** + * Changes the name of the table, usually to allow for lowercase situations. + * The parent implementation does nothing to the tableName, simply returns it. + * @param tableName + * @return + */ + public String filterTableName(String tableName) { + return tableName; + } + /** + * Returns a query to get the number of registers from a table + * @param tableName + * @return + */ + public String getCountQuery(String tableName) { + return "SELECT COUNT(*) FROM " + filterTableName(tableName); + } + /** + * @param string + * @param string2 + * @param whereClause + * @param string3 + */ + public void getUpdate(String tableName, String string2, StringBuffer whereClause, String string3) { + // TODO Auto-generated method stub + + } + /** + * Returns an SQL UPDATE statement + * @param string + * @param string2 + * @param string3 + */ + public String getUpdate(String tableName, String setClause, String whereClause) { + String query = "UPDATE " + filterTableName(tableName); //$NON-NLS-1$ + query += " SET " + setClause; //$NON-NLS-1$ + if (!whereClause.equals("")) query += " WHERE " + whereClause; //$NON-NLS-1$ + return query; + } + /** + * Returns an SQL DELETE statement + * @param string + * @param string2 + * @return + */ + public String getDelete(String tableName, String whereClause) { + String query = "DELETE FROM " + filterTableName(tableName); //$NON-NLS-1$ + if (!whereClause.equals("")) { + query += " WHERE " + whereClause; //$NON-NLS-1$ + } + return query; + } + /** + * @param userid - the userid used to connect to the database + * @return the default schema for the database + */ + public String getDefaultSchema(String userid) { + return userid; + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DriverInfo.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DriverInfo.java new file mode 100644 index 0000000..6b13c1d --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/DriverInfo.java @@ -0,0 +1,57 @@ +package com.quantum.adapters; + +import java.util.Vector; + +public class DriverInfo implements Comparable { + private String driverType; + private String displayName; + private Vector driverNames = new Vector(); + private DatabaseAdapter adapter; + public DriverInfo(String driverType, String displayName, DatabaseAdapter adapter) { + this.driverType = driverType; + this.displayName = displayName; + this.adapter = adapter; + } + + public String getDriverType() { + return driverType; + } + + public void setDriverType(String driverType) { + this.driverType = driverType; + } + + public void addDriverName(String driverName) { + driverNames.addElement(driverName); + } + + public String[] getDriverNames() { + String retVal[] = new String[driverNames.size()]; + for (int i = 0; i < driverNames.size(); i++) { + retVal[i] = (String) driverNames.elementAt(i); + } + return retVal; + } + + public DatabaseAdapter getAdapter() { + return adapter; + } + + public void setAdapter(DatabaseAdapter adapter) { + this.adapter = adapter; + } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public int compareTo(Object o) { + DriverInfo that = (DriverInfo) o; + return this.getDisplayName().compareTo(that.getDisplayName()); + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/FeatureNotSupported.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/FeatureNotSupported.java new file mode 100644 index 0000000..f80aa56 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/FeatureNotSupported.java @@ -0,0 +1,7 @@ +package com.quantum.adapters; + +public class FeatureNotSupported extends Error { + public FeatureNotSupported(String error) { + super(error); + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/GenericAdapter.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/GenericAdapter.java new file mode 100644 index 0000000..bb4eb6b --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/GenericAdapter.java @@ -0,0 +1,20 @@ +package com.quantum.adapters; + + + + +public class GenericAdapter extends DatabaseAdapter { + + public String getShowTableQuery(String qualifier, boolean isDefault) { + return null; + } + public String getShowViewQuery(String qualifier, boolean isDefault) { + return null; + } + + public String getShowSequenceQuery(String qualifier, boolean isDefault) { + return null; + } + + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/MySQLAdapter.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/MySQLAdapter.java new file mode 100644 index 0000000..d764095 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/MySQLAdapter.java @@ -0,0 +1,9 @@ +package com.quantum.adapters; + + + +public class MySQLAdapter extends DatabaseAdapter { + public String getShowTableQuery(String qualifier, boolean isDefault) { + return "SHOW TABLES"; //$NON-NLS-1$ + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/NoSuchAdapterException.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/NoSuchAdapterException.java new file mode 100644 index 0000000..ec71a00 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/NoSuchAdapterException.java @@ -0,0 +1,9 @@ +package com.quantum.adapters; + +import com.quantum.Messages; + +public class NoSuchAdapterException extends Exception { + public NoSuchAdapterException(String driverName) { + super(Messages.getString("Error.NoDatabase") + driverName + Messages.getString("NoSuchAdapterException.<-_2")); //$NON-NLS-1$ //$NON-NLS-2$ + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/OracleAdapter.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/OracleAdapter.java new file mode 100644 index 0000000..a7fc544 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/OracleAdapter.java @@ -0,0 +1,67 @@ +package com.quantum.adapters; + +import com.quantum.Messages; +import com.quantum.sql.SQLHelper; +import com.quantum.util.QuantumUtil; + + + +public class OracleAdapter extends DatabaseAdapter { + public String getShowSequenceQuery(String qualifier, boolean isDefault) { + return "SELECT SEQUENCE_OWNER, SEQUENCE_NAME FROM ALL_SEQUENCES WHERE SEQUENCE_OWNER = '" + qualifier + "'"; //$NON-NLS-1$ + } + public String getPrevValue(String sequence, String owner) { + return "SELECT LAST_NUMBER FROM ALL_SEQUENCES WHERE SEQUENCE_OWNER = '" + owner + "' AND SEQUENCE_NAME = '" + sequence + "'"; //$NON-NLS-1$ //$NON-NLS-2$ + } + public String getNextValue(String sequence, String owner) { + return "SELECT " + SQLHelper.getQualifiedName(owner, sequence) + ".NEXTVAL FROM DUAL"; + } + public String getCommentsQuery(String tableName, String column) { + String query = "SELECT COMMENTS FROM ALL_COL_COMMENTS WHERE TABLE_NAME = '"; + query += QuantumUtil.getTableName(tableName) + "' AND COLUMN_NAME = '" + column + "'" ; + if (!(QuantumUtil.getSchemaName(tableName).equals(""))) + query += " AND OWNER = '" + QuantumUtil.getSchemaName(tableName) + "'"; + return query; + } + /** + * Quotes a string according to the type of the column + * @param string to be quoted + * @param type according to java.sql.Types + * @return + */ + public String quote(String string, int type, String typeString) { + if (type == java.sql.Types.DATE || type == java.sql.Types.TIMESTAMP) { + string = string.trim(); + String sub = string.substring(string.length()-2, string.length()-1); + if (string.length() > 1 && sub.equals(Messages.getString("OracleAdapter.._3"))) //$NON-NLS-1$ + string = string.substring(0,string.length()-2); + return "TO_DATE('" + string + "','yyyy-mm-dd hh24:mi:ss')"; //$NON-NLS-1$ //$NON-NLS-2$ + } + // use the default (upper type) + return super.quote(string, type, typeString); + } + + /* (non-Javadoc) + * @see com.quantum.adapters.DatabaseAdapter#filterTableName(java.lang.String) + */ + public String filterTableName(String tableName) { + // If there is no mixed case, better not quote, it's prettier on display + if (tableName.equals(tableName.toUpperCase())) return tableName; + // We quote the table name (and only the table name) because it has mixed case + if (QuantumUtil.getSchemaName(tableName).equals("")) + return "\"" + tableName +"\""; //$NON-NLS-1$ + else + return QuantumUtil.getSchemaName(tableName) + ".\"" + + QuantumUtil.getTableName(tableName) + "\""; +} + + /** + * The default schema for Oracle is the upper-case userid. + * @see com.quantum.adapters.DatabaseAdapter#getDefaultSchema(java.lang.String) + */ + public String getDefaultSchema(String userid) { + return super.getDefaultSchema(userid).toUpperCase(); + } + + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/PostgresAdapter.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/PostgresAdapter.java new file mode 100644 index 0000000..8389bf1 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/PostgresAdapter.java @@ -0,0 +1,70 @@ +package com.quantum.adapters; + +import com.quantum.sql.SQLHelper; +import com.quantum.util.QuantumUtil; +import com.quantum.util.sql.TypesHelper; + + +public class PostgresAdapter extends DatabaseAdapter { + public String getShowTableQuery(String qualifier, boolean isDefault) { + return "SELECT SCHEMANAME, TABLENAME FROM PG_TABLES WHERE SCHEMANAME = '" + + qualifier + "'"; + } + public String getShowViewQuery(String qualifier, boolean isDefault) { + return "SELECT SCHEMANAME, VIEWNAME FROM PG_VIEWS WHERE SCHEMANAME = '" + + qualifier + "'"; + } + public String getShowSequenceQuery(String qualifier, boolean isDefault) { + return "SELECT SCHEMANAME, relname FROM pg_class WHERE relkind = 'S'" + + "AND SCHEMANAME = '" + qualifier + "'"; + } + public String getNextValue(String sequence, String owner) { + return "SELECT NEXTVAL('" + SQLHelper.getQualifiedName(owner, sequence) + "')"; + } + public String getPrevValue(String sequence, String owner) { + return "SELECT * FROM " + SQLHelper.getQualifiedName(owner, sequence); + } + + /** + * Quotes a string according to the type of the column + * @param string to be quoted + * @param type according to java.sql.Types + * @return + */ + public String quote(String string, int type, String typeString) { + // Booleans in PostgreSQL are queried "t" or "f", but require "true" or "false" when inputed. + if (type == TypesHelper.BIT || type == TypesHelper.BOOLEAN ) // Postgresql seems to identify booleans as BITs + { + if (string.indexOf('t') >= 0 || string.indexOf('T') >= 0 ) + return "true"; + else if (string.indexOf('f') >= 0 || string.indexOf('F') >= 0 ) + return "false"; + else + return string; + } + // use the default (upper type) + return super.quote(string, type, typeString); + } + + /** + * @see com.quantum.adapters.DatabaseAdapter#filterTableName(java.lang.String) + */ + public String filterTableName(String tableName) { + // If there is no mixed case, better not quote, it's prettier on display + if (tableName.equals(tableName.toUpperCase())) return tableName; + // We quote the table name (and only the table name) because it has mixed case + if (QuantumUtil.getSchemaName(tableName).equals("")) { + return "\"" + tableName +"\""; //$NON-NLS-1$ + } else { + return QuantumUtil.getSchemaName(tableName) + ".\"" + + QuantumUtil.getTableName(tableName) + "\""; + } + } + /** + * @see com.quantum.adapters.DatabaseAdapter#getDefaultSchema(java.lang.String) + */ + public String getDefaultSchema(String userid) { + return "public"; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/RedBrickAdapter.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/RedBrickAdapter.java new file mode 100644 index 0000000..623c3be --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/RedBrickAdapter.java @@ -0,0 +1,23 @@ +package com.quantum.adapters; + + +/** + * @author bcholmes + */ +public class RedBrickAdapter extends DatabaseAdapter { + + public String getShowTableQuery(String qualifier, boolean isDefault) { + return "select name from rbw_tables where type = 'TABLE'"; + } + + public String getShowViewQuery(String qualifier, boolean isDefault) { + return "select name from rbw_tables where type = 'VIEW'"; + } + /** + * @see com.quantum.adapters.DatabaseAdapter#getDefaultSchema(java.lang.String) + */ + public String getDefaultSchema(String userid) { + return null; + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/ColorManager.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/ColorManager.java new file mode 100644 index 0000000..a7a662c --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/ColorManager.java @@ -0,0 +1,28 @@ +package com.quantum.editors; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.widgets.Display; + +public class ColorManager { + + protected Map fColorTable = new HashMap(10); + + public void dispose() { + Iterator e= fColorTable.values().iterator(); + while (e.hasNext()) + ((Color) e.next()).dispose(); + } + public Color getColor(RGB rgb) { + Color color= (Color) fColorTable.get(rgb); + if (color == null) { + color= new Color(Display.getCurrent(), rgb); + fColorTable.put(rgb, color); + } + return color; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/NonRuleBasedDamagerRepairer.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/NonRuleBasedDamagerRepairer.java new file mode 100644 index 0000000..6829684 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/NonRuleBasedDamagerRepairer.java @@ -0,0 +1,135 @@ +package com.quantum.editors; + +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.DocumentEvent; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.IRegion; +import org.eclipse.jface.text.ITypedRegion; +import org.eclipse.jface.text.Region; +import org.eclipse.jface.text.TextAttribute; +import org.eclipse.jface.text.TextPresentation; +import org.eclipse.jface.text.presentation.IPresentationDamager; +import org.eclipse.jface.text.presentation.IPresentationRepairer; +import org.eclipse.jface.util.Assert; +import org.eclipse.swt.custom.StyleRange; + +public class NonRuleBasedDamagerRepairer + implements IPresentationDamager, IPresentationRepairer { + + /** The document this object works on */ + protected IDocument fDocument; + /** The default text attribute if non is returned as data by the current token */ + protected TextAttribute fDefaultTextAttribute; + + /** + * Constructor for NonRuleBasedDamagerRepairer. + */ + public NonRuleBasedDamagerRepairer(TextAttribute defaultTextAttribute) { + Assert.isNotNull(defaultTextAttribute); + + fDefaultTextAttribute = defaultTextAttribute; + } + + /** + * @see IPresentationRepairer#setDocument(IDocument) + */ + public void setDocument(IDocument document) { + fDocument = document; + } + + public void setTextAttribute(TextAttribute attr) { + fDefaultTextAttribute = attr; + } + + /** + * Returns the end offset of the line that contains the specified offset or + * if the offset is inside a line delimiter, the end offset of the next line. + * + * @param offset the offset whose line end offset must be computed + * @return the line end offset for the given offset + * @exception BadLocationException if offset is invalid in the current document + */ + protected int endOfLineOf(int offset) throws BadLocationException { + + IRegion info = fDocument.getLineInformationOfOffset(offset); + if (offset <= info.getOffset() + info.getLength()) + return info.getOffset() + info.getLength(); + + int line = fDocument.getLineOfOffset(offset); + try { + info = fDocument.getLineInformation(line + 1); + return info.getOffset() + info.getLength(); + } catch (BadLocationException x) { + return fDocument.getLength(); + } + } + + /** + * @see IPresentationDamager#getDamageRegion(ITypedRegion, DocumentEvent, boolean) + */ + public IRegion getDamageRegion( + ITypedRegion partition, + DocumentEvent event, + boolean documentPartitioningChanged) { + if (!documentPartitioningChanged) { + try { + + IRegion info = fDocument.getLineInformationOfOffset(event.getOffset()); + int start = Math.max(partition.getOffset(), info.getOffset()); + + int end = + event.getOffset() + + (event.getText() == null ? event.getLength() : event.getText().length()); + + if (info.getOffset() <= end && end <= info.getOffset() + info.getLength()) { + // optimize the case of the same line + end = info.getOffset() + info.getLength(); + } else + end = endOfLineOf(end); + + end = Math.min(partition.getOffset() + partition.getLength(), end); + return new Region(start, end - start); + + } catch (BadLocationException x) { + } + } + + return partition; + } + + /** + * @see IPresentationRepairer#createPresentation(TextPresentation, ITypedRegion) + */ + public void createPresentation( + TextPresentation presentation, + ITypedRegion region) { + addRange( + presentation, + region.getOffset(), + region.getLength(), + fDefaultTextAttribute); + } + + /** + * Adds style information to the given text presentation. + * + * @param presentation the text presentation to be extended + * @param offset the offset of the range to be styled + * @param length the length of the range to be styled + * @param attr the attribute describing the style of the range to be styled + */ + protected void addRange( + TextPresentation presentation, + int offset, + int length, + TextAttribute attr) { + if (attr != null) + presentation.addStyleRange( + new StyleRange( + offset, + length, + attr.getForeground(), + attr.getBackground(), + attr.getStyle())); + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLColorConstants.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLColorConstants.java new file mode 100644 index 0000000..ae519bf --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLColorConstants.java @@ -0,0 +1,13 @@ +package com.quantum.editors; + +import org.eclipse.swt.graphics.RGB; + +public class SQLColorConstants { + public static RGB BACKGROUND = new RGB(255, 0, 255); + public static RGB COMMENT = new RGB(88, 148, 64); + public static RGB IDENTIFIER = new RGB(0, 0, 0); + public static RGB KEYWORD = new RGB(126, 0, 75); + public static RGB STRING = new RGB(0, 0, 255); + public static RGB NUMERIC = new RGB(255, 0, 0); + public static RGB DEFAULT = new RGB(0, 0, 0); +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLConfiguration.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLConfiguration.java new file mode 100644 index 0000000..985c0d8 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLConfiguration.java @@ -0,0 +1,89 @@ +package com.quantum.editors; + +import java.util.HashMap; + +import com.quantum.QuantumPlugin; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferenceConverter; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.TextAttribute; +import org.eclipse.jface.text.presentation.IPresentationReconciler; +import org.eclipse.jface.text.presentation.PresentationReconciler; +import org.eclipse.jface.text.source.ISourceViewer; +import org.eclipse.jface.text.source.SourceViewerConfiguration; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.RGB; + +public class SQLConfiguration extends SourceViewerConfiguration { + private PresentationReconciler reconciler = new PresentationReconciler(); + private ColorManager colorManager; + private HashMap cache = new HashMap(); + private boolean textBold = false; + private boolean keywordBold = true; + private boolean stringBold = false; + private boolean commentBold = false; + private boolean numericBold = false; + public SQLConfiguration(ColorManager colorManager) { + this.colorManager = colorManager; + } + public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { + return new String[] { + IDocument.DEFAULT_CONTENT_TYPE, + SQLPartitionScanner.SQL_COMMENT, + SQLPartitionScanner.SQL_KEYWORD, + SQLPartitionScanner.SQL_IDENTIFIER}; + } + + public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { + initializeColors(); + return reconciler; + } + public void loadPrefs() { + IPreferenceStore store = QuantumPlugin.getDefault().getPreferenceStore(); + textBold = store.getBoolean("quantum.text.bold"); //$NON-NLS-1$ + keywordBold = store.getBoolean("quantum.keyword.bold"); //$NON-NLS-1$ + stringBold = store.getBoolean("quantum.string.bold"); //$NON-NLS-1$ + commentBold = store.getBoolean("quantum.comment.bold"); //$NON-NLS-1$ + numericBold = store.getBoolean("quantum.numeric.bold"); //$NON-NLS-1$ + SQLColorConstants.BACKGROUND = PreferenceConverter.getColor(store, "quantum.background.color"); //$NON-NLS-1$ + SQLColorConstants.DEFAULT = PreferenceConverter.getColor(store, "quantum.text.color"); //$NON-NLS-1$ + SQLColorConstants.IDENTIFIER = PreferenceConverter.getColor(store, "quantum.text.color"); //$NON-NLS-1$ + SQLColorConstants.KEYWORD = PreferenceConverter.getColor(store, "quantum.keyword.color"); //$NON-NLS-1$ + SQLColorConstants.STRING = PreferenceConverter.getColor(store, "quantum.string.color"); //$NON-NLS-1$ + SQLColorConstants.COMMENT = PreferenceConverter.getColor(store, "quantum.comment.color"); //$NON-NLS-1$ + SQLColorConstants.NUMERIC = PreferenceConverter.getColor(store, "quantum.numeric.color"); //$NON-NLS-1$ + } + public void initializeColors() { + setDamageRepairer(getAttr(SQLColorConstants.KEYWORD, keywordBold), SQLPartitionScanner.SQL_KEYWORD); + setDamageRepairer(getAttr(SQLColorConstants.COMMENT, commentBold), SQLPartitionScanner.SQL_COMMENT); + setDamageRepairer(getAttr(SQLColorConstants.STRING, stringBold), SQLPartitionScanner.SQL_STRING); + setDamageRepairer(getAttr(SQLColorConstants.DEFAULT, textBold), IDocument.DEFAULT_CONTENT_TYPE); + setDamageRepairer(getAttr(SQLColorConstants.DEFAULT, textBold), SQLPartitionScanner.SQL_SYMBOL); + setDamageRepairer(getAttr(SQLColorConstants.DEFAULT, textBold), SQLPartitionScanner.SQL_IDENTIFIER); + setDamageRepairer(getAttr(SQLColorConstants.DEFAULT, textBold), SQLPartitionScanner.SQL_SEPARATOR); + setDamageRepairer(getAttr(SQLColorConstants.NUMERIC, numericBold), SQLPartitionScanner.SQL_NUMERIC); + } + public TextAttribute getAttr(RGB color, boolean bold) { + colorManager.getColor(SQLColorConstants.BACKGROUND); + Color foreground = colorManager.getColor(color); + TextAttribute attr = new TextAttribute(foreground); + if (bold) { + return new TextAttribute(foreground, attr.getBackground(), SWT.BOLD); + } + return attr; + } + public void setDamageRepairer(TextAttribute attr, String token) { + NonRuleBasedDamagerRepairer ndr = (NonRuleBasedDamagerRepairer) cache.get(token); + if (ndr == null) { + ndr = + new NonRuleBasedDamagerRepairer(attr); + reconciler.setDamager(ndr, token); + reconciler.setRepairer(ndr, token); + cache.put(token, ndr); + } else { + ndr.setTextAttribute(attr); + } + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLDocumentProvider.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLDocumentProvider.java new file mode 100644 index 0000000..1fab1c3 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLDocumentProvider.java @@ -0,0 +1,35 @@ +package com.quantum.editors; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.IDocumentPartitioner; +import org.eclipse.jface.text.rules.DefaultPartitioner; +import org.eclipse.ui.editors.text.FileDocumentProvider; + +public class SQLDocumentProvider extends FileDocumentProvider { + + public SQLDocumentProvider() { + super(); + } + + protected IDocument createDocument(Object element) throws CoreException { + IDocument document = super.createDocument(element); + if (document != null) { + IDocumentPartitioner partitioner = + new DefaultPartitioner( + new SQLPartitionScanner(), + new String[] { + IDocument.DEFAULT_CONTENT_TYPE, + SQLPartitionScanner.SQL_KEYWORD, + SQLPartitionScanner.SQL_COMMENT, + SQLPartitionScanner.SQL_IDENTIFIER, + SQLPartitionScanner.SQL_STRING, + SQLPartitionScanner.SQL_SEPARATOR, + SQLPartitionScanner.SQL_SYMBOL, + SQLPartitionScanner.SQL_NUMERIC }); + partitioner.connect(document); + document.setDocumentPartitioner(partitioner); + } + return document; + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLEditor.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLEditor.java new file mode 100644 index 0000000..1ceab17 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLEditor.java @@ -0,0 +1,59 @@ +package com.quantum.editors; + +import com.quantum.QuantumPlugin; + +import org.eclipse.jface.preference.PreferenceConverter; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.editors.text.TextEditor; + +public class SQLEditor extends TextEditor { + SQLConfiguration config; + private ColorManager colorManager; + /** + * An editor capable of editing SQL scripts + */ + public SQLEditor() { + super(); + colorManager = new ColorManager(); + config = new SQLConfiguration(colorManager); + config.loadPrefs(); + + setPreferenceStore(QuantumPlugin.getDefault().getPreferenceStore()); + IPropertyChangeListener preferenceListener = new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + config.loadPrefs(); + config.initializeColors(); + getSourceViewer().invalidateTextPresentation(); + StyledText widget = getSourceViewer().getTextWidget(); + FontData font = PreferenceConverter.getFontData(getPreferenceStore(), "quantum.font"); //$NON-NLS-1$ + widget.setFont(new Font(Display.getCurrent(), font)); + Color background = colorManager.getColor(SQLColorConstants.BACKGROUND); + widget.setBackground(background); + } + }; + getPreferenceStore(). + addPropertyChangeListener(preferenceListener); + + setSourceViewerConfiguration(config); + setDocumentProvider(new SQLDocumentProvider()); + } + public void dispose() { + colorManager.dispose(); + super.dispose(); + } + public void createPartControl(Composite arg0) { + super.createPartControl(arg0); + StyledText widget = getSourceViewer().getTextWidget(); + FontData font = PreferenceConverter.getFontData(getPreferenceStore(), "quantum.font"); //$NON-NLS-1$ + widget.setFont(new Font(Display.getCurrent(), font)); + Color background = colorManager.getColor(SQLColorConstants.BACKGROUND); + widget.setBackground(background); + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLPartitionScanner.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLPartitionScanner.java new file mode 100644 index 0000000..01898d1 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/editors/SQLPartitionScanner.java @@ -0,0 +1,225 @@ +package com.quantum.editors; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.rules.EndOfLineRule; +import org.eclipse.jface.text.rules.ICharacterScanner; +import org.eclipse.jface.text.rules.IPredicateRule; +import org.eclipse.jface.text.rules.IRule; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.IWhitespaceDetector; +import org.eclipse.jface.text.rules.MultiLineRule; +import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; +import org.eclipse.jface.text.rules.SingleLineRule; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.jface.text.rules.WhitespaceRule; + +public class SQLPartitionScanner extends RuleBasedPartitionScanner { + public final static String SQL_COMMENT = "__sql_comment"; //$NON-NLS-1$ + public final static String SQL_IDENTIFIER = "__sql_word"; //$NON-NLS-1$ + public final static String SQL_STRING = "__sql_string"; //$NON-NLS-1$ + public final static String SQL_KEYWORD = "__sql_keyword"; //$NON-NLS-1$ + public final static String SQL_SYMBOL = "__sql_symbol"; //$NON-NLS-1$ + public final static String SQL_SEPARATOR = "__sql_separator"; //$NON-NLS-1$ + public final static String SQL_NUMERIC = "__sql_numeric"; //$NON-NLS-1$ + + private final static String[] KEYWORDS = { + "ALTER", //$NON-NLS-1$ + "AND", //$NON-NLS-1$ + "BY", //$NON-NLS-1$ + "COLUMN", //$NON-NLS-1$ + "CREATE", //$NON-NLS-1$ + "DELETE", //$NON-NLS-1$ + "DROP", //$NON-NLS-1$ + "FROM", //$NON-NLS-1$ + "GROUP", //$NON-NLS-1$ + "INSERT", //$NON-NLS-1$ + "INTO", //$NON-NLS-1$ + "NOT", //$NON-NLS-1$ + "NULL", //$NON-NLS-1$ + "OR", //$NON-NLS-1$ + "ORDER", //$NON-NLS-1$ + "SELECT", //$NON-NLS-1$ + "SEQUENCE", //$NON-NLS-1$ + "SET", //$NON-NLS-1$ + "TABLE", //$NON-NLS-1$ + "UNION", //$NON-NLS-1$ + "UNIQUE", //$NON-NLS-1$ + "UPDATE", //$NON-NLS-1$ + "USING", //$NON-NLS-1$ + "VALUES", //$NON-NLS-1$ + "VIEW", //$NON-NLS-1$ + "WHEN", //$NON-NLS-1$ + "WHERE" //$NON-NLS-1$ + }; + + public SQLPartitionScanner() { + + List rules = new ArrayList(); + + IToken comment = new Token(SQL_COMMENT); + IToken string = new Token(SQL_STRING); + IToken identifier = new Token(SQL_IDENTIFIER); + IToken keyword = new Token(SQL_KEYWORD); + IToken separator = new Token(SQL_SEPARATOR); + IToken symbol = new Token(SQL_SYMBOL); + IToken whitespace = new Token(IDocument.DEFAULT_CONTENT_TYPE); + IToken numeric = new Token(SQL_NUMERIC); + + rules.add(new PredicateRuleAdapter(new WhitespaceRule(new WhitespaceDetector()), whitespace)); + rules.add(new MultiLineRule("/*", "*/", comment)); //$NON-NLS-1$ //$NON-NLS-2$ + rules.add(new EndOfLineRule("--", comment)); //$NON-NLS-1$ + rules.add(new SingleLineRule("'", "'", string)); //$NON-NLS-1$ //$NON-NLS-2$ + rules.add(new PredicateRuleAdapter(new SQLNumberRule(numeric), numeric)); + SQLWordRule wordRule = new SQLWordRule(identifier); + for (int i = 0; i < KEYWORDS.length; i++) { + wordRule.addKeyword(KEYWORDS[i], keyword); + } + rules.add(new PredicateRuleAdapter(wordRule, keyword)); + rules.add(new PredicateRuleAdapter(wordRule, identifier)); + rules.add(new PredicateRuleAdapter(new SQLSeparatorRule(separator), separator)); + rules.add(new PredicateRuleAdapter(new SymbolRule(symbol), symbol)); + + IPredicateRule[] result= new IPredicateRule[rules.size()]; + rules.toArray(result); + setPredicateRules(result); + } +} + +class PredicateRuleAdapter implements IPredicateRule { + IRule rule; + IToken token; + public PredicateRuleAdapter(IRule rule, IToken token) { + this.rule = rule; + this.token = token; + } + + public IToken evaluate(ICharacterScanner scanner, boolean resume) { + return rule.evaluate(scanner); + } + + public IToken getSuccessToken() { + return token; + } + + public IToken evaluate(ICharacterScanner scanner) { + return rule.evaluate(scanner); + } + +} + +class SQLSeparatorRule implements IRule { + IToken token; + public SQLSeparatorRule(IToken token) { + this.token = token; + } + public IToken evaluate(ICharacterScanner scanner) { + char c = (char) scanner.read(); + if (c == ';') { + return token; + } + scanner.unread(); + return Token.UNDEFINED; + } + +} + +class SymbolRule implements IRule { + IToken token; + public SymbolRule(IToken token) { + this.token = token; + } + public IToken evaluate(ICharacterScanner scanner) { + int val = scanner.read(); + if (val != ICharacterScanner.EOF) { + char c = (char) val; + if (!Character.isWhitespace(c) && !Character.isLetterOrDigit(c) && c != '_') { + return token; + } + } + scanner.unread(); + return Token.UNDEFINED; + } + +} + +class WhitespaceDetector implements IWhitespaceDetector { + + public boolean isWhitespace(char c) { + return Character.isWhitespace(c); + } +} + +class SQLNumberRule implements IRule { + private IToken token; + + public SQLNumberRule(IToken token) { + this.token = token; + } + + public IToken evaluate(ICharacterScanner scanner) { + char c = (char) scanner.read(); + if (Character.isDigit(c)) { + // postive numbers and zero + do { + c= (char) scanner.read(); + } while (Character.isDigit(c) || c == '.'); + scanner.unread(); + return token; + } else if (c == '-') { + // negative numbers + c = (char) scanner.read(); + if (Character.isDigit(c)) { + do { + c= (char) scanner.read(); + } while (Character.isDigit(c) || c == '.'); + scanner.unread(); + return token; + } else { + scanner.unread(); + scanner.unread(); + return Token.UNDEFINED; + } + } else { + scanner.unread(); + return Token.UNDEFINED; + } + } +} + +class SQLWordRule implements IRule { + private IToken token; + private HashMap keywords = new HashMap(); + + public SQLWordRule(IToken token) { + this.token = token; + } + + public void addKeyword(String word, IToken token) { + keywords.put(word.toUpperCase(), token); + } + + public IToken evaluate(ICharacterScanner scanner) { + char c = (char) scanner.read(); + if (Character.isLetter(c) || c == '_') { + StringBuffer value = new StringBuffer(); + do { + value.append(c); + c= (char) scanner.read(); + } while (Character.isLetterOrDigit(c) || c == '_'); + scanner.unread(); + IToken retVal = (IToken) keywords.get(value.toString().toUpperCase()); + if (retVal != null) { + return retVal; + } else { + return token; + } + } else { + scanner.unread(); + return Token.UNDEFINED; + } + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/ExtensionAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/ExtensionAction.java new file mode 100644 index 0000000..50a35db --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/ExtensionAction.java @@ -0,0 +1,132 @@ +/* + * Created on 17/02/2004 + * + */ +package com.quantum.extensions; + +import java.io.IOException; +import java.io.StringWriter; +import java.util.Iterator; + +import javax.xml.parsers.ParserConfigurationException; + +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.actions.SelectionListenerAction; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.model.xml.ModelToXMLConverter; +import com.quantum.sql.TableRow; +import com.quantum.sql.metadata.MetaDataXMLInterface; +import com.quantum.util.xml.XMLHelper; +import com.quantum.view.bookmark.BookmarkView; +import com.quantum.view.bookmark.EntityNode; +import com.quantum.view.bookmark.TreeNode; +import com.quantum.view.tableview.TableView; + +/** + * @author panic + * + * Defines an Action Class to implement extension Actions. + * An external plug-in that wants to extend quantum will + * generate one ExtensionAction object for each action it + * wants to perform. + */ +public class ExtensionAction extends SelectionListenerAction { + private IViewPart view; + private IQuantumExtension extension; + private TableRow tableRow; + + public ExtensionAction(IViewPart view, String label, String toolTip, IQuantumExtension extension) { + super(label); + this.view = view; + this.extension = extension; + + setText(label); + setToolTipText(toolTip); //$NON-NLS-1$ + tableRow = null; + } + + public void run() { + if (extension instanceof IMetadataExtension && view instanceof BookmarkView) + runMetadataExtension(); + else if (extension instanceof IDataExtension && view instanceof TableView) + runDataExtension(); + } + + /** + * + */ + private void runDataExtension() { + IDataExtension dataExtension = (IDataExtension) extension; + if (tableRow == null) return; + Document doc; + try { + doc = XMLHelper.createEmptyDocument(); + } catch (ParserConfigurationException e) { + e.printStackTrace(); + return; + } + Element root = (Element) doc.appendChild(doc.createElement(Messages.getString("ExportXMLAction.Metadata"))); //$NON-NLS-1$ + MetaDataXMLInterface.createElementText(root, Messages.getString("ExportXMLAction.Author"), //$NON-NLS-1$ + Messages.getString("ExportXMLAction.Quantum")); //$NON-NLS-1$ + MetaDataXMLInterface.createElementText(root, Messages.getString("ExportXMLAction.Version"), //$NON-NLS-1$ + Messages.getString("ExportXMLAction.XMLVersionNumber")); //$NON-NLS-1$ + ModelToXMLConverter.getInstance().convert(root, tableRow.getEntity() ); + MetaDataXMLInterface.stringMatrixToXML(tableRow.getRowTableData(), doc, root, "DataRow"); //$NON-NLS-1$ + + dataExtension.run(doc); + } + + private void runMetadataExtension() { + IMetadataExtension metadataExtension = (IMetadataExtension) extension; + BookmarkView bookmarkView = (BookmarkView) view; + StructuredSelection selection = bookmarkView.getSelection(); + if (selection == null) return; + Document doc; + try { + doc = XMLHelper.createEmptyDocument(); + } catch (ParserConfigurationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return; + } + Element root = (Element) doc.appendChild(doc.createElement(Messages.getString("ExportXMLAction.Metadata"))); //$NON-NLS-1$ + MetaDataXMLInterface.createElementText(root, Messages.getString("ExportXMLAction.Author"), //$NON-NLS-1$ + Messages.getString("ExportXMLAction.Quantum")); //$NON-NLS-1$ + MetaDataXMLInterface.createElementText(root, Messages.getString("ExportXMLAction.Version"), //$NON-NLS-1$ + Messages.getString("ExportXMLAction.XMLVersionNumber")); //$NON-NLS-1$ + Iterator iter = selection.iterator(); + while (iter.hasNext()) { + TreeNode current = (TreeNode) iter.next(); + EntityNode entityNode = (EntityNode) current; + ModelToXMLConverter.getInstance().convert(root, entityNode.getEntity() ); + } + + StringWriter text = new StringWriter(); + try { + XMLHelper.createDOMSerializer(text).serialize(doc); + } catch (IOException e) { + e.printStackTrace(); + } + String textXml = new String(text.getBuffer()); + QuantumPlugin.getDefault().getSysClip().setContents( + new Object[] { textXml }, + new Transfer[] { TextTransfer.getInstance()}); + + metadataExtension.run(doc); + } + + /** + * @param row + */ + public void addRowData(TableRow row) { + tableRow = row; + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/IDataExtension.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/IDataExtension.java new file mode 100644 index 0000000..9149235 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/IDataExtension.java @@ -0,0 +1,21 @@ +/* + * Created on 21/03/2004 + * + */ +package com.quantum.extensions; + +import org.w3c.dom.Document; + +/** + * @author panic + * + */ +public interface IDataExtension extends IQuantumExtension { + /** + * Callback method for data export + * + * @param doc. An org.w3c.dom.Document with the XML data on the selected items + */ + public void run(Document doc); + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/IMetadataExtension.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/IMetadataExtension.java new file mode 100644 index 0000000..34298c7 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/IMetadataExtension.java @@ -0,0 +1,21 @@ +/* + * Created on 15/02/2004 + * + */ +package com.quantum.extensions; + +import org.w3c.dom.Document; + +/** + * @author panic + * + */ +public interface IMetadataExtension extends IQuantumExtension{ + /** + * Callback method for metadata export + * + * @param doc. An org.w3c.dom.Document with the XML data on the selected items + */ + public void run(Document doc); + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/IQuantumExtension.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/IQuantumExtension.java new file mode 100644 index 0000000..e9806c3 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/IQuantumExtension.java @@ -0,0 +1,13 @@ +/* + * Created on 17/02/2004 + * + */ +package com.quantum.extensions; + +/** + * @author panic + * A commom parent for the Quantum Extensions + */ +public interface IQuantumExtension { + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/ProcessServiceMembers.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/ProcessServiceMembers.java new file mode 100644 index 0000000..30ca7f2 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/extensions/ProcessServiceMembers.java @@ -0,0 +1,281 @@ + +/* + * Created on 16-feb-2004 + * + */ +package com.quantum.extensions; +import java.util.Vector; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IPluginRegistry; +import org.eclipse.core.runtime.Platform; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.WorkbenchException; +import org.w3c.dom.Document; + +import com.quantum.view.bookmark.BookmarkView; +import com.quantum.view.tableview.TableView; + +/** + * Extension processing logic for the functions extension-point. + * Extract specific information about each function. Create callback + * function object when required. + * + * @author panic + * + */ +public class ProcessServiceMembers { + + /** + * The fully-qualified name of the functions extension-point for this plug-in. + */ + private static final String EXTENSION_POINT_METADATA = + "com.quantum.Quantum.metadata"; + private static final String EXTENSION_POINT_DATA = + "com.quantum.Quantum.data"; + + /** + * Name of the XML attribute designating a metadata actor label. + */ + private static final String FUNCTION_NAME_ATTRIBUTE = "label"; + + /** + * Name of the XML attribute designating the fully-qualified name + * of the implementation class of a function. + */ + private static final String CLASS_ATTRIBUTE = "class"; + + /** + * Perform initial extension processing for the members of the + * functions extension-point. Make calls to the user interface + * module to add the functions of an extension to the UI functions grid. + * For each function, a virtual proxy callback object is created and handed + * to the user interface module. The proxy class is a nested top-level + * class and is therefore known at compile time. The actual (real) callback + * objects configured into extensions are instantiated and initialized in + * a lazy fashion by the proxy callback objects. + * + * @param grid The UI functions grid exposing the functions configured + * into functions extensions. + * + */ + public static void process(IViewPart view, Vector extensionActions) throws WorkbenchException { + + extensionActions.clear(); + + IPluginRegistry registry = Platform.getPluginRegistry(); + String extPointId; + // We have two different extension points, we choose the needed one based + // on the view that calls this function. + // Our two extension points have the same attributes, so the only change is the name + // If the implementation differed more, we should probably make two different functions + if (view instanceof BookmarkView) + extPointId = EXTENSION_POINT_METADATA; + else if (view instanceof TableView) + extPointId = EXTENSION_POINT_DATA; + else + return; + + IExtensionPoint extensionPoint = + registry.getExtensionPoint(extPointId); + if (extensionPoint == null) { + throw new WorkbenchException( + "unable to resolve extension-point: " + extPointId); + } + IConfigurationElement[] members = + extensionPoint.getConfigurationElements(); + + // For each service: + for (int m = 0; m < members.length; m++) { + IConfigurationElement member = members[m]; + // Get the label of the extender plugin and the ID of the extension. + IExtension extension = member.getDeclaringExtension(); + String pluginLabel = + extension.getDeclaringPluginDescriptor().getLabel(); + if (pluginLabel == null) { + pluginLabel = "[unnamed plugin]"; + } + // Get the name of the operation implemented by the service. + // The operation name is a service attribute in the extension's XML specification. + String functionName = member.getAttribute(FUNCTION_NAME_ATTRIBUTE); + if (functionName == null) { + functionName = "[unnamed function]"; + } + String label = pluginLabel + "/" + functionName; + // Add a row to support this operation to the UI grid. + IQuantumExtension proxy = null; + if (view instanceof BookmarkView) + proxy = (IMetadataExtension) new MetadataFunctionProxy(member); + else if (view instanceof TableView) + proxy = (IDataExtension) new DataFunctionProxy(member); + //grid.addFunction(proxy, functionName, label); + extensionActions.add(new ExtensionAction(view, label, label, proxy)); + } + } + + /** + * Virtual proxy class for function invokation. + * Members of this class support lazy processing by fronting the real + * implementations of arithmetic functions configured into extensions. + */ + private static class MetadataFunctionProxy implements IMetadataExtension { + // The "real" implementation of the function. + private IMetadataExtension delegate = null; + // The configured state of the extension element representing this arithmetic function. + private IConfigurationElement element; + // Whether this function has been invoked before. + // Used for lazy evaluation of the service. + private boolean invoked = false; + + /** + * Construct a virtual proxy to stand in place of an extension function. + * The constructor simply keeps track of an arithmetic function's configured state + * without at this time instantiating the implementation of the function. + * + * @param element The configuration of this arithmetic function. + */ + public MetadataFunctionProxy(IConfigurationElement element) { + this.element = element; + } + + /** + * Compute the function value. + * The proxy computation first instantiates the implementation + * of the function, if this is the first time the function is called, + * and then delegates to that implementation. The instantiation and + * initialization of the delegate implementation uses the standard + * callback object instantiation and initialization methods of Eclipse. + * + * @see com.bolour.sample.eclipse.service.ui.IFunction#compute(long) + */ + public final void run(Document doc) { + try { + getDelegate().run(doc); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Instantiate and initialize the implementation of the function if + * this is the first time the proxy has been called. + * + * @return The implementation delegate (same as the instance variable delegate. + * @throws Exception If the callback object is misconfigured. + */ + private final IMetadataExtension getDelegate() throws Exception { + if (invoked) { + return delegate; + } + invoked = true; + try { + Object callback = + element.createExecutableExtension(CLASS_ATTRIBUTE); + if (!(callback instanceof IMetadataExtension)) { + String message = + "callback class '" + + callback.getClass().getName() + + "' is not an IFunction"; + System.err.println(message); + throw new ClassCastException(message); + } + delegate = (IMetadataExtension) callback; + } catch (CoreException ex) { + System.err.println(ex.getMessage()); + ex.printStackTrace(); + throw ex; + } catch (Error err) { + System.err.println(err.getMessage()); + err.printStackTrace(); + throw err; + } + return delegate; + } + } + /** + * Virtual proxy class for function invokation. + * Members of this class support lazy processing by fronting the real + * implementations of arithmetic functions configured into extensions. + */ + private static class DataFunctionProxy implements IDataExtension { + // The "real" implementation of the function. + private IDataExtension delegate = null; + // The configured state of the extension element representing this arithmetic function. + private IConfigurationElement element; + // Whether this function has been invoked before. + // Used for lazy evaluation of the service. + private boolean invoked = false; + + /** + * Construct a virtual proxy to stand in place of an extension function. + * The constructor simply keeps track of an arithmetic function's configured state + * without at this time instantiating the implementation of the function. + * + * @param element The configuration of this arithmetic function. + */ + public DataFunctionProxy(IConfigurationElement element) { + this.element = element; + } + + /** + * Compute the function value. + * The proxy computation first instantiates the implementation + * of the function, if this is the first time the function is called, + * and then delegates to that implementation. The instantiation and + * initialization of the delegate implementation uses the standard + * callback object instantiation and initialization methods of Eclipse. + * + * @see com.bolour.sample.eclipse.service.ui.IFunction#compute(long) + */ + public final void run(Document doc) { + try { + getDelegate().run(doc); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Instantiate and initialize the implementation of the function if + * this is the first time the proxy has been called. + * + * @return The implementation delegate (same as the instance variable delegate. + * @throws Exception If the callback object is misconfigured. + */ + private final IDataExtension getDelegate() throws Exception { + if (invoked) { + return delegate; + } + invoked = true; + try { + Object callback = + element.createExecutableExtension(CLASS_ATTRIBUTE); + if (!(callback instanceof IDataExtension)) { + String message = + "callback class '" + + callback.getClass().getName() + + "' is not an IFunction"; + System.err.println(message); + throw new ClassCastException(message); + } + delegate = (IDataExtension) callback; + } catch (CoreException ex) { + System.err.println(ex.getMessage()); + ex.printStackTrace(); + throw ex; + } catch (Error err) { + System.err.println(err.getMessage()); + err.printStackTrace(); + throw err; + } + return delegate; + } + } + +} + diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Bookmark.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Bookmark.java new file mode 100644 index 0000000..d2dff2b --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Bookmark.java @@ -0,0 +1,525 @@ +package com.quantum.model; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.quantum.IQuantumConstants; +import com.quantum.QuantumPlugin; +import com.quantum.adapters.AdapterFactory; +import com.quantum.adapters.DatabaseAdapter; +import com.quantum.sql.ConnectionEstablisher; +import com.quantum.sql.MultiSQLServer; + +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * Class Bookmark holds the "static" information of a bookmark, that is the data that + * is saved and loaded from the external file and describes a bookmark. This info will + * be filled up by the end user. + * + * @author root + */ +public class Bookmark { + + private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); + private String name = ""; //$NON-NLS-1$ + private String username = ""; //$NON-NLS-1$ + private String password = ""; //$NON-NLS-1$ + private String connect = ""; //$NON-NLS-1$ + private String driver = ""; //$NON-NLS-1$ + private String type = ""; //$NON-NLS-1$ + private String driverFile = ""; //$NON-NLS-1$ + + /** + * A quick list is a list of favourite tables that a person might want to view + * without having to look at the entire list of tables. + */ + private Map quickList = new Hashtable(); + private Set schemas = new HashSet(); + private Connection connection = null; + private ConnectionEstablisher connectionEstablisher; + private boolean changed = true; + private List queries = Collections.synchronizedList(new ArrayList()); + private boolean promptForPassword = false; + private boolean autoCommit = true; + private String autoCommitPreference = IQuantumConstants.autoCommitTrue; + + public Bookmark() { + this(MultiSQLServer.getInstance()); + } + + public Bookmark(ConnectionEstablisher connectionEstablisher) { + this.connectionEstablisher = connectionEstablisher; + } + + public Bookmark(Bookmark data) { + this(); + setName(data.getName()); + setUsername(data.getUsername()); + setPassword(data.getPassword()); + setConnect(data.getConnect()); + setDriver(data.getDriver()); + setType(data.getType()); + setDriverFile(data.getDriverFile()); + setPromptForPassword(data.getPromptForPassword()); + setAutoCommit(data.isAutoCommit()); + setAutoCommitPreference(data.getAutoCommitPreference()); + + this.schemas.addAll(data.schemas); + this.quickList = new Hashtable(data.quickList); + } + + /** + * Returns the JDBC URL. + * @return String + */ + public String getConnect() { + return connect; + } + + /** + * Returns the driver. + * @return String + */ + public String getDriver() { + return driver; + } + + /** + * Returns the driverFile. + * @return String + */ + public String getDriverFile() { + return driverFile; + } + + /** + * Returns the password. + * @return String + */ + public String getPassword() { + return password; + } + + /** + * Returns the username. + * @return String + */ + public String getUsername() { + return username; + } + + /** + * Sets the connect. + * @param connect The connect to set + */ + public void setConnect(String connect) { + if (connect == null) { + connect = ""; //$NON-NLS-1$ + } + this.connect = connect; + } + + /** + * Sets the driver. + * @param driver The driver to set + */ + public void setDriver(String driver) { + if (driver == null) { + driver = ""; //$NON-NLS-1$ + } + this.driver = driver; + } + + /** + * Sets the driverFile. + * @param driverFile The driverFile to set + */ + public void setDriverFile(String driverFile) { + if (driverFile == null) { + driverFile = ""; //$NON-NLS-1$ + } + this.driverFile = driverFile; + } + + /** + * Sets the password. + * @param password The password to set + */ + public void setPassword(String password) { + if (password == null) { + password = ""; //$NON-NLS-1$ + } + this.password = password; + } + + /** + * Sets the username. + * @param username The username to set + */ + public void setUsername(String username) { + if (username == null) { + username = ""; //$NON-NLS-1$ + } + this.username = username; + } + + /** + * Returns the name. + * @return String + */ + public String getName() { + return name; + } + + /** + * Sets the name. + * @param name The name to set + */ + public void setName(String name) { + if (name == null) { + name = ""; //$NON-NLS-1$ + } + if (!name.equals(this.name)) { + + String oldName = this.name; + this.name = name; + this.propertyChangeSupport.firePropertyChange("name", oldName, this.name); + this.changed = true; + } + } + + public boolean isEmpty() { + if (name.equals("") && //$NON-NLS-1$ + username.equals("") && //$NON-NLS-1$ + password.equals("") && //$NON-NLS-1$ + connect.equals("") && //$NON-NLS-1$ + driver.equals("") && //$NON-NLS-1$ + type.equals("") && //$NON-NLS-1$ + driverFile.equals("")) { //$NON-NLS-1$ + return true; + } + return false; + } + public String toString() { + StringBuffer buffer = new StringBuffer(); + buffer.append("["); //$NON-NLS-1$ + buffer.append("name="); //$NON-NLS-1$ + buffer.append(name); + buffer.append(", "); //$NON-NLS-1$ + buffer.append("username="); //$NON-NLS-1$ + buffer.append(username); + buffer.append(", "); //$NON-NLS-1$ + buffer.append("password=****"); //$NON-NLS-1$ + buffer.append(", "); //$NON-NLS-1$ + buffer.append("connect="); //$NON-NLS-1$ + buffer.append(connect); + buffer.append(", "); //$NON-NLS-1$ + buffer.append("driver="); //$NON-NLS-1$ + buffer.append(driver); + buffer.append(", "); //$NON-NLS-1$ + buffer.append("type="); //$NON-NLS-1$ + buffer.append(type); + buffer.append(", "); //$NON-NLS-1$ + buffer.append("driverFile="); //$NON-NLS-1$ + buffer.append(driverFile); + buffer.append("]"); //$NON-NLS-1$ + return buffer.toString(); + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Connection connect(PasswordFinder passwordFinder) throws ConnectionException { + boolean isConnected = isConnected(); + if (this.connection == null) { + this.connection = this.connectionEstablisher.connect(this, passwordFinder); + } + + if (isConnected() != isConnected) { + this.propertyChangeSupport.firePropertyChange( + "connected", isConnected, isConnected()); + } + return this.connection; + } + + /** + * Returns the connection object. + * @return the Connection object associated with the current JDBC source. + * + */ + public Connection getConnection() throws NotConnectedException { + if (this.connection == null) { + throw new NotConnectedException(); + } + return this.connection; + } + + /** + * @return true if the BookmarkNode is connected to a JDBC source + */ + public boolean isConnected() { + return (connection != null); + } + + /** + * Sets the connection member. From that moment on the BookmarkNode is "connected" (open) + * @param connection : a valid connection to a JDBC source + */ + public void setConnection(Connection connection) { + this.connection = connection; + } + + public void disconnect() throws ConnectionException { + boolean isConnected = isConnected(); + try { + if (this.connection != null) { + this.connectionEstablisher.disconnect(this.connection); + } + } finally { + this.connection = null; + if (isConnected() != isConnected) { + this.propertyChangeSupport.firePropertyChange( + "connected", isConnected, isConnected()); + } + } + } + public void addSchema(String schema) { + if (schema != null && schema.trim().length() > 0) { + addSchema(new Schema(schema)); + } + } + + public void addSchema(Schema qualifier) { + if (qualifier != null) { + this.schemas.add(qualifier); + this.changed = true; + this.propertyChangeSupport.firePropertyChange("schemas", null, null); + } + } + + public void setSchemas(Schema[] schemas) { + this.schemas.clear(); + for (int i = 0, length = (schemas == null) ? 0 : schemas.length; + i < length; + i++) { + this.schemas.add(schemas[i]); + + } + this.changed = true; + this.propertyChangeSupport.firePropertyChange("schemas", null, null); + } + + /** + * @return a list of all the schemas that have been set up. + */ + public Schema[] getSchemas() { + Set set = new HashSet(); + set.addAll(this.schemas); + if (set.isEmpty()) { + set.add(new Schema(getAdapter().getDefaultSchema(this.username), + this.username, true)); + } + List list = new ArrayList(set); + Collections.sort(list); + return (Schema[]) list.toArray(new Schema[list.size()]); + } + + /** + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object obj) { + if (!(obj instanceof Bookmark)) return false; + String name = ((Bookmark)obj).getName(); + if (name.equals(this.getName())) return true; + return false; + } + + /** + * @param listener + */ + public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { + this.propertyChangeSupport.addPropertyChangeListener(listener); + } + + /** + * @param listener + */ + public synchronized void removePropertyChangeListener(PropertyChangeListener listener) { + this.propertyChangeSupport.removePropertyChangeListener(listener); + } + + public void addQuickListEntry(String type, String schemaName, String name) { + Entity entity = EntityFactory.getInstance().create(this, schemaName, name, type); + this.quickList.put(entity.getCondQualifiedName(), entity); + this.propertyChangeSupport.firePropertyChange("quickList", null, null); + this.changed = true; + } + + public void addQuickListEntry(Entity entity) { + addQuickListEntry(entity.getType(), entity.getSchema(), entity.getName()); + } + + public void removeQuickListEntry(Entity entity) { + if (entity != null && this.quickList.containsKey(entity.getCondQualifiedName())) { + this.quickList.remove(entity.getCondQualifiedName()); + this.propertyChangeSupport.firePropertyChange("quickList", null, null); + this.changed = true; + } + } + + public Entity[] getQuickListEntries() { + return (Entity[]) this.quickList.values().toArray(new Entity[this.quickList.size()]); + } + + public boolean hasQuickList() { + return !this.quickList.isEmpty(); + } + /** + * @return + */ + public boolean isChanged() { + return changed; + } + + /** + * @param b + */ + public void setChanged(boolean b) { + changed = b; + } + + public Database getDatabase() throws NotConnectedException { + if (!isConnected()) { + throw new NotConnectedException(); + } + return new Database(this); + } + + public DatabaseAdapter getAdapter() { + return AdapterFactory.getInstance().getAdapter(getType()); + } + + public Entity[] getEntitiesForSchema(Schema schema, String type) throws SQLException { + try { + Entity[] entities = getDatabase().getEntities(this, schema, type); + return entities; + } catch (NotConnectedException e) { + return new Entity[0]; + } + } + + public Entity getEntity(Schema schema, String name) throws SQLException { + Entity result = null; + if (schema != null && name != null) { + Entity[] entities = getEntitiesForSchema(schema, null); + for (int i = 0, length = (entities == null) ? 0 : entities.length; + result == null && i < length; + i++) { + if (schema.equals(entities[i].getSchema()) && + name.equals(entities[i].getName())) { + result = entities[i]; + } + } + } + return result; + } + + public boolean isInQuickList(Entity entity) { + return this.quickList.containsKey(entity.getCondQualifiedName()); + } + + /** + * + * @param queryString + */ + public void addQuery(String queryString) { + if (this.queries.contains(queryString)) { + this.queries.remove(queryString); + } + this.queries.add(queryString); + + int size = getQueryHistorySize(); + + while (this.queries.size() > size) { + this.queries.remove(0); + } + this.propertyChangeSupport.firePropertyChange("queries", null, null); + this.changed = true; + } + + public String[] getQueries() { + return (String[]) this.queries.toArray(new String[this.queries.size()]); + } + + private int getQueryHistorySize() { + IPreferenceStore store = + QuantumPlugin.getDefault().getPreferenceStore(); + return store.getInt(getClass().getName() + ".queryHistorySize"); //$NON-NLS-1$ + } + /** + * @return + */ + public boolean getPromptForPassword() { + return promptForPassword; + } + + /** + * @param b + */ + public void setPromptForPassword(boolean b) { + promptForPassword = b; + } + + /** + * @return + */ + public boolean isAutoCommit() { + return autoCommit; + } + + /** + * @return + */ + public String getAutoCommitPreference() { + return autoCommitPreference; + } + + /** + * @param b + */ + public void setAutoCommit(boolean b) { + autoCommit = b; + } + + /** + * @param string + */ + public void setAutoCommitPreference(String string) { + autoCommitPreference = string; + } + + // Returns true or false indicating whether this bookmark must be set to AutoCommit on connection or not + public boolean getDefaultAutoCommit(){ + if (autoCommitPreference.equals(IQuantumConstants.autoCommitTrue)) return true; + else if (autoCommitPreference.equals(IQuantumConstants.autoCommitFalse)) return false; + else if (autoCommitPreference.equals(IQuantumConstants.autoCommitSaved)) return autoCommit; + + return true; + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/BookmarkCollection.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/BookmarkCollection.java new file mode 100644 index 0000000..58a854e --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/BookmarkCollection.java @@ -0,0 +1,312 @@ +package com.quantum.model; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; +import java.util.Vector; + +import com.quantum.IQuantumConstants; +import com.quantum.Messages; +import com.quantum.model.xml.ModelToXMLConverter; +import com.quantum.sql.metadata.MetaDataXMLInterface; + +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * The collection of database bookmarks that the Quantum plug-in knows about. + * This collection is loaded by the QuantumPlugin class before any Quantum plugin + * extension is invoked. + * + * @author BC + */ +public class BookmarkCollection { + + private static BookmarkCollection instance = new BookmarkCollection(); + private List bookmarks = new Vector(); + private boolean changed = false; + private PropertyChangeSupport support = new PropertyChangeSupport(this); + + private BookmarkCollection() { + } + + /** + * Singleton accessor + */ + public static BookmarkCollection getInstance() { + return BookmarkCollection.instance; + } + + /** + * Imports the bookmars from a properties file. This load method is + * provided for backwards compatability only; we no longer persist + * bookmarks as properties files. + * @param file + */ + public void load(File file) throws IOException { + Properties props = new Properties(); + FileInputStream in = new FileInputStream(file); + props.load(in); + in.close(); + fromProperties(true, props); + } + + private void fromProperties(boolean overwrite, Properties props) { + List newBookmarks = new Vector(); + int i = 0; + while (true) { + Bookmark bookmark = new Bookmark(); + String name = props.getProperty(i + ".name"); //$NON-NLS-1$ + if (name == null) { + break; + } + bookmark.setName(name); + bookmark.setUsername(props.getProperty(i + ".username")); //$NON-NLS-1$ + bookmark.setPassword(props.getProperty(i + ".password")); //$NON-NLS-1$ + bookmark.setConnect(props.getProperty(i + ".connect")); //$NON-NLS-1$ + bookmark.setDriver(props.getProperty(i + ".driver")); //$NON-NLS-1$ + String schema = props.getProperty(i + ".schema"); //$NON-NLS-1$ + if (schema != null) { + bookmark.addSchema(schema); + } + String type = props.getProperty(i + ".type"); //$NON-NLS-1$ + if (type != null) { + bookmark.setType(type); + } else { + bookmark.setType(""); //$NON-NLS-1$ + } + String driverFile = props.getProperty(i + ".driverLocation"); //$NON-NLS-1$ + if (driverFile != null) { + bookmark.setDriverFile(driverFile); + } else { + bookmark.setDriverFile(""); //$NON-NLS-1$ + } + System.out.println(bookmark.toString()); + if (!bookmark.isEmpty()) { + newBookmarks.add(bookmark); + } + i++; + } + if (overwrite) { + this.bookmarks = newBookmarks; + } else { + this.bookmarks.addAll(newBookmarks); + } + } + /** + * Finds a Bookmark with the specified name. + * + * @param name + * @return the bookmark with the specified name, or null if no bookmark can be found + */ + public Bookmark find(String name){ + Bookmark result = null; + if (name != null) { + for (Iterator i = this.bookmarks.iterator(); result == null && i.hasNext(); ) { + Bookmark temp = (Bookmark) i.next(); + if (name.equals(temp.getName())) { + result = temp; + } + } + } + return result; + } + + /** + * Exports a Bookmark data to an XMLDocument Element + * The complementary function is importXML() + * @param root The Element to fill up with the bookmark info + */ + public void exportXML(Element root) { + System.out.println("Bookmarks: Saving to Element"); //$NON-NLS-1$ + Element bookmarkRoot = MetaDataXMLInterface.createElementText(root,"bookmarks", ""); //$NON-NLS-1$ //$NON-NLS-2$ + for (int i = 0; i < bookmarks.size(); i++) { + Bookmark b = (Bookmark) bookmarks.get(i); + ModelToXMLConverter.getInstance().convert(bookmarkRoot, b); + } + } + + /** + * Imports a Bookmark data from an XMLDocument Element + * The complementary function is exportXML() + * @param root The Element from which to load + */ + public void importXML(Element root) { + this.changed = true; + System.out.println("Bookmarks: Loading from Element"); //$NON-NLS-1$ + Vector newBookmarks = new Vector(); + NodeList nodes = root.getElementsByTagName("bookmark"); //$NON-NLS-1$ + for (int i = 0; i < nodes.getLength(); i++) { + Bookmark bookmark = new Bookmark(); + Element column = (Element) nodes.item(i); + + String name = MetaDataXMLInterface.getElementText(column,"name"); //$NON-NLS-1$ + if (name == null) break; + bookmark.setName(name); + + MetaDataXMLInterface.getElementText(column,"name"); //$NON-NLS-1$ + bookmark.setUsername(MetaDataXMLInterface.getElementText(column,"username")); //$NON-NLS-1$ + bookmark.setPassword(MetaDataXMLInterface.getElementText(column,"password")); //$NON-NLS-1$ + bookmark.setPromptForPassword(Boolean.TRUE.toString().equalsIgnoreCase( + MetaDataXMLInterface.getElementText(column,"prompt"))); //$NON-NLS-1$ + bookmark.setConnect(MetaDataXMLInterface.getElementText(column,"connect")); //$NON-NLS-1$ + bookmark.setAutoCommit(Boolean.TRUE.toString().equalsIgnoreCase( + MetaDataXMLInterface.getElementText(column,"autoCommit", "True"))); //$NON-NLS-1$ + bookmark.setAutoCommitPreference(MetaDataXMLInterface.getElementText(column,"autoCommitPreference", IQuantumConstants.autoCommitTrue)); //$NON-NLS-1$ + bookmark.setDriver(MetaDataXMLInterface.getElementText(column,"driver")); //$NON-NLS-1$ + bookmark.addSchema(MetaDataXMLInterface.getElementText(column,"schema")); //$NON-NLS-1$ + bookmark.setType(MetaDataXMLInterface.getElementText(column,"type")); //$NON-NLS-1$ + bookmark.setDriverFile(MetaDataXMLInterface.getElementText(column,"driverLocation")); //$NON-NLS-1$ + NodeList children = column.getElementsByTagName(Messages.getString("ExportXMLAction.OtherSchemas")); + if (children.getLength() > 0) { + importSchemas((Element) children.item(0), bookmark); + } + System.out.println(bookmark.toString()); + if (!bookmark.isEmpty()) { + newBookmarks.addElement(bookmark); + } + importQuickList(bookmark, column); + importQueryList(bookmark, column); + } + this.bookmarks.addAll(newBookmarks); + this.support.firePropertyChange("bookmarks", null, null); + } + + private void importSchemas(Element otherSchemas, Bookmark bookmark) { + Vector vector = MetaDataXMLInterface.getVectorText(otherSchemas, Messages.getString("ExportXMLAction.SchemaName")); + List list = new ArrayList(); + for (Iterator i = vector.iterator(); i.hasNext();) { + String schemaName = (String) i.next(); + list.add(new Schema(schemaName)); + } + bookmark.setSchemas((Schema[]) list.toArray(new Schema[list.size()])); + } + + private void importQuickList(Bookmark bookmark, Element bookmarkElement) { + NodeList quickList = bookmarkElement.getElementsByTagName("quickList"); + for (int j = 0, + length = (quickList == null) ? 0 : quickList.getLength(); + j < length; + j++) { + + Element element = (Element) quickList.item(j); + NodeList childNodes = element.getChildNodes(); + + for (int k = 0, + length2 = (childNodes == null) ? 0 : childNodes.getLength(); + k < length2; + k++) { + if (Node.ELEMENT_NODE == childNodes.item(k).getNodeType()) { + Element entity = (Element) childNodes.item(k); + bookmark.addQuickListEntry(entity.getTagName(), + entity.getAttribute("schema"), entity.getAttribute("name")); + } + } + } + } + + private void importQueryList(Bookmark bookmark, Element bookmarkElement) { + NodeList queryList = bookmarkElement.getElementsByTagName("queryList"); + for (int i = 0, + length = (queryList == null) ? 0 : queryList.getLength(); + i < length; + i++) { + + Element element = (Element) queryList.item(i); + NodeList childNodes = element.getElementsByTagName("query"); + + for (int k = 0, + length2 = (childNodes == null) ? 0 : childNodes.getLength(); + k < length2; + k++) { + + Element query = (Element) childNodes.item(k); + bookmark.addQuery(MetaDataXMLInterface.getElementText(query,"queryString")); + + } + } + } + + public void addBookmark(Bookmark b) { + this.changed = true; + if (!bookmarks.contains(b)) { + Bookmark[] original = getBookmarks(); + bookmarks.add(b); + this.support.firePropertyChange("bookmarks", original, getBookmarks()); + } + } + public void removeBookmark(Bookmark b) { + this.changed = true; + if (bookmarks.contains(b)) { + Bookmark[] original = getBookmarks(); + bookmarks.remove(b); + this.support.firePropertyChange("bookmarks", original, getBookmarks()); + } + } + + public Bookmark[] getBookmarks() { + return (Bookmark[]) this.bookmarks.toArray(new Bookmark[this.bookmarks.size()]); + } + /** + * @return + */ + public boolean isAnythingChanged() { + boolean anythingChanged = this.changed; + for (Iterator i = this.bookmarks.iterator(); !anythingChanged && i.hasNext();) { + Bookmark bookmark = (Bookmark) i.next(); + anythingChanged |= bookmark.isChanged(); + } + return anythingChanged; + } + + public boolean isChanged() { + return this.changed; + } + + /** + * @param b + */ + public void setChanged(boolean changed) { + this.changed = changed; + } + + /** + * @param listener + */ + public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { + this.support.addPropertyChangeListener(listener); + } + + /** + * @param listener + */ + public synchronized void removePropertyChangeListener(PropertyChangeListener listener) { + this.support.removePropertyChangeListener(listener); + } + + /** + * @param string + * @return + */ + public String getCopyName(String name) { + + String copyName = Messages.getString("BookmarkView.CopyOf") + name; + int i = 1; + while (find(copyName) != null) + { + copyName = Messages.getString("BookmarkView.CopyOf") + name + "(" + String.valueOf(i) + ")"; + i++; + } + + return copyName; + } + + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/BookmarkHolder.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/BookmarkHolder.java new file mode 100644 index 0000000..1f4a35c --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/BookmarkHolder.java @@ -0,0 +1,17 @@ +/* + * Created on 22-jul-2003 + * + */ +package com.quantum.model; + + +/** + * User interface components that can provide a connection to the database they + * relate to implement this interface. Such components must know how to obtain a + * password, as required. + * + * @author panic + */ +public interface BookmarkHolder { + public Bookmark getBookmark(); +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Column.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Column.java new file mode 100644 index 0000000..53923e4 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Column.java @@ -0,0 +1,21 @@ +package com.quantum.model; + +/** + * + * @author bcholmes + */ +public interface Column { + public int getSize(); + public int getPrimaryKeyOrder(); + public boolean isPrimaryKey(); + public String getName(); + public int getNumberOfFractionalDigits(); + public String getTypeName(); + public boolean isReal(); + public boolean isNullable(); + public boolean isNumeric(); + public int getType(); + public Entity getParentEntity(); + public String getQualifiedTableName(); + public String getRemarks(); +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/ColumnImpl.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/ColumnImpl.java new file mode 100644 index 0000000..eb4e6cb --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/ColumnImpl.java @@ -0,0 +1,148 @@ +package com.quantum.model; + +import com.quantum.sql.SQLHelper; + +/** + * @author BC + */ +class ColumnImpl implements Column, Comparable { + + private int size; + private boolean nullable; + private int primaryKeyOrder; + private String name; + private Entity entity; + private int numberOfFractionalDigits; + private String typeName; + private int type; + private int position; + private String remarks; + + ColumnImpl(Entity entity, String name, String typeName, int type, + int size, int numberOfFractionalDigits, boolean nullable, int position, + String remarks) { + + this.entity = entity; + this.name = name; + this.typeName = typeName; + this.type = type; + this.size = size; + this.numberOfFractionalDigits = numberOfFractionalDigits; + this.nullable = nullable; + this.position = position; + this.remarks = remarks; + } + + /** + * @see com.quantum.model.Column#getPrimaryKeyOrder() + */ + public int getPrimaryKeyOrder() { + return this.primaryKeyOrder; + } + + /** + * @see com.quantum.model.Column#isPrimaryKey() + */ + public boolean isPrimaryKey() { + return getPrimaryKeyOrder() > 0; + } + + /** + * @see com.quantum.model.Column#getName() + */ + public String getName() { + return this.name; + } + + /** + * @see com.quantum.model.Column#getTypeName() + */ + public String getTypeName() { + return this.typeName; + } + + /** + * @see com.quantum.model.Column#isReal() + */ + public boolean isReal() { + return false; + } + + /** + * @see com.quantum.model.Column#isNullable() + */ + public boolean isNullable() { + return this.nullable; + } + + /** + * @see com.quantum.model.Column#isNumeric() + */ + public boolean isNumeric() { + return SQLHelper.isNumeric(this.type); + } + + /** + * @see com.quantum.model.Column#getType() + */ + public int getType() { + return this.type; + } + + /** + * @see com.quantum.model.Column#getParentEntity() + */ + public Entity getParentEntity() { + return this.entity; + } + + /** + * @see com.quantum.model.Column#getQualifiedTableName() + */ + public String getQualifiedTableName() { + return this.entity.getCondQualifiedName(); + } + /** + * @param i + */ + void setPrimaryKeyOrder(int i) { + this.primaryKeyOrder = i; + } + + /** + * @see java.lang.Comparable#compareTo(java.lang.Object) + */ + public int compareTo(Object o) { + ColumnImpl that = (ColumnImpl) o; + if (this.isPrimaryKey() && that.isPrimaryKey()) { + return this.primaryKeyOrder - that.primaryKeyOrder; + } else if (this.isPrimaryKey()) { + return -1; + } else if (that.isPrimaryKey()) { + return 1; + } else { + return this.position - that.position; + } + } + /** + * @return + */ + public int getSize() { + return size; + } + + /** + * @return + */ + public int getNumberOfFractionalDigits() { + return numberOfFractionalDigits; + } + + /** + * @return + */ + public String getRemarks() { + return this.remarks == null ? "" : this.remarks; + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/ConnectionException.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/ConnectionException.java new file mode 100644 index 0000000..f1da0bf --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/ConnectionException.java @@ -0,0 +1,56 @@ +package com.quantum.model; + +/** + * @author BC + */ +public class ConnectionException extends Exception { + + private Throwable cause = null; + + /** + * + */ + public ConnectionException() { + super(); + } + + /** + * @param message + */ + public ConnectionException(String message) { + super(message); + } + + /** + * @param message + * @param cause + */ + public ConnectionException(String message, Throwable cause) { + super(message); + this.cause = cause; + } + + /** + * @param cause + */ + public ConnectionException(Throwable cause) { + super(cause.getMessage()); + this.cause = cause; + } + + public Throwable getCause() { + return this.cause; + } + + public String toString() { + String base = super.toString(); + if (this.cause != null) { + base += System.getProperty("line.separator") + + "Root cause:" + + System.getProperty("line.separator") + + this.cause.toString(); + } + return base; + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Constraint.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Constraint.java new file mode 100644 index 0000000..f927ffc --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Constraint.java @@ -0,0 +1,8 @@ +package com.quantum.model; + +/** + * @author BC + */ +public interface Constraint { + public Entity getEntity(); +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Database.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Database.java new file mode 100644 index 0000000..b6dee05 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Database.java @@ -0,0 +1,214 @@ +package com.quantum.model; + +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import com.quantum.IQuantumConstants; +import com.quantum.adapters.DatabaseAdapter; +import com.quantum.sql.MultiSQLServer; +import com.quantum.sql.SQLResults; + +/** + * @author BC + */ +public class Database { + + private DatabaseAdapter databaseAdapter; + private Bookmark bookmark; + + public Database(Bookmark bookmark) { + this.bookmark = bookmark; + this.databaseAdapter = bookmark.getAdapter(); + } + + private static final String[] ALL_TYPES = { + IQuantumConstants.Table, + IQuantumConstants.View, + IQuantumConstants.Sequence }; + + private static final List STANDARD_TABLE_TYPES = + Collections.synchronizedList(new ArrayList()); + + static { + for (int i = 0, length = (ALL_TYPES == null) ? 0 : ALL_TYPES.length; + i < length; + i++) { + STANDARD_TABLE_TYPES.add(ALL_TYPES[i]); + } + } + + public String[] getEntityTypes() + throws NotConnectedException, SQLException { + return getEntityTypes(this.bookmark.getConnection(), this.bookmark.getSchemas()[0]); + } + + + /** + *

This method returns a list of entity types supported by the database + * adapter. This list will always be limited to Tables, Views and + * Sequences.

+ * + *

Not all databases support all types. MySQL only supports + * Tables. Informix supports Tables and Views. Oracle and DB2 support + * Tables, Views and Sequences.

+ * + * @param connection + * @param schema - + * This parameter is somewhat bogus. It is used to determine if the + * adapter defines an SQL statement for finding entities of a + * particular types. + * @return + * @throws SQLException + */ + public String[] getEntityTypes(Connection connection, Schema schema) + throws SQLException { + + Set set = new HashSet(); + if (this.databaseAdapter.getShowTableQuery(schema.getName(), false) != null) { + set.add(IQuantumConstants.Table); + } else if (this.databaseAdapter.getShowViewQuery(schema.getName(), false) != null) { + set.add(IQuantumConstants.View); + } else if (this.databaseAdapter.getShowSequenceQuery(schema.getName(), false) != null) { + set.add(IQuantumConstants.Sequence); + } + + DatabaseMetaData metaData = connection.getMetaData(); + ResultSet resultSet = metaData.getTableTypes(); + while (resultSet.next()) { + String type = resultSet.getString("TABLE_TYPE"); + if (type != null) { + type = type.trim(); + } + if (STANDARD_TABLE_TYPES.contains(type)) { + set.add(type); + } + } + + return (String[]) set.toArray(new String[set.size()]); + } + + public String getInformation() throws SQLException { + try { + Connection connection = this.bookmark.getConnection(); + DatabaseMetaData metaData = connection.getMetaData(); + + return metaData == null ? null : metaData.getDatabaseProductName() + " " + + metaData.getDatabaseProductVersion(); + } catch (NotConnectedException e) { + // TODO: think about this... + return ""; + } + } + + /** + * Get a list of entities (tables, views, sequences) for a particular + * bookmark. This function is usually not redefined because it gives + * an external interface. You will usually redefine the getShowTableQuery(), + * getShowViewQuery(), etc. + * + * @param bookmark - + * the bookmark that describes the database that is being accessed. + * @param passwordFinder - + * a utility class that knows how to obtain a password, if required + * @param schema - + * the schema from which to extract + * @param type - + * the type ("VIEW", "TABLE", etc.) of entities to extract or null + * if all entity types should be extracted + * @return + * an array of entity objects representing the tables, views and sequences. + * @throws SQLException + */ + public Entity[] getEntities(Bookmark bookmark, Schema schema, String type) + throws SQLException, NotConnectedException { + Connection connection = bookmark.getConnection(); + Entity[] result = getEntities(bookmark, connection, schema, type); + return (result == null) ? new Entity[0] : result; + } + + protected Entity[] getEntities(Bookmark bookmark, Connection connection, Schema schema, String type) + throws SQLException { + + List list = new ArrayList(); + String[] types = (type == null) ? ALL_TYPES : new String[] { type }; + + for (int i = 0; i < types.length; i++) { + list.addAll(getEntitiesList(bookmark, connection, types[i], schema)); + } + + return (Entity[]) list.toArray(new Entity[list.size()]); + } + + protected List getEntitiesList(Bookmark bookmark, Connection connection, String type, Schema schema) + throws SQLException { + + String sql = getSQL(bookmark, type, schema); + List list = new ArrayList(); + SQLResults results = null; + if (sql != null) { + results = MultiSQLServer.getInstance().execute(connection, sql); + for (int i = 1, size = (results == null) ? 0 : results.getRowCount(); i <= size; i++) { + String schemaName = results.getColumnCount() == 1 + ? schema.getName() : results.getElement(1, i).toString(); + String tableName = results.getColumnCount() == 1 + ? results.getElement(1, i).toString() + : results.getElement(2, i).toString(); + if (tableName != null && tableName.length() > 0) { + Entity entity = EntityFactory.getInstance().create( + bookmark, schemaName, tableName, type); + if (entity != null) { + list.add(entity); + } + } + } + } + // If we have some results, we go back + if (results != null) return list; + // Else, we try the JDBC driver + DatabaseMetaData metaData = connection.getMetaData(); + // getTables needs a null schema to get all the schemas. So we don't pass a "" schema, but a null one + ResultSet set = null; + if (metaData.supportsSchemasInTableDefinitions()) + set = metaData.getTables(null, (schema != null) ? schema.getName() : null, "%", new String[] { type }); + else + set = metaData.getTables(null, null, "%", new String[] { type }); + + while (set.next()) { + String tempSchema = set.getString("TABLE_SCHEM"); + tempSchema = (tempSchema == null) ? "" : tempSchema.trim(); + String tableName = set.getString("TABLE_NAME"); + tableName = (tableName == null) ? "" : tableName.trim(); + + if (tableName != null && tableName.length() > 0) { + Entity entity = EntityFactory.getInstance().create(bookmark, tempSchema, tableName, type); + if (entity != null) { + list.add(entity); + } + } + } + set.close(); + return list; + } + + + private String getSQL(Bookmark bookmark, String type, Schema schema) { + if (Entity.TABLE_TYPE.equals(type)) { + return this.databaseAdapter.getShowTableQuery(schema.getName(), schema.isDefault()); + } else if (Entity.VIEW_TYPE.equals(type)) { + return this.databaseAdapter.getShowViewQuery(schema.getName(), schema.isDefault()); + } else if (Entity.SEQUENCE_TYPE.equals(type)) { + return this.databaseAdapter.getShowSequenceQuery(schema.getName(), schema.isDefault()); + } else { + return null; + } + } + + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Entity.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Entity.java new file mode 100644 index 0000000..845c751 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Entity.java @@ -0,0 +1,40 @@ +package com.quantum.model; + +import com.quantum.IQuantumConstants; + +/** + * @author BC + */ +public interface Entity extends BookmarkHolder { + + public static final String TABLE_TYPE = IQuantumConstants.Table; + public static final String VIEW_TYPE = IQuantumConstants.View; + public static final String SEQUENCE_TYPE = IQuantumConstants.Sequence; + + public String getName(); + public String getSchema(); + public String getType(); + public Column[] getColumns(); + public Index[] getIndexes(); + public Column getColumn(String columnName); + /** + * Returns a String with the qualified name of the Entity. + * That is, "schema.name". The difference with getQualifiedName() + * is that the schema may be absent if it's not defined in the bookmark + */ + public String getCondQualifiedName(); + + /** + * @return - TRUE if the entity exists in the database
+ * - FALSE if the entity does not exist in the database
+ * - null if it's not known whether or not the + * entity exists in the database. + */ + public Boolean exists(); + /** + * Some databases support mixed-case table names. Queries issued + * against these tables must be quoted. + * @return + */ + public String getQuotedTableName(); +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/EntityFactory.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/EntityFactory.java new file mode 100644 index 0000000..de48c0f --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/EntityFactory.java @@ -0,0 +1,36 @@ +package com.quantum.model; + + +/** + * + * + * @author BC + */ +public class EntityFactory { + + private static EntityFactory instance = new EntityFactory(); + + private EntityFactory() { + } + + public static EntityFactory getInstance() { + return EntityFactory.instance; + } + + public Entity create(Bookmark bookmark, String schema, String name, String type) { + if (type != null) { + type = type.toUpperCase().trim(); + } + + if (Entity.TABLE_TYPE.equals(type)) { + return new TableImpl(bookmark, schema, name); + } else if (Entity.VIEW_TYPE.equals(type)) { + return new ViewImpl(bookmark, schema, name); + } else if (Entity.SEQUENCE_TYPE.equals(type)) { + return new SequenceImpl(bookmark, schema, name); + } else { + return null; +// throw new IllegalArgumentException("Unknown type: " + type); + } + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/EntityHolder.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/EntityHolder.java new file mode 100644 index 0000000..897c82b --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/EntityHolder.java @@ -0,0 +1,8 @@ +package com.quantum.model; + +/** + * @author BC + */ +public interface EntityHolder { + public Entity getEntity(); +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/EntityImpl.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/EntityImpl.java new file mode 100644 index 0000000..a960fbb --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/EntityImpl.java @@ -0,0 +1,182 @@ + package com.quantum.model; + +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.quantum.adapters.AdapterFactory; +import com.quantum.adapters.DatabaseAdapter; + +/** + * This class models a table or view. + * + * @author bcholmes + */ +abstract class EntityImpl implements Entity { + private String schema; + private String name; + private String type; + private Bookmark bookmark; + private Boolean exists = Boolean.TRUE; + + public EntityImpl(Bookmark bookmark, String schema, String name, String type) { + this.schema = schema; + this.name = name; + this.type = type; + this.bookmark = bookmark; + } + public Bookmark getBookmark() { + return this.bookmark; + } + public String getName() { + return this.name; + } + public String getSchema() { + return this.schema; + } + public String getType() { + return this.type; + } + public String getCondQualifiedName() { + return (this.schema == null || this.schema.length() == 0) ? + this.name : this.schema + "." + this.name; + } + public Column getColumn(String columnName) { + Column column = null; + Column[] columns = getColumns(); + for (int i = 0, length = (columns == null) ? 0 : columns.length; + column == null && i < length; + i++) { + if (columnName != null && columnName.equals(columns[i].getName())) { + column = columns[i]; + } + } + return column; + } + public Column[] getColumns() { + + Column[] columns = new Column[0]; + try { + // TODO: Some DBs (like DB2) don't support metadata + Map temp = new HashMap(); + Connection connection = this.bookmark.getConnection(); + DatabaseMetaData metaData = connection.getMetaData(); + ResultSet resultSet = metaData.getColumns(null, getSchema(), getName(), null); + + while (resultSet.next()) { + ColumnImpl column = new ColumnImpl( + this, + resultSet.getString("COLUMN_NAME"), + resultSet.getString("TYPE_NAME"), + resultSet.getInt("DATA_TYPE"), + resultSet.getInt("COLUMN_SIZE"), + resultSet.getInt("DECIMAL_DIGITS"), + "YES".equalsIgnoreCase(resultSet.getString("IS_NULLABLE")), + resultSet.getInt("ORDINAL_POSITION"), + getComments(resultSet.getString("REMARKS"),getCondQualifiedName(), resultSet.getString("COLUMN_NAME")) + ); + temp.put(column.getName(), column); + } + resultSet.close(); + + resultSet = metaData.getPrimaryKeys(null, getSchema(), getName()); + while (resultSet.next()) { + String name = resultSet.getString("COLUMN_NAME"); + short keySequence = resultSet.getShort("KEY_SEQ"); + ColumnImpl column = (ColumnImpl) temp.get(name); + if (column != null) { + column.setPrimaryKeyOrder(keySequence); + } + } + resultSet.close(); + + List columnList = Collections.synchronizedList( + new ArrayList(temp.values())); + Collections.sort(columnList); + columns = (Column[]) columnList.toArray(new Column[columnList.size()]); + + } catch (NotConnectedException e) { + } catch (SQLException e) { + } + return columns; + } + + /** + * Some JDBC drivers (Oracle for example) won't return the comments + * We recheck with a custom query, if it's defined + * @param iniComment The already got comment + * @param tableName The fully qualified table name + * @param columnName The column name + */ + private String getComments( String iniComment, String tableName, String columnName) { + if (iniComment != null && iniComment.length() > 0) + return iniComment; + String comment = ""; + try { + Connection con = this.bookmark.getConnection(); + Statement stmt = con.createStatement(); + DatabaseAdapter adapter = AdapterFactory.getInstance().getAdapter(this.bookmark.getType()); + if (adapter != null && stmt != null && adapter.getCommentsQuery(tableName, columnName) != null) { + + stmt.execute(adapter.getCommentsQuery(tableName, columnName)); + ResultSet set = stmt.getResultSet(); + if (set.next()) + comment = set.getString(1); + } + } catch (NotConnectedException e) { + } catch (SQLException e) { + } + + return comment; + } + public Index[] getIndexes() { + + List indexList = new ArrayList(); + Map temp = new HashMap(); + try { + Connection connection = this.bookmark.getConnection(); + DatabaseMetaData metaData = connection.getMetaData(); + ResultSet resultSet = metaData.getIndexInfo(null, getSchema(), getName(), false, false); + + while (resultSet.next()) { + String indexName = resultSet.getString("INDEX_NAME"); + IndexImpl index = (IndexImpl) temp.get(indexName); + if (index == null) { + index = new IndexImpl(this, indexName); + temp.put(indexName, index); + } + String columnName = resultSet.getString("COLUMN_NAME"); + String ascending = resultSet.getString("ASC_OR_DESC"); + index.addColumn(columnName, ascending == null + ? null : (ascending.toUpperCase().startsWith("A") + ? Boolean.TRUE : Boolean.FALSE)); + } + resultSet.close(); + indexList.addAll(temp.values()); + + } catch (NotConnectedException e) { + } catch (SQLException e) { + } + return (Index[]) indexList.toArray(new Index[indexList.size()]); + } + + public Boolean exists() { + return this.exists; + } + + + /** + * @see com.quantum.model.Entity#getQuotedTableName() + */ + public String getQuotedTableName() { + return getBookmark().getAdapter().filterTableName(getCondQualifiedName()); + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/ForeignKey.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/ForeignKey.java new file mode 100644 index 0000000..6a39917 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/ForeignKey.java @@ -0,0 +1,15 @@ +package com.quantum.model; + +/** + * @author BC + */ +public interface ForeignKey extends Constraint { + public String getName(); + public Entity getForeignEntity(); + public String getForeignEntityName(); + public String getForeignEntitySchema(); + public int getNumberOfColumns(); + public String getLocalColumnName(int index); + public String getForeignColumnName(int index); + public int getDeleteRule(); +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/HasMetaData.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/HasMetaData.java new file mode 100644 index 0000000..6d1ab1f --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/HasMetaData.java @@ -0,0 +1,24 @@ +/* + * Created on 22-jul-2003 + * + */ +package com.quantum.model; + +import com.quantum.sql.metadata.ObjectMetaData; + +/** + * Interface for objects that offer metadata support + * @author panic + * + */ +public interface HasMetaData { + public ObjectMetaData getMetaData() throws NotConnectedException; + /** + * Returns a String with the qualified name of the Entity. + * That is, "schema.name". The difference with getConQualifiedName() + * is that the schema is always present if the database supports schemas. + * @return + */ + public String getQualifiedName(); + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Index.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Index.java new file mode 100644 index 0000000..3aa5cf5 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Index.java @@ -0,0 +1,13 @@ +package com.quantum.model; + +/** + * @author BC + */ +public interface Index { + public String getName(); + public int getNumberOfColumns(); + public String getColumnName(int ordinalPosition); + public Entity getParentEntity(); + public boolean isAscending(int ordinalPosition); + public boolean isDescending(int ordinalPosition); +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/IndexImpl.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/IndexImpl.java new file mode 100644 index 0000000..2bda513 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/IndexImpl.java @@ -0,0 +1,69 @@ +package com.quantum.model; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * @author BC + */ +/*package*/ class IndexImpl implements Index { + + private String name; + private List columnNames = Collections.synchronizedList(new ArrayList()); + private Entity entity; + private List ascending = Collections.synchronizedList(new ArrayList()); + + IndexImpl(Entity entity, String name) { + + this.name = name; + this.entity = entity; + } + + void addColumn(String columnName, Boolean ascending) { + this.columnNames.add(columnName); + this.ascending.add(ascending); + } + + public String getName() { + return this.name; + } + + /** + * @see com.quantum.model.Index#getNumberOfColumns() + */ + public int getNumberOfColumns() { + return this.columnNames.size(); + } + + /** + * @see com.quantum.model.Index#getColumnName(int) + */ + public String getColumnName(int ordinalPosition) { + return (String) this.columnNames.get(ordinalPosition); + } + + /** + * @see com.quantum.model.Index#getParentEntity() + */ + public Entity getParentEntity() { + return this.entity; + } + + /** + * @see com.quantum.model.Index#isAscending() + */ + public boolean isAscending(int ordinalPosition) { + Boolean ascending = (Boolean) this.ascending.get(ordinalPosition); + return Boolean.TRUE.equals(ascending); + } + + /** + * @see com.quantum.model.Index#isDescending() + */ + public boolean isDescending(int ordinalPosition) { + Boolean ascending = (Boolean) this.ascending.get(ordinalPosition); + return Boolean.FALSE.equals(ascending); + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/NotConnectedException.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/NotConnectedException.java new file mode 100644 index 0000000..0f4ee12 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/NotConnectedException.java @@ -0,0 +1,8 @@ +package com.quantum.model; + +/** + * @author BC + */ +public class NotConnectedException extends ConnectionException { + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/PasswordFinder.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/PasswordFinder.java new file mode 100644 index 0000000..4ba0e1d --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/PasswordFinder.java @@ -0,0 +1,15 @@ +package com.quantum.model; + +/** + * When a bookmark doesn't have a saved password, an + * implementation of a password finder class can be called + * to obtain one. + * + * @author BC + */ +public interface PasswordFinder { + + public String getPassword(); + public boolean isPasswordMeantToBeSaved(); + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Schema.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Schema.java new file mode 100644 index 0000000..154e15b --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Schema.java @@ -0,0 +1,109 @@ +package com.quantum.model; + +/** + * @author BC + */ +public class Schema implements Comparable { + + private String name; + private String displayName; + private boolean isDefault; + + + public Schema() { + } + + public Schema(String name, String displayName, boolean isDefault) { + this.name = name; + this.displayName = displayName; + this.isDefault = isDefault; + } + + public Schema(String name) { + this(name, name, false); + } + + /** + * @return + */ + public String getName() { + return name; + } + + /** + * @param string + */ + public void setName(String string) { + name = string; + } + + /** + * @see java.lang.Comparable#compareTo(java.lang.Object) + */ + public int compareTo(Object o) { + Schema that = (Schema) o; + if (that.isDefault() == this.isDefault()) { + return this.getDisplayName().compareTo(that.getDisplayName()); + } else { + return that.isDefault() ? 1 : -1; + } + } + public boolean equals(Object obj) { + if (getClass() != obj.getClass()) { + return false; + } else { + Schema that = (Schema) obj; + if (this.name == null && !(that.name == null)) { + return false; + } else if (this.name != null && !this.name.equals(that.name)) { + return false; + } else if (this.displayName == null && !(that.displayName == null)) { + return false; + } else if (this.displayName == null && !this.displayName.equals(that.displayName)) { + return false; + } else { + return true; + } + } + } + public int hashCode() { + int hashCode = super.hashCode(); + if (this.name != null) { + hashCode ^= this.name.hashCode(); + } + if (this.displayName != null) { + hashCode ^= this.displayName.hashCode(); + } + + return hashCode; + } + + /** + * @return + */ + public boolean isDefault() { + return isDefault; + } + + /** + * @param b + */ + public void setDefault(boolean isDefault) { + this.isDefault = isDefault; + } + + /** + * @return + */ + public String getDisplayName() { + return displayName; + } + + /** + * @param string + */ + public void setDisplayName(String string) { + displayName = string; + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/SchemaHolder.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/SchemaHolder.java new file mode 100644 index 0000000..7961492 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/SchemaHolder.java @@ -0,0 +1,8 @@ +package com.quantum.model; + +/** + * @author BC + */ +public interface SchemaHolder { + public Schema getSchema(); +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Sequence.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Sequence.java new file mode 100644 index 0000000..374af35 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Sequence.java @@ -0,0 +1,8 @@ +package com.quantum.model; + +/** + * @author BC + */ +public interface Sequence extends Entity { + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/SequenceImpl.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/SequenceImpl.java new file mode 100644 index 0000000..0443906 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/SequenceImpl.java @@ -0,0 +1,13 @@ +package com.quantum.model; + +class SequenceImpl extends EntityImpl implements Sequence { + public SequenceImpl(Bookmark bookmark, String schema, String name) { + super(bookmark, schema, name, SEQUENCE_TYPE); + } + public Column[] getColumns() { + return new Column[0]; + } + public Column getColumn(String columnName) { + return null; + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Table.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Table.java new file mode 100644 index 0000000..91bbc31 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Table.java @@ -0,0 +1,11 @@ +package com.quantum.model; + +import java.sql.SQLException; + +/** + * @author BC + */ +public interface Table extends Entity { + public Integer getSize(); + public void deleteAllRows() throws SQLException, ConnectionException; +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/TableImpl.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/TableImpl.java new file mode 100644 index 0000000..161ab0f --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/TableImpl.java @@ -0,0 +1,31 @@ +package com.quantum.model; + +import java.sql.SQLException; + +import com.quantum.adapters.AdapterFactory; +import com.quantum.sql.MultiSQLServer; +import com.quantum.sql.SQLHelper; + + +class TableImpl extends EntityImpl implements Table { + public TableImpl(Bookmark bookmark, String schema, String name) { + super(bookmark, schema, name, TABLE_TYPE); + } + + public Integer getSize() { + Integer size = null; + try { + size = new Integer(SQLHelper.getSize( + getBookmark().getConnection(), getCondQualifiedName(), + AdapterFactory.getInstance().getAdapter(getBookmark().getType()))); + } catch (SQLException e) { + } catch (ConnectionException e) { + } + return size; + } + + public void deleteAllRows() throws SQLException, ConnectionException { + String sql = "DELETE FROM " + getCondQualifiedName(); + MultiSQLServer.getInstance().execute(getBookmark().getConnection(), sql); + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/View.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/View.java new file mode 100644 index 0000000..2078bf4 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/View.java @@ -0,0 +1,11 @@ +package com.quantum.model; + + +/** + * @author BC + */ +public interface View extends Entity { + + public Integer getSize(); + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/ViewImpl.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/ViewImpl.java new file mode 100644 index 0000000..7a49d86 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/ViewImpl.java @@ -0,0 +1,25 @@ +package com.quantum.model; + +import java.sql.SQLException; + +import com.quantum.adapters.AdapterFactory; +import com.quantum.sql.SQLHelper; + + +class ViewImpl extends EntityImpl implements View { + public ViewImpl(Bookmark bookmark, String schema, String name) { + super(bookmark, schema, name, VIEW_TYPE); + } + + public Integer getSize() { + Integer size = null; + try { + size = new Integer(SQLHelper.getSize( + getBookmark().getConnection(), getCondQualifiedName(), + AdapterFactory.getInstance().getAdapter(getBookmark().getType()))); + } catch (SQLException e) { + } catch (ConnectionException e) { + } + return size; + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/xml/ModelToXMLConverter.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/xml/ModelToXMLConverter.java new file mode 100644 index 0000000..908b239 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/xml/ModelToXMLConverter.java @@ -0,0 +1,150 @@ +package com.quantum.model.xml; + +import com.quantum.Messages; +import com.quantum.model.Bookmark; +import com.quantum.model.Column; +import com.quantum.model.Entity; +import com.quantum.model.Schema; +import com.quantum.sql.metadata.MetaDataXMLInterface; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Text; + +/** + * @author BC + */ +public class ModelToXMLConverter { + + private static final ModelToXMLConverter instance = new ModelToXMLConverter(); + + private ModelToXMLConverter() { + } + + public static ModelToXMLConverter getInstance() { + return ModelToXMLConverter.instance; + } + + public void createRoot(Document document) { + document.appendChild(document.createElement("SAVED_DATA")); + } + + public void convert(Element bookmarkRoot, Bookmark b) { + Document document = bookmarkRoot.getOwnerDocument(); + Element bookmark = MetaDataXMLInterface.createElementText(bookmarkRoot,"bookmark", ""); //$NON-NLS-1$ //$NON-NLS-2$ + MetaDataXMLInterface.createElementText(bookmark,"name", b.getName()); //$NON-NLS-1$ + MetaDataXMLInterface.createElementText(bookmark,"username", b.getUsername()); //$NON-NLS-1$ + MetaDataXMLInterface.createElementText(bookmark,"password", b.getPassword()); //$NON-NLS-1$ + MetaDataXMLInterface.createElementText(bookmark,"prompt", b.getPromptForPassword() ? "true" : "false"); //$NON-NLS-1$ + MetaDataXMLInterface.createElementText(bookmark,"connect", b.getConnect()); //$NON-NLS-1$ + MetaDataXMLInterface.createElementText(bookmark,"autoCommit", b.isAutoCommit() ? "true" : "false"); //$NON-NLS-1$ + MetaDataXMLInterface.createElementText(bookmark,"autoCommitPreference", b.getAutoCommitPreference()); //$NON-NLS-1$ + MetaDataXMLInterface.createElementText(bookmark,"driver", b.getDriver()); //$NON-NLS-1$ + MetaDataXMLInterface.createElementText(bookmark,"type", b.getType()); //$NON-NLS-1$ + MetaDataXMLInterface.createElementText(bookmark,"driverLocation", b.getDriverFile()); //$NON-NLS-1$ + Element otherSchemas = (Element) bookmark.appendChild(document.createElement(Messages.getString("ExportXMLAction.OtherSchemas"))); //$NON-NLS-1$ + Schema[] schemas = b.getSchemas(); + for (int i = 0, length = (schemas == null) ? 0 : schemas.length; + i < length; + i++) { + if (!schemas[i].isDefault()) { + MetaDataXMLInterface.createElementText( + otherSchemas,Messages.getString("ExportXMLAction.SchemaName"), schemas[i].getName()); //$NON-NLS-1$ + } + } + Entity[] quickList = b.getQuickListEntries(); + Element quickListEntity = document.createElement("quickList"); + for (int j = 0, length = (quickList == null) ? 0 : quickList.length; + j < length; + j++) { + ModelToXMLConverter.getInstance().convert(quickListEntity, quickList[j]); + } + bookmark.appendChild(quickListEntity); + convertQueryList(b, bookmark); + } + + + public void convert(Element parent, Entity entity) { + convert(parent, entity, true); + } + public void convert(Element parent, Entity entity, boolean recurse) { + Document document = parent.getOwnerDocument(); + Element element = document.createElement(getEntityDOMNodeName(entity)); + element.setAttribute("name", entity.getName()); + if (entity.getSchema() != null) { + element.setAttribute("schema", entity.getSchema()); + } + if (recurse) { + convert(element, entity.getColumns()); + } + parent.appendChild(element); + } + + public void convert(Element element, Column[] columns) { + for (int i = 0, length = (columns == null) ? 0 : columns.length; + i < length; + i++) { + convert(element, columns[i]); + } + } + + public void convert(Element parent, Column column) { + Document document = parent.getOwnerDocument(); + Element element = document.createElement("column"); + element.setAttribute("name", column.getName()); + element.setAttribute("type", column.getTypeName()); + element.setAttribute("primaryKey", column.isPrimaryKey() ? "true" : "false"); + element.setAttribute("nullable", column.isNullable() ? "true" : "false"); + if (column.isNumeric()) { + if (column.getSize() > 0) { + element.setAttribute("size", String.valueOf(column.getSize())); + } + if (column.getNumberOfFractionalDigits() > 0) { + element.setAttribute("numberOfFractionalDigits", String.valueOf(column.getNumberOfFractionalDigits())); + } + } else { + if (column.getSize() > 0) { + element.setAttribute("size", String.valueOf(column.getSize())); + } + } + if (column.getRemarks().length() > 0) + MetaDataXMLInterface.createElementText(element, "remarks", column.getRemarks()); + parent.appendChild(element); + } + + + public String getEntityDOMNodeName(Entity entity) { + if (Entity.TABLE_TYPE.equals(entity.getType())) { + return "table"; + } else if (Entity.VIEW_TYPE.equals(entity.getType())) { + return "view"; + } else if (Entity.SEQUENCE_TYPE.equals(entity.getType())) { + return "sequence"; + } else { + return "unknown"; + } + } + + public void convertQueryList( + Bookmark bookmark, + Element parent) { + + Document document = parent.getOwnerDocument(); + String[] queryList = bookmark.getQueries(); + Element queryListEntity = document.createElement("queryList"); + for (int j = 0, length = (queryList == null) ? 0 : queryList.length; + j < length; + j++) { + Element query = document.createElement("query"); + + // will have more possibilities later + Element queryString = document.createElement("queryString"); + Text queryText = document.createTextNode(queryList[j]); + queryString.appendChild(queryText); + query.appendChild(queryString); + queryListEntity.appendChild(query); + } + parent.appendChild(queryListEntity); + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/xml/TorqueConverter.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/xml/TorqueConverter.java new file mode 100644 index 0000000..15c3c57 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/xml/TorqueConverter.java @@ -0,0 +1,90 @@ +package com.quantum.model.xml; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.sql.SQLException; +import java.sql.Types; + +import com.quantum.model.Bookmark; +import com.quantum.model.Column; +import com.quantum.model.Entity; +import com.quantum.model.Schema; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * @author BC + */ +public class TorqueConverter { + public void createRoot(Document document) { + Element root = document.createElement("database"); + document.appendChild(root); + } + public void convert(Element root, Bookmark bookmark, Schema schema) { + try { + Entity[] tables = bookmark.getEntitiesForSchema( + schema, Entity.TABLE_TYPE); + + for (int i = 0, length = (tables == null) ? 0 : tables.length; + i < length; + i++) { + convert(root, tables[i]); + } + } catch (SQLException e) { + } + } + + public void convert(Element root, Entity entity) { + Element table = root.getOwnerDocument().createElement("table"); + table.setAttribute("name", entity.getName()); + + Column[] columns = entity.getColumns(); + for (int i = 0, length = (columns == null) ? 0 : columns.length; + i < length; + i++) { + convert(table, columns[i]); + } + + root.appendChild(table); + } + + public void convert(Element root, Column column) { + Element element = root.getOwnerDocument().createElement("column"); + element.setAttribute("name", column.getName()); + if (column.isPrimaryKey()) { + element.setAttribute("primaryKey", "true"); + } + element.setAttribute("required", column.isNullable() ? "false" : "true"); + if (column.isNumeric() && column.getNumberOfFractionalDigits() > 0) { + element.setAttribute("size", String.valueOf(column.getSize()) + + "," + String.valueOf(column.getNumberOfFractionalDigits())); + } else if (column.getSize() >= 0) { + element.setAttribute("size", String.valueOf(column.getSize())); + } + element.setAttribute("type", getStandardType(column.getType())); + + root.appendChild(element); + } + + private String getStandardType(int type) { + String result = null; + try { + Field[] fields = Types.class.getFields(); + for (int i = 0, length = (fields == null) ? 0 : fields.length; + result == null & i < length; + i++) { + if (fields[i].getDeclaringClass() == Integer.TYPE && + Modifier.isStatic(fields[i].getModifiers()) && + Modifier.isPublic(fields[i].getModifiers()) && + type == fields[i].getLong(null)) { + + result = fields[i].getName(); + } + } + } catch (IllegalAccessException e) { + // shouldn't happen + } + return result; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/perspective/DBPerspective.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/perspective/DBPerspective.java new file mode 100644 index 0000000..c47f2ce --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/perspective/DBPerspective.java @@ -0,0 +1,30 @@ +package com.quantum.perspective; + +import org.eclipse.ui.IFolderLayout; +import org.eclipse.ui.IPageLayout; +import org.eclipse.ui.IPerspectiveFactory; + +/** + * @author root + */ +public class DBPerspective implements IPerspectiveFactory { + public void createInitialLayout(IPageLayout layout) { + layout.setEditorAreaVisible(false); + IFolderLayout side = + layout.createFolder( + "side", //$NON-NLS-1$ + IPageLayout.LEFT, + 0.33F, + layout.getEditorArea()); + side.addView("com.quantum.view.bookmarkview"); //$NON-NLS-1$ + layout.addView("com.quantum.view.sqlqueryview", IPageLayout.BOTTOM, 0.33F, layout.getEditorArea()); //$NON-NLS-1$ + IFolderLayout bottomRight = + layout.createFolder( + "bottomRight", //$NON-NLS-1$ + IPageLayout.BOTTOM, + 0.33F, + "com.quantum.view.sqlqueryview"); + bottomRight.addView("com.quantum.view.tableview.TableView"); //$NON-NLS-1$ + bottomRight.addView("com.quantum.view.logview"); //$NON-NLS-1$ + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/CopyPreferences.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/CopyPreferences.java new file mode 100644 index 0000000..51df2dc --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/CopyPreferences.java @@ -0,0 +1,37 @@ +package com.quantum.preferences; + + +import com.quantum.QuantumPlugin; + +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.StringFieldEditor; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +public class CopyPreferences + extends FieldEditorPreferencePage + implements IWorkbenchPreferencePage { + + public CopyPreferences() { + super(FieldEditorPreferencePage.GRID); + + // Set the preference store for the preference page. + IPreferenceStore store = + QuantumPlugin.getDefault().getPreferenceStore(); + setPreferenceStore(store); + } + + public void init(IWorkbench workbench) { + this.workbench = workbench; + } + + IWorkbench workbench; + + protected void createFieldEditors() { + StringFieldEditor copyColumnSeparator = new StringFieldEditor("copyColumnSeparator", "&Normal Copy Separator:", getFieldEditorParent()); + this. + addField(copyColumnSeparator); + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/CustomCopyPreferences.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/CustomCopyPreferences.java new file mode 100644 index 0000000..065fbb3 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/CustomCopyPreferences.java @@ -0,0 +1,46 @@ +package com.quantum.preferences; + + +import com.quantum.QuantumPlugin; + +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.StringFieldEditor; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +public class CustomCopyPreferences + extends FieldEditorPreferencePage + implements IWorkbenchPreferencePage { + + public CustomCopyPreferences() { + super(FieldEditorPreferencePage.GRID); + + // Set the preference store for the preference page. + IPreferenceStore store = + QuantumPlugin.getDefault().getPreferenceStore(); + setPreferenceStore(store); + } + + public void init(IWorkbench workbench) { + this.workbench = workbench; + } + + IWorkbench workbench; + + protected void createFieldEditors() { + StringFieldEditor customCopyName = new StringFieldEditor("customCopyName1", "&Name:", getFieldEditorParent()); + addField(customCopyName); + StringFieldEditor customCopyTableItem = new StringFieldEditor("customCopyTableItem1", "&Table Item:", getFieldEditorParent()); + addField(customCopyTableItem); + StringFieldEditor customCopyTableSeparator = new StringFieldEditor("customCopyTableSeparator1", "&Table Separator:", getFieldEditorParent()); + addField(customCopyTableSeparator); + StringFieldEditor customCopyColumnItem = new StringFieldEditor("customCopyColumnItem1", "&Column Item:", getFieldEditorParent()); + addField(customCopyColumnItem); + StringFieldEditor customCopyColumnSeparator = new StringFieldEditor("customCopyColumnSeparator1", "&Column Separator:", getFieldEditorParent()); + addField(customCopyColumnSeparator); + StringFieldEditor customCopyTemplate = new StringFieldEditor("customCopyTemplate1", "&Template:", getFieldEditorParent()); + addField(customCopyTemplate); + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/CustomCopyPreferences2.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/CustomCopyPreferences2.java new file mode 100644 index 0000000..ad0fbf4 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/CustomCopyPreferences2.java @@ -0,0 +1,46 @@ +package com.quantum.preferences; + + +import com.quantum.QuantumPlugin; + +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.StringFieldEditor; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +public class CustomCopyPreferences2 + extends FieldEditorPreferencePage + implements IWorkbenchPreferencePage { + + public CustomCopyPreferences2() { + super(FieldEditorPreferencePage.GRID); + + // Set the preference store for the preference page. + IPreferenceStore store = + QuantumPlugin.getDefault().getPreferenceStore(); + setPreferenceStore(store); + } + + public void init(IWorkbench workbench) { + this.workbench = workbench; + } + + IWorkbench workbench; + + protected void createFieldEditors() { + StringFieldEditor customCopyName = new StringFieldEditor("customCopyName2", "&Name:", getFieldEditorParent()); + addField(customCopyName); + StringFieldEditor customCopyTableItem = new StringFieldEditor("customCopyTableItem2", "&Table Item:", getFieldEditorParent()); + addField(customCopyTableItem); + StringFieldEditor customCopyTableSeparator = new StringFieldEditor("customCopyTableSeparator2", "&Table Separator:", getFieldEditorParent()); + addField(customCopyTableSeparator); + StringFieldEditor customCopyColumnItem = new StringFieldEditor("customCopyColumnItem2", "&Column Item:", getFieldEditorParent()); + addField(customCopyColumnItem); + StringFieldEditor customCopyColumnSeparator = new StringFieldEditor("customCopyColumnSeparator2", "&Column Separator:", getFieldEditorParent()); + addField(customCopyColumnSeparator); + StringFieldEditor customCopyTemplate = new StringFieldEditor("customCopyTemplate2", "&Template:", getFieldEditorParent()); + addField(customCopyTemplate); + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/CustomCopyPreferences3.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/CustomCopyPreferences3.java new file mode 100644 index 0000000..2b3cf1b --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/CustomCopyPreferences3.java @@ -0,0 +1,46 @@ +package com.quantum.preferences; + + +import com.quantum.QuantumPlugin; + +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.StringFieldEditor; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +public class CustomCopyPreferences3 + extends FieldEditorPreferencePage + implements IWorkbenchPreferencePage { + + public CustomCopyPreferences3() { + super(FieldEditorPreferencePage.GRID); + + // Set the preference store for the preference page. + IPreferenceStore store = + QuantumPlugin.getDefault().getPreferenceStore(); + setPreferenceStore(store); + } + + public void init(IWorkbench workbench) { + this.workbench = workbench; + } + + IWorkbench workbench; + + protected void createFieldEditors() { + StringFieldEditor customCopyName = new StringFieldEditor("customCopyName3", "&Name:", getFieldEditorParent()); + addField(customCopyName); + StringFieldEditor customCopyTableItem = new StringFieldEditor("customCopyTableItem3", "&Table Item:", getFieldEditorParent()); + addField(customCopyTableItem); + StringFieldEditor customCopyTableSeparator = new StringFieldEditor("customCopyTableSeparator3", "&Table Separator:", getFieldEditorParent()); + addField(customCopyTableSeparator); + StringFieldEditor customCopyColumnItem = new StringFieldEditor("customCopyColumnItem3", "&Column Item:", getFieldEditorParent()); + addField(customCopyColumnItem); + StringFieldEditor customCopyColumnSeparator = new StringFieldEditor("customCopyColumnSeparator3", "&Column Separator:", getFieldEditorParent()); + addField(customCopyColumnSeparator); + StringFieldEditor customCopyTemplate = new StringFieldEditor("customCopyTemplate3", "&Template:", getFieldEditorParent()); + addField(customCopyTemplate); + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/GlobalPreferences.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/GlobalPreferences.java new file mode 100644 index 0000000..05156eb --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/GlobalPreferences.java @@ -0,0 +1,49 @@ +package com.quantum.preferences; + + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; + +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.IntegerFieldEditor; +import org.eclipse.jface.preference.StringFieldEditor; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +/** + * PreferencePage for the global options on QuantumDB + * @author panic + * + */ +public class GlobalPreferences +extends FieldEditorPreferencePage +implements IWorkbenchPreferencePage { + + public GlobalPreferences() { + super(FieldEditorPreferencePage.GRID); + + // Set the preference store for the preference page. + IPreferenceStore store = + QuantumPlugin.getDefault().getPreferenceStore(); + setPreferenceStore(store); + } + + public void init(IWorkbench workbench) { + this.workbench = workbench; + } + + IWorkbench workbench; + + protected void createFieldEditors() { + IntegerFieldEditor queryHistorySize = new IntegerFieldEditor( + "com.quantum.model.Bookmark.queryHistorySize", + Messages.getString(getClass().getName() + "." + + "com.quantum.model.Bookmark.queryHistorySize"), + getFieldEditorParent()); + queryHistorySize.setValidRange(0, Integer.MAX_VALUE); + this.addField(queryHistorySize); + StringFieldEditor askPasswordString = new StringFieldEditor("askPasswordString", "&Ask for password string:", getFieldEditorParent()); + this.addField(askPasswordString); + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/SQLEditorPreferences.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/SQLEditorPreferences.java new file mode 100644 index 0000000..b1697ba --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/SQLEditorPreferences.java @@ -0,0 +1,339 @@ +package com.quantum.preferences; + + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.editors.ColorManager; +import com.quantum.editors.SQLColorConstants; +import com.quantum.util.versioning.VersioningHelper; + +import org.eclipse.jface.preference.ColorFieldEditor; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferenceConverter; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.FontDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +public class SQLEditorPreferences extends PreferencePage + implements IWorkbenchPreferencePage { + FontDialog fontDialog; + ColorFieldEditor backgroundColorEditor; + + ColorFieldEditor textColorEditor; + boolean textFlag; + ColorFieldEditor keywordColorEditor; + boolean keywordFlag; + ColorFieldEditor stringColorEditor; + boolean stringFlag; + ColorFieldEditor numericColorEditor; + boolean numericFlag; + ColorFieldEditor commentColorEditor; + boolean commentFlag; + + Button boldText; + Button boldKeyword; + Button boldString; + Button boldNumeric; + Button boldComment; + + IWorkbench workbench; + FontData fontData; + Label fontDisplay; + public void init(IWorkbench workbench) { + //Initialize the preference store + this.workbench = workbench; + setPreferenceStore(QuantumPlugin.getDefault().getPreferenceStore()); + initializeColorDefaults(getPreferenceStore()); + } + + private void initializeColorDefaults(IPreferenceStore store) { + RGB BACKGROUND = new RGB(255, 255, 255); + RGB COMMENT = new RGB(88, 148, 64); + RGB KEYWORD = new RGB(126, 0, 75); + RGB STRING = new RGB(0, 0, 255); + RGB NUMERIC = new RGB(255, 0, 0); + RGB DEFAULT = new RGB(0, 0, 0); + PreferenceConverter.setDefault(store, + "quantum.background.color", BACKGROUND); //$NON-NLS-1$ + PreferenceConverter.setDefault(store, + "quantum.text.color", DEFAULT); //$NON-NLS-1$ + PreferenceConverter.setDefault(store, + "quantum.keyword.color", KEYWORD); //$NON-NLS-1$ + PreferenceConverter.setDefault(store, + "quantum.comment.color", COMMENT); //$NON-NLS-1$ + PreferenceConverter.setDefault(store, + "quantum.string.color", STRING); //$NON-NLS-1$ + PreferenceConverter.setDefault(store, + "quantum.numeric.color", NUMERIC); //$NON-NLS-1$ + } + + protected void performDefaults() { + fontData = null; + updateFontDisplay(); + textFlag = false; + keywordFlag = true; + stringFlag = false; + numericFlag = false; + commentFlag = false; + updateFlags(); + backgroundColorEditor.loadDefault(); + textColorEditor.loadDefault(); + keywordColorEditor.loadDefault(); + stringColorEditor.loadDefault(); + commentColorEditor.loadDefault(); + numericColorEditor.loadDefault(); + } + /** + * Save the preferences to the preference store. + */ + public boolean performOk() { + PreferenceConverter.setValue(getPreferenceStore(), "quantum.font", fontData); //$NON-NLS-1$ + getPreferenceStore().setValue("quantum.text.bold", textFlag); //$NON-NLS-1$ + getPreferenceStore().setValue("quantum.keyword.bold", keywordFlag); //$NON-NLS-1$ + getPreferenceStore().setValue("quantum.string.bold", stringFlag); //$NON-NLS-1$ + getPreferenceStore().setValue("quantum.comment.bold", commentFlag); //$NON-NLS-1$ + getPreferenceStore().setValue("quantum.numeric.bold", numericFlag); //$NON-NLS-1$ + backgroundColorEditor.store(); + textColorEditor.store(); + keywordColorEditor.store(); + stringColorEditor.store(); + commentColorEditor.store(); + numericColorEditor.store(); + return super.performOk(); + } + protected Control createContents(Composite parent) { + Composite main = new Composite(parent, SWT.NULL); + + GridLayout innerLayout = new GridLayout(); + innerLayout.numColumns = 4; + main.setLayout(innerLayout); + + fontData = PreferenceConverter.getFontData(getPreferenceStore(), "quantum.font"); //$NON-NLS-1$ + textFlag = getPreferenceStore().getBoolean("quantum.text.bold"); //$NON-NLS-1$ + keywordFlag = getPreferenceStore().getBoolean("quantum.keyword.bold"); //$NON-NLS-1$ + stringFlag = getPreferenceStore().getBoolean("quantum.string.bold"); //$NON-NLS-1$ + commentFlag = getPreferenceStore().getBoolean("quantum.comment.bold"); //$NON-NLS-1$ + numericFlag = getPreferenceStore().getBoolean("quantum.numeric.bold"); //$NON-NLS-1$ + + fontDialog = new FontDialog(workbench.getActiveWorkbenchWindow().getShell()); + Button fontButton = new Button(main, SWT.PUSH); + fontButton.setText(Messages.getString("PreferencesPage.PickFont")); //$NON-NLS-1$ + fontButton.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + if (fontData != null) { + VersioningHelper.setFont(fontDialog, new FontData[] { fontData} ); + } + FontData data = fontDialog.open(); + if (data != null) { + fontData = data; + updateFontDisplay(); + } + } + }); + Button defaultButton = new Button(main, SWT.PUSH); + defaultButton.setText(Messages.getString("PreferencesPage.DefaultFont")); //$NON-NLS-1$ + defaultButton.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + fontData = null; + updateFontDisplay(); + } + }); + + fontDisplay = new Label(main, SWT.NULL); + GridData data = new GridData(GridData.FILL_HORIZONTAL); + data.grabExcessHorizontalSpace = true; + fontDisplay.setLayoutData(data); + updateFontDisplay(); + + ColorManager manager = new ColorManager(); + + Composite comp = new Composite(main, SWT.NULL); + GridData layoutData = new GridData(); + layoutData.horizontalSpan = 2; + comp.setLayoutData(layoutData); + + manager.getColor(SQLColorConstants.DEFAULT); + backgroundColorEditor = + new ColorFieldEditor( + "quantum.background.color", //$NON-NLS-1$ + Messages.getString("PreferencesPage.BackgroundColor"), //$NON-NLS-1$ + comp); + + Composite temp = new Composite(main, SWT.NULL); + temp.setSize(0, 0); + + comp = new Composite(main, SWT.NULL); + layoutData = new GridData(); + layoutData.horizontalSpan = 2; + comp.setLayoutData(layoutData); + + textColorEditor = + new ColorFieldEditor( + "quantum.text.color", //$NON-NLS-1$ + Messages.getString("PreferencesPage.DefaultTextColor"), //$NON-NLS-1$ + comp); + + boldText = new Button(main, SWT.CHECK); + boldText.setSelection(textFlag); + boldText.setText(Messages.getString("PreferencesPage.Bold")); //$NON-NLS-1$ + boldText.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + textFlag = boldText.getSelection(); + } + }); + + comp = new Composite(main, SWT.NULL); + layoutData = new GridData(); + layoutData.horizontalSpan = 2; + comp.setLayoutData(layoutData); + + keywordColorEditor = + new ColorFieldEditor( + Messages.getString("PreferencesPage.quantum.keyword.color_26"), //$NON-NLS-1$ + Messages.getString("PreferencesPage.KeywordTextColor"), //$NON-NLS-1$ + comp); + + boldKeyword = new Button(main, SWT.CHECK); + boldKeyword.setSelection(keywordFlag); + boldKeyword.setText(Messages.getString("PreferencesPage.Bold")); //$NON-NLS-1$ + boldKeyword.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + keywordFlag = boldKeyword.getSelection(); + } + }); + + comp = new Composite(main, SWT.NULL); + layoutData = new GridData(); + layoutData.horizontalSpan = 2; + comp.setLayoutData(layoutData); + + commentColorEditor = + new ColorFieldEditor( + "quantum.comment.color", //$NON-NLS-1$ + Messages.getString("PreferencesPage.CommentTextColor"), //$NON-NLS-1$ + comp); + + boldComment = new Button(main, SWT.CHECK); + boldComment.setSelection(commentFlag); + boldComment.setText(Messages.getString("PreferencesPage.Bold")); //$NON-NLS-1$ + boldComment.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + commentFlag = boldComment.getSelection(); + } + }); + + comp = new Composite(main, SWT.NULL); + layoutData = new GridData(); + layoutData.horizontalSpan = 2; + comp.setLayoutData(layoutData); + + stringColorEditor = + new ColorFieldEditor( + "quantum.string.color", //$NON-NLS-1$ + Messages.getString("PreferencesPage.StringTextColor"), //$NON-NLS-1$ + comp); + + boldString = new Button(main, SWT.CHECK); + boldString.setSelection(stringFlag); + boldString.setText(Messages.getString("PreferencesPage.Bold")); //$NON-NLS-1$ + boldString.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + stringFlag = boldString.getSelection(); + } + }); + + comp = new Composite(main, SWT.NULL); + layoutData = new GridData(); + layoutData.horizontalSpan = 2; + comp.setLayoutData(layoutData); + + numericColorEditor = + new ColorFieldEditor( + "quantum.numeric.color", //$NON-NLS-1$ + Messages.getString("PreferencesPage.NumericTextColor"), //$NON-NLS-1$ + comp); + + boldNumeric = new Button(main, SWT.CHECK); + boldNumeric.setSelection(numericFlag); + boldNumeric.setText(Messages.getString("PreferencesPage.Bold")); //$NON-NLS-1$ + boldNumeric.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + numericFlag = boldNumeric.getSelection(); + } + }); + + backgroundColorEditor.setPreferencePage(this); + backgroundColorEditor.setPreferenceStore(getPreferenceStore()); + backgroundColorEditor.load(); + + textColorEditor.setPreferencePage(this); + textColorEditor.setPreferenceStore(getPreferenceStore()); + textColorEditor.load(); + + keywordColorEditor.setPreferencePage(this); + keywordColorEditor.setPreferenceStore(getPreferenceStore()); + keywordColorEditor.load(); + + commentColorEditor.setPreferencePage(this); + commentColorEditor.setPreferenceStore(getPreferenceStore()); + commentColorEditor.load(); + + stringColorEditor.setPreferencePage(this); + stringColorEditor.setPreferenceStore(getPreferenceStore()); + stringColorEditor.load(); + + numericColorEditor.setPreferencePage(this); + numericColorEditor.setPreferenceStore(getPreferenceStore()); + numericColorEditor.load(); + + return main; + } + public void updateFontDisplay() { + if (fontData == null) { + fontDisplay.setText(Messages.getString("PreferencesPage.Font_Default")); //$NON-NLS-1$ + } else { + String style = Messages.getString("PreferencesPage.regular"); //$NON-NLS-1$ + if (fontData.getStyle() == SWT.BOLD) { + style = Messages.getString("PreferencesPage.bold"); //$NON-NLS-1$ + } else if (fontData.getStyle() == SWT.ITALIC) { + style = Messages.getString("PreferencesPage.italic"); //$NON-NLS-1$ + } else if (fontData.getStyle() == (SWT.BOLD | SWT.ITALIC)) { + style = Messages.getString("PreferencesPage.boldItalic"); //$NON-NLS-1$ + } + fontDisplay.setText(Messages.getString("PreferencesPage.FontPrompt") + fontData.getName() + '-' + style + '-' + fontData.getHeight()); //$NON-NLS-1$ + } + } + public void updateFlags() { + boldText.setSelection(textFlag); + boldKeyword.setSelection(keywordFlag); + boldString.setSelection(stringFlag); + boldNumeric.setSelection(numericFlag); + boldComment.setSelection(commentFlag); + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/properties/BookmarkPropertyPage.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/properties/BookmarkPropertyPage.java new file mode 100644 index 0000000..42c4065 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/properties/BookmarkPropertyPage.java @@ -0,0 +1,284 @@ +package com.quantum.properties; + +import com.quantum.IQuantumConstants; +import com.quantum.adapters.AdapterFactory; +import com.quantum.adapters.DriverInfo; +import com.quantum.model.Bookmark; +import com.quantum.view.bookmark.TreeNode; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.TabFolder; +import org.eclipse.swt.widgets.TabItem; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.dialogs.PropertyPage; + +public class BookmarkPropertyPage extends PropertyPage { + + private Text password; + private Text userid; + private Button prompt; + + private Text jdbcURL; + private Text driverName; + private Text driverPath; + + private Combo type; + private Combo autoCommit; + private DriverInfo[] adapters = AdapterFactory.getInstance().getDriverList(); + + protected Control createContents(Composite parent) { + + Composite composite = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + composite.setLayout(layout); + GridData data = new GridData(GridData.FILL); + data.grabExcessHorizontalSpace = true; + composite.setLayoutData(data); + + Label nameLabel = new Label(composite, SWT.NONE); + nameLabel.setText("Name:"); + + Label name = new Label(composite, SWT.NONE); + + Bookmark bookmark = getBookmark(); + String description = bookmark.getName(); + name.setText(description); + + TabFolder tabFolder = new TabFolder(parent, SWT.NONE); + layout = new GridLayout(); + tabFolder.setLayout(layout); + data = new GridData(GridData.FILL_BOTH); + data.grabExcessHorizontalSpace = true; + data.grabExcessVerticalSpace = true; + data.verticalAlignment = GridData.FILL; + data.horizontalSpan = 2; + data.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING; + tabFolder.setLayoutData(data); + + createUserTab(tabFolder); + createDriverTab(tabFolder); + createOptionsTab(tabFolder); + + performDefaults(); + return composite; + } + + private Bookmark getBookmark() { + Bookmark bookmark = + ((TreeNode) getElement()).getBookmark(); + return bookmark; + } + + private void createDriverTab(TabFolder tabFolder) { + TabItem driverTab = new TabItem(tabFolder, SWT.NONE); + driverTab.setText("JDBC Driver"); + + Composite composite = new Composite(tabFolder, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + composite.setLayout(layout); + GridData data = new GridData(GridData.FILL); + data.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING; + data.grabExcessHorizontalSpace = true; + composite.setLayoutData(data); + + Label label = new Label(composite, SWT.NONE); + label.setText("Connection URL:"); + + this.jdbcURL = new Text(composite, SWT.BORDER); + data = new GridData(GridData.FILL); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + data.grabExcessHorizontalSpace = true; + this.jdbcURL.setLayoutData(data); + + label = new Label(composite, SWT.NONE); + label.setText("Driver Name:"); + + this.driverName = new Text(composite, SWT.BORDER); + data = new GridData(GridData.FILL); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + this.driverName.setLayoutData(data); + + label = new Label(composite, SWT.NONE); + label.setText("Driver Location:"); + + this.driverPath = new Text(composite, SWT.BORDER); + data = new GridData(GridData.FILL); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + this.driverPath.setLayoutData(data); + + label = new Label(composite, SWT.NULL); + label.setText("Type:"); + this.type = new Combo(composite, SWT.SIMPLE | SWT.DROP_DOWN | SWT.READ_ONLY); + String adapterNames[] = new String[adapters.length]; + for (int i = 0; i < adapters.length; i++) { + adapterNames[i] = adapters[i].getDisplayName(); + } + this.type.setItems(adapterNames); + + data = new GridData(); + data.horizontalAlignment = GridData.FILL; + this.type.setLayoutData(data); + + driverTab.setControl(composite); + } + + private void createUserTab(TabFolder tabFolder) { + TabItem userTab = new TabItem(tabFolder, SWT.NONE); + userTab.setText("User"); + + Composite composite = new Composite(tabFolder, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + composite.setLayout(layout); + GridData data = new GridData(GridData.FILL); + data.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING; + data.grabExcessHorizontalSpace = true; + composite.setLayoutData(data); + + Label useridLabel = new Label(composite, SWT.NONE); + useridLabel.setText("Userid:"); + + this.userid = new Text(composite, SWT.BORDER); + data = new GridData(GridData.FILL); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + data.grabExcessHorizontalSpace = true; + this.userid.setLayoutData(data); + + Label passworLabel = new Label(composite, SWT.NONE); + passworLabel.setText("Password:"); + + this.password = new Text(composite, SWT.BORDER); + this.password.setEchoChar('*'); + data = new GridData(GridData.FILL); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + this.password.setLayoutData(data); + + this.prompt = new Button(composite, SWT.CHECK); + this.prompt.setText("Prompt for password"); + data = new GridData(GridData.FILL); + data.horizontalSpan = 2; + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + this.prompt.setLayoutData(data); + + this.prompt.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + password.setEditable(!((Button) event.getSource()).getSelection()); + } + }); + + userTab.setControl(composite); + } + + /** + * @param tabFolder + */ + private void createOptionsTab(TabFolder tabFolder) { + TabItem optionsTab = new TabItem(tabFolder, SWT.NONE); + optionsTab.setText("Options"); + + Composite composite = new Composite(tabFolder, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + composite.setLayout(layout); + GridData data = new GridData(GridData.FILL); + data.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING; + data.grabExcessHorizontalSpace = true; + composite.setLayoutData(data); + + Label label; + + label = new Label(composite, SWT.NULL); + label.setText("On connection, Auto-Commit should be:"); + this.autoCommit = new Combo(composite, SWT.SIMPLE | SWT.DROP_DOWN | SWT.READ_ONLY); + String autoCommitTypes[] = new String[] { + IQuantumConstants.autoCommitTrue, + IQuantumConstants.autoCommitFalse, + IQuantumConstants.autoCommitSaved + }; + this.autoCommit.setItems(autoCommitTypes); + + data = new GridData(); + data.horizontalAlignment = GridData.FILL; + this.autoCommit.setLayoutData(data); + + optionsTab.setControl(composite); + + } + + + + /** + * @see org.eclipse.jface.preference.PreferencePage#performApply() + */ + public boolean performOk() { + Bookmark bookmark = getBookmark(); + bookmark.setUsername(this.userid.getText()); + bookmark.setPromptForPassword(this.prompt.getSelection()); + if (this.prompt.getSelection()) { + bookmark.setPassword(""); + } else { + bookmark.setPassword(this.password.getText()); + } + + int index = this.type.getSelectionIndex(); + bookmark.setType(this.adapters[index].getDriverType()); + bookmark.setConnect(this.jdbcURL.getText()); + bookmark.setDriver(this.driverName.getText()); + bookmark.setDriverFile(this.driverPath.getText()); + if (this.autoCommit.getSelectionIndex() >= 0) + bookmark.setAutoCommitPreference(this.autoCommit.getItem(this.autoCommit.getSelectionIndex())); + return super.performOk(); + } + /* (non-Javadoc) + * @see org.eclipse.jface.preference.PreferencePage#performDefaults() + */ + protected void performDefaults() { + super.performDefaults(); + Bookmark bookmark = getBookmark(); + + this.prompt.setSelection(bookmark.getPromptForPassword()); + this.password.setEditable(!bookmark.getPromptForPassword()); + this.password.setText(bookmark.getPassword()); + this.userid.setText(bookmark.getUsername()); + + this.type.select(0); + boolean done = false; + for (int i = 0, + length = (adapters == null) ? 0 : adapters.length; + !done && i < length; + i++) { + if (bookmark.getType() != null && + bookmark.getType().equals(adapters[i].getDriverType())) { + this.type.select(i); + done = true; + } + } + if (bookmark.getAutoCommitPreference().equals(IQuantumConstants.autoCommitTrue)) + this.autoCommit.select(0); + else if (bookmark.getAutoCommitPreference().equals(IQuantumConstants.autoCommitFalse)) + this.autoCommit.select(1); + else if (bookmark.getAutoCommitPreference().equals(IQuantumConstants.autoCommitSaved)) + this.autoCommit.select(2); + + this.driverName.setText(bookmark.getDriver()); + this.jdbcURL.setText(bookmark.getConnect()); + this.driverPath.setText(bookmark.getDriverFile()); + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/properties/DatabaseInformationPropertyPage.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/properties/DatabaseInformationPropertyPage.java new file mode 100644 index 0000000..e1a0606 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/properties/DatabaseInformationPropertyPage.java @@ -0,0 +1,60 @@ +package com.quantum.properties; + +import java.sql.SQLException; + +import com.quantum.model.Bookmark; +import com.quantum.model.NotConnectedException; +import com.quantum.view.bookmark.TreeNode; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.ui.dialogs.PropertyPage; + +public class DatabaseInformationPropertyPage extends PropertyPage { + + public DatabaseInformationPropertyPage() { + super(); + } + + protected Control createContents(Composite parent) { + + Composite composite = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + composite.setLayout(layout); + GridData data = new GridData(GridData.FILL); + data.grabExcessHorizontalSpace = true; + composite.setLayoutData(data); + + Label productLabel = new Label(composite, SWT.NONE); + productLabel.setText("Product:"); + + Label productDescriptionLabel = new Label(composite, SWT.NONE); + + Bookmark bookmark = + ((TreeNode) getElement()).getBookmark(); + String description = null; + try { + description = bookmark.getDatabase().getInformation(); + } catch (NotConnectedException e) { + } catch (SQLException e) { + } + if (description == null) { + description = ""; + } + productDescriptionLabel.setText(description); + return composite; + } + + protected void performDefaults() { + } + + public boolean performOk() { + return true; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/properties/EntityPropertyPage.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/properties/EntityPropertyPage.java new file mode 100644 index 0000000..6937c1b --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/properties/EntityPropertyPage.java @@ -0,0 +1,187 @@ +package com.quantum.properties; + +import com.quantum.model.Column; +import com.quantum.model.Entity; +import com.quantum.model.Index; +import com.quantum.view.bookmark.EntityNode; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.TabFolder; +import org.eclipse.swt.widgets.TabItem; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.ui.dialogs.PropertyPage; + +public class EntityPropertyPage extends PropertyPage { + + protected Control createContents(Composite parent) { + + Composite composite = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + composite.setLayout(layout); + GridData data = new GridData(GridData.FILL); + data.grabExcessHorizontalSpace = true; + composite.setLayoutData(data); + + Label label = new Label(composite, SWT.NONE); + label.setText("Name:"); + + Entity entity = getEntity(); + + Label name = new Label(composite, SWT.NONE); + name.setText(entity.getName()); + + label = new Label(composite, SWT.NONE); + label.setText("Schema:"); + + Label schema = new Label(composite, SWT.NONE); + schema.setText(entity.getSchema()); + + if (!Entity.SEQUENCE_TYPE.equals(getEntity().getType())) { + TabFolder tabFolder = new TabFolder(parent, SWT.NONE); + layout = new GridLayout(); + tabFolder.setLayout(layout); + data = new GridData(GridData.FILL_BOTH); + data.grabExcessHorizontalSpace = true; + data.grabExcessVerticalSpace = true; + data.verticalAlignment = GridData.FILL; + data.horizontalSpan = 2; + data.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING; + tabFolder.setLayoutData(data); + + createColumnsTab(tabFolder); + createIndexesTab(tabFolder); + } + + return composite; + } + + private Entity getEntity() { + Entity entity = + ((EntityNode) getElement()).getEntity(); + return entity; + } + + private void createColumnsTab(TabFolder tabFolder) { + TabItem columnsTab = new TabItem(tabFolder, SWT.NONE); + columnsTab.setText("Columns"); + + Table table = new Table(tabFolder, SWT.FULL_SELECTION | SWT.MULTI); + table.setLinesVisible(true); + table.setHeaderVisible(true); + + GridLayout layout = new GridLayout(); + layout.marginWidth = 5; + layout.marginHeight = 5; + table.setLayout(layout); + GridData data = new GridData(GridData.FILL); + data.horizontalAlignment = GridData.FILL_HORIZONTAL; + data.verticalAlignment = GridData.FILL_VERTICAL; + data.grabExcessHorizontalSpace = true; + data.grabExcessVerticalSpace = true; + table.setLayoutData(data); + + String[] columnNames = { "Name", "Type", "Size", "Digits", + "Primary Key", "Nullable", "Remarks" }; + + for (int i = 0, length = columnNames.length; i < length; i++) { + TableColumn column = new TableColumn(table, SWT.NONE); + column.setText(columnNames[i]); + } + for (int i = 0, length = columnNames.length; i < length; i++) { + table.getColumn(i).pack(); + } + + Column[] columns = getEntity().getColumns(); + for (int i = 0, length = columns.length; i < length; i++) { + TableItem item = new TableItem(table, SWT.NONE); + item.setText(new String[] { + columns[i].getName(), + columns[i].getTypeName(), + String.valueOf(columns[i].getSize()), + columns[i].getNumberOfFractionalDigits() == 0 ? "" : + String.valueOf(columns[i].getNumberOfFractionalDigits()), + columns[i].isPrimaryKey() ? "Yes" : "No", + columns[i].isNullable() ? "Yes" : "No", + columns[i].getRemarks() }); + } + + for (int i = 0, length = columnNames.length; i < length; i++) { + table.getColumn(i).pack(); + } + + data = new GridData(GridData.FILL); + data.horizontalAlignment = GridData.FILL_HORIZONTAL; + data.verticalAlignment = GridData.FILL_VERTICAL; + data.grabExcessHorizontalSpace = true; + data.grabExcessVerticalSpace = true; + table.setLayoutData(data); + + columnsTab.setControl(table); + } + + private void createIndexesTab(TabFolder tabFolder) { + TabItem indexesTab = new TabItem(tabFolder, SWT.NONE); + indexesTab.setText("Indexes"); + + Table table = new Table(tabFolder, SWT.FULL_SELECTION | SWT.MULTI); + table.setLinesVisible(true); + table.setHeaderVisible(true); + + GridLayout layout = new GridLayout(); + layout.marginWidth = 5; + layout.marginHeight = 5; + table.setLayout(layout); + GridData data = new GridData(GridData.FILL); + data.horizontalAlignment = GridData.FILL_HORIZONTAL; + data.verticalAlignment = GridData.FILL_VERTICAL; + data.grabExcessHorizontalSpace = true; + data.grabExcessVerticalSpace = true; + table.setLayoutData(data); + + String[] columnNames = { "Name", "Column", "Ascending" }; + + for (int i = 0, length = columnNames.length; i < length; i++) { + TableColumn column = new TableColumn(table, SWT.NONE); + column.setText(columnNames[i]); + } + for (int i = 0, length = columnNames.length; i < length; i++) { + table.getColumn(i).pack(); + } + + Index[] indexes = getEntity().getIndexes(); + for (int i = 0, length = indexes.length; i < length; i++) { + for (int j = 0, numberOfColumns = indexes[i].getNumberOfColumns(); + j < numberOfColumns; j++) { + + TableItem item = new TableItem(table, SWT.NONE); + item.setText(new String[] { + j == 0 ? indexes[i].getName() : "", + indexes[i].getColumnName(j), + indexes[i].isAscending(j) ? "Yes" + : (indexes[i].isDescending(j)) ? "No" : "" }); + } + } + + for (int i = 0, length = columnNames.length; i < length; i++) { + table.getColumn(i).pack(); + } + + data = new GridData(GridData.FILL); + data.horizontalAlignment = GridData.FILL_HORIZONTAL; + data.verticalAlignment = GridData.FILL_VERTICAL; + data.grabExcessHorizontalSpace = true; + data.grabExcessVerticalSpace = true; + table.setLayoutData(data); + + indexesTab.setControl(table); + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/properties/SchemaPropertyPage.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/properties/SchemaPropertyPage.java new file mode 100644 index 0000000..d812f59 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/properties/SchemaPropertyPage.java @@ -0,0 +1,256 @@ +package com.quantum.properties; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.Vector; + +import com.quantum.QuantumPlugin; +import com.quantum.model.Bookmark; +import com.quantum.model.BookmarkHolder; +import com.quantum.model.ConnectionException; +import com.quantum.model.Schema; +import com.quantum.sql.SQLHelper; +import com.quantum.ui.dialog.ExceptionDisplayDialog; +import com.quantum.util.connection.ConnectionUtil; +import com.quantum.view.bookmark.AddSchemaDialog; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.ui.dialogs.PropertyPage; + +public class SchemaPropertyPage extends PropertyPage { + + class ContentProviderImpl implements IStructuredContentProvider { + public Object[] getElements(Object inputElement) { + List list = new ArrayList((Collection) inputElement); + Collections.sort(list); + return list.toArray(); + } + + public void dispose() { + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + } + } + + class LabelProviderImpl implements ITableLabelProvider { + + public Image getColumnImage(Object element, int columnIndex) { + if (columnIndex == 0) { + return QuantumPlugin.getImage("schema.gif"); + } else { + return null; + } + } + + public String getColumnText(Object element, int columnIndex) { + if (columnIndex == 0) { + return ((Schema) element).getDisplayName(); + } else { + return null; + } + } + + public void addListener(ILabelProviderListener listener) { + } + + public void dispose() { + } + + public boolean isLabelProperty(Object element, String property) { + return "displayName".equals(property); + } + + public void removeListener(ILabelProviderListener listener) { + } + } + + private Set schemas = Collections.synchronizedSet(new HashSet()); + private TableViewer schemaTable; + private Button addButton; + private Button removeButton; + + private ConnectionUtil connectionUtil = new ConnectionUtil(); + + protected Control createContents(Composite parent) { + + Composite composite = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + composite.setLayout(layout); + GridData data = new GridData(); + composite.setLayoutData(data); + + this.schemaTable = new TableViewer(composite, + SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER); + + layout = new GridLayout(); + layout.marginWidth = 5; + layout.marginHeight = 5; + + this.schemaTable.getTable().setLayout(layout); + data = new GridData(); + data.heightHint = 200; + data.widthHint = 200; +// data.verticalSpan = 2; + this.schemaTable.getTable().setLayoutData(data); + this.schemaTable.setLabelProvider(new LabelProviderImpl()); + this.schemaTable.setContentProvider(new ContentProviderImpl()); + this.schemaTable.setInput(this.schemas); + + createButtonArea(composite); + + performDefaults(); + return composite; + } + + private void createButtonArea(Composite composite) { + GridLayout layout; + GridData data; + Composite buttonArea = new Composite(composite, SWT.NONE); + layout = new GridLayout(); + layout.numColumns = 1; + buttonArea.setLayout(layout); + data = new GridData(); + data.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING; + buttonArea.setLayoutData(data); + + this.addButton = new Button(buttonArea, SWT.NULL); + this.addButton.setText("Add"); + data = new GridData(); + data.horizontalAlignment = GridData.FILL_HORIZONTAL; + data.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING; + data.widthHint = 60; + this.addButton.setLayoutData(data); + this.addButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + addSchema(); + } + }); + + this.removeButton = new Button(buttonArea, SWT.NULL); + this.removeButton.setText("Remove"); + this.removeButton.setEnabled(false); + data = new GridData(); + data.horizontalAlignment = GridData.FILL_HORIZONTAL; + data.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING; + data.widthHint = 60; + this.removeButton.setLayoutData(data); + this.removeButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + removeSchema(SchemaPropertyPage.this.schemaTable.getSelection()); + } + }); + + this.schemaTable.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + SchemaPropertyPage.this.removeButton.setEnabled( + !event.getSelection().isEmpty()); + } + }); + } + + private void addSchema() { + Bookmark bookmark = getBookmark(); + boolean isAlreadyConnected = bookmark.isConnected(); + + if (!isAlreadyConnected) { + boolean confirmed = MessageDialog.openConfirm(getShell(), "Connect Required", + "We must connect to the database to retrieve schemas."); + if (confirmed) { + this.connectionUtil.connect(bookmark, getShell()); + } + } + + try { + if (bookmark.isConnected()) { + Vector schemas = SQLHelper.getSchemas(bookmark.getConnection()); + AddSchemaDialog dialog = new AddSchemaDialog(getShell(), schemas); + dialog.open(); + if (dialog.getSelectedSchemas() != null) { + Collection temp = dialog.getSelectedSchemas(); + for (Iterator i = temp.iterator(); i.hasNext();) { + String name = (String) i.next(); + this.schemas.add(new Schema(name)); + } + refreshTable(); + } + + if (!isAlreadyConnected) { + bookmark.disconnect(); + } + } + } catch (ConnectionException e) { + ExceptionDisplayDialog.openError(getShell(), null, null, e); + } + } + + private void removeSchema(ISelection selection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + for (Iterator i = structuredSelection.iterator(); i.hasNext();) { + Schema element = (Schema) i.next(); + this.schemas.remove(element); + } + refreshTable(); + } + + private Bookmark getBookmark() { + Bookmark bookmark = + ((BookmarkHolder) getElement()).getBookmark(); + return bookmark; + } + + /** + * @see org.eclipse.jface.preference.PreferencePage#performApply() + */ + public boolean performOk() { + getBookmark().setSchemas((Schema[]) this.schemas.toArray( + new Schema[this.schemas.size()])); + return true; + } + /* (non-Javadoc) + * @see org.eclipse.jface.preference.PreferencePage#performDefaults() + */ + protected void performDefaults() { + super.performDefaults(); + Bookmark bookmark = getBookmark(); + + this.schemas.clear(); + Schema[] schemas = bookmark.getSchemas(); + for (int i = 0, length = (schemas == null) ? 0 : schemas.length; + i < length; + i++) { + if (!schemas[i].isDefault()) { + this.schemas.add(schemas[i]); + } + } + refreshTable(); + } + + private void refreshTable() { + this.schemaTable.refresh(); + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/ConnectionEstablisher.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/ConnectionEstablisher.java new file mode 100644 index 0000000..75d9363 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/ConnectionEstablisher.java @@ -0,0 +1,19 @@ +package com.quantum.sql; + +import java.sql.Connection; + +import com.quantum.model.Bookmark; +import com.quantum.model.ConnectionException; +import com.quantum.model.PasswordFinder; + +/** + * @author BC + */ +public interface ConnectionEstablisher { + + public Connection connect(Bookmark bookmark, PasswordFinder passwordFinder) + throws ConnectionException; + public void disconnect(Connection connection) + throws ConnectionException; + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/FilterSort.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/FilterSort.java new file mode 100644 index 0000000..844e6de --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/FilterSort.java @@ -0,0 +1,83 @@ +package com.quantum.sql; + +import java.util.ArrayList; + +public class FilterSort { + private ArrayList filterList = new ArrayList(); + private ArrayList sortList = new ArrayList(); + private ArrayList ascDescList = new ArrayList(); + public void addFilter(String column, String operator, String value, boolean isString) { + FilterRow row = new FilterRow(); + row.column = column; + row.operator = operator; + row.value = value; + row.isString = isString; + filterList.add(row); + } + public void clearFilters() { + filterList.clear(); + } + public void addSort(String column, String ascDesc) { + int ind = sortList.indexOf(column); + if (ind < 0) { + sortList.add(column); + ascDescList.add(ascDesc); + return; + } + if (ind < ascDescList.size()) { + ascDescList.remove(ind); + } + ascDescList.add(ind, ascDesc); + } + public void removeSort(String column) { + int ind = sortList.indexOf(column); + if (ind < 0) return; + sortList.remove(ind); + ascDescList.remove(ind); + } + public String toString() { + StringBuffer text = new StringBuffer(); + if (filterList.size() > 0) { + text.append(" WHERE "); //$NON-NLS-1$ + for (int i = 0; i < filterList.size(); i++) { + FilterRow row = (FilterRow) filterList.get(i); + text.append(row.column); + text.append(" "); //$NON-NLS-1$ + text.append(row.operator); + text.append(" "); //$NON-NLS-1$ + if (row.isString) { + text.append(escape(row.value)); + } else { + text.append(row.value); + } + text.append(" "); //$NON-NLS-1$ + if (i < filterList.size() - 1) { + text.append("AND "); //$NON-NLS-1$ + } + } + } + if (sortList.size() > 0) { + text.append(" ORDER BY "); //$NON-NLS-1$ + for (int i = 0; i < sortList.size(); i++) { + String value = (String) sortList.get(i); + text.append(value); + text.append(" "); + text.append(ascDescList.get(i)); + if (i < sortList.size() - 1) { + text.append(", "); //$NON-NLS-1$ + } + } + } + return text.toString(); + } + public static String escape(String original) { + return '\'' + original + '\''; + } +} + +class FilterRow { + public String column; + public String operator; + public String value; + public boolean isString; +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/MultiSQLServer.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/MultiSQLServer.java new file mode 100644 index 0000000..843d57f --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/MultiSQLServer.java @@ -0,0 +1,426 @@ +package com.quantum.sql; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.InputStream; +import java.io.Reader; +import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.Driver; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Hashtable; +import java.util.Properties; +import java.util.Vector; + +import com.quantum.model.Bookmark; +import com.quantum.model.ConnectionException; +import com.quantum.model.Entity; +import com.quantum.model.PasswordFinder; +import com.quantum.sql.metadata.MetaDataJDBCInterface; +import com.quantum.sql.metadata.ObjectMetaData; +import com.quantum.view.LogProxy; +import com.quantum.view.bookmark.EntityNode; +import com.quantum.view.bookmark.TreeNode; + + +/** + * MultiSQLServer is a Singleton, used as a interface with the sql drivers. + * Use MultiSQLServer.getInstance() to get the object. + */ +public class MultiSQLServer implements ConnectionEstablisher { + private static final int STREAM = 1024 * 2; + public static final String USERNAME = "user"; //$NON-NLS-1$ + public static final String PASSWORD = "password"; //$NON-NLS-1$ + private static MultiSQLServer instance = null; + private Hashtable classLoaderCache = new Hashtable(); + boolean running = true; + + public MultiSQLServer() { + //start(); + } + public synchronized static MultiSQLServer getInstance() { + if (instance == null) { + instance = new MultiSQLServer(); + } + return instance; + } + + public void commit(Connection con) { + LogProxy log = LogProxy.getInstance(); + try { + con.commit(); + } catch (SQLException e) { + log.addText(LogProxy.ERROR, "Error commiting: " + e, e); //$NON-NLS-1$ + } + } + + public void rollback(Connection con) { + LogProxy log = LogProxy.getInstance(); + try { + con.rollback(); + } catch (SQLException e) { + log.addText(LogProxy.ERROR, "Error rolling back: " + e, e); //$NON-NLS-1$ + } + } + + public void setAutoCommit(Connection con, boolean enabled) { + LogProxy log = LogProxy.getInstance(); + try { + if (con != null) { + con.setAutoCommit(enabled); + } else { + log.addText(LogProxy.ERROR, "Please connect before setting autocommit"); //$NON-NLS-1$ + } + } catch (SQLException e) { + log.addText(LogProxy.ERROR, "Error setting autocommit: " + e, e); //$NON-NLS-1$ + } + } + + public void disconnect(Connection connection) throws ConnectionException { + try { + if (connection != null) { + connection.close(); + } + } catch (SQLException e) { + throw new ConnectionException(e); + } + } + + public Vector getSchemas(Connection con) { + ResultSet set; + Vector schemaList = new Vector(); + try { + DatabaseMetaData meta = con.getMetaData(); + set = meta.getSchemas(); + while (set.next()) { + schemaList.add(set.getString("TABLE_SCHEM")); //$NON-NLS-1$ + } + set.close(); + } catch (SQLException e) { + LogProxy log = LogProxy.getInstance(); + log.addText(LogProxy.ERROR, e); + } + return schemaList; + } + /** + * Makes a connection to a JDBC driver based on the data from a bookmark + * @param bookmark - + * The Bookmark with the data needed to make the connection + * @param passwordFinder - + * A utility class that can be invoked if the bookmark does not + * include a password + * @return The Connection object if everything went OK + */ + public Connection connect(Bookmark bookmark, PasswordFinder passwordFinder) + throws ConnectionException { + + String password = bookmark.getPassword(); + if (bookmark.getPromptForPassword()) { + password = passwordFinder.getPassword(); + if (passwordFinder.isPasswordMeantToBeSaved()) { + bookmark.setPassword(password); + } + } + Connection con; + if (password != null) { + con = connect(bookmark, password); + } else { + return null; + } + // Set the autoCommit state of the bookmark to the default on new connections + bookmark.setAutoCommit(bookmark.getDefaultAutoCommit()); + // Set the autoCommit state of the JDBC connection to the bookmark autoCommit statec + setAutoCommit(con, bookmark.isAutoCommit()); + return con; + + } + private Connection connect(Bookmark bookmark, String password) + throws ConnectionException { + LogProxy log = LogProxy.getInstance(); + log.addText(LogProxy.QUERY, "Connecting to: " + bookmark.getName()); //$NON-NLS-1$ + URL urls[] = new URL[1]; + try { + String driverFile = bookmark.getDriverFile(); + URLClassLoader loader = + (URLClassLoader) classLoaderCache.get(driverFile); + if (loader == null) { + urls[0] = new File(driverFile).toURL(); + loader = new URLClassLoader(urls); + classLoaderCache.put(driverFile, loader); + System.out.println("Creating new classloader"); //$NON-NLS-1$ + } else { + System.out.println("Using classloader in cache"); //$NON-NLS-1$ + } + Class driverClass = loader.loadClass(bookmark.getDriver()); + Driver driver = (Driver) driverClass.newInstance(); + Properties props = new Properties(); + props.put(USERNAME, bookmark.getUsername()); + props.put(PASSWORD, password); + Connection connection = + driver.connect(bookmark.getConnect(), props); + if (connection == null) { + throw new ConnectionException("Error: Driver returned a null connection: " + bookmark.toString()); //$NON-NLS-1$ + } + log.addText(LogProxy.RESULTS, "Connected to: " + bookmark.getName()); //$NON-NLS-1$ + System.out.println("Connected"); //$NON-NLS-1$ + return connection; + } catch (SQLException e) { + throw new ConnectionException(e); + } catch (MalformedURLException e) { + throw new ConnectionException(e); + } catch (ClassNotFoundException e) { + throw new ConnectionException(e); + } catch (InstantiationException e) { + throw new ConnectionException(e); + } catch (IllegalAccessException e) { + throw new ConnectionException(e); + } + } + public SQLResults execute(Connection con, String s) throws SQLException { + return execute(con, s, -1, -1); + } + public SQLResults execute(Connection con, String s, int startRow, int endRow) throws SQLException { + return execute(con, s, -1, -1, Integer.MAX_VALUE); + } + + public SQLResults execute(Connection con, String s, int startRow, int endRow, int maxLength) throws SQLException { + return execute(con, s, startRow, endRow, maxLength, ""); //$NON-NLS-1$ + } + + public SQLResults execute( + Connection con, + String s, + int startRow, + int endRow, + int maxLength, + String encoding) + throws SQLException { + + SQLResults results = new SQLResults(); + + System.out.println("Executing"); //$NON-NLS-1$ + LogProxy log = LogProxy.getInstance(); + log.addText(LogProxy.QUERY, "Executing Request [" + s + "]"); //$NON-NLS-1$ //$NON-NLS-2$ + boolean metadata = false; + if (s.startsWith("METADATA")) { //$NON-NLS-1$ + metadata = true; + } + if (metadata) { + results.setQuery(s); + String table = s.substring(s.indexOf(':') + 1); + String query = "SELECT * FROM " + table + " WHERE (1 = 0)"; //$NON-NLS-1$ //$NON-NLS-2$ + s = query; + log.addText(LogProxy.QUERY, "Metadata Request [" + s + "]"); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + results.setQuery(s); + } + + Statement stmt = con.createStatement(); + boolean flag = stmt.execute(s); + results.setResultSet(flag); + if (metadata) { + genMetadataResultSet(results, stmt); + return results; + } + if (!flag) { + int updates = stmt.getUpdateCount(); + results.setUpdateCount(updates); + log.addText(LogProxy.RESULTS, "Success: " + updates + " records updated"); //$NON-NLS-1$ //$NON-NLS-2$ + + } else { + ResultSet set = stmt.getResultSet(); + ResultSetMetaData metaData = set.getMetaData(); + int columnCount = metaData.getColumnCount(); + Vector columnNames = new Vector(); + for (int i = 1; i <= columnCount; i++) { + columnNames.addElement(metaData.getColumnName(i)); + } + results.setColumnNames(columnNames); + Vector columnTypes = new Vector(); + for (int i = 1; i <= columnCount; i++) { + columnTypes.addElement(metaData.getColumnTypeName(i)); + } + results.setColumnTypes(columnTypes); + int columnSizes[] = new int[columnCount]; + for (int i = 1; i <= columnCount; i++) { + columnSizes[i - 1] = metaData.getColumnDisplaySize(i); + } + int rowCount = 1; + boolean exitEarly = false; + while (set.next()) { + boolean disable = startRow < 1 || endRow < 1; + boolean start = rowCount >= startRow; + boolean end = rowCount <= endRow; + if (disable || (start && end)) { + Vector row = new Vector(); + for (int i = 1; i <= columnCount; i++) { + String value; + if (columnSizes[i - 1] < STREAM + && columnSizes[i - 1] < maxLength) { + if (encoding.equals("")) { //$NON-NLS-1$ + value = set.getString(i); + } else { + try { + value = + new String(set.getBytes(i), encoding); + } catch (UnsupportedEncodingException e) { + log.addText(LogProxy.ERROR, "Error Unsupported encoding " + encoding.toString() + ":" + e.toString(), e); //$NON-NLS-1$ //$NON-NLS-2$ + value = new String(set.getBytes(i)); + } + } + } else { + try { + if (encoding.equals("")) { //$NON-NLS-1$ + Reader reader = set.getCharacterStream(i); + StringBuffer buffer = new StringBuffer(); + if (reader != null) { + int retVal = reader.read(); + int count = 0; + while (retVal >= 0) { + buffer.append((char) retVal); + retVal = reader.read(); + count++; + if (count > maxLength) { + buffer.append("...>>>"); //$NON-NLS-1$ + break; + } + } + reader.close(); + } + value = buffer.toString(); + } else { + InputStream binaryStream = + set.getBinaryStream(i); + ByteArrayOutputStream baos = + new ByteArrayOutputStream(); + if (binaryStream != null) { + int retVal = binaryStream.read(); + int count = 0; + while (retVal >= 0) { + baos.write(retVal); + retVal = binaryStream.read(); + count++; + if (count > maxLength) { + break; + } + } + binaryStream.close(); + } + value = + new String( + baos.toByteArray(), + encoding); + } + } catch (Throwable e) { + // hack for mysql which doesn't implement + // character streams + value = set.getString(i); + } + } + if (set.wasNull()) { + row.addElement(""); //$NON-NLS-1$ + } else { + row.addElement(value); + } + } + results.addRow(row); + } + rowCount++; + if (!disable && (rowCount > endRow)) { + exitEarly = true; + break; + } + } + if (exitEarly) { + results.setHasMore(set.next()); + } else { + results.setMaxSize(rowCount); + results.setHasMore(false); + } + set.close(); + } + log.addText(LogProxy.RESULTS, "Success: result set displayed"); //$NON-NLS-1$ + stmt.close(); + System.out.println("Executed"); //$NON-NLS-1$ + System.out.println(); + return results; + } + private void genMetadataResultSet(SQLResults results, Statement stmt) + throws SQLException { + ResultSet set = stmt.getResultSet(); + ResultSetMetaData metaData = set.getMetaData(); + int columnCount = metaData.getColumnCount(); + Vector columnNames = new Vector(); + columnNames.addElement("ColumnName"); //$NON-NLS-1$ + columnNames.addElement("Type"); //$NON-NLS-1$ + columnNames.addElement("Size"); //$NON-NLS-1$ + columnNames.addElement("Nullable"); //$NON-NLS-1$ + columnNames.addElement("AutoIncrement"); //$NON-NLS-1$ + results.setColumnNames(columnNames); + for (int i = 1; i <= columnCount; i++) { + Vector row = new Vector(); + row.addElement(metaData.getColumnName(i)); + row.addElement(metaData.getColumnTypeName(i)); + int textSize = metaData.getColumnDisplaySize(i); + int precision = metaData.getPrecision(i); + int scale = metaData.getScale(i); + if (scale == 0 && precision == 0) { + row.addElement(Integer.toString(precision)); + } else { + row.addElement(textSize + ", " + precision + ", " + scale); //$NON-NLS-1$ //$NON-NLS-2$ + } + int nullable = metaData.isNullable(i); + if (nullable == ResultSetMetaData.columnNoNulls) { + row.addElement("Not Null"); //$NON-NLS-1$ + } else if (nullable == ResultSetMetaData.columnNullable) { + row.addElement("Nullable"); //$NON-NLS-1$ + } else if ( + nullable == ResultSetMetaData.columnNullableUnknown) { + row.addElement("Nullable"); //$NON-NLS-1$ + } else { + row.addElement(""); //$NON-NLS-1$ + } + row.addElement( + (metaData.isAutoIncrement(i) + ? Boolean.TRUE + : Boolean.FALSE) + .toString()); + results.addRow(row); + } + results.setHasMore(false); + set.close(); + } + + /** + * Returns an ObjectMetadata object got from the connection 'con' using the name and schema of the node. + * @param con + * @param node + * @return + * @throws SQLException + */ + public ObjectMetaData getObjectMetadata(Connection con, TreeNode node) throws SQLException { + ObjectMetaData metadata = new ObjectMetaData(); + if (!(node instanceof Entity)) return metadata; + + String schema = ((Entity)node).getSchema(); + String tableName = node.getName(); + + if (schema.length() == 0) schema = null; + metadata.setColumns(MetaDataJDBCInterface.getColumns(con, schema, tableName)); + if (node instanceof EntityNode && ((EntityNode) node).isTable()) { + metadata.setPrimaryKeys(MetaDataJDBCInterface.getPrimaryKeys(con, schema, tableName)); + metadata.setForeignKeys(MetaDataJDBCInterface.getForeignKeys(con, schema, tableName, true)); + metadata.setIndexInfo(MetaDataJDBCInterface.getIndexInfo(con, schema, tableName)); + metadata.setBestRowId(MetaDataJDBCInterface.getBestRowId(con, schema, tableName)); + } + return metadata; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/SQLHelper.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/SQLHelper.java new file mode 100644 index 0000000..7a050d1 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/SQLHelper.java @@ -0,0 +1,73 @@ +package com.quantum.sql; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.Vector; + +import com.quantum.adapters.DatabaseAdapter; +import com.quantum.view.LogProxy; + +public class SQLHelper { + + public static Vector getSchemas(Connection connection) { + return MultiSQLServer.getInstance().getSchemas(connection); + } + public static int getSize(Connection connection, String tableName, DatabaseAdapter adapter) throws SQLException { + SQLResults results = MultiSQLServer.getInstance().execute( + connection, adapter.getCountQuery(tableName)); + if (results.getRowCount() > 0 && results.getColumnCount() > 0) { + return Integer.parseInt(results.getElement(1, 1).toString()); + } else { + return -1; + } + } + + public static SQLResults getResults(Connection connection, String query, int start, int end, int maxLength, String encoding) { + try { + return MultiSQLServer.getInstance().execute(connection, + query, start, end, maxLength, encoding); + } catch (SQLException e) { + LogProxy log = LogProxy.getInstance(); + log.addText( + LogProxy.ERROR, + "Error Executing: " + query + ":" + e.toString(), e); //$NON-NLS-1$ //$NON-NLS-2$ + } + SQLResults results = new SQLResults(); + results.setIsError(true); + return results; + } + + /** + * True if the type is Real (numeric and with decimal part) according to java.sql.Types + * @param type + * @return + */ + public static boolean isReal(int type) { + return (type == java.sql.Types.DECIMAL || type == java.sql.Types.DOUBLE || type ==java.sql.Types.FLOAT || + type == java.sql.Types.NUMERIC || type == java.sql.Types.REAL ); + } + + /** + * True if the type is Numeric according to java.sql.Types + * @param type + * @return + */ + public static boolean isNumeric(int type) { + return (type == java.sql.Types.DECIMAL || type == java.sql.Types.DOUBLE || type ==java.sql.Types.FLOAT || + type == java.sql.Types.NUMERIC || type == java.sql.Types.REAL || type == java.sql.Types.BIGINT || + type == java.sql.Types.TINYINT || type == java.sql.Types.SMALLINT || type == java.sql.Types.INTEGER ); + } + /** + * True if the type is textual according to java.sql.Types + * @param type + * @return + */ + public static boolean isText(int type) { + return (type == java.sql.Types.CLOB || type == java.sql.Types.VARBINARY || type ==java.sql.Types.VARCHAR + || type == java.sql.Types.CHAR || type == java.sql.Types.LONGVARCHAR ); + } + + public static String getQualifiedName(String schema, String name) { + return (schema != null && schema.length() > 0) ? schema + "." + name : name; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/SQLParser.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/SQLParser.java new file mode 100644 index 0000000..c2dc2cb --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/SQLParser.java @@ -0,0 +1,62 @@ +package com.quantum.sql; + +import java.util.Vector; + +import com.quantum.sql.parser.SQLLexx; +import com.quantum.sql.parser.Token; + +public class SQLParser { + + /** + * Parses a query string into executable units. + * @param query + * @return a Vector of Strings, with the individual executable units. + */ + public static Vector parse(String query) { + Vector commands = new Vector(); + Vector groups = new Vector(); + try { + Vector tokens = SQLLexx.parse(query); + StringBuffer buffer = new StringBuffer(); + StringBuffer groupBuffer = new StringBuffer(); + for (int i = 0; i < tokens.size(); i++) { + Token t = (Token) tokens.elementAt(i); + if (t.getType() == Token.COMMENT) { + // ignore comments + } else if (t.getType() == Token.SEPARATOR) { + groupBuffer.append(t.getValue()); + String newCommand = buffer.toString().trim(); + if (!newCommand.equals("")) { //$NON-NLS-1$ + commands.addElement(newCommand); + } + buffer = new StringBuffer(); + } else if (t.getType() == Token.GROUP) { + // We don't append the group token because it may be misinterpreted + //groupBuffer.append(t.getValue()); + String newGroup = groupBuffer.toString().trim(); + if (!newGroup.equals("")) { //$NON-NLS-1$ + groups.addElement(newGroup); + //Groups have precedence over commands, so the preceding commands are erased + commands.clear(); + } + groupBuffer = new StringBuffer(); + } else { + // We append the tokens to the buffer until it's a separator or group. + buffer.append(t.getValue()); + groupBuffer.append(t.getValue()); + } + } + String newCommand = buffer.toString().trim(); + if (!newCommand.equals("")) { //$NON-NLS-1$ + commands.addElement(newCommand); + } + } catch (Throwable e) { + e.printStackTrace(); + } + System.out.println("Returning"); //$NON-NLS-1$ + Vector result = new Vector(); + result.addAll(groups); + result.addAll(commands); + return result; + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/SQLResults.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/SQLResults.java new file mode 100644 index 0000000..3abc2b9 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/SQLResults.java @@ -0,0 +1,139 @@ +package com.quantum.sql; + +import java.util.ArrayList; +import java.util.Vector; + +/** + * com.quantum project + * @author root + * +*/ +public class SQLResults { + private String query; + private String table; + private ArrayList rows = new ArrayList(); + private Vector columns; + private Vector columnTypes; + private int[] columnSizes; + private int updateCount = 0; + private boolean resultSet = false; + private boolean hasMore = false; + private boolean isError = false; + private int maxSize = -1; + + public void setColumnNames(Vector columns) { + this.columns = columns; + } + public String getColumnName(int column) { + if (columns.size() < column) return ""; //$NON-NLS-1$ + return columns.elementAt(column - 1).toString(); + + } + public void setColumnTypes(Vector columnsTypes) { + this.columnTypes = columnsTypes; + } + public String getColumnType(int column) { + if (columnTypes.size() < column) return ""; //$NON-NLS-1$ + return columnTypes.elementAt(column - 1).toString(); + } + public void setColumnSizes(int[] columnSizes) { + this.columnSizes = columnSizes; + } + public int getColumnSize(int column) { + if (columnSizes.length < column) return 0; + return columnSizes[column - 1]; + } + public void addRow(Vector row) { + rows.add(row); + } + public Object getElement(int column, int row) { + return ((Vector) rows.get(row - 1)).elementAt(column - 1); + } + public int getColumnCount() { + if (columns.size() > 0) { + return columns.size(); + } + return 0; + } + public int getRowCount() { + return rows.size(); + } + /** + * Returns the query. + * @return String + */ + public String getQuery() { + return query; + } + + /** + * Sets the query. + * @param query The query to set + */ + public void setQuery(String query) { + this.query = query; + } + + /** + * Returns the resultSet. + * @return boolean + */ + public boolean isResultSet() { + return resultSet; + } + + /** + * Sets the resultSet. + * @param resultSet The resultSet to set + */ + public void setResultSet(boolean resultSet) { + this.resultSet = resultSet; + } + + public int getUpdateCount() { + return updateCount; + } + + public void setUpdateCount(int updateCount) { + this.updateCount = updateCount; + } + + public String getTable() { + return table; + } + + public void setTable(String table) { + this.table = table; + } + + public boolean hasMore() { + return hasMore; + } + + public void setHasMore(boolean hasMore) { + this.hasMore = hasMore; + } + + public int getMaxSize() { + return maxSize; + } + + public void setMaxSize(int maxSize) { + this.maxSize = maxSize; + } + + public boolean isError() { + return isError; + } + + public void setIsError(boolean isError) { + this.isError = isError; + } + /** + * + */ + public Object[] getRows() { + return rows.toArray(); + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/TableRow.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/TableRow.java new file mode 100644 index 0000000..e263d49 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/TableRow.java @@ -0,0 +1,60 @@ +package com.quantum.sql; + +import com.quantum.model.Bookmark; +import com.quantum.model.Entity; +import com.quantum.util.StringMatrix; + +public class TableRow { + private String[] columnNames; + private Bookmark bookmark; + private String table; + private Entity entity; + private StringMatrix fullTableData; + + public TableRow(Entity entity, Bookmark bookmark, String table, StringMatrix tableData) { + this.entity = entity; + this.table = table; + // tableData will contain the first row of the tableData, for compatibility reasons with older code + // TODO: refactor the older code to allow for multiple selections + this.columnNames = tableData.getHeader(); + this.bookmark = bookmark; + this.fullTableData = tableData; + } + + public int getColumnCount() { + return columnNames.length; + } + + public String[] getColumnNames() { + return columnNames; + } + + public String getTable() { + return table; + } + + public Bookmark getBookmark() { + return this.bookmark; + } + + public Entity getEntity() { + return this.entity; + } + + public void setColumnNames(String[] columnNames) { + this.columnNames = columnNames; + } + + public String[] getTableData() { + return getTableRow(0); + } + + public String[] getTableRow(int i) { + return fullTableData.getRow(i); + } + + public StringMatrix getRowTableData() { + return fullTableData; + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/metadata/MetaDataJDBCInterface.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/metadata/MetaDataJDBCInterface.java new file mode 100644 index 0000000..b754964 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/metadata/MetaDataJDBCInterface.java @@ -0,0 +1,195 @@ +/* + * Created on 8/04/2003 + * + */ +package com.quantum.sql.metadata; + +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; + +import com.quantum.util.StringMatrix; + +/** + * Groups functions that allow extracting data from a JDBC connection + * in the form of StringMatrix objects + * + * @author panic + * + */ +public class MetaDataJDBCInterface { + + /** + * @param con : A valid (open) connection to an JDBC database + * @param schema : Schema of the table. Must be null if not given + * @param table : Name of the table. + * @return a StringMatrix with the info of the columns' metadata, null if error + */ + public static StringMatrix getColumns(Connection con, String schema, String table) + throws SQLException { + + DatabaseMetaData meta = con.getMetaData(); + ResultSet set = null; + StringMatrix columns = null; + try { + set = meta.getColumns(null, schema, table, null); + columns = fillMatrix(set); + set.close(); + + } catch (SQLException e) { + } + if (columns == null) { + columns = new StringMatrix(); + String query = "SELECT * FROM \"" + table + "\" WHERE (1 = 0)"; //$NON-NLS-1$ //$NON-NLS-2$ + Statement stmt = con.createStatement(); + stmt.execute(query); + ResultSet rset = stmt.getResultSet(); + ResultSetMetaData rsMetaData = rset.getMetaData(); + int columnCount = rsMetaData.getColumnCount(); + String headMatrix[] = {"TABLE_CAT","TABLE_SCHEM","TABLE_NAME","COLUMN_NAME","DATA_TYPE","TYPE_NAME","COLUMN_SIZE", + "BUFFER_LENGTH","DECIMAL_DIGITS","NUM_PREC_RADIX","NULLABLE","REMARKS", + "COLUMN_DEF","SQL_DATA_TYPE","SQL_DATETIME_SUB","CHAR_OCTET_LENGTH", + "ORDINAL_POSITION","IS_NULLABLE","SCOPE_CATLOG","SCOPE_SCHEMA","SCOPE_TABLE","SOURCE_DATA_TYPE"}; + columns.addMatrixHeader(headMatrix); + for (int i = 0; i < columnCount; i++) { + columns.add(null, i); /* TABLE_CAT */ + columns.add(schema, i); /* TABLE_SCHEM */ + columns.add(table, i); /* TABLE_NAME */ + columns.add(rsMetaData.getColumnName(i+1), i); /* COLUMN_NAME */ + columns.add(String.valueOf(rsMetaData.getColumnType(i+1)), i); /* DATA_TYPE */ + columns.add(rsMetaData.getColumnTypeName(i+1), i); /* TYPE_NAME */ + columns.add(String.valueOf(rsMetaData.getPrecision(i+1)), i); /* COLUMN_SIZE */ + columns.add(null, i); /* BUFFER_LENGTH */ + columns.add(String.valueOf(rsMetaData.getScale(i+1)), i); /* DECIMAL_DIGITS */ + columns.add(null, i); /* NUM_PREC_RADIX */ + int isNullable = rsMetaData.isNullable(i+1); + columns.add(String.valueOf(isNullable), i); /* NULLABLE */ + columns.add(null, i); /* REMARKS */ + columns.add(null, i); /* COLUMN_DEF */ + columns.add(null, i); /* SQL_DATA_TYPE */ + columns.add(null, i); /* SQL_DATETIME_SUB */ + columns.add(String.valueOf(rsMetaData.getColumnDisplaySize(i+1)), i); /* CHAR_OCTET_LENGTH */ + columns.add(String.valueOf(i+1), i); /* ORDINAL_POSITION */ + columns.add(isNullable == DatabaseMetaData.columnNullable ? "YES" : "NO", i ); + columns.add(null, i); /* SCOPE_CATLOG */ + columns.add(null, i); /* SCOPE_SCHEMA */ + columns.add(null, i); /* SCOPE_TABLE */ + columns.add(null, i); /* SOURCE_DATA_TYPE */ + } + } + return columns; + } + + /** + * @param con : A valid (open) connection to an JDBC database + * @param schema : Schema of the table. Must be null if not given + * @param table : Name of the table. + * @return a StringMatrix with the info of the primary keys + */ + public static StringMatrix getPrimaryKeys(Connection con, String schema, String table) { + + StringMatrix keys = new StringMatrix(); + try { + DatabaseMetaData meta = con.getMetaData(); + ResultSet set = meta.getPrimaryKeys(null, schema, table); + keys = fillMatrix(set); + set.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + return keys; + } + + /** + * @param con : A valid (open) connection to an JDBC database + * @param schema : Schema of the table. Must be null if not given + * @param table : Name of the table. + * @param imported : Determines if the foreign keys are the imported or exported ones + * @return a StringMatrix with the info of the foreign keys + */ + public static StringMatrix getForeignKeys(Connection con, String schema, String table, boolean imported ) { + + ResultSet set = null; + StringMatrix keys = new StringMatrix(); + try { + DatabaseMetaData meta = con.getMetaData(); + if (imported){ + set = meta.getImportedKeys(null, schema, table); + } else { + set = meta.getExportedKeys(null, schema, table); + } + keys = fillMatrix(set); + set.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + return keys; + } + + /** + * @param con : A valid (open) connection to an JDBC database + * @param schema : Schema of the table. Must be null if not given + * @param table : Name of the table. + * @return a StringMatrix with the info of the indexes on that table + */ + public static StringMatrix getIndexInfo(Connection con, String schema, String table) { + + ResultSet set = null; + DatabaseMetaData meta; + StringMatrix keys = new StringMatrix(); + try { + meta = con.getMetaData(); + set = meta.getIndexInfo(null, schema, table, false, false); + keys = fillMatrix(set); + set.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + return keys; + } + + + /** + * + * @param set + * @return a filled StringMatrix with the set results + * @throws SQLException + */ + public static StringMatrix fillMatrix(ResultSet set) throws SQLException { + int columnCount = set.getMetaData().getColumnCount(); + StringMatrix keys = new StringMatrix(); + for (int i = 1; i <= columnCount; i++) { + keys.addHeader(set.getMetaData().getColumnName(i)); + } + int row = 0; + while (set.next()) { + for (int i = 1; i <= columnCount; i++) { + keys.add(set.getString(i), row); + } + row++; + } + return keys; + } + + /** + * @param con + * @param schema + * @param tableName + */ + public static StringMatrix getBestRowId(Connection con, String schema, String table) + throws SQLException { + + ResultSet set = null; + DatabaseMetaData meta = con.getMetaData(); + set = meta.getBestRowIdentifier(null, schema, table, DatabaseMetaData.bestRowSession, true); + StringMatrix keys = fillMatrix(set); + set.close(); + return keys; + + } + + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/metadata/MetaDataXMLInterface.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/metadata/MetaDataXMLInterface.java new file mode 100644 index 0000000..03cc5e4 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/metadata/MetaDataXMLInterface.java @@ -0,0 +1,191 @@ +/* + * Created on 15/04/2003 + * + */ +package com.quantum.sql.metadata; + +import java.util.Vector; + +import com.quantum.util.StringMatrix; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.Text; + + +/** + * @author panic + * Handles interface between an ObjectMetaData and XML storage. + * It can write an existing metadata object to XML and generate + * a new ObjectMetaData from existing XML. + */ +public class MetaDataXMLInterface { + + /** + * Exports an ObjectMetaData to an XML document, under a root Element + * @param metadata The ObjectMetaData to export + * @param doc A valid XML document to receive the export + * @param root The Element under which all the XML data will be written + */ + public static void metaDataToXML(ObjectMetaData metadata, Document doc, Element root) { + StringMatrix columns = metadata.getColumns(); + if (columns != null) + stringMatrixToXML(columns, doc, root, "COLUMN"); //$NON-NLS-1$ + StringMatrix primaryKeys = metadata.getPrimaryKeys(); + if (primaryKeys != null) + stringMatrixToXML(primaryKeys, doc, root, "PRIMARY_KEY_ITEM"); //$NON-NLS-1$ + StringMatrix foreignKeys = metadata.getForeignKeys(); + if (foreignKeys != null) + stringMatrixToXML(foreignKeys, doc, root, "FOREIGN_KEY_ITEM"); //$NON-NLS-1$ + StringMatrix indexInfo = metadata.getIndexInfo(); + if (indexInfo != null) + stringMatrixToXML(indexInfo, doc, root, "INDEX_ITEM"); //$NON-NLS-1$ + } + + /** + * Imports an XML element to an ObjectMetaData. The format has to be the same as extracted by + * the MetaDataToXML function. + * @param metadata The ObjectMetaData to fill up. Usually empty. + * @param root The Element having all the XML data + */ + public static void xmlToMetaData(ObjectMetaData metadata, Element root) { + StringMatrix columns = new StringMatrix(); + MetaDataXMLInterface.xmlToStringMatrix(columns, root, "COLUMN"); //$NON-NLS-1$ + metadata.setColumns(columns); + StringMatrix primaryKeys = new StringMatrix(); + MetaDataXMLInterface.xmlToStringMatrix(primaryKeys, root, "PRIMARY_KEY_ITEM"); //$NON-NLS-1$ + metadata.setPrimaryKeys(primaryKeys); + StringMatrix foreignKeys = new StringMatrix(); + MetaDataXMLInterface.xmlToStringMatrix(foreignKeys, root, "FOREIGN_KEY_ITEM"); //$NON-NLS-1$ + metadata.setForeignKeys(foreignKeys); + StringMatrix indexInfo = new StringMatrix(); + MetaDataXMLInterface.xmlToStringMatrix(indexInfo, root, "INDEX_ITEM"); //$NON-NLS-1$ + metadata.setIndexInfo(indexInfo); + } + + /** + * Adds a StringMatrix to an XML document + * @param matrix The StringMatrix to add + * @param doc The XmlDocument to which it will be added + * @param root An element of the previous document under which the info will be added + * @param sub A key under which each row of the StringMatrix will be added + */ + public static void stringMatrixToXML(StringMatrix matrix, Document doc, Element root, String sub) { + for (int i = 0; i < matrix.size(); i++) { + Element localRoot = (Element) root.appendChild(doc.createElement(sub)); + for (int j = 0; j < matrix.getNumColumns(); j++) { + String key = matrix.getHeaderColumn(j); + Element tableName = (Element) localRoot.appendChild(doc.createElement(key)); + String value = matrix.get(key, i); + if (value != null) + tableName.appendChild(doc.createTextNode(value)); + } + } + } + + /** + * Fills a StringMatrix with the data from XML, usually extracted with the StringMatrixToXML function + * @param matrix The matrix to fill up, usually empty. + * @param root The Element with all the data in XML DOM + * @param sub The String to select the Nodes which interest us. Only the selected nodes will be added + * to the StringMatrix. + */ + private static void xmlToStringMatrix(StringMatrix matrix, Element root, String sub) { + NodeList columns = root.getElementsByTagName(sub); + for (int i = 0; i < columns.getLength(); i++) { + Node column = columns.item(i); + NodeList columnList = column.getChildNodes(); + for (int j = 0; j < columnList.getLength(); j++) { + Node node = columnList.item(j); + String header = node.getNodeName(); + if (header.equals("#text")) //$NON-NLS-1$ + continue; + String value = null; + if (node != null && node.hasChildNodes()) { + Node valueNode = node.getFirstChild(); + if (valueNode instanceof Text) { + value = valueNode.getNodeValue(); + } + } + if (!matrix.contains(header)) + matrix.addHeader(header); + matrix.addAt(header, value, i); + } + } + } + /** + * Creates a new Element with a text value + * @param root + * @param key + * @param value + * @return + */ + public static Element createElementText(Element root, String key, String value){ + // get the XmlDocument for use as a factory + Document doc = root.getOwnerDocument(); + Element newElement = doc.createElement(key); + + root.appendChild(newElement); + if (value != null && value.length() > 0) + { + Text valueText = doc.createTextNode(value); + newElement.appendChild(valueText); + } + return newElement; + } + + public static String getElementText(Element root, String key){ + return getElementText(root, key, ""); + } + /** + * gets the text value from an element or a child of it + * @param root element root + * @param key key to search + * @param defValue default string value if not found + * @return + */ + public static String getElementText(Element root, String key, String defValue){ + // get the XmlDocument for use as a factory + String value = defValue; + if (root.getNodeName().equals(key)){ + value = extractText(root, defValue); + } else { + NodeList children = root.getElementsByTagName(key); + if (children.getLength() > 0) { + Element column = (Element) children.item(0); + value = extractText(column, defValue); + } + } + return value; + } + + private static String extractText(Element node, String defValue){ + String value = defValue; + if (node != null && node.hasChildNodes()) { + Node valueNode = node.getFirstChild(); + if (valueNode instanceof Text) { + value = valueNode.getNodeValue(); + } + } + return value; + } + + /** + * Gets a Vector with the String values of the keys + * that are children of 'root' and that match 'key' + * @param root + * @param key + * @return + */ + public static Vector getVectorText(Element root, String key) { + Vector result = new Vector(); + NodeList children = root.getElementsByTagName(key); + for (int i = 0; i < children.getLength(); i++) { + Element column = (Element) children.item(i); + result.add(extractText(column, "")); + } + return result; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/metadata/ObjectMetaData.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/metadata/ObjectMetaData.java new file mode 100644 index 0000000..3858253 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/metadata/ObjectMetaData.java @@ -0,0 +1,204 @@ +/* + * Created on 8/04/2003 + * + */ +package com.quantum.sql.metadata; + +import java.util.Vector; + +import com.quantum.util.StringMatrix; + + +/** + * Class to hold the Metadata of a database element + * @author panic + */ +public class ObjectMetaData { + private StringMatrix columns = new StringMatrix(); + private StringMatrix primaryKeys = new StringMatrix(); + private StringMatrix foreignKeys = new StringMatrix(); + private StringMatrix indexInfo = new StringMatrix(); + private StringMatrix bestRowId = new StringMatrix(); + + + /** + * Gives the order of the column in the primary key + * @param column + * @return the order of the column in the primary key, 0 if it's not part of it. + */ + public int getPrimaryKeyOrder(String column){ + if (primaryKeys.size() == 0) return 0; + StringMatrix keyColumns = primaryKeys.select("COLUMN_NAME", column); //$NON-NLS-1$ + if (keyColumns != null && keyColumns.size() > 0) { + String index = keyColumns.get("KEY_SEQ", 0); // We suppose there is only a primary key //$NON-NLS-1$ + if (index != null ) return Integer.parseInt(index); + } + return 0; + } + + /** + * Gives the type of the column + * @param column + * @return the type of the column using the values defined in java.sql.Types + */ + public int getColumnType(String column){ + StringMatrix selectCol = columns.select("COLUMN_NAME", column); //$NON-NLS-1$ + if (selectCol != null && selectCol.size() > 0) { + String type = selectCol.get("DATA_TYPE", 0); // It should be only one column //$NON-NLS-1$ + if (type != null ) return Integer.parseInt(type); + } + return 0; + + } + + /** + * Returns a String with the names of the columns, separated by commas + */ + public String getColumnsString() { + String result = ""; //$NON-NLS-1$ + Vector columnNames = columns.getColumn("COLUMN_NAME"); //$NON-NLS-1$ + for (int i = 0; i < columnNames.size(); i++) { + if (i > 0) result += ", "; //$NON-NLS-1$ + result += (String) columnNames.get(i); + } + return result; + } + + /** + * Returns a vector of Strings with the names of the columns + */ + public Vector getColumnNamesVector() { + Vector result = new Vector(); + Vector columnNames = columns.getColumn("COLUMN_NAME"); //$NON-NLS-1$ + for (int i = 0; i < columnNames.size(); i++) { + result.add((String) columnNames.get(i)); + } + return result; + } + + // Inmediate getters and setters + + /** + * @param matrix + */ + public void setColumns(StringMatrix matrix) { + columns = matrix; + } + /** + * @param matrix + */ + public void setForeignKeys(StringMatrix matrix) { + foreignKeys = matrix; + } + + /** + * @param matrix + */ + public void setPrimaryKeys(StringMatrix matrix) { + primaryKeys = matrix; + } + /** + * @param matrix + */ + public void setBestRowId(StringMatrix matrix) { + bestRowId = matrix; + } + + /** + * @param matrix + */ + public void setIndexInfo(StringMatrix matrix) { + indexInfo = matrix; + } + + /** + * @return + */ + public StringMatrix getColumns() { + return columns; + } + + /** + * @return + */ + public StringMatrix getForeignKeys() { + return foreignKeys; + } + + /** + * @return + */ + public StringMatrix getPrimaryKeys() { + return primaryKeys; + } + + + /** + * @return + */ + public StringMatrix getIndexInfo() { + return indexInfo; + } + /** + * @return + */ + public StringMatrix getBestRowId() { + return bestRowId; + } + + + /** + * @param column + */ + public void dropColumn(String columnName) { + columns.dropMatching("COLUMN_NAME", columnName); //$NON-NLS-1$ + } + + // Common Object interface + + /* (non-Javadoc) + * @see java.lang.Object#clone() + */ + public Object clone() { + ObjectMetaData result = new ObjectMetaData(); + result.columns = (StringMatrix) columns.clone(); + result.primaryKeys = (StringMatrix) primaryKeys.clone(); + result.indexInfo = (StringMatrix) indexInfo.clone(); + result.foreignKeys = (StringMatrix) foreignKeys.clone(); + return result; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object obj) { + if (!(obj instanceof ObjectMetaData)) return false; + ObjectMetaData obMd = (ObjectMetaData) obj; + return (columns.equals(obMd.columns) && + primaryKeys.equals(obMd.primaryKeys) && + indexInfo.equals(obMd.indexInfo) && + foreignKeys.equals(obMd.foreignKeys) ); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + public String toString() { + return ( columns.toString() + + foreignKeys.toString() + + indexInfo.toString() + + primaryKeys.toString()); + } + + public String getQualifiedTableName(){ + if (columns.size() < 1) return ""; + String result = columns.get("TABLE_NAME", 0); + String schema = columns.get("TABLE_SCHEM", 0); + if (schema != null && schema.length() > 0) + result = schema + "." + result; + return result; + + } + + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/parser/SQLLexx.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/parser/SQLLexx.java new file mode 100644 index 0000000..e901266 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/parser/SQLLexx.java @@ -0,0 +1,166 @@ +package com.quantum.sql.parser; + +import java.util.Vector; + +public class SQLLexx { + private static String endline = ";"; //$NON-NLS-1$ + private static String dash = "-"; //$NON-NLS-1$ + private static String group = "/"; //$NON-NLS-1$ + /** + * Parses a SQL text into tokens. + * @param text + * @return a vector of Token objects. + */ + public static Vector parse(String text) { + Vector tokens = new Vector(); + StringPointer p = new StringPointer(text); + try { + while (!p.isDone()) { + int offset = p.getOffset(); + char c = p.getNext(); + // Adds END_OF_LINE token + if (c == '\n') { + tokens.addElement(new Token(Token.END_OF_LINE, "\n", offset, offset + 1)); + } + // Adds WHITESPACE token; + else if (Character.isWhitespace(c)) { + StringBuffer value = new StringBuffer(); + while (Character.isWhitespace(c) && !p.isDone()) { + value.append(c); + c = p.getNext(); + } + // done because of is done + if (Character.isWhitespace(c)) { + value.append(c); + } else if (!p.isDone()){ + p.back(); + } + tokens.addElement(new Token(Token.WHITESPACE, value.toString(), offset, offset + value.length())); + // Adds IDENTIFIER token (can be reserved SQL word or not); + } else if (Character.isLetter(c) || c == '_' || c == '$') { + StringBuffer value = new StringBuffer(); + while ((Character.isLetterOrDigit(c) || c == '_' || c == '$') && !p.isDone()) { + value.append(c); + c = p.getNext(); + } + if ((Character.isLetterOrDigit(c) || c == '_')) { + value.append(c); + } else if (!p.isDone()){ + p.back(); + } + tokens.addElement(new Token(Token.IDENTIFIER, value.toString(), offset, offset + value.length())); + // Adds LITERAL token; + } else if (c == '\'') { + StringBuffer value = new StringBuffer(); + value.append(c); + if (!p.isDone()) { + c = p.getNext(); + while (c != '\'' && c != '\n' && !p.isDone()) { + value.append(c); + c = p.getNext(); + } + if (c == '\'' || p.isDone()) { + value.append(c); + } else if (!p.isDone()){ + p.back(); + } + } + tokens.addElement(new Token(Token.LITERAL, value.toString(), offset, offset + value.length())); + // Adds COMMENT token (or SYMBOL (dash) if only one dash); + } else if (c == '-') { + p.mark(); + if (p.isDone()) { + tokens.addElement(new Token(Token.SYMBOL, dash, offset, offset + 1)); + } else { + char next = p.getNext(); + if (next == '-') { + StringBuffer value = new StringBuffer("--"); //$NON-NLS-1$ + if (!p.isDone()) { + c = p.getNext(); + while (c != '\n' && !p.isDone()) { + value.append(c); + c = p.getNext(); + } + if (p.isDone()) { + value.append(c); + } else { + p.back(); + } + } + tokens.addElement(new Token(Token.COMMENT, value.toString(), offset, offset + value.length())); + } else { + tokens.addElement(new Token(Token.SYMBOL, dash, offset, offset + 1)); + p.reset(); + } + } + // Adds SEPARATOR token (;), considers the rest of the line as COMMENT token; + } else if (c == ';') { + tokens.addElement(new Token(Token.SEPARATOR, endline, offset, offset + 1)); + StringBuffer value = new StringBuffer(); + if (!p.isDone()) { + c = p.getNext(); + while (c != '\n' && !p.isDone()) { + value.append(c); + c = p.getNext(); + } + if (p.isDone()) { + value.append(c); + } else { + p.back(); + } + // We add to the offset so as to skip the initial ';' + offset++; + tokens.addElement(new Token(Token.COMMENT, value.toString(), offset, offset + value.length())); + } + // Adds NUMERIC token; + } else if (Character.isDigit(c)) { + StringBuffer value = new StringBuffer(); + while ((Character.isDigit(c) || c == '.') && !p.isDone()) { + value.append(c); + c = p.getNext(); + } + if ((Character.isDigit(c) || c == '.')) { + value.append(c); + } else { + p.back(); + } + tokens.addElement(new Token(Token.NUMERIC, value.toString(), offset, offset + value.length())); + // Adds COMMENT token (or GROUP (slash) if only one slash); + } else if (c == '/') { + p.mark(); + // If we have '/*', it's a comment till '*/' found or eof + if (p.peek() == '*') { + StringBuffer value = new StringBuffer(); + c = p.getNext(); + value.append('/'); + while (!( c == '*' && p.peek() == '/' ) && !p.isDone()) { + value.append(c); + c = p.getNext(); + } + if (!p.isDone()){ + value.append(c); + c = p.getNext(); + value.append(c); + } + tokens.addElement(new Token(Token.COMMENT, value.toString(), offset, offset + value.length())); + } else { + // It's not '/*' , so it's a group token + tokens.addElement(new Token(Token.GROUP, group, offset, offset + 1)); + p.reset(); + } + // Adds SYMBOL token; + } else { + tokens.addElement(new Token(Token.SYMBOL, new String(new char[] {c}), offset, offset + 1)); + } + } + } catch (RuntimeException e) { + e.printStackTrace(); + } + +// System.out.println("-------------------"); +// for (int i = 0; i < tokens.size(); i++) { +// System.out.println((Token) tokens.elementAt(i)); +// } + return tokens; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/parser/StringPointer.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/parser/StringPointer.java new file mode 100644 index 0000000..846da29 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/parser/StringPointer.java @@ -0,0 +1,62 @@ +package com.quantum.sql.parser; + +public class StringPointer { + char[] value; + int offset = 0; + int mark = 0; + public StringPointer(String s) { + value = s.toCharArray(); + } + /** + * Returns the next character. Will return 0 if at end of file, but that's not + * checkeable because it can be a valid character. You should check with isDone(); + * @return + */ + public char getNext() { + char retVal = (offset < value.length) ? value[offset] : 0; + offset++; + return retVal; + } + /** + * Returns the next character, without advancing the pointer. + * Will return 0 if at end of file, but that's not + * checkeable because it can be a valid character. You should check with isDone(); + * @return + */ + public char peek() { + char retVal = (offset < value.length) ? value[offset] : 0; + return retVal; + } + /** + * Marks a poing of the stream to come back later (using reset()); + */ + public void mark() { + mark = offset; + } + /** + * Returns to a previously marked (with mark()) place. + */ + public void reset() { + offset = mark; + } + /** + * Sets the pointer back a character, in fact 'pop'ing it back to the stream; + */ + public void back() { + if (offset > 0) offset--; + } + + public int getOffset() { + return offset; + } + /** + * @return true if the stream is at an end + */ + public boolean isDone() { + return offset >= value.length; + } + + public int getLength() { + return value.length; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/parser/Token.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/parser/Token.java new file mode 100644 index 0000000..438ce5c --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/sql/parser/Token.java @@ -0,0 +1,57 @@ +package com.quantum.sql.parser; + +public class Token { + public static final char SEPARATOR = 'S'; + public static final char SYMBOL = 'Y'; + public static final char LITERAL = 'L'; + public static final char IDENTIFIER = 'I'; + public static final char COMMENT = 'C'; + public static final char WHITESPACE = 'W'; + public static final char NUMERIC = 'N'; + public static final char GROUP = 'G'; + public static final char END_OF_LINE = 'E'; + private char type; + private int start; + private int end; + private String value; + public Token(char type, String value, int start, int end) { + this.type = type; + this.value = value; + this.start = start; + this.end = end; + } + public int getEnd() { + return end; + } + + public int getStart() { + return start; + } + + public int getType() { + return type; + } + + public String getValue() { + return value; + } + + public void setEnd(int end) { + this.end = end; + } + + public void setStart(int start) { + this.start = start; + } + + public void setType(char type) { + this.type = type; + } + + public void setValue(String value) { + this.value = value; + } + public String toString() { + return type + " ->" + value + "<- [" + start + ", " + end + "]"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/ui/dialog/BookmarkSelectionDialog.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/ui/dialog/BookmarkSelectionDialog.java new file mode 100644 index 0000000..6707429 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/ui/dialog/BookmarkSelectionDialog.java @@ -0,0 +1,110 @@ +package com.quantum.ui.dialog; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; + +import com.quantum.Messages; +import com.quantum.model.Bookmark; +import com.quantum.model.BookmarkCollection; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.List; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; + +/** + * @author BC + */ +public class BookmarkSelectionDialog extends Dialog { + + private List list; + private String selection = null; + private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); + + /** + * @param parentShell + */ + public BookmarkSelectionDialog(Shell parentShell) { + super(parentShell); + int style = getShellStyle() | SWT.TITLE; + setShellStyle(style); + } + + protected void configureShell(Shell shell) { + super.configureShell(shell); + shell.setText(Messages.getString("BookmarkSelectionDialog.title")); + } + + /** + * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) + */ + protected Control createDialogArea(Composite parent) { + + Composite composite = new Composite(parent, 0); + GridLayout layout = new GridLayout(); + composite.setLayout(layout); + layout.numColumns = 1; + layout.verticalSpacing = 1; + + Label label = new Label(composite, SWT.NULL); + label.setText(Messages.getString("BookmarkSelectionDialog.text")); + + this.list = new List(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL); + Bookmark[] bookmarks = BookmarkCollection.getInstance().getBookmarks(); + + for (int i = 0, length = (bookmarks == null) ? 0 : bookmarks.length; i < length; i++) { + this.list.add(bookmarks[i].getName()); + if (i == 0) { + this.list.select(i); + setSelection(bookmarks[i].getName()); + } + } + + final List list = this.list; + list.addListener(SWT.Selection, new Listener() { + public void handleEvent (Event event) { + String[] selections = list.getSelection(); + if (selections != null && selections.length > 0) { + BookmarkSelectionDialog.this.setSelection(selections[0]); + } + } + }); + + GridData full = new GridData(); + full.horizontalAlignment = GridData.FILL; + full.verticalAlignment = GridData.FILL; + full.heightHint = convertHeightInCharsToPixels(3); + this.list.setLayoutData(full); + + return composite; + } + + /** + * @param listener + */ + public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { + this.propertyChangeSupport.addPropertyChangeListener(listener); + } + + /** + * @param listener + */ + public synchronized void removePropertyChangeListener(PropertyChangeListener listener) { + this.propertyChangeSupport.removePropertyChangeListener(listener); + } + + private void setSelection(String selection) { + String original = this.selection; + if (this.selection == null || !this.selection.equals(selection)) { + this.selection = selection; + this.propertyChangeSupport.firePropertyChange("selection", original, this.selection); + } + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/ui/dialog/ExceptionDisplayDialog.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/ui/dialog/ExceptionDisplayDialog.java new file mode 100644 index 0000000..7917a07 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/ui/dialog/ExceptionDisplayDialog.java @@ -0,0 +1,281 @@ +package com.quantum.ui.dialog; + +import com.quantum.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * @author BC + */ +public class ExceptionDisplayDialog extends Dialog { + + private Control detailsArea; + private Throwable throwable; + private String message; + + /** + * @param parentShell + */ + public ExceptionDisplayDialog(Shell parentShell, Throwable throwable) { + super(parentShell); + this.throwable = throwable; + } + + /** + * The Details button. + */ + private Button detailsButton; + + /** + * The title of the dialog. + */ + private String title; + + /** + * Indicates whether the error details viewer is currently created. + */ + private boolean detailsShown = false; + + /** + * Creates an error dialog. + * Note that the dialog will have no visual representation (no widgets) + * until it is told to open. + *

+ * Normally one should use openError to create and open one of these. + * This constructor is useful only if the error object being displayed contains child + * items and you need to specify a mask which will be used to filter the + * displaying of these children. + *

+ * + * @param parentShell the shell under which to create this dialog + * @param dialogTitle the title to use for this dialog, + * or null to indicate that the default title should be used + * @param message the message to show in this dialog, + * or null to indicate that the error's message should be shown + * as the primary message + * @param status the error to show to the user + * @param displayMask the mask to use to filter the displaying of child items, + * as per IStatus.matches + * @see org.eclipse.core.runtime.IStatus#matches(int) + */ + public ExceptionDisplayDialog( + Shell parentShell, + String dialogTitle, + String message, + Throwable throwable) { + super(parentShell); + + this.title = dialogTitle; + this.message = message; + this.throwable = throwable; + + setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL); + } + + /* (non-Javadoc) + * Method declared on Dialog. + * Handles the pressing of the Ok or Details button in this dialog. + * If the Ok button was pressed then close this dialog. If the Details + * button was pressed then toggle the displaying of the error details area. + * Note that the Details button will only be visible if the error being + * displayed specifies child details. + */ + protected void buttonPressed(int id) { + if (id == IDialogConstants.DETAILS_ID) { + // was the details button pressed? + toggleDetailsArea(); + } else { + super.buttonPressed(id); + } + } + /* (non-Javadoc) + * Method declared in Window. + */ + protected void configureShell(Shell shell) { + super.configureShell(shell); + shell.setText(title); + } + /* (non-Javadoc) + * Method declared on Dialog. + */ + protected void createButtonsForButtonBar(Composite parent) { + // create OK and Details buttons + createButton( + parent, + IDialogConstants.OK_ID, + IDialogConstants.OK_LABEL, + true); + this.detailsButton = + createButton( + parent, + IDialogConstants.DETAILS_ID, + IDialogConstants.SHOW_DETAILS_LABEL, + false); + } + + protected Control createDialogArea(Composite parent) { + + // create a composite with standard margins and spacing + Composite composite = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.marginHeight = + convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); + layout.marginWidth = + convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); + layout.verticalSpacing = + convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); + layout.horizontalSpacing = + convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + composite.setLayout(layout); + GridData childData = new GridData(GridData.FILL_BOTH); + childData.horizontalSpan = 2; + composite.setLayoutData(childData); + composite.setFont(parent.getFont()); + + Label label = new Label(composite, 0); + label.setText(this.message); + label.setFont(parent.getFont()); + + + GridData full = new GridData(); + full.horizontalAlignment = GridData.FILL; + full.verticalAlignment = GridData.FILL; + full.heightHint = convertHeightInCharsToPixels(3); + full.widthHint = convertWidthInCharsToPixels(60); + label.setLayoutData(full); + + return composite; + + } + + /** + * Create the expandable details arae. + * + * @param parent the parent composite + * @return the details text control + */ + protected Control createDetailsArea(Composite parent) { + + // create a composite with standard margins and spacing + Composite composite = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.marginHeight = + convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); + layout.marginWidth = + convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); + layout.verticalSpacing = + convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); + layout.horizontalSpacing = + convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + composite.setLayout(layout); + GridData childData = new GridData(GridData.FILL_BOTH); + childData.horizontalSpan = 2; + composite.setLayoutData(childData); + composite.setFont(parent.getFont()); + + Label label = new Label(composite, 0); + label.setText(Messages.getString("ExceptionDisplayDialog.stackTrace")); + label.setFont(parent.getFont()); + + GridData full = new GridData(); + full.horizontalAlignment = GridData.FILL; + full.verticalAlignment = GridData.FILL; + full.heightHint = convertHeightInCharsToPixels(3); + full.widthHint = convertWidthInCharsToPixels(60); + label.setLayoutData(full); + + Text text = + new Text( + composite, + SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI); + + text.setText(this.throwable.getMessage()); + + GridData data = + new GridData( + GridData.HORIZONTAL_ALIGN_FILL + | GridData.GRAB_HORIZONTAL + | GridData.VERTICAL_ALIGN_FILL + | GridData.GRAB_VERTICAL); + data.heightHint = convertHeightInCharsToPixels(8); + text.setLayoutData(data); + text.setFont(parent.getFont()); + + this.detailsShown = true; + return composite; + } + /** + * Opens an error dialog to display the given error. Use this method if the + * error object being displayed contains child items and you wish to + * specify a mask which will be used to filter the displaying of these + * children. The error dialog will only be displayed if there is at + * least one child status matching the mask. + * + * @param parentShell - + * the parent shell of the dialog, or null if none + * @param dialogTitle the title to use for this dialog, + * or null to indicate that the default title should be used + * @param message the message to show in this dialog, + * or null to indicate that the error's message should be shown + * as the primary message + * as per IStatus.matches + * @return the code of the button that was pressed that resulted in this dialog + * closing. This will be Dialog.OK if the OK button was + * pressed, or Dialog.CANCEL if this dialog's close window + * decoration or the ESC key was used. + * @see org.eclipse.core.runtime.IStatus#matches(int) + */ + public static int openError( + Shell parentShell, + String title, + String message, + Throwable throwable) { + + if (title == null) { + title = Messages.getString(ExceptionDisplayDialog.class.getName() + + "." + throwable.getClass().getName() + ".title"); + } + if (message == null) { + message = Messages.getString(ExceptionDisplayDialog.class.getName() + + "." + throwable.getClass().getName() + ".message"); + } + ExceptionDisplayDialog dialog = + new ExceptionDisplayDialog(parentShell, title, message, throwable); + return dialog.open(); + } + + /** + * Toggles the unfolding of the details area. This is triggered by + * the user pressing the details button. + */ + private void toggleDetailsArea() { + Point windowSize = getShell().getSize(); + Point oldSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); + + if (this.detailsShown) { + this.detailsArea.dispose(); + this.detailsShown = false; + detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL); + } else { + this.detailsArea = createDetailsArea((Composite) getContents()); + detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL); + } + + Point newSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); + + getShell().setSize( + new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y))); + + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/ui/dialog/PasswordDialog.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/ui/dialog/PasswordDialog.java new file mode 100644 index 0000000..8e5d5bf --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/ui/dialog/PasswordDialog.java @@ -0,0 +1,122 @@ +/* + * Created on 28-ago-2003 + * + */ +package com.quantum.ui.dialog; + +import com.quantum.Messages; +import com.quantum.model.PasswordFinder; + +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * @author panic + * + */ +public class PasswordDialog extends InputDialog { + + static class PasswordFinderImpl implements PasswordFinder { + private boolean passwordMeantToBeSaved = false; + private String password; + private boolean prompted = false; + private Shell shell; + + PasswordFinderImpl(Shell shell) { + this.shell = shell; + } + + protected void prompt() { + PasswordDialog dialog = + new PasswordDialog( + this.shell, + Messages.getString("MultiSQLServer.PasswordNotProvided"), + Messages.getString("MultiSQLServer.Enter_Password"), + "", + this); + dialog.open(); + this.prompted = true; + } + + /** + * @return + */ + public String getPassword() { + if (!this.prompted) { + prompt(); + } + return password; + } + + /** + * @return + */ + public boolean isPasswordMeantToBeSaved() { + if (!this.prompted) { + prompt(); + } + return passwordMeantToBeSaved; + } + + /** + * @param string + */ + public void setPassword(String string) { + password = string; + } + + /** + * @param b + */ + public void setPasswordMeantToBeSaved(boolean b) { + passwordMeantToBeSaved = b; + } + + } + + private PasswordFinderImpl passwordFinderImpl; + + /** + * @param parentShell + * @param dialogTitle + * @param dialogMessage + * @param initialValue + * @param validator + */ + protected PasswordDialog( + Shell parentShell, + String dialogTitle, + String dialogMessage, + String initialValue, + PasswordFinderImpl passwordFinderImpl) { + super(parentShell, dialogTitle, dialogMessage, initialValue, null); + this.passwordFinderImpl = passwordFinderImpl; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) + */ + protected Control createDialogArea(Composite parent) { + + Control control = super.createDialogArea(parent); + Text text = getText(); + text.setEchoChar('*'); + return control; + } + + public static PasswordFinder createPasswordFinder(Shell parentShell) { + PasswordFinderImpl passwordFinder = new PasswordFinderImpl(parentShell); + return passwordFinder; + } + /** + * @see org.eclipse.jface.dialogs.Dialog#okPressed() + */ + protected void okPressed() { + this.passwordFinderImpl.setPassword(getText().getText()); + super.okPressed(); + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/NthLevelConverter.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/NthLevelConverter.java new file mode 100644 index 0000000..09352f0 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/NthLevelConverter.java @@ -0,0 +1,145 @@ +/* + * Created on 11/08/2003 + * + */ +package com.quantum.util; + +import java.util.Iterator; +import java.util.Vector; + +import com.quantum.QuantumPlugin; + +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * Class to clasify two levels of strings. It's called Nth Level but in fact it has only two levels :o) + * @author panic + * + */ +public class NthLevelConverter { + private final int DEFAULT_COLUMNS = 10; + private final int DEFAULT_INCREMENT = 10; + + private Vector upper = new Vector(DEFAULT_COLUMNS,DEFAULT_INCREMENT); + + public void add(String id, String parentId, int level) { + OneLevelConverter upperLine = new OneLevelConverter(id); + if (level == 1) { // If it's an upper leaf + if (!upper.contains(upperLine)) + this.upper.add(upperLine); + } + else if (level == 0) { // It's a lower leaf + if (parentId == null) return; // No parent, what shall we do. + OneLevelConverter upperFinder = new OneLevelConverter(parentId); + // Search if its parent is already present in the upper level + int ind = upper.indexOf(upperFinder); + // If not, addIt and find its index + if (ind < 0) { + this.upper.add(upperFinder); + ind = upper.indexOf(upperFinder); + } + OneLevelConverter upperItem = (OneLevelConverter) upper.get(ind); + // If it has no children, we create a new Vector for the children + if (upperItem.getLower() == null) + upperItem.setLower(new Vector(DEFAULT_COLUMNS,DEFAULT_INCREMENT)); + Vector children = upperItem.getLower(); + // Is the item already present in the children of its parent? + int indChildren = children.indexOf(id); + // If it's not, we add it + if (indChildren < 0) { + OneLevelConverter leaf = new OneLevelConverter(id); + children.add(leaf); + } + } + + } + + + /** + * @return + */ + public Vector getUpper() { + return upper; + } + + public Vector getLevel(String id, int level){ + if (level == 1) + return upper; + else if (level == 0){ + if (id == null) return null; + OneLevelConverter upperFinder = new OneLevelConverter(id); + int ind = upper.indexOf(upperFinder); + if (ind < 0) + return null; + else { + OneLevelConverter upperItem = (OneLevelConverter) upper.get(ind); + return upperItem.getLower(); + } + } + return null; + } + + public void convert(String ind){ + IPreferenceStore store = QuantumPlugin.getDefault().getPreferenceStore(); + + String tableItem = QuantumUtil.trasposeEscape(store.getString("customCopyTableItem" + ind)); + String tableSeparator = QuantumUtil.trasposeEscape(store.getString("customCopyTableSeparator" + ind)); + String columnItem = QuantumUtil.trasposeEscape(store.getString("customCopyColumnItem" + ind)); + String columnSeparator = QuantumUtil.trasposeEscape(store.getString("customCopyColumnSeparator" + ind)); + + for (Iterator iter = upper.iterator(); iter.hasNext();) { + OneLevelConverter oneLevel = (OneLevelConverter) iter.next(); + String upperId = oneLevel.getId(); + Vector lower = oneLevel.getLower(); + if (lower != null) { + for (Iterator iterator = lower.iterator(); iterator.hasNext();) { + OneLevelConverter element = (OneLevelConverter) iterator.next(); + String convLeaf = columnItem + (iterator.hasNext() ? columnSeparator : ""); + + convLeaf = StringUtil.substituteString(convLeaf, "${schema}", QuantumUtil.getSchemaName(upperId)); + convLeaf = StringUtil.substituteString(convLeaf, "${qualified}", upperId); + convLeaf = StringUtil.substituteString(convLeaf, "${table}", QuantumUtil.getTableName(upperId)); + convLeaf = StringUtil.substituteString(convLeaf, "${column}", element.getId()); + + element.setResult(convLeaf); + } + } + // We have all the leafs converted, we calculate the parent conversion + String convUpper = tableItem + (iter.hasNext() ? tableSeparator : ""); + convUpper = StringUtil.substituteString(convUpper, "${schema}", QuantumUtil.getSchemaName(upperId)); + convUpper = StringUtil.substituteString(convUpper, "${qualified}", upperId); + convUpper = StringUtil.substituteString(convUpper, "${table}", QuantumUtil.getTableName(upperId)); + convUpper = StringUtil.substituteString(convUpper, "${column_list}", getColumnList(oneLevel)); + + oneLevel.setResult(convUpper); + } + } + + + /** + * Calculates the list of columns for an upper level converter. Has to be already converted. + * @param oneLevel + * @return + */ + private String getColumnList(OneLevelConverter oneLevel) { + + String result = ""; + Vector lower = oneLevel.getLower(); + if (lower != null) { + for (Iterator iterator = lower.iterator(); iterator.hasNext();) { + OneLevelConverter element = (OneLevelConverter) iterator.next(); + result += element.getResult(); + } + } + return result; + } + + public String getTableList() { + String result = ""; + for (Iterator iter = upper.iterator(); iter.hasNext();) { + OneLevelConverter oneLevel = (OneLevelConverter) iter.next(); + result += oneLevel.getResult(); + } + return result; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/OneLevelConverter.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/OneLevelConverter.java new file mode 100644 index 0000000..8763cd5 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/OneLevelConverter.java @@ -0,0 +1,77 @@ +/* + * Created on 11/08/2003 + * + */ +package com.quantum.util; + +import java.util.Vector; + +/** + * "record" class that holds an identifier and the resulting + * string. This string comes from applying rules to the identifier + * Also, can have a vector of lower-level classifiers. + * + * @author panic + * + */ +public class OneLevelConverter { + private String id = ""; + private String result = ""; + private Vector lower = null; + + OneLevelConverter(String id) { + this.id = id; + } + + // Getters and setters + /** + * @return + */ + public String getId() { + return id; + } + + /** + * @return + */ + public Vector getLower() { + return lower; + } + + /** + * @return + */ + public String getResult() { + return result; + } + + /** + * @param string + */ + public void setId(String string) { + id = string; + } + + /** + * @param vector + */ + public void setLower(Vector vector) { + lower = vector; + } + + /** + * @param string + */ + public void setResult(String string) { + result = string; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object obj) { + if (!(obj instanceof OneLevelConverter)) return false; + return this.id.equals(((OneLevelConverter)obj).id); + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/QuantumUtil.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/QuantumUtil.java new file mode 100644 index 0000000..c789923 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/QuantumUtil.java @@ -0,0 +1,47 @@ +/* + * Created on 24/08/2003 + * + */ +package com.quantum.util; + +import java.util.StringTokenizer; + +/** + * @author panic + * + */ +public class QuantumUtil { + /** + * Gets the first string in a string with the structure XXXX.XXXX + * @param qualifiedName + * @return The schema name if present, else an empty string ("") + */ + public static String getSchemaName(String qualifiedName) { + StringTokenizer st = new StringTokenizer(qualifiedName, "."); //$NON-NLS-1$ + if (st.countTokens() > 1) { + return st.nextToken(); + } else + return ""; + } + + /** + * Gets the second string in a string with the structure XXXX.XXXX + * @param qualifiedName + * @return The table name if present, else the received parameter + */ + public static String getTableName(String qualifiedName) { + StringTokenizer st = new StringTokenizer(qualifiedName, "."); //$NON-NLS-1$ + if (st.countTokens() > 1) { + st.nextToken(); + return st.nextToken(); + } else + return qualifiedName; + } + + public static String trasposeEscape(String untrans){ + String trasposed = StringUtil.substituteString(untrans, "\\n", "\n"); + trasposed = StringUtil.substituteString(trasposed, "\\t", "\t"); + + return trasposed; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/StringMatrix.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/StringMatrix.java new file mode 100644 index 0000000..f87f14d --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/StringMatrix.java @@ -0,0 +1,352 @@ +/* + * Created on 8/04/2003 + * + */ +package com.quantum.util; + +import java.util.Vector; + +/** + * @author jparrai + * Generic class to hold a Matrix of Strings, that is a Vector of Vectors of Strings. + * The first Vector "line" is supposed to have headers to the values of the rest. + * Those headers will always be case insensitive + */ +public class StringMatrix { + private final int DEFAULT_COLUMNS = 10; + private final int DEFAULT_ROWS = 10; + private final int DEFAULT_INCREMENT = 10; + + private Vector header = new Vector(DEFAULT_COLUMNS,DEFAULT_INCREMENT); + private Vector matrix = new Vector(DEFAULT_ROWS,DEFAULT_INCREMENT); + + /** + * Adds a String to the end of the header keys + * @param header : The string to be added + */ + public void addHeader(String header) { + this.header.add(header); + } + /** + * Adds a whole vector to the header + * @param header + */ + private void addVectorHeader(Vector header){ + this.header.addAll(header); + for (int i = 0; i < this.header.size(); i++) { + String element = (String) this.header.get(i); + this.header.setElementAt(element, i); + } + } + /** + * Adds a whole matrix to the header + * @param header + */ + public void addMatrixHeader(String header[]){ + for (int i = 0; i < header.length; i++) { + String element = (String) header[i]; + this.header.add(element); + } + } + /** + * Adds a String to the end of the row indicated + * @param value : The string to be added + * @param row : The row to + */ + public void add(String value, int row) { + grow(row); + Vector rowVector = (Vector) matrix.get(row); + rowVector.add(value); + } + /** + * Adds a StringMatrix to the end of the row indicated + * @param value : The string to be added + * @param row : The row to + */ + public void add(StringMatrix value) { + int row = matrix.size(); + for (int i = 0; i < value.size(); i++){ + grow(row); + for (int j = 0; j < value.getNumColumns(); j++){ + String header = value.getHeaderColumn(j); + addAt(header, value.get(header,i), row); + } + row++; + } + Vector rowVector = (Vector) matrix.get(row); + rowVector.add(value); + } + + /** + * Converts the StringMatrix into a copy of the given + * @param origin - The StringMatrix to be copied + */ + public void copy(StringMatrix origin) { + clear(); + add(origin); + } + + /** + * Clears (emtpies) the StringMatrix + */ + public void clear(){ + header.clear(); + matrix.clear(); + } + /** + * Adds a String to the row indicated, to the column that matches the key + * @param value : The string to be added + * @param row : The row to + */ + public void addAt(String key, String value, int row) { + grow(row); + Vector rowVector = (Vector) matrix.get(row); + int ind = header.indexOf(key); + if (ind < 0) return; + if (rowVector.size() < ind+1) rowVector.setSize(ind); + rowVector.add(ind, value); + } + /** + * Adds a whole vector to the end of the row indicated + * @param value : The vector to be added + * @param row : The row to + */ + private void addVector(Vector value, int row){ + grow(row); + Vector rowVector = (Vector) matrix.get(row); + rowVector.addAll(value); + } + + /** + * Tells if you have that particular key in your StringMatrix + * @param key + * @return + */ + public boolean contains(String key){ + return (findKey(key) >= 0); + } + /** + * Gets a String value from the row indicated, from the column that matches the key + * @param key + * @param row + * @return + */ + public String get(String key, int row){ + if (matrix.size() <= row) return null; + int col = findKey(key); + if (col < 0) return null; + Vector rowVector = (Vector) matrix.get(row); + if (rowVector == null) return null; + return (String) rowVector.get(col); + } + /** + * Finds the key in the header + * @param key + * @return + */ + private int findKey(String key) { + for (int i = 0; i < header.size(); i++) { + String element = (String) header.get(i); + if (element.equalsIgnoreCase(key)) return i; + } + return -1; + } + /** + * @param key: selects the column + * @return a Vector with all the values in the selected column; null if empty + */ + public Vector getColumn(String key){ + if (size() < 1 ) return null; + Vector result = new Vector(size(),1); + for (int i = 0; i < size(); i++){ + result.add(get(key, i)); + } + return result; + } + /** + * @param key: selects the column + * @return a Vector with all the values in the selected column, dropping duplicates; null if empty + */ + public Vector getUniqueColumn(String key){ + if (size() < 1 ) return null; + Vector result = new Vector(size(),1); + for (int i = 0; i < size(); i++){ + if (!result.contains(get(key, i))) result.add(get(key, i)); + } + return result; + } + /** + * @param key: selects the column + * @return a Vector of Integers with all the indexes of the rows + * matching the selected column, dropping duplicates; null if empty + */ + public Vector getIndexes(String key, String value){ + Vector result = new Vector(); + for (int i = 0; i < size(); i++){ + if (get(key, i).equals(value)) + result.add(new Integer(i)); + } + return result; + } + /** + * Deletes all the rows that matches the value for the key + * @param key: selects the column + */ + public void dropMatching(String key, String value){ + for (int i = 0; i < size(); i++){ + if (get(key, i).equals(value)) deleteRow(i); + } + } + /** + * Returns a StringMatrix with all the complete rows that match the key - value pair + * @param key The column key + * @param value The value to match + * @return a StringMatrix with only the rows where the key equals the value + */ + public StringMatrix select(String key, String value){ + StringMatrix result = new StringMatrix(); + result.addVectorHeader(header); + int j = 0; + for (int i = 0; i < size(); i++){ + if (get(key, i).equals(value)) { + result.addVector((Vector)matrix.get(i), j); + j++; + } + } + return result; + } + + // Private functions + /** + * Grows the StringMatrix till it's able to hold "row" rows. + * @param row : The number of rows that must hold + */ + private void grow(int row) { + if (matrix.size() <= row) + for (int i = matrix.size(); i <= row; i++) { + matrix.add(new Vector(header.size(), 1)); + } + } + /** + * Gets a String value from the row indicated , from the column number + * @param col : 0-index column + * @param row : 0-index column + * @return + */ + private String get(int col, int row){ + if (col < 0 || row < 0) return null; + Vector rowVector = (Vector) matrix.get(row); + if (rowVector == null) return null; + return (String) rowVector.get(col); + } + + // Generic interfaces + /** + * @param i + * @return : a StringMatrix with only one row, the selected by i + */ + public StringMatrix rowMatrix(int i){ + StringMatrix result = new StringMatrix(); + result.addVectorHeader(header); + result.addVector((Vector)matrix.get(i),0); + return result; + } + + /** + * Resturns a String[] with the selected row + * @param i The index of the row + * @return + */ + public String[] getRow(int i) { + if (i < matrix.size()) { + String[] result = new String[header.size()]; + Vector resVector = (Vector)matrix.get(i); + resVector.toArray(result); + return result; + } + return null; + + } + + + /** + * @return the number of rows + */ + public int size() { + return matrix.size(); + } + public int getNumColumns() { + return header.size(); + } + public String getHeaderColumn(int i){ + return (String) header.get(i); + } + public void deleteRow(int i){ + matrix.remove(i); + } + + + // Common Object interface + /* (non-Javadoc) + * @see java.lang.Object#clone() + */ + public Object clone() { + // Deep clone + StringMatrix matrix = new StringMatrix(); + matrix.copy(this); + return matrix; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + public String toString() { + String result = ""; + for (int j = 0; j < header.size(); j++){ + result += (String) header.get(j); + result += "\t"; + } + result += "\n"; + // Write the lines + for (int i = 0; i < matrix.size(); i++){ + for (int j = 0; j < header.size(); j++){ + result += get(j,i); + result += "\t"; + } + result += "\n"; + } + return result; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object obj) { + if (!(obj instanceof StringMatrix)) return false; + StringMatrix sm = (StringMatrix) obj; + if (!header.equals(sm.header)) return false; + if (matrix.size() != sm.matrix.size()) return false; + for (int i = 0; i < matrix.size(); i++){ + Vector row = (Vector) matrix.get(i); + Vector smRow = (Vector) sm.matrix.get(i); + if (!(row.equals(smRow))) return false; + } + return true; + } + + /** + * @return + */ + public Vector getMatrix() { + return matrix; + } + /** + * @return + */ + public String[] getHeader() { + String[] result = new String[header.size()]; + header.toArray(result); + return result; + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/StringUtil.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/StringUtil.java new file mode 100644 index 0000000..3ec3d3d --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/StringUtil.java @@ -0,0 +1,33 @@ +/* Created on Jan 19, 2004 */ +package com.quantum.util; + +import java.util.Arrays; + +/** + * @author holmesbc + */ +public class StringUtil { + + public static String substituteString(String original, String placeHolder, String replacementValue) { + StringBuffer buffer = new StringBuffer(); + char[] originalChars = original == null ? new char[0] : original.toCharArray(); + char[] placeHolderChars = placeHolder.toCharArray(); + char[] placeHolderComparisonArray = new char[placeHolderChars.length]; + + for (int i = 0, length = originalChars.length; i < length; i++) { + if (i <= length - placeHolderChars.length) { + System.arraycopy(originalChars, i, placeHolderComparisonArray, 0, placeHolderComparisonArray.length); + if (Arrays.equals(placeHolderComparisonArray, placeHolderChars)) { + i += placeHolderComparisonArray.length - 1; + buffer.append(replacementValue); + } else { + buffer.append(originalChars[i]); + } + } else { + buffer.append(originalChars[i]); + } + } + + return original == null ? null : buffer.toString(); + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/connection/ConnectionUtil.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/connection/ConnectionUtil.java new file mode 100644 index 0000000..ecfe620 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/connection/ConnectionUtil.java @@ -0,0 +1,46 @@ +package com.quantum.util.connection; + +import java.sql.Connection; + +import com.quantum.Messages; +import com.quantum.model.Bookmark; +import com.quantum.model.ConnectionException; +import com.quantum.model.NotConnectedException; +import com.quantum.ui.dialog.ExceptionDisplayDialog; +import com.quantum.ui.dialog.PasswordDialog; + +import org.eclipse.swt.widgets.Shell; + +/** + *

This utility gets a connection from a bookmark, and handles any UI-specific + * interactions such as providing messages to the user and/or prompting for a + * password. + * + * @author BC + */ +public class ConnectionUtil { + + public Connection getConnection(Bookmark bookmark, Shell shell) { + Connection connection = null; + try { + connection = bookmark.getConnection(); + } catch (NotConnectedException e) { + connection = connect(bookmark, shell); + } + return connection; + } + + public Connection connect(Bookmark bookmark, Shell shell) { + Connection connection = null; + try { + connection = bookmark.connect(PasswordDialog.createPasswordFinder(shell)); + } catch (ConnectionException e) { + ExceptionDisplayDialog.openError(shell, + Messages.getString(getClass().getName() + ".title"), + Messages.getString(getClass().getName() + ".message") + + " (Bookmark:"+bookmark.getName()+")", e); + } + return connection; + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/io/InputStreamHelper.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/io/InputStreamHelper.java new file mode 100644 index 0000000..33d4416 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/io/InputStreamHelper.java @@ -0,0 +1,18 @@ +package com.quantum.util.io; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; + +/** + * @author BC + */ +public class InputStreamHelper { + public static String readIntoString(InputStream inputStream) throws IOException { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + for (int b = inputStream.read(); b >= 0; b = inputStream.read()) { + outputStream.write((byte) b); + } + return new String(outputStream.toByteArray()); + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/sql/TypesHelper.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/sql/TypesHelper.java new file mode 100644 index 0000000..e8b87f6 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/sql/TypesHelper.java @@ -0,0 +1,59 @@ +/* Created on Jan 9, 2004 */ +package com.quantum.util.sql; + +import java.lang.reflect.Field; +import java.sql.Types; + +/** + * @author holmesbc + */ +public class TypesHelper { + + public static final int BIT = Types.BIT; + public static final int TINYINT = Types.TINYINT; + public static final int SMALLINT = Types.SMALLINT; + public static final int INTEGER = Types.INTEGER; + public static final int BIGINT = Types.BIGINT; + public static final int FLOAT = Types.FLOAT; + public static final int REAL = Types.REAL; + public static final int DOUBLE = Types.DOUBLE; + public static final int NUMERIC = Types.NUMERIC; + public static final int DECIMAL = Types.DECIMAL; + public static final int CHAR = Types.CHAR; + public static final int VARCHAR = Types.VARCHAR; + public static final int LONGVARCHAR = Types.LONGVARCHAR; + public static final int DATE = Types.DATE; + public static final int TIME = Types.TIME; + public static final int TIMESTAMP = Types.TIMESTAMP; + public static final int BINARY = Types.BINARY; + public static final int VARBINARY = Types.VARBINARY; + public static final int LONGVARBINARY = Types.LONGVARBINARY; + public static final int NULL = Types.NULL; + public static final int OTHER = Types.OTHER; + public static final int JAVA_OBJECT = Types.JAVA_OBJECT; + public static final int DISTINCT = Types.DISTINCT; + public static final int STRUCT = Types.STRUCT; + public static final int ARRAY = Types.ARRAY; + public static final int BLOB = Types.BLOB; + public static final int CLOB = Types.CLOB; + public static final int REF = Types.REF; + public static final int DATALINK; + public static final int BOOLEAN; + + static { + // These fields only exist in the JDK 1.4 version of the Types class. + BOOLEAN = getType("BOOLEAN", 16); + DATALINK = getType("DATALINK", 70); + } + + private static int getType(String typeName, int defaultValue) { + try { + Field field = Types.class.getField(typeName); + defaultValue = field.getInt(null); + } catch (NoSuchFieldException e) { + } catch (IllegalAccessException e) { + } + return defaultValue; + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/versioning/VersioningHelper.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/versioning/VersioningHelper.java new file mode 100644 index 0000000..1f3bacf --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/versioning/VersioningHelper.java @@ -0,0 +1,49 @@ +package com.quantum.util.versioning; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.widgets.FontDialog; + +/** + * This class provides backward compatibility between versions of Eclipse for + * known differences. + * + * @author BC + */ +public class VersioningHelper { + + public static final int ECLIPSE_VERSION_2_1_1 = 2135; + + /** + * Set the font in a FontDialog. In Eclipse 2.1.1, the + * setFontData() method was deprecated and an alternative + * method, setFontList() was suggested in its place. + * + * @param fontDialog + * @param fontData + */ + public static void setFont(FontDialog fontDialog, FontData[] fontData) { + try { + if (SWT.getVersion() >= ECLIPSE_VERSION_2_1_1) { + Method method = fontDialog.getClass().getMethod( + "setFontList", new Class[] { fontData.getClass()}); + method.invoke(fontDialog, new Object[] {fontData}); + } else if (fontData.length > 0) { + Method method = fontDialog.getClass().getMethod( + "setFontData", new Class[] { FontData.class }); + method.invoke(fontDialog, new Object[] { fontData[0] }); + } + } catch (NoSuchMethodException e) { + // should not happen + } catch (IllegalArgumentException e) { + // should not happen + } catch (IllegalAccessException e) { + // should not happen + } catch (InvocationTargetException e) { + // should not happen + } + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/xml/XMLHelper.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/xml/XMLHelper.java new file mode 100644 index 0000000..bf16296 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/xml/XMLHelper.java @@ -0,0 +1,73 @@ +package com.quantum.util.xml; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Writer; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.FactoryConfigurationError; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.xml.serialize.DOMSerializer; +import org.apache.xml.serialize.OutputFormat; +import org.apache.xml.serialize.XMLSerializer; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + + +/** + *

This class constructs a pretty-printing XML Serializer + * + * @author BC + */ +public class XMLHelper { + + private XMLHelper() {} + + public static DOMSerializer createDOMSerializer(Writer writer) + throws IOException { + XMLSerializer serializer = new XMLSerializer(writer, createOutputFormat()); + return serializer.asDOMSerializer(); + } + + public static DOMSerializer createDOMSerializer(OutputStream stream) + throws IOException { + XMLSerializer serializer = new XMLSerializer(stream, createOutputFormat()); + return serializer.asDOMSerializer(); + } + private static OutputFormat createOutputFormat() { + OutputFormat format = new OutputFormat(); + format.setIndenting(true); + format.setLineWidth(80); + return format; + } + + public static Document createEmptyDocument() throws ParserConfigurationException { + DocumentBuilder builder = createDocumentBuilder(); + return builder.newDocument(); + } + + public static Document createFromInputStream(InputStream stream) + throws IOException, SAXException, ParserConfigurationException { + DocumentBuilder builder = createDocumentBuilder(); + return builder.parse(stream); + } + + private static DocumentBuilder createDocumentBuilder() + throws FactoryConfigurationError, ParserConfigurationException { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + return factory.newDocumentBuilder(); + } + + public static void write(Writer writer, Document document) + throws IOException { + createDOMSerializer(writer).serialize(document); + } + + public static void write(OutputStream stream, Document document) + throws IOException { + createDOMSerializer(stream).serialize(document); + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/CopyAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/CopyAction.java new file mode 100644 index 0000000..27fe957 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/CopyAction.java @@ -0,0 +1,40 @@ +/* + * Created on 28-jul-2003 + * + */ +package com.quantum.view; + +import com.quantum.QuantumPlugin; +import com.quantum.view.tableview.TableView; + +import org.eclipse.jface.action.Action; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableItem; + + +public final class CopyAction extends Action { + private final TableView view; + private final Table table; + public CopyAction(TableView view, Table table) { + super(); + this.view = view; + this.table = table; + } + public void run() { + TableItem items[] = table.getSelection(); + StringBuffer text = new StringBuffer(); + for (int i = 0; i < items.length; i++) { + int columns = table.getColumnCount(); + for (int col = 0; col < columns; col++) { + text.append(items[i].getText(col)); + text.append('\t'); + } + text.append('\n'); + } + QuantumPlugin.getDefault().getSysClip().setContents( + new Object[] { text.toString()}, + new Transfer[] { TextTransfer.getInstance()}); + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/LogConstants.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/LogConstants.java new file mode 100644 index 0000000..38e6b0e --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/LogConstants.java @@ -0,0 +1,9 @@ +package com.quantum.view; + +public interface LogConstants { + public int QUERY = 1; + public int ERROR = 2; + public int RESULTS = 3; + public int WARNING = 4; + public int DEFAULT = 5; +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/LogProxy.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/LogProxy.java new file mode 100644 index 0000000..2c592c1 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/LogProxy.java @@ -0,0 +1,34 @@ +package com.quantum.view; + +import java.io.PrintWriter; +import java.io.StringWriter; + +public class LogProxy implements LogConstants { + private static LogProxy instance = null; + private SQLLogView log = null; + private LogProxy() { + } + public synchronized static LogProxy getInstance() { + if (instance == null) { + instance = new LogProxy(); + } + return instance; + } + public void addText(int type, String text) { + log = SQLLogView.getInstance(); + if (log != null) { + log.addText(type, text); + } + } + + public void addText(int type, String text, Exception e) { + addText(type, text); + StringWriter writer = new StringWriter(); + e.printStackTrace(new PrintWriter(writer)); + addText(type, writer.toString()); + } + + public void addText(int type, Exception e) { + addText(type, "Error occured: " + e, e); //$NON-NLS-1$ + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/SQLLogView.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/SQLLogView.java new file mode 100644 index 0000000..dfd7465 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/SQLLogView.java @@ -0,0 +1,109 @@ +package com.quantum.view; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.custom.StyledTextContent; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.part.ViewPart; + +public class SQLLogView extends ViewPart implements LogConstants { + private Color QUERY_COLOR; + private Color WARNING_COLOR; + private Color DEFAULT_COLOR; + private Color ERROR_COLOR; + private Color RESULTS_COLOR; + private StyledText widget; + private static SQLLogView instance = null; + private static final String newLine = "\n"; //$NON-NLS-1$ + public static SQLLogView getInstance() { + return instance; + } + + public void createPartControl(Composite parent) { + instance = this; + QUERY_COLOR = new Color(parent.getShell().getDisplay(), 0, 255, 0); + ERROR_COLOR = new Color(parent.getShell().getDisplay(), 255, 0, 0); + RESULTS_COLOR = new Color(parent.getShell().getDisplay(), 0, 0, 255); + DEFAULT_COLOR = new Color(parent.getShell().getDisplay(), 0, 0, 0); + WARNING_COLOR = new Color(parent.getShell().getDisplay(), 255, 127, 0); + widget = new StyledText(parent, SWT.H_SCROLL | SWT.V_SCROLL); + IActionBars bars = this.getViewSite().getActionBars(); + bars.setGlobalActionHandler(IWorkbenchActionConstants.COPY, copyAction); + bars.setGlobalActionHandler(IWorkbenchActionConstants.SELECT_ALL, selectAllAction); + + IToolBarManager toolBar = getViewSite().getActionBars().getToolBarManager(); + clearAction.setImageDescriptor(QuantumPlugin.getImageDescriptor("clear.gif")); //$NON-NLS-1$ + clearAction.setToolTipText(Messages.getString("SQLLogView.ClearLog")); //$NON-NLS-1$ + toolBar.add(clearAction); + + widget.setEditable(false); + + widget.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + instance = null; + } + }); + } + + public void addText(int style, String text) { + text = text + newLine; + int start = widget.getText().length(); + StyleRange styleRange = new StyleRange(); + styleRange.start = start; + styleRange.length = text.length(); + if (style == QUERY) { + styleRange.foreground = QUERY_COLOR; + } else if (style == ERROR) { + styleRange.foreground = ERROR_COLOR; + } else if (style == RESULTS) { + styleRange.foreground = RESULTS_COLOR; + } else if (style == WARNING) { + styleRange.foreground = WARNING_COLOR; + } else { + styleRange.foreground = DEFAULT_COLOR; + } + widget.append(text); + widget.setStyleRange(styleRange); + revealEndOfDocument(); + } + + protected void revealEndOfDocument() { + StyledTextContent doc= widget.getContent(); + int docLength= doc.getCharCount(); + if (docLength > 0) { + widget.setCaretOffset(docLength); + widget.showSelection(); + } + } + + public void setFocus() { + widget.setFocus(); + } + + private Action copyAction = new Action() { + public void run() { + widget.copy(); + } + }; + private Action selectAllAction = new Action() { + public void run() { + widget.selectAll(); + } + }; + private Action clearAction = new Action() { + public void run() { + widget.setText(""); //$NON-NLS-1$ + } + }; +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/SQLQueryView.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/SQLQueryView.java new file mode 100644 index 0000000..a8469e7 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/SQLQueryView.java @@ -0,0 +1,517 @@ +package com.quantum.view; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.LinkedList; +import java.util.NoSuchElementException; +import java.util.Vector; + +import org.eclipse.jface.action.Action; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ExtendedModifyEvent; +import org.eclipse.swt.custom.ExtendedModifyListener; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.ProgressBar; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IKeyBindingService; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.part.ViewPart; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.actions.ExecuteAction; +import com.quantum.actions.ExportQueryAction; +import com.quantum.actions.ImportQueryAction; +import com.quantum.model.Bookmark; +import com.quantum.model.NotConnectedException; +import com.quantum.sql.MultiSQLServer; +import com.quantum.sql.parser.SQLLexx; +import com.quantum.sql.parser.Token; +import com.quantum.view.bookmark.BookmarkNode; +import com.quantum.view.bookmark.BookmarkView; + +public class SQLQueryView extends ViewPart { + private ExecuteAction executeAction; + private ImportQueryAction importQueryAction; + private ExportQueryAction exportQueryAction; + private Label statusImage; + private Label status; + private ProgressBar progress; + private StyledText widget; + private ToolItem autoCommitItem; + private ToolItem commitItem; + private ToolItem rollbackItem; + private Color STRING_LITERAL; + private Color KEYWORD; + private Color COMMENT; + private Color NUMERIC; + private Color DEFAULT; + private long parseTime = 0; + private long fullTime = 0; + public SQLQueryView() { + super(); + } + public void setFocus() { + + String title = "Quantum SQL Query Editor"; + BookmarkNode bookmarkNode = null; + Bookmark bookmark = null; + Connection con = null; + if (BookmarkView.getInstance() != null ) { + bookmarkNode = BookmarkView.getInstance().getCurrentBookmark(); + } + if (bookmarkNode != null) + bookmark = bookmarkNode.getBookmark(); + if (bookmark != null) { + title = bookmark.getName() + " (" + title + ")"; + setTitle( title ); + try { + con = bookmark.getConnection(); + } catch (NotConnectedException e) { + // Doesn't matter, "con" remains null + } + } + + updateAutoCommitState(bookmark, con); + + widget.setFocus(); + + } + public static SQLQueryView getInstance() { + return (SQLQueryView) QuantumPlugin.getDefault().getView("com.quantum.view.sqlqueryview"); + + } + + public void createPartControl(org.eclipse.swt.widgets.Composite parent) { + initActions(); + KEYWORD = new Color(parent.getShell().getDisplay(), 126, 0, 75); + STRING_LITERAL = new Color(parent.getShell().getDisplay(), 0, 0, 255); + COMMENT = new Color(parent.getShell().getDisplay(), 88, 148, 64); + NUMERIC = new Color(parent.getShell().getDisplay(), 255, 0, 0); + DEFAULT = new Color(parent.getShell().getDisplay(), 0, 0, 0); + Composite main = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(1, false); + layout.horizontalSpacing = 0; + layout.verticalSpacing = 0; + main.setLayout(layout); + ToolBar toolbar = new ToolBar(main, SWT.HORIZONTAL); + ToolItem item = new ToolItem(toolbar, SWT.PUSH); + item.setImage(QuantumPlugin.getImage("play.gif")); //$NON-NLS-1$ + item.setToolTipText(Messages.getString("sqlqueryview.executeQuery")); //$NON-NLS-1$ + item.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + executeAction.run(); + } + }); + item = new ToolItem(toolbar, SWT.SEPARATOR); + item = new ToolItem(toolbar, SWT.PUSH); + item.setImage(QuantumPlugin.getImage("import.gif")); //$NON-NLS-1$ + item.setToolTipText(Messages.getString("sqlqueryview.importQuery")); //$NON-NLS-1$ + item.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + importQueryAction.run(); + } + }); + item = new ToolItem(toolbar, SWT.PUSH); + item.setImage(QuantumPlugin.getImage("export.gif")); //$NON-NLS-1$ + item.setToolTipText(Messages.getString("sqlqueryview.exportQuery")); //$NON-NLS-1$ + item.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + exportQueryAction.run(); + } + }); + item = new ToolItem(toolbar, SWT.PUSH); + item.setImage(QuantumPlugin.getImage("clear.gif")); //$NON-NLS-1$ + item.setToolTipText(Messages.getString("sqlqueryview.clear")); //$NON-NLS-1$ + item.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + setQuery(""); //$NON-NLS-1$ + } + }); + + item = new ToolItem(toolbar, SWT.SEPARATOR); + + commitItem = new ToolItem(toolbar, SWT.PUSH); + commitItem.setImage(QuantumPlugin.getImage("commit.gif")); //$NON-NLS-1$ + commitItem.setToolTipText(Messages.getString("SQLQueryView.Commit")); //$NON-NLS-1$ + commitItem.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent event) { + try { + BookmarkNode node = BookmarkView.getInstance().getCurrentBookmark(); + if (node != null) MultiSQLServer.getInstance().commit( + node.getBookmark().getConnection()); + } catch (NotConnectedException e) { + e.printStackTrace(); + } + } + }); + + rollbackItem = new ToolItem(toolbar, SWT.PUSH); + rollbackItem.setImage(QuantumPlugin.getImage("rollback.gif")); //$NON-NLS-1$ + rollbackItem.setToolTipText(Messages.getString("SQLQueryView.RollBack")); //$NON-NLS-1$ + rollbackItem.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent event) { + } + public void widgetSelected(SelectionEvent event) { + try { + BookmarkNode node = BookmarkView.getInstance().getCurrentBookmark(); + if (node != null) MultiSQLServer.getInstance().rollback( + node.getBookmark().getConnection()); + } catch (NotConnectedException e) { + e.printStackTrace(); + } + } + }); + + autoCommitItem = new ToolItem(toolbar, SWT.CHECK); + autoCommitItem.setImage(QuantumPlugin.getImage("autocommit.gif")); //$NON-NLS-1$ + autoCommitItem.setToolTipText(Messages.getString("SQLQueryView.AutoCommit")); //$NON-NLS-1$ + autoCommitItem.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent event) { + BookmarkNode node = BookmarkView.getInstance().getCurrentBookmark(); + if (node == null) return; + Connection con = null; + try { + // Get the connection + con = node.getBookmark().getConnection(); + // If connected (else will throw exception and jump out) switchs the state of the + // autoCommit option of the JDBC driver + MultiSQLServer.getInstance().setAutoCommit( con, autoCommitItem.getSelection()); + } catch (NotConnectedException e) { + //Doesn't matter + } + // Update the bookmark and the buttons + updateAutoCommitState(node.getBookmark(), con); + + } + }); + BookmarkNode node = BookmarkView.getInstance().getCurrentBookmark(); + if (node == null) autoCommitItem.setSelection(true); + else autoCommitItem.setSelection(node.getBookmark().isAutoCommit()); + if (autoCommitItem.getSelection()) { + commitItem.setEnabled(false); + rollbackItem.setEnabled(false); + } else { + commitItem.setEnabled(true); + rollbackItem.setEnabled(true); + } + widget = new StyledText(main, SWT.H_SCROLL | SWT.V_SCROLL); + + IActionBars bars = this.getViewSite().getActionBars(); + bars.setGlobalActionHandler(IWorkbenchActionConstants.CUT, cutAction); + bars.setGlobalActionHandler(IWorkbenchActionConstants.COPY, copyAction); + bars.setGlobalActionHandler(IWorkbenchActionConstants.PASTE, pasteAction); + bars.setGlobalActionHandler(IWorkbenchActionConstants.SELECT_ALL, selectAllAction); + + widget.setEditable(true); + widget.addExtendedModifyListener(modifyListener); + + GridData gridData = new GridData(); + gridData.horizontalAlignment = GridData.FILL; + gridData.verticalAlignment = GridData.FILL; + gridData.grabExcessHorizontalSpace = true; + gridData.grabExcessVerticalSpace = true; + widget.setLayoutData(gridData); + + Composite bottomStatus = new Composite(main, SWT.NONE); + gridData = new GridData(); + gridData.horizontalAlignment = GridData.FILL; + gridData.grabExcessHorizontalSpace = true; + bottomStatus.setLayoutData(gridData); + + GridLayout horizontal = new GridLayout(3, false); + layout.horizontalSpacing = 0; + layout.verticalSpacing = 0; + layout.marginHeight = 0; + layout.marginWidth = 0; + bottomStatus.setLayout(horizontal); + + statusImage = new Label(bottomStatus, SWT.NONE); + status = new Label(bottomStatus, SWT.NONE); + gridData = new GridData(); + gridData.horizontalAlignment = GridData.FILL; + gridData.grabExcessHorizontalSpace = true; + status.setLayoutData(gridData); + + progress = new ProgressBar(bottomStatus, SWT.HORIZONTAL); + + status.setText(Messages.getString("sqlqueryview.done")); //$NON-NLS-1$ + statusImage.setImage(QuantumPlugin.getImage("success.gif")); //$NON-NLS-1$ + progress.setMinimum(0); + + IKeyBindingService keyBindingService = getSite().getKeyBindingService(); + // TODO: check the version numbers for this method + keyBindingService.setScopes(new String[] { + "org.eclipse.ui.globalScope", + "com.quantum.view.sql" + }); + keyBindingService.registerAction(this.executeAction); + } + + /** + * Sets the state of the "Commit", "Rollback" and "autoCommit" buttons + * to reflect the situation in the connection + */ + protected void updateAutoCommitState(Bookmark bookmark, Connection con) { + boolean autoCommit = true; + // Calculate the state of the autoCommit option + if (con != null) + { + // If we have a connection, the autoCommit state is that of the connection + try { + autoCommit = con.getAutoCommit(); + } catch (SQLException e) { + // Doesn't matter, we take default + } + } else { + // if no connection, we try the autoCommit of the bookmark, or else the default + if (bookmark != null) autoCommit = bookmark.isAutoCommit(); + } + // Set the autoCommit state of the bookmark to the calculated + if (bookmark != null) bookmark.setAutoCommit(autoCommit); + // Set the state of the buttons to the correct autoCommit state + autoCommitItem.setSelection(autoCommit); + if (autoCommitItem.getSelection()) { + commitItem.setEnabled(false); + rollbackItem.setEnabled(false); + } else { + commitItem.setEnabled(true); + rollbackItem.setEnabled(true); + } + } + public void setProgress(int increment, int max) { + progress.setMaximum(max); + progress.setSelection(increment); + } + + private void initActions() { + executeAction = new ExecuteAction(); + executeAction.init(this); + importQueryAction = new ImportQueryAction(); + importQueryAction.init(this); + exportQueryAction = new ExportQueryAction(); + exportQueryAction.init(this); + } + + public void setStatus(String text) { + statusImage.setImage(null); + status.setText(text); + } + + public void setStatus(Image img, String text) { + statusImage.setImage(img); + status.setText(text); + } + + public String getQuery() { + return widget.getText(); + } + + public void setQuery(String text) { + widget.setText(text); + } + + private String[] keywords = { + "ADD", "ALL", "ALTER", "AND", "ANY", + "AS", "ASC", "AUTOINCREMENT", "AVA", "BETWEEN", + "BINARY", "BIT", "BOOLEAN", "BY", "CREATE", + "BYTE", "CHAR", "CHARACTER", "COLUMN", "CONSTRAINT", + "COUNT", "COUNTER", "CURRENCY", "DATABASE", "DATE", + "DATETIME", "DELETE", "DESC", "DISALLOW", "DISTINCT", + "DISTINCTROW", "DOUBLE", "DROP", "EXISTS", "FROM", + "FLOAT", "FLOAT4", "FLOAT8", "FOREIGN", "GENERAL", + "GROUP", "GUID", "HAVING", "INNER", "INSERT", + "IGNORE", "IMP", "IN", "INDEX", "INT", + "INTEGER", "INTEGER1", "INTEGER2", "INTEGER4", "INTO", + "IS", "JOIN", "KEY", "LEFT", "LEVEL", + "LIKE", "LOGICAL", "LONG", "LONGBINARY", "LONGTEXT", + "MAX", "MEMO", "MIN", "MOD", "MONEY", + "NOT", "NULL", "NUMBER", "NUMERIC", "OLEOBJECT", + "ON", "PIVOT", "OPTION", "PRIMARY", "ORDER", + "OUTER", "OWNERACCESS", "PARAMETERS", "PERCENT", "REAL", + "REFERENCES", "RIGHT", "SELECT", "SET", "SHORT", + "SINGLE", "SMALLINT", "SOME", "STDEV", "STDEVP", + "STRING", "SUM", "TABLE", "TABLEID", "TEXT", + "TIME", "TIMESTAMP", "TOP", "TRANSFORM", "UNION", + "UNIQUE", "UPDATE", "VALUE", "VALUES", "VAR", + "VARBINARY", "VARCHAR", "VARP", "WHERE", "WITH", + "YESNO" }; + + SyntaxHighlighter textUpdater = new SyntaxHighlighter(); + + private class UpdateRequest { + public UpdateRequest(String text, int start, int length) { + this.text = text; + this.start = start; + this.length = length; + } + public String text; + public int start; + public int length; + } + + private class SyntaxHighlighter extends Thread { + private boolean running = true; + private LinkedList requests = new LinkedList(); + public SyntaxHighlighter() { + super(); + setPriority(Thread.MIN_PRIORITY); + start(); + } + public synchronized void updateText(String text, int start, int length) { + requests.add(new UpdateRequest(text, start, length)); + notify(); + } + public synchronized void shutdown() { + running = false; + interrupt(); + } + public void run() { + while (running) { + try { + synchronized (this) { + if (requests.size() <= 0) { + wait(); + } else { + Thread.sleep(10); + } + } + UpdateRequest request = (UpdateRequest) requests.removeFirst(); + String text = request.text.toUpperCase(); + //int dirtyStart = request.start; + //int dirtyEnd = request.start + request.length; + StyleRange styleRange; + long startTime = System.currentTimeMillis(); + Vector tokens = SQLLexx.parse(text); + long subTime = System.currentTimeMillis(); + Vector styles = new Vector(); + int min = Integer.MAX_VALUE; + int max = 0; + for (int i = 0; i < tokens.size(); i++) { + Token t = (Token) tokens.elementAt(i); + String value = t.getValue(); + int start = t.getStart(); + int length = t.getEnd() - t.getStart(); + styleRange = new StyleRange(); + styleRange.start = start; + styleRange.length = value.length(); + styleRange.fontStyle = SWT.NULL; + styleRange.foreground = DEFAULT; + //boolean upper = start <= dirtyEnd && start >= dirtyStart; + //boolean lower = ((start + length) >= dirtyStart && (start + length) <= dirtyEnd); + //boolean both = (start <= dirtyStart && (start + length) >= dirtyEnd); + //if (upper || lower || both) { + if (true) { // Let's update the whole text, as some comment changes can alter everything + min = Math.min(start, min); + max = Math.max(max, start + length); + if (t.getType() == Token.IDENTIFIER) { + boolean keyword = false; + for (int index = 0; index < keywords.length; index++) { + if (value.equals(keywords[index])) { + keyword = true; + } + } + if (keyword) { + styleRange.fontStyle = SWT.BOLD; + styleRange.foreground = KEYWORD; + } else { + styleRange.foreground = DEFAULT; + } + styles.addElement(styleRange); + } else if (t.getType() == Token.COMMENT) { + styleRange.foreground = COMMENT; + styles.addElement(styleRange); + } else if (t.getType() == Token.LITERAL) { + styleRange.foreground = STRING_LITERAL; + styles.addElement(styleRange); + } else if (t.getType() == Token.NUMERIC) { + styleRange.foreground = NUMERIC; + styles.addElement(styleRange); + } else { + styles.addElement(styleRange); + } + } + } + StyleRange[] ranges = new StyleRange[styles.size()]; + for (int k = 0; k < ranges.length; k++) { + ranges[k] = (StyleRange) styles.elementAt(k); + } + if (max >= 0 && ranges.length > 0) { + setStyles(ranges, min, max - min); + } + long endTime = System.currentTimeMillis(); + parseTime = subTime - startTime; + fullTime = endTime - startTime; + } catch (NoSuchElementException e) { + // ignore a missing request + } catch (InterruptedException e) { + // ignore any interruptions + } + } + } + } + public void setStyles(final StyleRange[] styles, final int start, final int length) { + getViewSite().getShell().getDisplay().asyncExec(new Runnable() { + public void run() { + try { + for (int i = 0; i < styles.length; i++) { + widget.setStyleRange(styles[i]); + } + } catch (Throwable t) { + System.out.println("Error with styles: " + t.getClass().toString()); //$NON-NLS-1$ + // ignore any errors + } + } + }); + } + + ExtendedModifyListener modifyListener = new ExtendedModifyListener() { + public void modifyText(ExtendedModifyEvent event) { + textUpdater.updateText(getQuery(), event.start, event.length); + } + }; + + private Action cutAction = new Action() { + public void run() { + widget.cut(); + } + }; + private Action copyAction = new Action() { + public void run() { + widget.copy(); + } + }; + private Action pasteAction = new Action() { + public void run() { + widget.paste(); + } + }; + private Action selectAllAction = new Action() { + public void run() { + widget.selectAll(); + } + }; +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/ViewHelper.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/ViewHelper.java new file mode 100644 index 0000000..e460e44 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/ViewHelper.java @@ -0,0 +1,101 @@ +/* + * Created on 22-jul-2003 + * + */ +package com.quantum.view; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.sql.Connection; +import java.sql.SQLException; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.sql.MultiSQLServer; +import com.quantum.sql.SQLResults; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IViewPart; + +/** + * @author panic + * + */ +public class ViewHelper { + + public static SQLResults tryGetResults(IViewPart view, Connection con, String query) { + return tryGetResults(view.getSite().getShell(), con, query); + } + + public static SQLResults tryGetResults(Shell shell, Connection con, String query) { + SQLResults results = null; + MultiSQLServer server = MultiSQLServer.getInstance(); + try { + results = server.execute(con, query); + } catch (SQLException e) { + LogProxy log = LogProxy.getInstance(); + log.addText(LogProxy.ERROR, e.getLocalizedMessage(), e); //$NON-NLS-1$ //$NON-NLS-2$ + results = new SQLResults(); + results.setIsError(true); + MessageDialog.openConfirm(shell, "Database returned error", e.getLocalizedMessage()); //$NON-NLS-1$ + } + return results; + } + + public static FileOutputStream askSaveFile(String key, Shell shell) { + return askSaveFile(key, shell, null, null); + } + /** + * Asks the user for a file to be saved. Uses a key to get the preferences and save the path. + * The preferences should be defined in the Messages file. + * @param key + * @param shell + * @param filterExt + * @param filterNames + * @return - An already opened FileOutputStream, or NULL if nothing selected, dialog canceled or some error. + */ + public static FileOutputStream askSaveFile(String key, Shell shell, String[] filterExt, String[] filterNames) { + + FileDialog dialog = new FileDialog(shell, SWT.SAVE); + + if (filterExt == null) { + dialog.setFilterExtensions(new String[]{Messages.getString("filedialog."+key+".filter"), + Messages.getString("filedialog.allfiles.filter")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + dialog.setFilterNames(new String[]{ Messages.getString("filedialog."+key+".name"), + Messages.getString("filedialog.allfiles.name")}); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + dialog.setFilterExtensions(filterExt); + dialog.setFilterNames(filterNames); + } + + dialog.setFilterPath(QuantumPlugin.getDefault().getPreferenceStore().getString("quantum.dialogs."+ key + ".path")); + String filename = dialog.open(); + if (filename == null) return null; + // We save the used path + QuantumPlugin.getDefault().getPreferenceStore().setValue("quantum.dialogs."+ key + ".path", filename); + + FileOutputStream out = null; + File target = new File(filename); + if (target.exists() && Messages.getString("filedialog.options.ConfirmOverwrite").equals("y")) { + boolean confirmOverwrite = + MessageDialog.openConfirm(shell, Messages.getString("filedialog.message.ConfirmOverwriteTitle"), //$NON-NLS-1$ + Messages.getString("filedialog.message.ConfirmOverwriteMessage") + target.getName() + //$NON-NLS-1$ + Messages.getString("filedialog.message.ConfirmOverwriteQuestion")); //$NON-NLS-1$ + if (!confirmOverwrite) return null; + } + + try { + out = new FileOutputStream(target); + } catch (FileNotFoundException e) { + MessageDialog.openConfirm(shell, Messages.getString("filedialog.message.CannotOpenFileTitle"), //$NON-NLS-1$ + Messages.getString("filedialog.message.CannotOpenFileMessage") + filename+ //$NON-NLS-1$ + Messages.getString("filedialog.message.CannotOpenFileExplain")); //$NON-NLS-1$ + + } + return out; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/AddSchemaAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/AddSchemaAction.java new file mode 100644 index 0000000..9713922 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/AddSchemaAction.java @@ -0,0 +1,58 @@ +package com.quantum.view.bookmark; + +import java.util.Iterator; +import java.util.List; +import java.util.Vector; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.model.Bookmark; +import com.quantum.model.NotConnectedException; +import com.quantum.sql.SQLHelper; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.actions.SelectionListenerAction; + + +final class AddSchemaAction extends SelectionListenerAction { + private final IViewPart view; + /** + * @param BookmarkView + */ + public AddSchemaAction(IViewPart view) { + super(Messages.getString("BookmarkView.SetExtraSchemas")); //$NON-NLS-1$ + setImageDescriptor( + QuantumPlugin.getImageDescriptor("add_schema.gif")); //$NON-NLS-1$ + this.view = view; + } + + public void run() { + Bookmark bookmark = getBookmark(); + if (bookmark != null) { + try { + Vector schemas = SQLHelper.getSchemas(bookmark.getConnection()); + AddSchemaDialog dialog = new AddSchemaDialog(this.view.getSite().getShell(), schemas); + dialog.open(); + if (dialog.getSelectedSchemas() != null) { + for (Iterator i = dialog.getSelectedSchemas().iterator(); i.hasNext();) { + bookmark.addSchema((String) i.next()); + } + } + } catch (NotConnectedException e) { + } + } + } + + protected Bookmark getBookmark() { + List list = getSelectedNonResources(); + return (list.size() > 0) ? ((BookmarkNode) list.get(0)).getBookmark() : null; + } + + protected boolean updateSelection(IStructuredSelection selection) { + boolean enabled = super.updateSelection(selection) & + selection.size() == 1 & + (selection.getFirstElement() instanceof BookmarkNode); + return enabled & getBookmark().isConnected(); + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/AddSchemaDialog.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/AddSchemaDialog.java new file mode 100644 index 0000000..ce2819e --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/AddSchemaDialog.java @@ -0,0 +1,86 @@ +/* + * Created on 12-jul-2003 + * + */ +package com.quantum.view.bookmark; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.Vector; + +import com.quantum.IQuantumConstants; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.List; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.help.WorkbenchHelp; + +/** + * @author panic + * + */ +public class AddSchemaDialog extends Dialog { + + protected Vector input; + protected List list; + private Vector selection; + /** + * Creates a new AddSchemaDialog. + */ + public AddSchemaDialog(Shell parentShell, Vector input) { + super(parentShell); + this.input = input; + this.list = null; + selection = null; + } + /* (non-Javadoc) + * Method declared on Window. + */ + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText("Set Schemas"); + WorkbenchHelp.setHelp( + newShell, + IQuantumConstants.ADD_SCHEMA_DIALOG_CONTEXT); + } + /* (non-Javadoc) + * Method declared on Dialog + */ + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + + list = new List(composite, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI); + GridData data = new GridData(GridData.FILL_BOTH); + list.setLayoutData(data); + for (Iterator iter = input.iterator(); iter.hasNext();) { + String element = (String) iter.next(); + list.add(element); + } + return composite; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#okPressed() + */ + protected void okPressed() { + // If it's OK, then the selection is not null. Null is used to signal a canceled dialog. + selection = new Vector(); + if (list != null) { + String selecStr[] = list.getSelection(); + for (int i = 0; i < selecStr.length; i++) { + String string = selecStr[i]; + selection.add(string); + } + } + super.okPressed(); + } + + public Collection getSelectedSchemas() { + return this.selection == null ? null : new ArrayList(this.selection); + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkClipboard.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkClipboard.java new file mode 100644 index 0000000..665e50b --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkClipboard.java @@ -0,0 +1,13 @@ +package com.quantum.view.bookmark; + +import com.quantum.model.Bookmark; + +/** + * + * TODO: There must be a better way to do this... + * @author BC + */ +public interface BookmarkClipboard { + public void setBookmark(Bookmark bookmark); + public Bookmark getBookmark(); +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkContentProvider.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkContentProvider.java new file mode 100644 index 0000000..2335110 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkContentProvider.java @@ -0,0 +1,40 @@ +package com.quantum.view.bookmark; + +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.Viewer; + +public class BookmarkContentProvider implements ITreeContentProvider { + + public Object[] getChildren(Object element) { + if (element instanceof TreeNode) { + TreeNode node = (TreeNode) element; + return node.getChildren(); + } + return BookmarkListNode.EMPTY_ARRAY; + } + public Object[] getElements(Object inputElement) { + return getChildren(inputElement); + } + + public Object getParent(Object element) { + if (element instanceof TreeNode) { + TreeNode node = (TreeNode) element; + return node.getParent(); + } + return null; + } + + public boolean hasChildren(Object element) { + if (element instanceof TreeNode) { + TreeNode node = (TreeNode) element; + return node.hasChildren(); + } + return false; + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + } + + public void dispose() { + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkLabelProvider.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkLabelProvider.java new file mode 100644 index 0000000..71fec68 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkLabelProvider.java @@ -0,0 +1,74 @@ +package com.quantum.view.bookmark; + +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.swt.graphics.Image; + +/** + * @author root + * + * Implements the ILabelProvider for the Bookmarks. + */ +public class BookmarkLabelProvider implements ILabelProvider { + + private LabelDecorationInstructions labelDecorationInstructions = new LabelDecorationInstructions(); + + /** + * @see org.eclipse.jface.viewers.ILabelProvider#getImage(Object) + */ + public Image getImage(Object element) { + if (element != null && element instanceof TreeNode) { + return ((TreeNode) element).getImage(); + } else { + return null; + } + } + + /** + * @see org.eclipse.jface.viewers.ILabelProvider#getText(Object) + */ + public String getText(Object element) { + if (element != null && element instanceof TreeNode) { + String labelName = ((TreeNode) element).getLabelName(); + String decorations = ((TreeNode) element).getLabelDecorations( + this.labelDecorationInstructions); + if (decorations != null && decorations.trim().length() > 0) { + labelName += " " + decorations; + } + return labelName; + } else { + return element == null ? "<>" : element.toString(); + } + } + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(ILabelProviderListener) + */ + public void addListener(ILabelProviderListener listener) { + } + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose() + */ + public void dispose() { + } + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(Object, String) + */ + public boolean isLabelProperty(Object element, String property) { + return false; + } + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(ILabelProviderListener) + */ + public void removeListener(ILabelProviderListener listener) { + } + /** + * @return + */ + public LabelDecorationInstructions getLabelDecorationInstructions() { + return labelDecorationInstructions; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkListNode.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkListNode.java new file mode 100644 index 0000000..37adfc6 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkListNode.java @@ -0,0 +1,120 @@ +package com.quantum.view.bookmark; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.util.Arrays; +import java.util.Collections; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; + +import com.quantum.model.Bookmark; +import com.quantum.model.BookmarkCollection; + + +/** + * @author root + */ +public final class BookmarkListNode extends TreeNode implements PropertyChangeListener { + final static BookmarkListNode instance = new BookmarkListNode(); + final static TreeNode[] EMPTY_ARRAY = new TreeNode[0]; + private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); + private boolean initialized = false; + + private BookmarkListNode() { + super(null); + } + + public static BookmarkListNode getInstance() { + return BookmarkListNode.instance; + } + + /** + * @see com.quantum.view.bookmark.TreeNode#getChildren() + */ + public Object[] getChildren() { + if (!initialized) { + initializeChildren(); + BookmarkCollection.getInstance().addPropertyChangeListener(this); + } + BookmarkNode[] nodes = (BookmarkNode[]) this.children.toArray( + new BookmarkNode[this.children.size()]); + Arrays.sort(nodes); + return nodes; + } + + /** + * @see com.quantum.view.bookmark.TreeNode#hasChildren() + */ + public boolean hasChildren() { + return true; + } + + public String getName() { + return "ROOT"; //$NON-NLS-1$ + } + protected String getImageName() { + return null; + } + /** + * @param listener + */ + public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { + this.propertyChangeSupport.addPropertyChangeListener(listener); + } + + /** + * @param listener + */ + public synchronized void removePropertyChangeListener(PropertyChangeListener listener) { + this.propertyChangeSupport.removePropertyChangeListener(listener); + } + protected void firePropertyChange(PropertyChangeEvent event) { + this.propertyChangeSupport.firePropertyChange(event); + } + + protected synchronized void initializeChildren() { + boolean changed = false; + Map temp = new Hashtable(); + for (Iterator i = this.children.iterator(); i.hasNext();) { + BookmarkNode bookmark = (BookmarkNode) i.next(); + temp.put(bookmark.getName(), bookmark); + } + + this.children.clear(); + + Bookmark[] bookmarks = BookmarkCollection.getInstance().getBookmarks(); + for (int i = 0, length = (bookmarks == null) ? 0 : bookmarks.length; i < length; i++) { + + BookmarkNode node = (BookmarkNode) temp.remove(bookmarks[i].getName()); + if (node == null) { + this.children.add(new BookmarkNode(this, bookmarks[i])); + changed = true; + } else { + this.children.add(node); + } + } + + for (Iterator i = temp.values().iterator(); i.hasNext(); ) { + ((TreeNode) i.next()).dispose(); + changed = true; + } + + Collections.sort(this.children); + this.initialized = true; + + if (changed) { + firePropertyChange("bookmarks", null, null); + } + } + + /** + * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) + */ + public void propertyChange(PropertyChangeEvent event) { + if ("bookmarks".equals(event.getPropertyName())) { + initializeChildren(); + } + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkNode.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkNode.java new file mode 100644 index 0000000..c74c555 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkNode.java @@ -0,0 +1,167 @@ +package com.quantum.view.bookmark; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import com.quantum.model.Bookmark; +import com.quantum.model.ConnectionException; +import com.quantum.model.NotConnectedException; +import com.quantum.model.Schema; + +public class BookmarkNode extends TreeNode implements PropertyChangeListener { + private Bookmark bookmark; + + private QuickListNode quickListNode; + private QueryListNode queryListNode; + + public BookmarkNode(TreeNode parent, Bookmark bookmark) { + super(parent); + this.bookmark = bookmark; + this.bookmark.addPropertyChangeListener(this); + } + + public Object[] getChildren() { + if (bookmark.isConnected() && this.children.isEmpty()) { + initializeChildren(); + } + if (this.bookmark.isConnected()) { + return (TreeNode[]) this.children.toArray(new TreeNode[this.children.size()]); + } else { + return BookmarkListNode.EMPTY_ARRAY; + } + } + + protected void initializeChildren() { + boolean changed = false; + Map temp = new HashMap(); + for (Iterator i = this.children.iterator(); i.hasNext(); ) { + TreeNode node = (TreeNode) i.next(); + if (node instanceof SchemaNode) { + temp.put(node.getName(), node); + } + } + + this.children.clear(); + if (this.quickListNode == null) { + this.quickListNode = new QuickListNode(this); + } + if (this.queryListNode == null) { + this.queryListNode = new QueryListNode(this); + } + this.children.add(this.quickListNode); + this.children.add(this.queryListNode); + Bookmark bookmark = getBookmark(); + + Schema[] schemas = bookmark.getSchemas(); + for (int i = 0, length = (schemas == null) ? 0 : schemas.length; + i < length; + i++) { + SchemaNode node = (SchemaNode) temp.remove(schemas[i].getDisplayName()); + if (node == null) { + this.children.add(new SchemaNode(this, schemas[i])); + } else { + changed = true; + this.children.add(node); + } + } + + for (Iterator i = temp.values().iterator(); i.hasNext(); ) { + ((TreeNode) i.next()).dispose(); + changed = true; + } + + if (changed) { + firePropertyChange("children", null, null); + } + } + + public boolean hasChildren() { + // If the bookmark is connected but hasn't loaded the tables and views, we suppose it may have some + if (bookmark.isConnected() && this.children.isEmpty()) { + return true; + } else if (!bookmark.isConnected()) { + return false; + } else if (children != null && children.size() > 0) { + return true; + } + return false; + } + + protected void dispose() { + try { + this.bookmark.removePropertyChangeListener(this); + if (this.bookmark.isConnected()) { + this.bookmark.disconnect(); + } + } catch (ConnectionException e) { + } + } + + /** + * @see com.quantum.model.TreeNode#getName() + */ + public String getName() { + return this.bookmark == null ? "<>" : this.bookmark.getName(); + } + + /** + * @return + */ + public Bookmark getBookmark() { + return this.bookmark; + } + + protected String getImageName() { + return this.bookmark.isConnected() ? "connected.gif" : "bookmarks.gif"; + } + + /* (non-Javadoc) + * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) + */ + public void propertyChange(PropertyChangeEvent event) { + if ("connected".equals(event.getPropertyName())) { + if (Boolean.FALSE.equals(event.getNewValue())) { + removeAllChildren(); + } + firePropertyChange("connected", event.getOldValue(), event.getNewValue()); + } else if ("schemas".equals(event.getPropertyName())) { + initializeChildren(); + firePropertyChange("children", event.getOldValue(), event.getNewValue()); + } else if ("name".equals(event.getPropertyName())) { + firePropertyChange("name", event.getOldValue(), event.getNewValue()); + } + } + + protected void removeAllChildren() { + if (this.quickListNode != null) { + this.quickListNode.dispose(); + this.quickListNode = null; + } + if (this.queryListNode != null) { + this.queryListNode.dispose(); + this.queryListNode = null; + } + super.removeAllChildren(); + + } + public String getLabelDecorations(LabelDecorationInstructions labelDecorationInstructions) { + if (!labelDecorationInstructions.isDatabaseDataVisible()) { + return null; + } else if (!this.bookmark.isConnected()) { + return null; + } else { + try { + String decoration = this.bookmark.getDatabase().getInformation(); + return decoration == null ? null : "[" + decoration + "]"; + } catch (NotConnectedException e) { + return null; + } catch (SQLException e) { + return null; + } + } + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkView.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkView.java new file mode 100644 index 0000000..efc055f --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkView.java @@ -0,0 +1,269 @@ +package com.quantum.view.bookmark; + + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.Vector; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.viewers.IOpenListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.OpenEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.WorkbenchException; +import org.eclipse.ui.actions.ActionContext; +import org.eclipse.ui.part.ViewPart; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.actions.CustomCopyAction; +import com.quantum.extensions.ExtensionAction; +import com.quantum.extensions.ProcessServiceMembers; + +public class BookmarkView extends ViewPart implements PropertyChangeListener { + private CustomCopyAction customCopyAction1; + private CustomCopyAction customCopyAction2; + private CustomCopyAction customCopyAction3; + private Vector extensionVector; + + private BookmarkViewActionGroup actionGroup; + + private TreeViewer treeViewer; + private BookmarkLabelProvider labelProvider = new BookmarkLabelProvider(); + + /** + * @return - + * The instance of the BookmarkView. There is no guarantee of it being a singleton + * due to the workspace creating a new one (does the workspace call getInstance() ? ). + * It seems to work. + */ + public synchronized static BookmarkView getInstance() { + return (BookmarkView) QuantumPlugin.getDefault().getView("com.quantum.view.bookmarkview"); + } + /** + * Returns the current selected object in the tree. If it's a multiple selection, return the first. + * @return + */ + public Object getCurrent() { + if (treeViewer == null) return null; + return ((StructuredSelection) treeViewer.getSelection()) + .getFirstElement(); + } + /** + * Returns the current selected objects in the tree, in the form of a StructuredSelection. + * @return + */ + public StructuredSelection getSelection() { + if (treeViewer == null) return null; + return ((StructuredSelection) treeViewer.getSelection()); + } + + /** + * Navigates the tree to get the current bookmark (root) of the selected element. + * If it's a multiple selection, it takes the first one. + * @return + */ + public BookmarkNode getCurrentBookmark() { + TreeNode current = (TreeNode) getCurrent(); + return getRoot(current); + } + + private static BookmarkNode getRoot(TreeNode node){ + if (node == null) return null; + if (! (node instanceof TreeNode)) return null; + while (!( node instanceof BookmarkNode)) + { + node = (TreeNode) node.getParent(); + } + if (node instanceof BookmarkNode) return (BookmarkNode) node; + else return null; + + } + public void refresh() { + treeViewer.refresh(); + } + public void createPartControl(org.eclipse.swt.widgets.Composite parent) { + + treeViewer = new TreeViewer( + parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); + treeViewer.setContentProvider(new BookmarkContentProvider()); + treeViewer.setLabelProvider(this.labelProvider); + BookmarkListNode input = BookmarkListNode.getInstance(); + treeViewer.setInput(input); + initActions(); + + input.addPropertyChangeListener(this); + + initializePopUpMenu(); + fillActionBars(); + + treeViewer.addOpenListener(new IOpenListener() { + public void open(OpenEvent event) { + ActionContext context = new ActionContext( + getSelection()); + BookmarkView.this.actionGroup.setContext(context); + IAction action = actionGroup.getOpenAction(); + if (action != null) { + action.run(); + } + } + }); + + } + private void fillActionBars() { + Action enableTableSizes = new Action() { + public void run() { + labelProvider.getLabelDecorationInstructions().setSizeVisible(isChecked()); + treeViewer.refresh(); + } + }; + enableTableSizes.setText(Messages.getString("BookmarkView.ShowTableSizes")); //$NON-NLS-1$ + enableTableSizes.setChecked(false); + + IActionBars actionBars = getViewSite().getActionBars(); + actionBars.getMenuManager().add(enableTableSizes); + + Action showDatabaseData = new Action() { + public void run() { + labelProvider.getLabelDecorationInstructions().setDatabaseDataVisible(isChecked()); + treeViewer.refresh(); + } + }; + showDatabaseData.setText(Messages.getString("BookmarkView.ShowDatabaseData")); //$NON-NLS-1$ + showDatabaseData.setChecked(false); + actionBars.getMenuManager().add(showDatabaseData); + + this.actionGroup.fillActionBars(actionBars); + } + + private void initializePopUpMenu() { + MenuManager manager = new MenuManager(); + manager.setRemoveAllWhenShown(true); + manager.addMenuListener(new IMenuListener() { + public void menuAboutToShow(IMenuManager mgr) { + fillContextMenu(mgr); + } + }); + Menu fTextContextMenu = + manager.createContextMenu(treeViewer.getControl()); + treeViewer.getControl().setMenu(fTextContextMenu); + // register the menu to the site so that we can allow + // actions to be plugged in + getSite().registerContextMenu(manager, this.treeViewer); + } + public void initActions() { + + this.actionGroup = new BookmarkViewActionGroup(this, this.treeViewer); + +// openDataEditorAction = new OpenDataEditorAction(); +// openDataEditorAction.setText("Edit Data"); +// openDataEditorAction.setImageDescriptor( +// QuantumPlugin.getImageDescriptor("greentable.gif")); //$NON-NLS-1$ +// openDataEditorAction.init(this); + + IPreferenceStore store = QuantumPlugin.getDefault().getPreferenceStore(); + this.customCopyAction1 = new CustomCopyAction(this,1); // 1 is unused, just in case more custom copies are defined + this.customCopyAction1.setText(store.getString("customCopyName1")); //$NON-NLS-1$ + this.customCopyAction1.setImageDescriptor( + QuantumPlugin.getImageDescriptor("copy.gif")); //$NON-NLS-1$ + this.customCopyAction2 = new CustomCopyAction(this,2); // 1 is unused, just in case more custom copies are defined + this.customCopyAction2.setText(store.getString("customCopyName2")); //$NON-NLS-1$ + this.customCopyAction2.setImageDescriptor( + QuantumPlugin.getImageDescriptor("copy.gif")); //$NON-NLS-1$ + this.customCopyAction3 = new CustomCopyAction(this,3); // 1 is unused, just in case more custom copies are defined + this.customCopyAction3.setText(store.getString("customCopyName3")); //$NON-NLS-1$ + this.customCopyAction3.setImageDescriptor( + QuantumPlugin.getImageDescriptor("copy.gif")); //$NON-NLS-1$ + + extensionVector = new Vector(); + try { + ProcessServiceMembers.process(this, extensionVector); + } catch (WorkbenchException e) { + e.printStackTrace(); + } + + } + + public void dispose(){ + super.dispose(); + BookmarkListNode.getInstance().removePropertyChangeListener(this); + } + + public Shell getShell() { + return getSite().getShell(); + } + + /** + * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) + */ + public void propertyChange(PropertyChangeEvent event) { + if ("bookmarks".equals(event.getPropertyName())) { + refresh(); + } else if ("name".equals(event.getPropertyName()) && + event.getSource() instanceof BookmarkNode) { + refresh(); + } else if ("connected".equals(event.getPropertyName())) { + treeViewer.refresh(event.getSource()); + if (Boolean.TRUE.equals(event.getNewValue())) { + treeViewer.setExpandedState(event.getSource(), true); + } + } else { + treeViewer.refresh(event.getSource()); + } + } + + private void fillContextMenu(IMenuManager mgr) { + // TODO: this method is pretty barfy... make it cleaner + + IStructuredSelection selection = getSelection(); + ActionContext context = new ActionContext(selection); + this.actionGroup.setContext(context); + this.actionGroup.fillContextMenu(mgr); + + Object sel = getCurrent(); + // If selection is a BookmarkNode + if (sel instanceof EntityNode) { + EntityNode entityNode = (EntityNode) sel; + if (!entityNode.isSequence()) { + mgr.add(new Separator()); + MenuManager subMenu = new MenuManager(Messages.getString("bookmarkview.customCopyAction")); + subMenu.add(customCopyAction1); + subMenu.add(customCopyAction2); + subMenu.add(customCopyAction3); + mgr.add(subMenu); + + MenuManager subMenuExtension = new MenuManager("Extensions"); + for (int i = 0; i < extensionVector.size(); i++) { + ExtensionAction extensionAction = (ExtensionAction) extensionVector.get(i); + subMenuExtension.add(extensionAction); + } + if (extensionVector.size() > 0) mgr.add(subMenuExtension); + } + } else if (sel instanceof ColumnNode) { + MenuManager subMenu = new MenuManager(Messages.getString("bookmarkview.customCopyAction")); + subMenu.add(customCopyAction1); + subMenu.add(customCopyAction2); + subMenu.add(customCopyAction3); + mgr.add(subMenu); + + } + } + /** + * @see org.eclipse.ui.part.WorkbenchPart#setFocus() + */ + public void setFocus() { + } + + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkViewActionGroup.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkViewActionGroup.java new file mode 100644 index 0000000..9293770 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/BookmarkViewActionGroup.java @@ -0,0 +1,266 @@ +package com.quantum.view.bookmark; + +import java.util.Iterator; + +import com.quantum.QuantumPlugin; +import com.quantum.actions.AddToQuickListAction; +import com.quantum.actions.ConnectAction; +import com.quantum.actions.DeleteAllRowsAction; +import com.quantum.actions.DeleteBookmarkAction; +import com.quantum.actions.DisconnectAction; +import com.quantum.actions.NewBookmarkAction; +import com.quantum.actions.NextSequenceAction; +import com.quantum.actions.OpenQueryAction; +import com.quantum.actions.PrevSequenceAction; +import com.quantum.actions.RefreshBookmarkAction; +import com.quantum.actions.RemoveFromQuickListAction; +import com.quantum.actions.ViewTableAction; +import com.quantum.actions.ViewTableDetailsAction; +import com.quantum.model.Bookmark; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.actions.ActionGroup; +import org.eclipse.ui.actions.ExportResourcesAction; +import org.eclipse.ui.actions.SelectionListenerAction; +import org.eclipse.ui.actions.SelectionProviderAction; +import org.eclipse.ui.dialogs.PropertyDialogAction; + +/** + * @author BC + */ +public class BookmarkViewActionGroup extends ActionGroup + implements BookmarkClipboard { + + private Bookmark bookmarkClipboard; + + private Action newBookmarkAction; + + // bookmark node actions + private SelectionListenerAction connectAction; + private SelectionListenerAction disconnectAction; + private SelectionListenerAction deleteBookmarkAction; + + // Query node actions + private SelectionListenerAction openQueryAction; + + // Entity node actions + private SelectionListenerAction addToQuickListAction; + private SelectionListenerAction removeFromQuickListAction; + private SelectionListenerAction viewTableAction; + private SelectionListenerAction addSchemaAction; + private SelectionListenerAction viewTableDetailsAction; + + private SelectionListenerAction nextSequenceAction; + private SelectionListenerAction previousSequenceAction; + + + // other actions + private SelectionListenerAction refreshAction; + private SelectionListenerAction renameAction; + + private ExportResourcesAction exportAction; + + + private SelectionProviderAction propertiesAction; + + private SelectionListenerAction copyAction; + private SelectionListenerAction pasteAction; + private SelectionListenerAction deleteAllRowsAction; + + private IViewPart viewPart; + + public BookmarkViewActionGroup( + IViewPart viewPart, ISelectionProvider selectionProvider) { + this.viewPart = viewPart; + + this.newBookmarkAction = new NewBookmarkAction(this.viewPart); + + // bookmark actions + this.connectAction = new ConnectAction(this.viewPart); + this.disconnectAction = new DisconnectAction(this.viewPart); + this.deleteBookmarkAction = new DeleteBookmarkAction(this.viewPart); + + // entity actions + this.previousSequenceAction = new PrevSequenceAction(this.viewPart); + this.nextSequenceAction = new NextSequenceAction(this.viewPart); + this.addToQuickListAction = new AddToQuickListAction(this.viewPart); + this.removeFromQuickListAction = new RemoveFromQuickListAction(this.viewPart); + this.deleteAllRowsAction = new DeleteAllRowsAction(this.viewPart); + this.viewTableDetailsAction = new ViewTableDetailsAction(this.viewPart); + + this.openQueryAction = new OpenQueryAction(this.viewPart); + + this.viewTableAction = new ViewTableAction(this.viewPart); + this.addSchemaAction = new AddSchemaAction(this.viewPart); + this.refreshAction = new RefreshBookmarkAction(this.viewPart); + this.renameAction = new RenameAction(this.viewPart); + this.copyAction = new CopyAction(this.viewPart, this, selectionProvider); + this.pasteAction = new PasteAction(this.viewPart, this, selectionProvider); + this.exportAction = new ExportResourcesAction( + this.viewPart.getViewSite().getWorkbenchWindow()); + this.exportAction.setImageDescriptor(QuantumPlugin.getImageDescriptor("export.gif")); + + this.propertiesAction = new PropertyDialogAction( + this.viewPart.getSite().getShell(), selectionProvider); + } + + + /** + * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager) + */ + public void fillContextMenu(IMenuManager menu) { + + menu.add(this.newBookmarkAction); + menu.add(new Separator()); + + if (getStructuredSelection().size() > 0 && + isEverySelectionInstanceof(BookmarkNode.class)) { + + addToMenu(menu, this.connectAction); + addToMenu(menu, this.disconnectAction); + } + + menu.add(new Separator()); + menu.add(this.copyAction); + // TODO: paste needs to change enablement whenever something is added + // to the clipboard + addToMenu(menu, this.pasteAction); + addToMenu(menu, this.deleteBookmarkAction); + + if (getStructuredSelection().size() == 1 && + isEverySelectionInstanceof(BookmarkNode.class)) { + + addToMenu(menu, this.renameAction); + } + + menu.add(new Separator()); + + // NOTE: In Eclipse 3.0.0 M6, Export is no longer a sub-class of + // SelectionListenerAction. + this.exportAction.selectionChanged(getStructuredSelection()); + menu.add(this.exportAction); + + if (getStructuredSelection().size() == 1 && + isEverySelectionInstanceof(BookmarkNode.class)) { + + menu.add(new Separator()); + addToMenu(menu, this.addSchemaAction); + } + + if (isEverySelectionInstanceof(QueryNode.class)) { + if (getStructuredSelection().size() == 1) { + addToMenu(menu, this.openQueryAction); + } + } + + if (getStructuredSelection().size() > 0 && + isEverySelectionInstanceof(EntityNode.class)) { + + menu.add(new Separator()); + + if (getStructuredSelection().size() == 1) { + if (((EntityNode) getStructuredSelection().getFirstElement()).isSequence()) { + addToMenu(menu, this.nextSequenceAction); + addToMenu(menu, this.previousSequenceAction); + } else { + addToMenu(menu, this.viewTableAction); + addToMenu(menu, this.deleteAllRowsAction); + addToMenu(menu, this.viewTableDetailsAction); + } + } + + addToMenu(menu, this.addToQuickListAction); + addToMenu(menu, this.removeFromQuickListAction); + } + + if (getStructuredSelection().size() == 1) { + menu.add(new Separator()); + addToMenu(menu, this.refreshAction); + } + + createMarkerForActionsProvidedByOtherPlugins(menu); + + if (getStructuredSelection().size() == 1) { + addToMenu(menu, this.propertiesAction); + } + + } + + private void addToMenu(IMenuManager menu, SelectionListenerAction action) { + action.selectionChanged(getStructuredSelection()); + menu.add(action); + } + + private void addToMenu(IMenuManager menu, SelectionProviderAction action) { + action.selectionChanged(getStructuredSelection()); + menu.add(action); + } + + + private IStructuredSelection getStructuredSelection() { + return (IStructuredSelection) getContext().getSelection(); + } + + private boolean isEverySelectionInstanceof(Class selectedClass) { + boolean result = true; + IStructuredSelection selection = getStructuredSelection(); + for (Iterator i = selection.iterator(); result && i.hasNext(); ) { + Object object = i.next(); + result &= selectedClass.isAssignableFrom(object.getClass()); + } + + return result; + } + + public IAction getOpenAction() { + if (isEverySelectionInstanceof(BookmarkNode.class)) { + this.connectAction.selectionChanged(getStructuredSelection()); + return this.connectAction.isEnabled() ? this.connectAction : null; + } else if (isEverySelectionInstanceof(EntityNode.class)) { + this.viewTableAction.selectionChanged(getStructuredSelection()); + return this.viewTableAction.isEnabled() ? this.viewTableAction : null; + } else if (isEverySelectionInstanceof(QueryNode.class)) { + this.openQueryAction.selectionChanged(getStructuredSelection()); + return this.openQueryAction.isEnabled() ? this.openQueryAction : null; + } else { + return null; + } + } + + private void createMarkerForActionsProvidedByOtherPlugins(IMenuManager mgr) { + mgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); + mgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS + "-end")); //$NON-NLS-1$ + mgr.add(new Separator()); + } + public void fillActionBars(IActionBars actionBars) { + IToolBarManager toolBar = actionBars.getToolBarManager(); + toolBar.add(this.newBookmarkAction); + + actionBars.setGlobalActionHandler(IWorkbenchActionConstants.COPY, this.copyAction); + } + + + /* (non-Javadoc) + * @see com.quantum.view.bookmark.BookmarkClipboard#setBookmark(com.quantum.model.Bookmark) + */ + public void setBookmark(Bookmark bookmark) { + this.bookmarkClipboard = bookmark; + } + + + /* (non-Javadoc) + * @see com.quantum.view.bookmark.BookmarkClipboard#getBookmark() + */ + public Bookmark getBookmark() { + return this.bookmarkClipboard; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/ColumnNode.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/ColumnNode.java new file mode 100644 index 0000000..2894c03 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/ColumnNode.java @@ -0,0 +1,64 @@ +package com.quantum.view.bookmark; + +import com.quantum.model.Column; + +/** + * @author BC + */ +public class ColumnNode extends TreeNode { + + private Column column; + + public ColumnNode(TreeNode parent, Column column) { + super(parent); + this.column = column; + } + + public Object[] getChildren() { + return BookmarkListNode.EMPTY_ARRAY; + } + + public boolean hasChildren() { + return false; + } + + public String getName() { + return this.column.getName(); + } + + protected String getImageName() { + return this.column.isPrimaryKey() ? "keycolumn.gif" : "column.gif"; + } + + public String getLabelName() { + String label = getName() + " : " + this.column.getTypeName(); //$NON-NLS-1$ + if (this.column.isNumeric()) { + if (this.column.getSize() > 0 || this.column.getNumberOfFractionalDigits() > 0) { + label += "(" + Integer.toString(this.column.getSize()); //$NON-NLS-1$ + if (this.column.getNumberOfFractionalDigits() > 0) { + label += "," + Integer.toString(this.column.getNumberOfFractionalDigits()); //$NON-NLS-1$ + } + label += ")"; //$NON-NLS-1$ + } + } else if (this.column.getSize() > 0) { + label += "(" + Integer.toString(this.column.getSize()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ + } + return label; + } + /* (non-Javadoc) + * @see com.quantum.view.bookmark.TreeNode#initializeChildren() + */ + protected void initializeChildren() { + } + protected boolean isInitialized() { + return true; + } + + /** + * @return + */ + public Column getColumn() { + return column; + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/CopyAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/CopyAction.java new file mode 100644 index 0000000..5978426 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/CopyAction.java @@ -0,0 +1,109 @@ +/* + * Created on 11/08/2003 + * + */ +package com.quantum.view.bookmark; + +import java.io.IOException; +import java.io.StringWriter; +import java.util.Iterator; +import java.util.List; + +import javax.xml.parsers.ParserConfigurationException; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.model.Bookmark; +import com.quantum.model.xml.ModelToXMLConverter; +import com.quantum.util.QuantumUtil; +import com.quantum.util.xml.XMLHelper; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.actions.SelectionListenerAction; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + + +final class CopyAction extends SelectionListenerAction { + private IViewPart view; + private BookmarkClipboard bookmarkClipboard; + + /** + * @param BookmarkView + */ + public CopyAction(IViewPart view, BookmarkClipboard bookmarkClipboard, + ISelectionProvider selectionProvider) { + super(Messages.getString(CopyAction.class.getName() + ".text")); + setImageDescriptor(QuantumPlugin.getImageDescriptor("copy.gif")); + this.view = view; + this.bookmarkClipboard = bookmarkClipboard; + selectionProvider.addSelectionChangedListener(this); + } + public void run() { + + List list = getSelectedNonResources(); + Object selection = list.get(0); + + if (selection instanceof BookmarkNode) { + Bookmark bookmark = ((BookmarkNode) selection).getBookmark(); + this.bookmarkClipboard.setBookmark(bookmark); + QuantumPlugin.getDefault().getSysClip().setContents( + new Object[] { bookmark.getName()}, + new Transfer[] { TextTransfer.getInstance()}); + + } else if (selection instanceof EntityNode) { + try { + Document doc = XMLHelper.createEmptyDocument(); + Element root = doc.createElement("metadata"); + doc.appendChild(root); + ModelToXMLConverter.getInstance().convert(root, ((EntityNode) selection).getEntity()); + StringWriter text = new StringWriter(); + try { + XMLHelper.createDOMSerializer(text).serialize(doc); + } catch (IOException e) { + e.printStackTrace(); + } + String textXml = new String(text.getBuffer()); + QuantumPlugin.getDefault().getSysClip().setContents( + new Object[] { textXml }, + new Transfer[] { TextTransfer.getInstance()}); + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } + } else if (selection instanceof ColumnNode) { + String copyText = ""; //$NON-NLS-1$ + Iterator iter = list.iterator(); + IPreferenceStore store = QuantumPlugin.getDefault().getPreferenceStore(); + + while (iter.hasNext()) { + Object current = iter.next(); + if (current instanceof ColumnNode) { + ColumnNode column = (ColumnNode) current; + if (column != null) { + copyText += column.getName(); + if (iter.hasNext()) copyText += QuantumUtil.trasposeEscape(store.getString("copyColumnSeparator")); //$NON-NLS-1$ + } + } + } + + QuantumPlugin.getDefault().getSysClip().setContents( + new Object[] { copyText }, + new Transfer[] { TextTransfer.getInstance()}); + } + + } + /* (non-Javadoc) + * @see org.eclipse.ui.actions.SelectionListenerAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection) + */ + protected boolean updateSelection(IStructuredSelection selection) { + boolean enabled = super.updateSelection(selection); + + return enabled; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/EntityNode.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/EntityNode.java new file mode 100644 index 0000000..6d5adbe --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/EntityNode.java @@ -0,0 +1,128 @@ +package com.quantum.view.bookmark; + +import com.quantum.model.Column; +import com.quantum.model.Entity; +import com.quantum.model.EntityHolder; +import com.quantum.model.SchemaHolder; +import com.quantum.model.Table; +import com.quantum.model.View; + +/** + * @author BC + */ +public class EntityNode extends TreeNode implements EntityHolder { + + private Entity entity; + private boolean longFormName; + + public EntityNode(TreeNode parent, Entity entity) { + this(parent, entity, false); + } + public EntityNode(TreeNode parent, Entity entity, boolean longFormName) { + super(parent); + this.entity = entity; + this.longFormName = longFormName; + + if (parent instanceof SchemaHolder) { + SchemaHolder schemaHolder = (SchemaHolder) parent; + if (!schemaHolder.getSchema().getDisplayName().equals(entity.getSchema())) { + this.longFormName = true; + } + } + } + + public Object[] getChildren() { + initializeChildren(); + if (this.children.size() > 0) { + return (ColumnNode[]) this.children.toArray(new ColumnNode[this.children.size()]); + } else { + return BookmarkListNode.EMPTY_ARRAY; + } + } + + protected synchronized void initializeChildren() { + this.children.clear(); + Column[] columns = this.entity.getColumns(); + for (int i = 0, length = (columns == null) ? 0 : columns.length; + i < length; + i++) { + this.children.add(new ColumnNode(this, columns[i])); + } + // TODO: fire property change event + } + + public boolean hasChildren() { + if (!isSequence()) { + return true; + } else { + return false; + } + } + + public Entity getEntity() { + return this.entity; + } + + public String getName() { + return this.entity.getName(); + } + + public String getLabelName() { + return (this.longFormName) ? this.entity.getCondQualifiedName() : this.entity.getName(); + } + + public boolean isTable() { + return Entity.TABLE_TYPE.equals(this.entity.getType()); + } + + public boolean isView() { + return Entity.VIEW_TYPE.equals(this.entity.getType()); + } + + public boolean isSequence() { + return Entity.SEQUENCE_TYPE.equals(this.entity.getType()); + } + + protected String getImageName() { + if (isSequence()) { + return "sequence.gif"; + } else if (isView()) { + return "view.gif"; + } else { + return (this.entity.exists() == null || this.entity.exists().booleanValue()) + ? "bigtable.gif" : "missingtable.gif"; + } + } + + public String getLabelDecorations(LabelDecorationInstructions instructions) { + String decoration = null; + if (instructions.isSizeVisible()) { + Integer size = getSize(); + if (size != null) { + decoration = ((decoration == null) ? "" : decoration) + + "[" + size + "]"; + } + } + return decoration; + } + + private Integer getSize() { + if (isTable()) { + return ((Table) this.entity).getSize(); + } else if (isView()) { + return ((View) this.entity).getSize(); + } else { + return null; + } + } + + public int compareTo(Object o) { + if (o instanceof EntityNode) { + EntityNode that = (EntityNode) o; + return this.entity.getCondQualifiedName().compareTo( + that.entity.getCondQualifiedName()); + } else { + return super.compareTo(o); + } + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/GroupNode.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/GroupNode.java new file mode 100644 index 0000000..1064faa --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/GroupNode.java @@ -0,0 +1,92 @@ +/* + * Created on 27/06/2003 + * + */ +package com.quantum.view.bookmark; + +import java.sql.SQLException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import com.quantum.Messages; +import com.quantum.model.Bookmark; +import com.quantum.model.Entity; +import com.quantum.model.Schema; +import com.quantum.model.SchemaHolder; + +/** + * GroupNode represents a level of grouping in the BookmarkView hierarchy + * It will have categories like "TABLE", "VIEW" and so on, usually gotten from + * the JDBC driver. + * + * @author panic + */ +public class GroupNode extends TreeNode implements Comparable, SchemaHolder { + private String type = null; + private Schema schema = null; + + public GroupNode(TreeNode parent, Schema schema, String type) { + super(parent); + this.schema = schema; + this.type = type; + } + public boolean hasChildren() { + if (!isInitialized()) { + return true; + } else { + return !this.children.isEmpty(); + } + } + public Object[] getChildren() { + if (!isInitialized() && getBookmark().isConnected()) { + initializeChildren(); + } + return (TreeNode[]) this.children.toArray(new TreeNode[this.children.size()]); + } + protected void initializeChildren() { + try { + boolean firstTimeInitialization = !isInitialized(); + boolean changed = false; + Map temp = new HashMap(); + for (Iterator i = this.children.iterator(); i.hasNext();) { + TreeNode treeNode = (TreeNode) i.next(); + temp.put(treeNode.getName(), treeNode); + } + this.children.clear(); + + Bookmark bookmark = getBookmark(); + Entity[] entities = bookmark.getEntitiesForSchema(schema, type); + for (int i = 0, + length = (entities == null) ? 0 : entities.length; + i < length; + i++) { + + String name = entities[i].getName(); + EntityNode entityNode = (EntityNode) temp.remove(name); + if (entityNode == null) { + this.children.add(new EntityNode(this, entities[i])); + changed = true; + } else { + this.children.add(entityNode); + } + } + if (changed && !firstTimeInitialization) { + firePropertyChange("children", null, null); + } + } catch (SQLException e) { + } + } + public String getName() { + return Messages.getString(getClass().getName() + "." + this.type); + } + protected String getImageName() { + return "entitygroup.gif"; //$NON-NLS-1$ + } + /** + * @return + */ + public Schema getSchema() { + return schema; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/LabelDecorationInstructions.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/LabelDecorationInstructions.java new file mode 100644 index 0000000..c82df4b --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/LabelDecorationInstructions.java @@ -0,0 +1,39 @@ +package com.quantum.view.bookmark; + +/** + *

Label decorations are specified for the entire view

. + * + * @author BC + */ +public class LabelDecorationInstructions { + private boolean sizeVisible = false; + private boolean databaseDataVisible = false; + /** + * @return + */ + public boolean isSizeVisible() { + return sizeVisible; + } + + /** + * @param b + */ + public void setSizeVisible(boolean b) { + sizeVisible = b; + } + + /** + * @return + */ + public boolean isDatabaseDataVisible() { + return databaseDataVisible; + } + + /** + * @param b + */ + public void setDatabaseDataVisible(boolean b) { + databaseDataVisible = b; + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/PasteAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/PasteAction.java new file mode 100644 index 0000000..a7bf476 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/PasteAction.java @@ -0,0 +1,46 @@ +package com.quantum.view.bookmark; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.model.Bookmark; +import com.quantum.model.BookmarkCollection; + +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.actions.SelectionListenerAction; + + +final class PasteAction extends SelectionListenerAction { + private IViewPart view; + private BookmarkClipboard bookmarkClipboard; + /** + * @param BookmarkView + */ + public PasteAction(IViewPart view, BookmarkClipboard bookmarkClipboard, + ISelectionProvider selectionProvider) { + super(Messages.getString(PasteAction.class.getName() + ".text")); + setImageDescriptor(QuantumPlugin.getImageDescriptor("paste.gif")); + this.view = view; + selectionProvider.addSelectionChangedListener(this); + this.bookmarkClipboard = bookmarkClipboard; + } + public void run() { + if (this.bookmarkClipboard.getBookmark() != null) { + Bookmark bookmark = new Bookmark(this.bookmarkClipboard.getBookmark()); + String copyName = BookmarkCollection.getInstance().getCopyName(bookmark.getName()); + bookmark.setName(copyName); //$NON-NLS-1$ + BookmarkCollection.getInstance().addBookmark(bookmark); + } + } + + /* (non-Javadoc) + * @see org.eclipse.ui.actions.SelectionListenerAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection) + */ + protected boolean updateSelection(IStructuredSelection selection) { + boolean enabled = super.updateSelection(selection); + enabled &= this.bookmarkClipboard.getBookmark() != null; + return enabled; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/QueryListNode.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/QueryListNode.java new file mode 100644 index 0000000..eb8b173 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/QueryListNode.java @@ -0,0 +1,76 @@ +package com.quantum.view.bookmark; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; + +import com.quantum.Messages; + +/** + * @author BC + */ +public class QueryListNode extends TreeNode implements PropertyChangeListener { + + /** + * @param parent + */ + public QueryListNode(TreeNode parent) { + super(parent); + getBookmark().addPropertyChangeListener(this); + } + + /** + * @see com.quantum.view.bookmark.TreeNode#getChildren() + */ + public Object[] getChildren() { + initializeChildren(); + return (TreeNode[]) this.children.toArray(new TreeNode[this.children.size()]); + } + + protected void initializeChildren() { + this.children.clear(); + String[] queries = getBookmark().getQueries(); + for (int i = 0, length = (queries == null) ? 0 : queries.length; + i < length; + i++) { + this.children.add(new QueryNode(this, queries[i])); + } + } + + /** + * @see com.quantum.view.bookmark.TreeNode#hasChildren() + */ + public boolean hasChildren() { + return getBookmark().getQueries().length > 0; + } + + /** + * @see com.quantum.view.bookmark.TreeNode#getName() + */ + public String getName() { + return Messages.getString(getClass().getName() + ".labelName"); + } + + /** + * @see com.quantum.view.bookmark.TreeNode#getImageName() + */ + protected String getImageName() { + return "group.gif"; + } + + /** + * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) + */ + public void propertyChange(PropertyChangeEvent event) { + if ("queries".equals(event.getPropertyName())) { + firePropertyChange("queries", null, null); + } + } + /** + * @see com.quantum.view.bookmark.TreeNode#dispose() + */ + protected void dispose() { + getBookmark().removePropertyChangeListener(this); + super.dispose(); + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/QueryNode.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/QueryNode.java new file mode 100644 index 0000000..4826003 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/QueryNode.java @@ -0,0 +1,64 @@ +package com.quantum.view.bookmark; + +import com.quantum.sql.metadata.ObjectMetaData; + +public class QueryNode extends TreeNode { + + private String query; + private static final int MAX_SIZE = 30; + + public QueryNode(TreeNode parent, String query) { + super(parent); + this.query = query; + } + + public ObjectMetaData getMetaData() { + return null; //no metadata implementation for now + } + + public String getQuery() { + return this.query; + } + + public String getName() { + String name = this.query.trim(); + boolean trimmed = false; + name = name.replace('\n', ' '); + + if (name.length() > MAX_SIZE) { + name = name.substring(0, MAX_SIZE); + trimmed = true; + } + if (trimmed) { + name += "...->"; //$NON-NLS-1$ + } + return name; + } + + /** + * @see com.quantum.view.bookmark.TreeNode#getChildren() + */ + public Object[] getChildren() { + return BookmarkListNode.EMPTY_ARRAY; + } + + /** + * @see com.quantum.view.bookmark.TreeNode#hasChildren() + */ + public boolean hasChildren() { + return false; + } + + /** + * @see com.quantum.view.bookmark.TreeNode#getImageName() + */ + protected String getImageName() { + return "script.gif"; + } + + /* (non-Javadoc) + * @see com.quantum.view.bookmark.TreeNode#initializeChildren() + */ + protected void initializeChildren() { + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/QuickListNode.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/QuickListNode.java new file mode 100644 index 0000000..9e74ef5 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/QuickListNode.java @@ -0,0 +1,98 @@ +package com.quantum.view.bookmark; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; + +import com.quantum.Messages; +import com.quantum.model.Bookmark; +import com.quantum.model.Entity; + +/** + *

A "quick list" is a set of favourite entities that a user may want + * to work with without having to sift through the (somtimes lengthy) longer + * list of tables.

+ * + * @author bcholmes + */ +public class QuickListNode extends TreeNode implements PropertyChangeListener { + + private Map children = new Hashtable(); + + /** + * @param parent + */ + public QuickListNode(BookmarkNode parent) { + super(parent); + + Bookmark bookmark = getBookmark(); + bookmark.addPropertyChangeListener(this); + } + + /** + * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) + */ + public void propertyChange(PropertyChangeEvent event) { + if ("quickList".equals(event.getPropertyName())) { + initializeChildren(); + firePropertyChange("quickList", null, null); + } + } + + /** + * @see com.quantum.view.bookmark.TreeNode#hasChildren() + */ + public boolean hasChildren() { + return getBookmark().hasQuickList(); + } + /** + * @see com.quantum.view.bookmark.TreeNode#getImageName() + */ + protected String getImageName() { + return "group.gif"; + } + + /** + * @see com.quantum.view.bookmark.TreeNode#getChildren() + */ + public Object[] getChildren() { + Bookmark bookmark = getBookmark(); + if (children.isEmpty() && bookmark.hasQuickList()) { + initializeChildren(); + } + List list = new ArrayList(this.children.values()); + Collections.sort(list); + + return (TreeNode[]) list.toArray(new TreeNode[list.size()]); + } + + /** + * @see com.quantum.view.bookmark.TreeNode#getName() + */ + public String getName() { + return Messages.getString(QuickListNode.class.getName() + ".labelName"); + } + + protected synchronized void initializeChildren() { + this.children.clear(); + Entity[] entities = getBookmark().getQuickListEntries(); + for (int i = 0, length = (entities == null) ? 0 : entities.length; + i < length; + i++) { + + this.children.put(entities[i].getCondQualifiedName(), + new EntityNode(this, entities[i], true)); + } + } + /* (non-Javadoc) + * @see com.quantum.view.bookmark.TreeNode#isInitialized() + */ + protected boolean isInitialized() { + return true; + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/RenameAction.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/RenameAction.java new file mode 100644 index 0000000..175c68a --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/RenameAction.java @@ -0,0 +1,52 @@ +package com.quantum.view.bookmark; + +import com.quantum.Messages; +import com.quantum.model.Bookmark; + +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.actions.SelectionListenerAction; + +/** + * @author BC + */ +public class RenameAction extends SelectionListenerAction { + + private IViewPart viewPart; + + /** + * @param text + */ + protected RenameAction(IViewPart viewPart) { + super(Messages.getString(RenameAction.class.getName() + ".text")); + this.viewPart = viewPart; + } + + + + /** + * @see org.eclipse.ui.actions.SelectionListenerAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection) + */ + protected boolean updateSelection(IStructuredSelection selection) { + boolean enabled = super.updateSelection(selection); + return enabled & selection.size() == 1 & + selection.getFirstElement() instanceof BookmarkNode; + } + + private Bookmark getBookmark() { + return ((BookmarkNode) getSelectedNonResources().get(0)).getBookmark(); + } + + /** + * @see org.eclipse.jface.action.IAction#run() + */ + public void run() { + InputDialog dialog = new InputDialog(this.viewPart.getSite().getShell(), "Select a new name", + "Name: ", getBookmark().getName(), null); + int result = dialog.open(); + if (result == InputDialog.OK) { + getBookmark().setName(dialog.getValue()); + } + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/SchemaNode.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/SchemaNode.java new file mode 100644 index 0000000..6b44cda --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/SchemaNode.java @@ -0,0 +1,81 @@ +package com.quantum.view.bookmark; + +import java.sql.SQLException; + +import com.quantum.model.Bookmark; +import com.quantum.model.NotConnectedException; +import com.quantum.model.Schema; +import com.quantum.model.SchemaHolder; + +/** + * @author BC + */ +public class SchemaNode extends TreeNode implements SchemaHolder { + + private Schema schema; + /** + * @param parent + */ + public SchemaNode(TreeNode parent, Schema schema) { + super(parent); + this.schema = schema; + } + + /** + * @see com.quantum.view.bookmark.TreeNode#getChildren() + */ + public Object[] getChildren() { + Bookmark bookmark = getBookmark(); + if (!bookmark.isConnected()) { + return BookmarkListNode.EMPTY_ARRAY; + } else { + if (this.children.isEmpty()) { + initializeChildren(); + } + } + return (TreeNode[]) this.children.toArray(new TreeNode[this.children.size()]); + } + + protected void initializeChildren() { + this.children.clear(); + Bookmark bookmark = getBookmark(); + try { + String[] types = bookmark.getDatabase().getEntityTypes(); + for (int i = 0, length = (types == null) ? 0 : types.length; + i < length; + i++) { + this.children.add(new GroupNode(this, this.schema, types[i])); + } + } catch (NotConnectedException e) { + } catch (SQLException e) { + } + } + + /** + * @see com.quantum.view.bookmark.TreeNode#hasChildren() + */ + public boolean hasChildren() { + return getBookmark().isConnected(); + } + + /** + * @see com.quantum.view.bookmark.TreeNode#getName() + */ + public String getName() { + return this.schema.getDisplayName(); + } + + /** + * @see com.quantum.view.bookmark.TreeNode#getImageName() + */ + protected String getImageName() { + return this.schema.isDefault() ? "user.gif" : "schema.gif"; + } + + /** + * @see com.quantum.model.SchemaHolder#getSchema() + */ + public Schema getSchema() { + return this.schema; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/TreeNode.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/TreeNode.java new file mode 100644 index 0000000..1d18d38 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/TreeNode.java @@ -0,0 +1,124 @@ +package com.quantum.view.bookmark; + +import java.beans.PropertyChangeEvent; +import java.util.Iterator; +import java.util.Vector; + +import com.quantum.QuantumPlugin; +import com.quantum.model.Bookmark; +import com.quantum.model.BookmarkHolder; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.swt.graphics.Image; + +/** + * Base class for all nodes of the internal tree of data. Basically allows navigation. + * @author root + */ +public abstract class TreeNode + implements BookmarkHolder, Comparable, IAdaptable { + + private TreeNode parent = null; + protected Vector children = new Vector(); + private boolean disposed = false; + + public TreeNode(TreeNode parent) { + this.parent = parent; + } + + public abstract Object[] getChildren(); + public TreeNode getParent() { + return this.parent; + } + public abstract boolean hasChildren(); + public abstract String getName(); + + public Bookmark getBookmark() { + return getParent().getBookmark(); + } + + public String getLabelName() { + return getName(); + } + + /** + * @return an Image object to appear in the view, null if not found + */ + public Image getImage() { + return QuantumPlugin.getImage(getImageName()); + } + + /** + * @return + */ + protected abstract String getImageName(); + + + /** + * @see java.lang.Comparable#compareTo(java.lang.Object) + */ + public int compareTo(Object object) { + TreeNode that = (TreeNode) object; + return this.getLabelName().compareTo(that.getLabelName()); + } + + public String toString() { + return getLabelName(); + } + + public String getLabelDecorations(LabelDecorationInstructions labelDecorationInstructions) { + return null; + } + /** + * @param propertyName + * @param oldValue + * @param newValue + */ + protected void firePropertyChange( + String propertyName, + Object oldValue, + Object newValue) { + + firePropertyChange(new PropertyChangeEvent(this, propertyName, oldValue, newValue)); + } + + /** + * @param propertyName + * @param oldValue + * @param newValue + */ + protected void firePropertyChange(PropertyChangeEvent event) { + TreeNode parent = getParent(); + if (parent != null && !this.disposed) { + parent.firePropertyChange(event); + } + } + + protected void dispose() { + this.disposed = true; + removeAllChildren(); + } + protected void removeAllChildren() { + for (Iterator i = this.children.iterator(); i.hasNext();) { + TreeNode element = (TreeNode) i.next(); + element.dispose(); + } + } + + protected boolean isInitialized() { + return !this.children.isEmpty(); + } + + public Object getAdapter(Class adapter) { + return null; + } + protected abstract void initializeChildren(); + public void reload() { + if (isInitialized()) { + initializeChildren(); + for (Iterator i = this.children.iterator(); i.hasNext(); ) { + ((TreeNode) i.next()).reload(); + } + } + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/EntitySubset.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/EntitySubset.java new file mode 100644 index 0000000..0b70c9d --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/EntitySubset.java @@ -0,0 +1,86 @@ +package com.quantum.view.subset; + +import java.sql.SQLException; + +import com.quantum.model.Bookmark; +import com.quantum.model.BookmarkCollection; +import com.quantum.model.Column; +import com.quantum.model.Entity; +import com.quantum.model.Index; +import com.quantum.model.Schema; + +/** + * @author BC + */ +public class EntitySubset implements Entity { + + private String name; + private String schema; + private String bookmarkName; + + public EntitySubset(String name, String schema, String bookmarkName) { + this.name = name; + this.schema = schema; + this.bookmarkName = bookmarkName; + } + + public String getName() { + return this.name; + } + + public String getSchema() { + return schema; + } + + public String getType() { + return null; + } + + public Column[] getColumns() { + // TODO: limit the columns + Entity relatedEntity = getEntityFromBookmark(); + if (relatedEntity != null) { + Column[] columns = relatedEntity.getColumns(); + return columns; + } else { + return null; + } + } + + public Index[] getIndexes() { + return new Index[0]; + } + + public Column getColumn(String columnName) { + Entity relatedEntity = getEntityFromBookmark(); + return relatedEntity == null + ? null : relatedEntity.getColumn(columnName); + } + + public String getCondQualifiedName() { + return this.schema + "." + this.name; + } + + public Boolean exists() { + return null; + } + + public Bookmark getBookmark() { + return BookmarkCollection.getInstance().find(this.bookmarkName); + } + + private Entity getEntityFromBookmark() { + try { + return getBookmark().getEntity( + new Schema(schema), name); + } catch (SQLException e) { + return null; + } + } + /** + * @see com.quantum.model.Entity#getQuotedTableName() + */ + public String getQuotedTableName() { + return getBookmark().getAdapter().filterTableName(getCondQualifiedName()); + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/ObjectNode.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/ObjectNode.java new file mode 100644 index 0000000..149135f --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/ObjectNode.java @@ -0,0 +1,167 @@ +package com.quantum.view.subset; + +import com.quantum.IQuantumConstants; +import com.quantum.Messages; +import com.quantum.model.Entity; +import com.quantum.model.EntityHolder; +import com.quantum.sql.metadata.MetaDataXMLInterface; +import com.quantum.sql.metadata.ObjectMetaData; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * Defines a node for the Subset. It contains an editable ObjectMetaData + * where you can erase columns you are not interested in. + * @author jparrai + * + */ +public class ObjectNode implements Comparable, EntityHolder { + private SubsetNode parent = null; + private ObjectMetaData metadata = null; + private int order = 0; + private Entity entity; + + public ObjectNode(SubsetNode parent, ObjectMetaData metadata, String bookmark, String name, String schema) { + this.parent = parent; + this.metadata = metadata; + this.entity = new EntitySubset(name, schema, bookmark); + } + + public ObjectNode(){ + } + public String getType(){ + return IQuantumConstants.View; + } + + /* (non-Javadoc) + * @see com.quantum.view.bookmark.TreeNode#getChildren() + * We consider the columns of the metadata to be the children. + */ + public Object[] getChildren() { +// if (metadata != null && ColumnMetaData.getColumnsMetaDataNode(metadata, this) != null) { +// return ColumnMetaData.getColumnsMetaDataNode(metadata, this).toArray(); +// } else { + return SubsetRoot.EMPTY_ARRAY; +// } + } + + public Object getParent() { + return parent; + } + + public boolean hasChildren() { +// if (metadata == null) return false; +// return (ColumnMetaData.getColumnsMetaDataNode(metadata, this) != null && +// ColumnMetaData.getColumnsMetaDataNode(metadata, this).size() > 0); + return false; + } + + public String getName() { + return this.entity.getName(); + } + + public String toString() { + return getName(); + } + + public int compareTo(Object o) { + if (o instanceof ObjectNode) { + ObjectNode node = (ObjectNode) o; + if (node.getOrder() > getOrder()) return -1; + if (node.getOrder() < getOrder()) return 1; + // If the order is the same, we use alphabetical order + return getEntity().getCondQualifiedName().compareTo( + node.getEntity().getCondQualifiedName()); + } else throw new ClassCastException(); + } + + public void setObjectMetadata(ObjectMetaData metadata) { + this.metadata = metadata; + } + /** + * @return + */ + public ObjectMetaData getMetaData() { + return metadata; + } + + /** + * @return The order of this ObjectNode inside the SubsetNode + */ + public int getOrder() { + return order; + } + /** + * Sets an ordering (inside the SubsetNode) to the ObjectNode + * @param i + */ + public void setOrder(int i) { + order = i; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object obj) { + if (!(obj instanceof ObjectNode)) return false; + return (getEntity().getCondQualifiedName().equals( + ((ObjectNode) obj).getEntity().getCondQualifiedName())); + } + + /** + * Imports one ObjectNode from an XMLDocument. There must be a tag for the Table Name, another for the Bookmark + * name and other for the metadata. The complement function is exportXML() + * @param root Document to get the data from + * @param parent The SubsetNode to which to add the new ObjectNode + * @return The newly created ObjectNode, or null if some error. + */ + public static ObjectNode importXML(Element root, SubsetNode parent){ + // Get the name tag value into objName + String objName = MetaDataXMLInterface.getElementText(root, Messages.getString("ExportXMLAction.TableName")); //$NON-NLS-1$ + String objSchema = MetaDataXMLInterface.getElementText(root, Messages.getString("ExportXMLAction.SchemaName")); //$NON-NLS-1$ + if (objName == "") return null; //$NON-NLS-1$ + // Get the bookmark tag value into objName + String bookmarkName = MetaDataXMLInterface.getElementText(root, Messages.getString("ExportXMLAction.BookmarkName")); //$NON-NLS-1$ + if (bookmarkName == "") return null; //$NON-NLS-1$ + ObjectMetaData metadata = new ObjectMetaData(); + // The rest of the tags go to be the metadata + MetaDataXMLInterface.xmlToMetaData(metadata, root); + // We can finally create the new ObjectNode with the collected data + ObjectNode objectNode = new ObjectNode(parent, metadata, bookmarkName, objName, objSchema); + return objectNode; + } + + /** + * Exports an ObjectNode to an XMLDocument. The complement function is importXML() + * @param root Document to write the XML tags to + */ + public void exportXML(Element root){ + Document doc = root.getOwnerDocument(); + Element sub = (Element) root.appendChild(doc.createElement(Messages.getString("ExportXMLAction.Table"))); //$NON-NLS-1$ + MetaDataXMLInterface.createElementText(sub,Messages.getString("ExportXMLAction.TableName"), getEntity().getName()); //$NON-NLS-1$ + MetaDataXMLInterface.createElementText(sub,Messages.getString("ExportXMLAction.SchemaName"), getEntity().getSchema()); //$NON-NLS-1$ + MetaDataXMLInterface.createElementText(sub,Messages.getString("ExportXMLAction.BookmarkName"), getEntity().getBookmark().getName()); //$NON-NLS-1$ + if (this.metadata != null) + MetaDataXMLInterface.metaDataToXML(this.metadata, doc, sub); + } + + /** + * Generates a query with all the columns in the metadata of the ObjectNode. + * "SELECT *" would not be valid because you can have less columns in the ObjectNode than in the table or view. + * @return String with the Query + */ + public String getQuery() { + String result = new String(""); //$NON-NLS-1$ + result = "SELECT " + metadata.getColumnsString() + " FROM " + getEntity().getCondQualifiedName(); //$NON-NLS-1$ //$NON-NLS-2$ + return result; + } + + /** + * @see com.quantum.model.EntityHolder#getEntity() + */ + public Entity getEntity() { + return this.entity; + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetContentProvider.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetContentProvider.java new file mode 100644 index 0000000..dd8133b --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetContentProvider.java @@ -0,0 +1,158 @@ +package com.quantum.view.subset; + +import java.util.Vector; + +import com.quantum.Messages; +import com.quantum.sql.metadata.MetaDataXMLInterface; +import com.quantum.view.bookmark.ColumnNode; +import com.quantum.view.bookmark.TreeNode; + +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.Viewer; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +public class SubsetContentProvider implements ITreeContentProvider { + private Vector subsets = new Vector(); + private static SubsetContentProvider instance = null; + private boolean hasChanged = false; + + /** + * Singleton accessor + */ + public static synchronized SubsetContentProvider getInstance() { + if (instance == null) { + instance = new SubsetContentProvider(); + } + return instance; + } + + private SubsetContentProvider() { + } + + public void exportXML(Element root) { + System.out.println("Subsets: Saving to Element"); //$NON-NLS-1$ + Element subsetRoot = MetaDataXMLInterface.createElementText(root,Messages.getString("ExportXMLAction.Subsets"), ""); //$NON-NLS-1$ //$NON-NLS-2$ + for (int i = 0; i < subsets.size(); i++) { + SubsetNode current = (SubsetNode) subsets.get(i); + current.exportXML(subsetRoot); + } + } + + /** + * Imports the data from an XML file to the tree. Does not set the tree to + * changed because it's usually invoked from the initial import routine. + * @param root + */ + public void importXML(Element root){ + System.out.println("Bookmarks: Loading from Element"); //$NON-NLS-1$ + Vector newSubsets = new Vector(); + NodeList nodes = root.getElementsByTagName(Messages.getString("ExportXMLAction.Subset")); //$NON-NLS-1$ + for (int i = 0; i < nodes.getLength(); i++) { + SubsetNode subset = new SubsetNode(); + Element node = (Element) nodes.item(i); + subset.importXML(node,true); + newSubsets.add(subset); + } + subsets = newSubsets; + } + + + public Object[] getChildren(Object parentElement) { + if (parentElement.equals(SubsetRoot.ROOT)) { + return subsets.toArray(); + } else if (parentElement instanceof TreeNode) { + TreeNode node = (TreeNode) parentElement; + return node.getChildren(); + } + return SubsetRoot.EMPTY_ARRAY; + } + + public Object[] getElements(Object inputElement) { + return getChildren(inputElement); + } + + public Object getParent(Object element) { + if (element.equals(SubsetRoot.ROOT)) { + return null; + } else if (element instanceof TreeNode) { + TreeNode node = (TreeNode) element; + return node.getParent(); + } + return null; + } + + public boolean hasChildren(Object element) { + if (element.equals(SubsetRoot.ROOT)) { + return true; + } else if (element instanceof TreeNode) { + TreeNode node = (TreeNode) element; + return node.hasChildren(); + } + return false; + } + + public void setChildren(SubsetNode b, Vector tables) { + b.setChildren(tables); + } + + public void addSubset(SubsetNode b) { + hasChanged = true; + if (!subsets.contains(b)) { + subsets.addElement(b); + } + } + public void removeSubset(SubsetNode b) { + hasChanged = true; + if (subsets.contains(b)) { + subsets.removeElement(b); + } + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + } + + public void dispose() { + } + + public boolean hasChanged() { + return hasChanged; + } + + public int getSize() { + return subsets.size(); + } + + /** + * @param b + */ + public void setHasChanged(boolean b) { + hasChanged = b; + } + + /** + * @param column + */ + public void deleteColumn(ColumnNode column) { + // TODO: reinstate this +// TreeNode node = (TreeNode) column.getParent(); +// if (!(node instanceof HasMetaData)) return; +// ObjectMetaData metadata = ((HasMetaData)node).getMetaData(); +// if (metadata == null) return; +// metadata.dropColumn(column.getName()); +// setHasChanged(true); +// + } + + /** + * @param object + */ + public void deleteObject(ObjectNode object) { + SubsetNode node = (SubsetNode) object.getParent(); + if (!(node instanceof SubsetNode)) return; + node.remove(object); + setHasChanged(true); + + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetLabelProvider.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetLabelProvider.java new file mode 100644 index 0000000..2f64f53 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetLabelProvider.java @@ -0,0 +1,61 @@ +package com.quantum.view.subset; + +import com.quantum.view.bookmark.TreeNode; + +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.swt.graphics.Image; + +/** + * @author root + * + * Implements the ILabelProvider for the Bookmarks. + */ +public class SubsetLabelProvider implements ILabelProvider { + /** + * @see org.eclipse.jface.viewers.ILabelProvider#getImage(Object) + */ + public Image getImage(Object element) { + if (element instanceof TreeNode) { + return ((TreeNode) element).getImage(); + } else { + return null; + } + } + + /** + * @see org.eclipse.jface.viewers.ILabelProvider#getText(Object) + */ + public String getText(Object element) { + if (element instanceof TreeNode) { + return ((TreeNode) element).getLabelName(); + } else { + return element.toString(); + } + } + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(ILabelProviderListener) + */ + public void addListener(ILabelProviderListener listener) { + } + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose() + */ + public void dispose() { + } + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(Object, String) + */ + public boolean isLabelProperty(Object element, String property) { + return false; + } + + /** + * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(ILabelProviderListener) + */ + public void removeListener(ILabelProviderListener listener) { + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetNode.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetNode.java new file mode 100644 index 0000000..8f6c5cf --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetNode.java @@ -0,0 +1,162 @@ +package com.quantum.view.subset; + +import java.util.Collections; +import java.util.Vector; + +import com.quantum.Messages; +import com.quantum.sql.metadata.MetaDataXMLInterface; +import com.quantum.view.bookmark.TreeNode; + +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +public class SubsetNode extends TreeNode { + private String name = null; + private Vector children = new Vector(); + + public SubsetNode(SubsetNode param) { + super(param.getParent()); + name = param.name; + children.addAll(param.children); + } + + public SubsetNode() { + super(SubsetRoot.ROOT); + } + + public SubsetNode(String name) { + super(SubsetRoot.ROOT); + this.name = name; + } + + public void setName(String name) { + this.name = name; + } + + public String getName(){ + return name; + } + + public Object[] getChildren() { + return children.toArray(); + } + + public boolean hasChildren() { + if (children != null && children.size() > 0) { + return true; + } + return false; + } + + public void setChildren(Vector children) { + for (int i = 0; i < children.size(); i++) { + Object obj = children.elementAt(i); + isValid(obj); + } + Collections.sort(children); + this.children = children; + } + + public void isValid(Object child) { + boolean valid = false; + if (child instanceof ObjectNode ) { + valid = true; + } + if (!valid) { + throw new RuntimeException("Invalid SubsetNode child: " + child.getClass().getName()); //$NON-NLS-1$ + } + } + + + /** + * Finds a child of the SubsetNode with the said name + * @param name + * @return the TreeNode found. null if none + */ + public TreeNode find(String name){ + for (int i = 0; i < children.size(); i++) { + Object obj = children.elementAt(i); + if (obj instanceof TreeNode){ + TreeNode node = (TreeNode) obj; + if (name.equals(node.getName())) return node; + } + } + return null; + } + + public boolean add(ObjectNode object){ + if (children.indexOf(object) >= 0) return false; + children.add(object); + return true; + } + + public boolean addReplace(ObjectNode object){ + children.remove(object); + return add(object); + } + + public boolean remove(ObjectNode object){ + return children.remove(object); + } + + public void exportXML(Element root) { + Element sub = MetaDataXMLInterface.createElementText(root,Messages.getString("ExportXMLAction.Subset"), ""); //$NON-NLS-1$ //$NON-NLS-2$ + MetaDataXMLInterface.createElementText(sub,Messages.getString("ExportXMLAction.SubsetName"), getName()); //$NON-NLS-1$ + for (int i = 0; i < children.size(); i++) { + Object obj = children.elementAt(i); + if (obj instanceof ObjectNode){ + ((ObjectNode) obj).exportXML(sub); + } + } + + } + + /** + * Imports a set of XML tags (parsed into a XMLDocument) into a Subset + * @param root Document to get the data from + * @param replace True if you want to replace already-existing elements with the same name, false if not + */ + public void importXML(Element root, boolean replace) { + if (replace) { + String name = MetaDataXMLInterface.getElementText(root, Messages.getString("ExportXMLAction.SubsetName")); //$NON-NLS-1$ + if (name == "") return; //$NON-NLS-1$ + setName(name); + } + importElementXML(root, replace, Messages.getString("ExportXMLAction.Table")); //$NON-NLS-1$ + importElementXML(root, replace, Messages.getString("ExportXMLAction.View")); //$NON-NLS-1$ + + } + + + /** + * + * Imports one type of element from a XMLDocument (possibly a part of one) into a Subset + * @param root Document to get the data from + * @param replace True if you want to replace already-existing elements with the same name, false if not + * @param type The type of element to import, has to correspond with the XML tag + */ + private void importElementXML(Element root, boolean replace, String type) { + // We get all the tags named as the type + NodeList tables = root.getElementsByTagName(type); + for (int i = 0; i < tables.getLength(); i++) { + Element table = (Element) tables.item(i); + ObjectNode objectNode = ObjectNode.importXML(table, this); + if (replace)addReplace(objectNode); + else add(objectNode); + } + } + + /* (non-Javadoc) + * @see com.quantum.view.bookmark.TreeNode#getImageName() + */ + protected String getImageName() { + return "subset.gif"; + } + + /* (non-Javadoc) + * @see com.quantum.view.bookmark.TreeNode#initializeChildren() + */ + protected void initializeChildren() { + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetRoot.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetRoot.java new file mode 100644 index 0000000..3e893f6 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetRoot.java @@ -0,0 +1,41 @@ +package com.quantum.view.subset; + +import com.quantum.view.bookmark.TreeNode; + + +/** + * @author root + */ +public final class SubsetRoot extends TreeNode { + public final static SubsetRoot ROOT = new SubsetRoot(); + public final static TreeNode[] EMPTY_ARRAY = new TreeNode[0]; + + private SubsetRoot() { + super(null); + } + /** + * @see com.quantum.view.bookmark.TreeNode#getChildren() + */ + public Object[] getChildren() { + return EMPTY_ARRAY; + } + + /** + * @see com.quantum.view.bookmark.TreeNode#hasChildren() + */ + public boolean hasChildren() { + return true; + } + + public String getName() { + return "ROOT"; //$NON-NLS-1$ + } + protected String getImageName() { + return null; + } + /* (non-Javadoc) + * @see com.quantum.view.bookmark.TreeNode#initializeChildren() + */ + protected void initializeChildren() { + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetView.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetView.java new file mode 100644 index 0000000..448ff51 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/subset/SubsetView.java @@ -0,0 +1,354 @@ +package com.quantum.view.subset; + +import java.io.IOException; +import java.io.StringReader; +import java.util.Vector; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.actions.CustomCopyAction; +import com.quantum.actions.DeleteColumnAction; +import com.quantum.actions.DeleteObjectAction; +import com.quantum.actions.DeleteSubsetAction; +import com.quantum.actions.ExportXMLAction; +import com.quantum.actions.NewSubsetAction; +import com.quantum.actions.ViewTableAction; +import com.quantum.view.bookmark.ColumnNode; +import com.quantum.view.bookmark.TreeNode; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.part.ViewPart; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * @author panic + * + * View for subsets + * */ +public class SubsetView extends ViewPart { + + private SubsetContentProvider provider = SubsetContentProvider.getInstance(); + private NewSubsetAction newSubsetAction; + private DeleteSubsetAction deleteSubsetAction; + private DeleteObjectAction deleteObjectAction; + private DeleteColumnAction deleteColumnAction; + private CustomCopyAction customCopyAction; + + private ViewTableAction viewTableAction; + private ExportXMLAction exportXMLAction; + private static SubsetView instance = null; + private TreeViewer treeViewer; + private Label status; + public synchronized static SubsetView getInstance() { + return instance; + } + /** + * Returns the current selected object in the tree. If it's a multiple selection, return the first. + * @return + */ + public Object getCurrent() { + if (treeViewer == null) return null; + return ((StructuredSelection) treeViewer.getSelection()) + .getFirstElement(); + } + /** + * Returns the current selected objects in the tree, in the form of a StructuredSelection. + * @return + */ + public StructuredSelection getSelection() { + if (treeViewer == null) return null; + return ((StructuredSelection) treeViewer.getSelection()); + } + + /** + * Navigates the tree to get the current subset (root) of the selected element. + * If it's a multiple selection, it takes the first one. + * @return + */ + public SubsetNode getCurrentSubset() { + TreeNode current = (TreeNode) getCurrent(); + + return getRoot(current); + } + + /** + * Navigates a given TreeNode till finds a SubsetNode + * @param node + * @return + */ + private static SubsetNode getRoot(TreeNode node){ + while (!( node instanceof SubsetNode)) + { + node = (TreeNode) node.getParent(); + } + return (SubsetNode) node; + + } + + + /** + * Deletes the current node (first selected) in the tree + */ + public void deleteCurrent() { + provider.removeSubset(getCurrentSubset()); + treeViewer.refresh(); + } + + public void refreshSubsetData(){ + //if (treeViewer == null) return; + //SubsetContentProvider provider = (SubsetContentProvider) treeViewer.getContentProvider(); + //Object[] objects = provider.getElements(Root.ROOT); + //for (int i = 0; i < objects.length; i++) { + //SubsetNode current = (SubsetNode) objects[i]; + + //} + } + + public void expandCurrent(SubsetNode node) { + treeViewer.setExpandedState(node, true); + treeViewer.refresh(node, false); + } + public void refresh() { + treeViewer.refresh(); + } + public void disconnect() { + } + + public void createPartControl(org.eclipse.swt.widgets.Composite parent) { + instance = this; + initActions(); + Composite main = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(1, false); + layout.horizontalSpacing = 0; + layout.verticalSpacing = 0; + main.setLayout(layout); + + + treeViewer = new TreeViewer(main); + treeViewer.setContentProvider(provider); + treeViewer.setLabelProvider(new SubsetLabelProvider()); + treeViewer.setInput(SubsetRoot.ROOT); + MenuManager manager = new MenuManager(); + manager.setRemoveAllWhenShown(true); + Menu fTextContextMenu = + manager.createContextMenu(treeViewer.getControl()); + treeViewer.getControl().setMenu(fTextContextMenu); + treeViewer.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent event) { + Object sel = getCurrent(); + if (sel instanceof ObjectNode) { + viewTableAction.run(); + } + } + }); + + manager.addMenuListener(new IMenuListener() { + public void menuAboutToShow(IMenuManager mgr) { + Object sel = getCurrent(); + if (sel instanceof SubsetNode) { + mgr.add(deleteSubsetAction); + deleteSubsetAction.setText(Messages.getString("SubsetView.Delete")); //$NON-NLS-1$ + deleteSubsetAction.setImageDescriptor( + QuantumPlugin.getImageDescriptor("delete.gif")); //$NON-NLS-1$ + mgr.add(pasteAction); + pasteAction.setText(Messages.getString("SubsetView.Paste")); //$NON-NLS-1$ + pasteAction.setImageDescriptor(QuantumPlugin.getImageDescriptor("paste.gif")); //$NON-NLS-1$ + mgr.add(exportXMLAction); + exportXMLAction.setText(Messages.getString("bookmarkview.exportXML")); //$NON-NLS-1$ + exportXMLAction.setImageDescriptor(QuantumPlugin.getImageDescriptor("xml.gif")); //$NON-NLS-1$ + + } else if (sel instanceof ObjectNode) { + mgr.add(deleteObjectAction); + deleteObjectAction.setText(Messages.getString("SubsetView.Delete")); //$NON-NLS-1$ + deleteObjectAction.setImageDescriptor(QuantumPlugin.getImageDescriptor("delete.gif")); //$NON-NLS-1$ + mgr.add(viewTableAction); + viewTableAction.setText(Messages.getString("bookmarkview.viewTable")); //$NON-NLS-1$ + viewTableAction.setImageDescriptor(QuantumPlugin.getImageDescriptor("table.gif")); //$NON-NLS-1$ + mgr.add(exportXMLAction); + exportXMLAction.setText(Messages.getString("bookmarkview.exportXML")); //$NON-NLS-1$ + exportXMLAction.setImageDescriptor(QuantumPlugin.getImageDescriptor("xml.gif")); //$NON-NLS-1$ + customCopyAction.selectionChanged( + (IStructuredSelection) treeViewer.getSelection()); + mgr.add(customCopyAction); + } else if (sel instanceof ColumnNode){ + mgr.add(deleteColumnAction); + deleteColumnAction.setText(Messages.getString("SubsetView.Delete")); //$NON-NLS-1$ + deleteColumnAction.setImageDescriptor(QuantumPlugin.getImageDescriptor("delete.gif")); //$NON-NLS-1$ + customCopyAction.selectionChanged( + (IStructuredSelection) treeViewer.getSelection()); + mgr.add(customCopyAction); + + } else { + mgr.add(newSubsetAction); + } + } + }); + + GridData gridData = new GridData(); + gridData.horizontalAlignment = GridData.FILL; + gridData.verticalAlignment = GridData.FILL; + gridData.grabExcessHorizontalSpace = true; + gridData.grabExcessVerticalSpace = true; + treeViewer.getControl().setLayoutData(gridData); + status = new Label(main, SWT.NONE); + gridData = new GridData(); + gridData.horizontalAlignment = GridData.FILL; + gridData.grabExcessHorizontalSpace = true; + status.setLayoutData(gridData); + + IActionBars bars = getViewSite().getActionBars(); + bars.setGlobalActionHandler(IWorkbenchActionConstants.PASTE, pasteAction); + bars.setGlobalActionHandler(IWorkbenchActionConstants.DELETE, deleteSubsetAction); + + IToolBarManager toolBar = getViewSite().getActionBars().getToolBarManager(); + toolBar.add(newSubsetAction); + + status.setText(Messages.getString("bookmarkview.done")); //$NON-NLS-1$ + } + public void initActions() { + newSubsetAction = new NewSubsetAction(); + newSubsetAction.setText("New Subset"); //$NON-NLS-1$ + newSubsetAction.setToolTipText(Messages.getString("SubsetView.CreatesANewEmptySubset")); //$NON-NLS-1$ + newSubsetAction.setImageDescriptor( + QuantumPlugin.getImageDescriptor("subset.gif")); //$NON-NLS-1$ + newSubsetAction.init(this); + deleteColumnAction = new DeleteColumnAction(); + deleteColumnAction.setText("Delete Column"); //$NON-NLS-1$ + deleteColumnAction.setToolTipText(Messages.getString("SubsetView.DeletesTheSelectedColumns")); //$NON-NLS-1$ + deleteColumnAction.setImageDescriptor( + QuantumPlugin.getImageDescriptor("delete.gif")); //$NON-NLS-1$ + deleteColumnAction.init(this); + deleteObjectAction = new DeleteObjectAction(); + deleteObjectAction.setText("Delete Object"); //$NON-NLS-1$ + deleteObjectAction.setToolTipText(Messages.getString("SubsetView.DeletesTheSelectedObject")); //$NON-NLS-1$ + deleteObjectAction.setImageDescriptor( + QuantumPlugin.getImageDescriptor("delete.gif")); //$NON-NLS-1$ + deleteObjectAction.init(this); + deleteSubsetAction = new DeleteSubsetAction(); + deleteSubsetAction.setText("Delete Subset"); //$NON-NLS-1$ + deleteSubsetAction.setToolTipText(Messages.getString("SubsetView.DeletesTheSelectedSubset")); //$NON-NLS-1$ + deleteSubsetAction.setImageDescriptor( + QuantumPlugin.getImageDescriptor("delete.gif")); //$NON-NLS-1$ + deleteSubsetAction.init(this); +// viewTableAction = new ViewTableAction(); +// viewTableAction.setText(Messages.getString("bookmarkview.viewTable")); //$NON-NLS-1$ +// viewTableAction.setImageDescriptor( +// QuantumPlugin.getImageDescriptor("table.gif")); //$NON-NLS-1$ +// viewTableAction.init(this); + exportXMLAction = new ExportXMLAction(); + exportXMLAction.setText(Messages.getString("bookmarkview.exportXML")); //$NON-NLS-1$ + exportXMLAction.setImageDescriptor( + QuantumPlugin.getImageDescriptor("table.gif")); //$NON-NLS-1$ + exportXMLAction.init(this); + + this.customCopyAction = new CustomCopyAction(this,1); // 1 is unused, just in case more custom copies are defined + this.customCopyAction.setText(Messages.getString("bookmarkview.customCopyAction")); //$NON-NLS-1$ + this.customCopyAction.setImageDescriptor( + QuantumPlugin.getImageDescriptor("copy.gif")); //$NON-NLS-1$ + + + + } + public void setFocus() { + } + + private Action pasteAction = new Action() { + public void run() { + Object sel = getCurrent(); + if (sel == null) return; + if (!(sel instanceof SubsetNode)) return; + + SubsetNode subset = (SubsetNode) sel; + + TextTransfer transfer = TextTransfer.getInstance(); + String xmlMetaData = (String) QuantumPlugin.getDefault().getSysClip().getContents(transfer); + StringReader text = new StringReader(xmlMetaData); + InputSource source = new InputSource(text); + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder parser; + Document doc; + try { + parser = factory.newDocumentBuilder(); + doc = parser.parse(source); + } catch (ParserConfigurationException e) { + e.printStackTrace(); + return; + } catch (SAXException e) { + e.printStackTrace(); + return; + } catch (IOException e) { + e.printStackTrace(); + return; + } + Element root = doc.getDocumentElement(); + subset.importXML(root, false); + treeViewer.refresh(); + provider.setHasChanged(true); + + } + }; + + public void addNewSubset(SubsetNode subset) { + provider.addSubset(subset); + treeViewer.refresh(); + } + public void setStatus(String text) { + status.setText(text); + } + public void dispose(){ + super.dispose(); + } + + /** + * Returs a Vector with all the elements of the treeViewer + * @return + */ + public Vector getElements(){ + Vector result = new Vector(); + if (treeViewer == null) return result; + SubsetContentProvider provider = (SubsetContentProvider) treeViewer.getContentProvider(); + Object[] objects = provider.getElements(SubsetRoot.ROOT); + for (int i = 0; i < objects.length; i++) { + SubsetNode current = (SubsetNode) objects[i]; + result.add(current); + } + return result; + } + + public void deleteColumn (ColumnNode column){ + provider.deleteColumn(column); + treeViewer.refresh(); + } + + public void deleteObject (ObjectNode object){ + provider.deleteObject(object); + treeViewer.refresh(); + } + + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/DefaultSizes.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/DefaultSizes.java new file mode 100644 index 0000000..aa53489 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/DefaultSizes.java @@ -0,0 +1,6 @@ +package com.quantum.view.tableview; + +public class DefaultSizes { + public static int PAGE_SIZE = 200; + public static int MAX_COLUMN_SIZE = 1024 * 2; +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/TableAdapter.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/TableAdapter.java new file mode 100644 index 0000000..17d7b29 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/TableAdapter.java @@ -0,0 +1,269 @@ +package com.quantum.view.tableview; + +import java.sql.SQLException; +import java.util.Vector; + +import com.quantum.Messages; +import com.quantum.adapters.AdapterFactory; +import com.quantum.adapters.DatabaseAdapter; +import com.quantum.model.Bookmark; +import com.quantum.model.Entity; +import com.quantum.model.NotConnectedException; +import com.quantum.sql.FilterSort; +import com.quantum.sql.SQLHelper; +import com.quantum.sql.SQLResults; + +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TextCellEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.Text; + +public class TableAdapter { + + private Table table = null; + + public static final String DEFAULT = ""; //$NON-NLS-1$ + public static final String UTF_8 = "UTF-8"; //$NON-NLS-1$ + public static final String UTF_16 = "UTF-16"; //$NON-NLS-1$ + + private int pageSize = DefaultSizes.PAGE_SIZE; + private int maxColumnSize = DefaultSizes.MAX_COLUMN_SIZE; + private FilterSort extra = new FilterSort(); + private int offset = 1; + private int totalSize = -1; + private Vector rows = new Vector(); + private Vector columnNames = new Vector(); + private boolean hasMore = false; + + private Bookmark bookmark = null; + private Entity entity = null; + private String query; + + private String encoding = ""; //$NON-NLS-1$ + + private TableAdapter(Entity entity) { + this.entity = entity; + this.bookmark = entity.getBookmark(); + } + private TableAdapter(Bookmark bookmark) { + this.bookmark = bookmark; + } + public void fullMode() { + offset = 1; + pageSize = Integer.MAX_VALUE; + } + public void resetMode() { + offset = 1; + pageSize = DefaultSizes.PAGE_SIZE; + } + public static TableAdapter createFromQuery(Bookmark bookmark, SQLResults results) throws NotConnectedException { + TableAdapter retVal = new TableAdapter(bookmark); + retVal.setQuery(results.getQuery()); + retVal.setData(results); + return retVal; + } + public static TableAdapter createFromTable(Entity entity) { + TableAdapter retVal = new TableAdapter(entity); + return retVal; + } + private void loadSize() { + try { + if (entity != null) { + totalSize = SQLHelper.getSize( + bookmark.getConnection(), entity.getCondQualifiedName(), + AdapterFactory.getInstance().getAdapter(bookmark.getType())); + } + } catch (SQLException e) { + e.printStackTrace(); + } catch (NotConnectedException e) { + e.printStackTrace(); + } + } + public int getStartIndex() { + if (totalSize == 0) { + return 0; + } + return offset; + } + public int getEndIndex() { + return offset + rows.size() - 1; + } + public int getTotalSize() { + return totalSize; + } + public void nextPage() { + loadSize(); + offset = offset + pageSize; + if (totalSize >= 0 && offset > totalSize) { + offset = offset - pageSize; + } + } + public void previousPage() { + offset = offset - pageSize; + if (offset < 1) { + offset = 1; + } + } + public boolean hasNextPage() { + if (entity != null) { + if (offset + pageSize <= totalSize) { + return true; + } + return false; + } + return hasMore; + } + public boolean hasPreviousPage() { + if (offset > 1) { + return true; + } + return false; + } + + public String getQuery() { + if (entity != null) { + DatabaseAdapter adapter = AdapterFactory.getInstance().getAdapter(bookmark.getType()); + if (adapter == null) throw new RuntimeException(); + else return adapter.getTableQuery((entity).getCondQualifiedName()) + extra.toString(); + } + return query; + } + public void loadData() throws NotConnectedException { + loadSize(); + if (entity != null) { + if (offset > totalSize) { + offset = 1; + } + } + String query = getQuery(); + System.out.println(offset + Messages.getString("TableAdapter.to") + (offset + pageSize - 1)); //$NON-NLS-1$ + SQLResults results = SQLHelper.getResults(bookmark.getConnection(), query, offset, offset + pageSize - 1, maxColumnSize, encoding); + setData(results); + } + public void resetOffset() { + offset = 1; + } + public void setData(SQLResults results) throws NotConnectedException { + if (results.isError()) return; + int rowCount = results.getRowCount(); + int columnCount = results.getColumnCount(); + rows = new Vector(); + columnNames = new Vector(); + for (int col = 1; col <= columnCount; col++) { + columnNames.addElement(results.getColumnName(col)); + } + for (int row = 1; row <= rowCount; row++) { + String rowData[] = new String[columnCount]; + for (int col = 1; col <= columnCount; col++) { + rowData[col - 1] = results.getElement(col, row).toString(); + } + rows.addElement(rowData); + } + hasMore = results.hasMore(); + if (entity == null && results.getMaxSize() >= 0) { + if (offset > results.getMaxSize()) { + offset = 1; + loadData(); + } + } + } + public void loadTable(Table table) { + this.table = table; + table.setHeaderVisible(true); + for (int i = 0; i < columnNames.size(); i++) { + TableColumn column = new TableColumn(table, SWT.NONE); + column.setText(columnNames.elementAt(i).toString()); + } + for (int i = 0; i < columnNames.size(); i++) { + table.getColumn(i).pack(); + } + for (int row = 0; row < rows.size(); row++) { + TableItem item = new TableItem(table, SWT.NONE); + String itemData[] = (String[]) rows.elementAt(row); + item.setText(itemData); + } + for (int i = 0; i < columnNames.size(); i++) { + table.getColumn(i).pack(); + } + } + + public TableViewer addTableViewer(Table table) { + TableViewer tableViewer = new TableViewer(table); + tableViewer.setUseHashlookup(true); + String[] colNams = new String[columnNames.size()]; + for (int i = 0; i < columnNames.size(); i++) { + colNams[i] = (String) columnNames.get(i); + } + tableViewer.setColumnProperties(colNams); + + // Create the cell editors + CellEditor[] editors = new CellEditor[columnNames.size()]; + for (int i = 0; i < columnNames.size(); i++) { + TextCellEditor textEditor = new TextCellEditor(table); + ((Text) textEditor.getControl()).setTextLimit(60); + editors[i] = textEditor; + } + // Assign the cell editors to the viewer + tableViewer.setCellEditors(editors); + // Set the cell modifier for the viewer + //tableViewer.setCellModifier(new MetaDataModifier(this)); + // Set the default sorter for the viewer + //tableViewer.setSorter(new ExampleTaskSorter(ExampleTaskSorter.DESCRIPTION)); + + return tableViewer; + } + + public int getPageSize() { + return pageSize; + } + + public void setFilterSort(FilterSort extra) { + this.extra = extra; + } + public String getTable() { + return (entity != null) ? entity.getCondQualifiedName() : null; + } + + public void setQuery(String query) { + this.query = query; + } + public String getEncoding() { + return encoding; + } + + public void setEncoding(String encoding) { + this.encoding = encoding; + } + public String getStatusString() { + String status = getStartIndex() + Messages.getString("TableAdapter.to") + getEndIndex() + Messages.getString("TableAdapter.of") + //$NON-NLS-1$ //$NON-NLS-2$ + getTotalSize(); + if (!encoding.equals(DEFAULT)) { + status += " (" + encoding + ")"; //$NON-NLS-1$ //$NON-NLS-2$ + } + String filterText = extra.toString(); + if (!filterText.equals("")) { //$NON-NLS-1$ + status += " (" + filterText + ")"; //$NON-NLS-1$ //$NON-NLS-2$ + } + if (pageSize == Integer.MAX_VALUE) { + status += Messages.getString("TableAdapter.full"); //$NON-NLS-1$ + } + return status; + } + /** + * @return + */ + public Bookmark getBookmark() { + return this.bookmark; + } + /** + * @return + */ + public Entity getEntity() { + return entity; + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/TableView.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/TableView.java new file mode 100644 index 0000000..dc41455 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/TableView.java @@ -0,0 +1,283 @@ +package com.quantum.view.tableview; + +import java.util.Vector; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.TabFolder; +import org.eclipse.swt.widgets.TabItem; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.ui.ISelectionListener; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.WorkbenchException; +import org.eclipse.ui.part.ViewPart; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.extensions.ProcessServiceMembers; +import com.quantum.model.Bookmark; +import com.quantum.model.Entity; +import com.quantum.model.NotConnectedException; +import com.quantum.sql.SQLResults; +import com.quantum.ui.dialog.ExceptionDisplayDialog; +import com.quantum.view.LogProxy; + +/** + * The Table View. Displays tables and Queries. + */ +public class TableView extends ViewPart implements ISelectionListener { + + private class DefaultEncodingAction extends Action { + private final TableAdapter ta; + private DefaultEncodingAction(TableAdapter ta) { + super(); + this.ta = ta; + } + public void run() { + ta.setEncoding(TableAdapter.DEFAULT); + } + } + private static TableView instance = null; + private TabFolder tabs = null; + private Composite parent; + private Vector extensionVector; + + /** + * Generic contructor + */ + public TableView() { + } + + + public void setFocus() { + setQualifiedTitle(); + } + + /** + * Gets the instance of the TableView. This view can appear on multiple + * perspectives, but tabs within the view are shared no matter which perspective + * is open. + * + * @return the TableView instance. + */ + public static TableView getInstance() { + return (TableView) QuantumPlugin.getDefault().getView("com.quantum.view.tableview.TableView"); + } + + /** + * Close the current tab, disposing of it + */ + public void closeCurrent() { + if (tabs == null) return; + + if (tabs.getSelectionIndex() >= 0) { + try { + TabItem item = tabs.getItem(tabs.getSelectionIndex()); + item.dispose(); + } catch (Throwable e) { + LogProxy.getInstance().addText(LogProxy.ERROR, "Error Closing Current: " + e.toString()); //$NON-NLS-1$ + e.printStackTrace(); + } + } + if (tabs.getItemCount() == 0) { + setTitle(Messages.getString("tableview.QuantumTableViewName")); //$NON-NLS-1$ + } + } + + /** + * Reload table or query data into the selected tab + */ + public void refreshCurrent() { + TabItem item = tabs.getItem(tabs.getSelectionIndex()); + TableAdapter adapter = (TableAdapter) item.getData(); + Bookmark bookmark = adapter.getBookmark(); + String table = adapter.getTable(); + if (table == null) { + loadTable(bookmark, item, null, null, true, true); + } else { + loadTable(bookmark, item, null, null, true, true); + } + String title = Messages.getString("tableview.QuantumTableViewName"); //$NON-NLS-1$ + if (bookmark != null) + title = bookmark.getName() + Messages.getString("tableview.ViewNameInitialDecoration") + title + Messages.getString("tableview.ViewNameFinalDecoration"); //$NON-NLS-1$ //$NON-NLS-2$ + setTitle(title); + } + + public void loadQuery(Bookmark bookmark, SQLResults results) { + loadTable(bookmark, null, null, results, true, false); + } + public void loadTable(Entity entity) { + loadTable(entity.getBookmark(), null, entity, null, false, true); + } + public void loadTable(Bookmark bookmark, TabItem tabItem, Entity entity, SQLResults results, boolean query, boolean reload) { + try { + TableAdapter adapter; + // If no TabItem is given we have to create a new one, with the info of the table or view. + if (tabItem == null) { + tabItem = new TabItem(tabs, SWT.NONE); + // Data is stored in a TableAdapter object + if (query) { + adapter = TableAdapter.createFromQuery(bookmark, results); + } else { + adapter = TableAdapter.createFromTable(entity); + } + // That is stored in the tabItem, so it won't get lost + tabItem.setData(adapter); + // This does not really belong here, but it'll fail if done before the creation of the + // first TabItem, so it remains here till a better place found. + // We set a function to change the Title of the window depending on the selected tab. + tabs.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + setQualifiedTitle(); + } + }); + } else { + // If there is already a TabItem, we take its TableAdapter object + adapter = (TableAdapter) tabItem.getData(); + } + + // We create a Composite widget (main) to display our data, with a GridLayout + Composite main = new Composite(tabs, SWT.NONE); + GridLayout layout = new GridLayout(1, false); + layout.horizontalSpacing = 0; + layout.verticalSpacing = 0; + main.setLayout(layout); + + + // load widgets, the order of loading them determines the appearance in screen + ToolBar widgetToolBar = new ToolBar(main, SWT.HORIZONTAL); + // We fill up our Composite widget, the main table display, etc. + final Table table = new Table(main, SWT.FULL_SELECTION | SWT.MULTI); + final Label label = new Label(main, SWT.NULL); + TableViewToolBar toolBar = new TableViewToolBar(this, widgetToolBar, table, adapter, label); + + + // load table + if (reload) { + adapter.resetOffset(); + adapter.loadData(); + } + // Load the table data from the adapter into the widget + adapter.loadTable(table); + // Experimental, won't make it into 2.2 + // final TableViewer viewer = adapter.addTableViewer(table); + + String tableName = adapter.getTable(); + if (tableName != null) { + tabItem.setText(bookmark.getName() + ":" + tableName); + } else { + tabItem.setText(bookmark.getName() + ":" + adapter.getQuery()); + } + + toolBar.getPrevious().setEnabled(adapter.hasPreviousPage()); + toolBar.getNext().setEnabled(adapter.hasNextPage()); + label.setText(adapter.getStatusString()); + + GridData gridData = new GridData(); + gridData.horizontalAlignment = GridData.FILL; + gridData.verticalAlignment = GridData.FILL; + gridData.grabExcessHorizontalSpace = true; + gridData.grabExcessVerticalSpace = true; + table.setLayoutData(gridData); + + gridData = new GridData(); + gridData.horizontalAlignment = GridData.FILL; + label.setLayoutData(gridData); + + + toolBar.setColumns(this, adapter, table); + final TableAdapter ta = adapter; + final Action defaultEncodingAction = new DefaultEncodingAction(ta); + defaultEncodingAction.setText(Messages.getString("tableview.defaultEncoding")); //$NON-NLS-1$ + final Action UTF8EncodingAction = new Action() { + public void run() { + ta.setEncoding(TableAdapter.UTF_8); + } + }; + UTF8EncodingAction.setText(Messages.getString("tableview.UTF8Encoding")); //$NON-NLS-1$ + final Action UTF16EncodingAction = new Action() { + public void run() { + ta.setEncoding(TableAdapter.UTF_16); + } + }; + UTF16EncodingAction.setText(Messages.getString("tableview.UTF16Encoding")); //$NON-NLS-1$ + + IMenuListener menuListener = new TableViewMenuListener(this, table, UTF16EncodingAction, ta, defaultEncodingAction, UTF8EncodingAction, extensionVector); + + // final setup + MenuManager manager = new MenuManager(); + manager.setRemoveAllWhenShown(true); + Menu fTextContextMenu = manager.createContextMenu(table); + table.setMenu(fTextContextMenu); + table.setLinesVisible(true); + manager.addMenuListener(menuListener); + + tabItem.setControl(main); + tabs.setSelection(tabs.indexOf(tabItem)); + + setQualifiedTitle(); + } catch (NotConnectedException e) { + e.printStackTrace(); + handleException(e); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected void handleException(Exception e) { + ExceptionDisplayDialog.openError(getSite().getShell(), null, null, e); + } + + /** + * @return + */ + /** + * Sets the title of the window to the text of the selected tab + */ + private void setQualifiedTitle() { + if (tabs.getSelectionIndex() < 0) return; + TabItem item = tabs.getItem(tabs.getSelectionIndex()); + String defTitle = Messages.getString("tableview.QuantumTableViewName"); //$NON-NLS-1$ + String title = item.getText(); + int ind = title.indexOf(Messages.getString("tableview.BookmarkSeparator")); //$NON-NLS-1$ + if (ind > 0) defTitle = title.substring(0,ind) + + Messages.getString("tableview.ViewNameInitialDecoration") //$NON-NLS-1$ + + defTitle + + Messages.getString("tableview.ViewNameFinalDecoration"); //$NON-NLS-1$ + setTitle(defTitle); + } + + public void createPartControl(Composite parent) { + instance = this; + this.parent = parent; + initActions(); + tabs = new TabFolder(parent, SWT.NONE); + } + + public void initActions() { + extensionVector = new Vector(); + try { + ProcessServiceMembers.process(this, extensionVector); + } catch (WorkbenchException e) { + e.printStackTrace(); + } + + } + + public void selectionChanged(IWorkbenchPart part, ISelection selection) { + + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/TableViewMenuListener.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/TableViewMenuListener.java new file mode 100644 index 0000000..09da28f --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/TableViewMenuListener.java @@ -0,0 +1,138 @@ +/* + * Created on 28-jul-2003 + * + */ +package com.quantum.view.tableview; + +import java.util.Vector; + +import com.quantum.Messages; +import com.quantum.extensions.ExtensionAction; +import com.quantum.sql.TableRow; +import com.quantum.util.StringMatrix; +import com.quantum.wizards.DeleteRowPage; +import com.quantum.wizards.InsertRowPage; +import com.quantum.wizards.SQLRowWizard; +import com.quantum.wizards.UpdateRowPage; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; + + +public final class TableViewMenuListener implements IMenuListener { + private final TableView tableView; + private final Table table; + private final Action UTF16EncodingAction; + private final TableAdapter ta; + private final Action defaultEncodingAction; + private final Action UTF8EncodingAction; + private final Vector extensionVector; + + public TableViewMenuListener( + TableView view, + Table table, + Action UTF16EncodingAction, + TableAdapter ta, + Action defaultEncodingAction, + Action UTF8EncodingAction, + Vector extensionVector ) { + + super(); + this.tableView = view; + this.table = table; + this.UTF16EncodingAction = UTF16EncodingAction; + this.ta = ta; + this.defaultEncodingAction = defaultEncodingAction; + this.UTF8EncodingAction = UTF8EncodingAction; + this.extensionVector = extensionVector; + } + public void menuAboutToShow(IMenuManager mgr) { + if (ta.getTable() != null) { + TableItem[] selection = table.getSelection(); + TableColumn[] columns = table.getColumns(); + // Copy in columnNames the names of the columns of the selected rows + String columnNames[] = new String[columns.length]; + for (int i = 0; i < columns.length; i++) { + columnNames[i] = columns[i].getText(); + } + // Copy in data the values of the data columns of the selected rows + StringMatrix data = new StringMatrix(); + data.addMatrixHeader(columnNames); + if (selection != null && selection.length > 0) { + for (int iRow = 0; iRow < selection.length; iRow++) { + TableItem sel = selection[iRow]; + for (int i = 0; i < columns.length; i++) { + data.addAt(columnNames[i], sel.getText(i), iRow ); + } + } + } else { + // Create dummy values in case nothing selected + for (int i = 0; i < columns.length; i++) { + data.addAt(columnNames[i], "", 0); //$NON-NLS-1$ + } + } + final TableRow row = + new TableRow(ta.getEntity(), ta.getBookmark(), ta.getTable(), data); + Action updateAction = new Action() { + public void run() { + UpdateRowPage page = new UpdateRowPage(""); //$NON-NLS-1$ + SQLRowWizard wizard = new SQLRowWizard(); + wizard.init(Messages.getString("TableView.UpdateRow"), page, row, ta); //$NON-NLS-1$ + WizardDialog dialog = + new WizardDialog( + tableView.getSite().getShell(), + wizard); + dialog.open(); + } + }; + updateAction.setText(Messages.getString("tableview.update")); //$NON-NLS-1$ + Action insertAction = new Action() { + public void run() { + InsertRowPage page = new InsertRowPage(""); //$NON-NLS-1$ + SQLRowWizard wizard = new SQLRowWizard(); + wizard.init(Messages.getString("TableView.InsertRow"), page, row, ta); //$NON-NLS-1$ + WizardDialog dialog = + new WizardDialog( + tableView.getSite().getShell(), + wizard); + dialog.open(); + } + }; + insertAction.setText(Messages.getString("tableview.insert")); //$NON-NLS-1$ + Action deleteAction = new Action() { + public void run() { + DeleteRowPage page = new DeleteRowPage(""); //$NON-NLS-1$ + SQLRowWizard wizard = new SQLRowWizard(); + wizard.init(Messages.getString("TableView.DeleteRow"), page, row, ta); //$NON-NLS-1$ + WizardDialog dialog = + new WizardDialog( + tableView.getSite().getShell(), + wizard); + dialog.open(); + } + }; + deleteAction.setText(Messages.getString("tableview.delete")); //$NON-NLS-1$ + mgr.add(insertAction); + mgr.add(updateAction); + mgr.add(deleteAction); + + MenuManager subMenuExtension = new MenuManager("Extensions"); + for (int i = 0; i < extensionVector.size(); i++) { + ExtensionAction extensionAction = (ExtensionAction) extensionVector.get(i); + extensionAction.addRowData(row); + subMenuExtension.add(extensionAction); + } + if (extensionVector.size() > 0) mgr.add(subMenuExtension); + + } + mgr.add(defaultEncodingAction); + mgr.add(UTF8EncodingAction); + mgr.add(UTF16EncodingAction); + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/TableViewToolBar.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/TableViewToolBar.java new file mode 100644 index 0000000..cb06fbd --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/TableViewToolBar.java @@ -0,0 +1,246 @@ +/* + * Created on 28-jul-2003 + * + */ +package com.quantum.view.tableview; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.actions.CloseTableAction; +import com.quantum.actions.RefreshTableAction; +import com.quantum.model.NotConnectedException; +import com.quantum.sql.TableRow; +import com.quantum.util.StringMatrix; +import com.quantum.view.CopyAction; +import com.quantum.wizards.SQLRowWizard; +import com.quantum.wizards.SortFilterPage; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; + +/** + * @author panic + * + */ +public class TableViewToolBar { + + private ToolBar toolBar; + private RefreshTableAction refreshTableAction; + private CloseTableAction closeTableAction; + private ToolItem previous; + private ToolItem next; + + ToolItem filter; + + public TableViewToolBar( + final TableView view, + final ToolBar toolBar, + final Table table, + final TableAdapter ta, + final Label label) { + + this.toolBar = toolBar; + + refreshTableAction = new RefreshTableAction(); + refreshTableAction.setText(Messages.getString("tableview.refresh")); //$NON-NLS-1$ + refreshTableAction.setImageDescriptor( + QuantumPlugin.getImageDescriptor("refresh.gif")); //$NON-NLS-1$ + refreshTableAction.init(view); + closeTableAction = new CloseTableAction(); + closeTableAction.setText(Messages.getString("tableview.close")); //$NON-NLS-1$ + closeTableAction.setImageDescriptor( + QuantumPlugin.getImageDescriptor("close.gif")); //$NON-NLS-1$ + closeTableAction.init(view); + + ToolItem toolItem = new ToolItem(toolBar, SWT.PUSH); + toolItem.setImage(QuantumPlugin.getImage("refresh.gif")); //$NON-NLS-1$ + toolItem.setToolTipText(Messages.getString("tableview.refresh")); //$NON-NLS-1$ + toolItem.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + refreshTableAction.run(); + } + }); + + final Action copyAction = new CopyAction(view, table); + final Action selectAllAction = new Action() { + public void run() { + table.selectAll(); + } + }; + toolItem = new ToolItem(toolBar, SWT.PUSH); + toolItem.setImage(QuantumPlugin.getImage("copy.gif")); //$NON-NLS-1$ + toolItem.setToolTipText(Messages.getString("tableview.copy")); //$NON-NLS-1$ + toolItem.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + copyAction.run(); + } + }); + toolItem = new ToolItem(toolBar, SWT.PUSH); + toolItem.setImage(QuantumPlugin.getImage("table.gif")); //$NON-NLS-1$ + toolItem.setToolTipText(Messages.getString("tableview.selectAll")); //$NON-NLS-1$ + toolItem.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + selectAllAction.run(); + } + }); + + filter = new ToolItem(toolBar, SWT.PUSH); + filter.setImage(QuantumPlugin.getImage("filter.gif")); //$NON-NLS-1$ + filter.setToolTipText(Messages.getString("tableview.filterSort")); //$NON-NLS-1$ + + toolItem = new ToolItem(toolBar, SWT.SEPARATOR); + + final ToolItem fullMode = new ToolItem(toolBar, SWT.PUSH | SWT.CHECK); + + previous = new ToolItem(toolBar, SWT.PUSH); + next = new ToolItem(toolBar, SWT.PUSH); + + fullMode.setImage(QuantumPlugin.getImage("fulldata.gif")); //$NON-NLS-1$ + fullMode.setToolTipText(Messages.getString("tableview.showAll")); //$NON-NLS-1$ + fullMode.setSelection(false); + fullMode.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent event) { + try { + if (ta.getPageSize() == Integer.MAX_VALUE) { + ta.resetMode(); + } else { + ta.fullMode(); + } + ta.loadData(); + table.removeAll(); + for (int i = table.getColumnCount() - 1; i >= 0; i--) { + table.getColumn(i).dispose(); + } + ta.loadTable(table); + label.setText(ta.getStatusString()); + previous.setEnabled(ta.hasPreviousPage()); + next.setEnabled(ta.hasNextPage()); + } catch (NotConnectedException e) { + view.handleException(e); + } + } + }); + previous.setImage(QuantumPlugin.getImage("previous.gif")); //$NON-NLS-1$ + previous.setToolTipText("Previous"); //$NON-NLS-1$ + previous.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent event) { + try { + ta.previousPage(); + ta.loadData(); + table.removeAll(); + for (int i = table.getColumnCount() - 1; i >= 0; i--) { + table.getColumn(i).dispose(); + } + ta.loadTable(table); + label.setText(ta.getStatusString()); + previous.setEnabled(ta.hasPreviousPage()); + next.setEnabled(ta.hasNextPage()); + } catch (NotConnectedException e) { + view.handleException(e); + } + } + }); + next.setImage(QuantumPlugin.getImage("next.gif")); //$NON-NLS-1$ + next.setToolTipText("Next"); //$NON-NLS-1$ + next.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent event) { + try { + ta.nextPage(); + ta.loadData(); + table.removeAll(); + for (int i = table.getColumnCount() - 1; i >= 0; i--) { + table.getColumn(i).dispose(); + } + ta.loadTable(table); + label.setText(ta.getStatusString()); + previous.setEnabled(ta.hasPreviousPage()); + next.setEnabled(ta.hasNextPage()); + } catch (NotConnectedException e) { + view.handleException(e); + } + } + }); + + toolItem = new ToolItem(toolBar, SWT.SEPARATOR); + + toolItem = new ToolItem(toolBar, SWT.PUSH); + toolItem.setImage(QuantumPlugin.getImage("close.gif")); //$NON-NLS-1$ + toolItem.setToolTipText(Messages.getString("tableview.close")); //$NON-NLS-1$ + toolItem.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + closeTableAction.run(); + } + }); + + } + + public void setColumns( final TableView view, final TableAdapter ta, Table table) { + + // We create a matrix of TableColumn (columns in the Table widget) with + // the columns in the table object + TableColumn[] columns = table.getColumns(); + String columnNames[] = new String[columns.length]; + for (int i = 0; i < columns.length; i++) { + columnNames[i] = columns[i].getText(); + } + // Copy in data the values of the data columns of the selected rows + StringMatrix data = new StringMatrix(); + data.addMatrixHeader(columnNames); + // Create dummy values in case nothing selected + for (int i = 0; i < columns.length; i++) { + data.addAt(columnNames[i], "", 0); //$NON-NLS-1$ + } + final TableRow emptyRow = new TableRow(ta.getEntity(), ta.getBookmark(), ta.getTable(), data); + + filter.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + SortFilterPage page = new SortFilterPage(""); //$NON-NLS-1$ + SQLRowWizard wizard = new SQLRowWizard(); + wizard.init(Messages.getString("TableView.FilterAndSort"), page, emptyRow, ta); //$NON-NLS-1$ + WizardDialog dialog = new WizardDialog(view.getSite().getShell(), wizard); + dialog.open(); + } + }); + } + + + + /** + * @return + */ + public ToolItem getNext() { + return next; + } + + /** + * @return + */ + public ToolItem getPrevious() { + return previous; + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/BaseSQLPage.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/BaseSQLPage.java new file mode 100644 index 0000000..459a949 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/BaseSQLPage.java @@ -0,0 +1,49 @@ +package com.quantum.wizards; + +import com.quantum.adapters.DatabaseAdapter; +import com.quantum.model.Bookmark; +import com.quantum.model.Column; +import com.quantum.model.ConnectionException; +import com.quantum.model.Entity; +import com.quantum.sql.TableRow; +import com.quantum.view.ViewHelper; +import com.quantum.view.tableview.TableAdapter; + +import org.eclipse.jface.wizard.WizardPage; + +/** + * @author BC + */ +public abstract class BaseSQLPage extends WizardPage implements SQLPage { + + protected TableRow row; + protected TableAdapter adapter; + + public BaseSQLPage(String pageName) { + super(pageName); + } + public boolean performFinish() { + try { + Bookmark bookmark = this.adapter.getBookmark(); + bookmark.addQuery(getQueryText()); + ViewHelper.tryGetResults(getShell(), bookmark.getConnection(), getQueryText()); + } catch (ConnectionException e) { + e.printStackTrace(); + } + return true; + } + protected abstract String getQueryText(); + protected void appendColumn(StringBuffer whereClause, Entity entity, String columnName, DatabaseAdapter adapter, String value) { + + if (adapter != null && entity != null && entity.getColumn(columnName) != null) { + Column column = entity.getColumn(columnName); + whereClause.append(adapter.quote(value, column.getType(), column.getTypeName())); + } else { + whereClause.append(value); + } + } + public void init(TableRow row, TableAdapter adapter) { + this.row = row; + this.adapter = adapter; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/BookmarkWizard.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/BookmarkWizard.java new file mode 100644 index 0000000..da768ff --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/BookmarkWizard.java @@ -0,0 +1,297 @@ +package com.quantum.wizards; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.adapters.AdapterFactory; +import com.quantum.adapters.DriverInfo; +import com.quantum.model.Bookmark; +import com.quantum.model.BookmarkCollection; +import com.quantum.view.bookmark.BookmarkNode; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class BookmarkWizard extends Wizard { + BookmarkPage mainPage; + + private Bookmark current; + + public void init(BookmarkNode selection) { + System.out.println("Initing workbench"); //$NON-NLS-1$ + this.current = selection.getBookmark(); + setWindowTitle(Messages.getString("BookmarkWizard.NewBookmark")); //$NON-NLS-1$ + } + public void init() { + System.out.println("Initing workbench"); //$NON-NLS-1$ + current = null; + setWindowTitle(Messages.getString("BookmarkWizard.NewBookmark")); //$NON-NLS-1$ + } + public boolean performFinish() { + System.out.println("perform finish workbench"); //$NON-NLS-1$ + String bookmarkName = mainPage.name.getText(); + if ( BookmarkCollection.getInstance().find(bookmarkName) != null){ + MessageDialog.openInformation( + this.getShell(),Messages.getString("BookmarkWizard.Error"),Messages.getString("BookmarkWizard.bookmarkAlreadyExists")); //$NON-NLS-1$ //$NON-NLS-2$ + return false; + } + + mainPage.performFinish(); + return true; + } + public void addPages() { + System.out.println("adding pages"); //$NON-NLS-1$ + if (current != null) { + mainPage = new BookmarkPage(Messages.getString("BookmarkWizard.Testing"), current); //$NON-NLS-1$ + } else { + mainPage = new BookmarkPage(Messages.getString("BookmarkWizard.Testing")); //$NON-NLS-1$ + } + addPage(mainPage); + System.out.println("adding pages"); //$NON-NLS-1$ + } +} + +class BookmarkPage extends WizardPage { + public static final String ADD = "ADD"; //$NON-NLS-1$ + String action = ADD; + Text name; + Text username; + Text password; + Text schema; + Text connect; + Text driver; + //List driverList; + Combo type; + Text driverFile; + Button prompt; + + Bookmark initialData = null; + + FileDialog dialog; + + DriverInfo[] drivers = AdapterFactory.getInstance().getDriverList(); + /** + * Constructor for BookmarkPage. + * @param pageName + */ + public BookmarkPage(String pageName) { + super(pageName); + initialData = null; + } + /** + * Constructor for BookmarkPage. + * @param pageName + */ + public BookmarkPage(String pageName, Bookmark bookmark) { + super(pageName); + this.initialData = bookmark; + } + + public void createControl(Composite parent) { + System.out.println("page create control"); //$NON-NLS-1$ + dialog = new FileDialog(getContainer().getShell(), SWT.OPEN); + dialog.setFilterExtensions(new String[]{"*.jar", "*.zip","*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + dialog.setFilterNames(new String[]{Messages.getString("BookmarkWizard.JarFiles"),Messages.getString("BookmarkWizard.ZipFiles"), Messages.getString("BookmarkWizard.AllFiles")}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + Composite container = new Composite(parent, SWT.NULL); + GridLayout layout = new GridLayout(); + container.setLayout(layout); + layout.numColumns = 2; + layout.verticalSpacing = 9; + + + Label label = new Label(container, SWT.NULL); + label.setText(Messages.getString("BookmarkWizard.BookmarkNameAst")); //$NON-NLS-1$ + name = new Text(container, SWT.BORDER | SWT.SINGLE); + GridData fullHorizontal = new GridData(); + fullHorizontal.horizontalAlignment = GridData.FILL; + name.setLayoutData(fullHorizontal); + + label = new Label(container, SWT.NULL); + label.setText(Messages.getString("BookmarkWizard.UsernameAst")); //$NON-NLS-1$ + username = new Text(container, SWT.BORDER | SWT.SINGLE); + fullHorizontal = new GridData(); + fullHorizontal.horizontalAlignment = GridData.FILL; + username.setLayoutData(fullHorizontal); + + label = new Label(container, SWT.NULL); + label.setText(Messages.getString("BookmarkWizard.PasswordAst")); //$NON-NLS-1$ + password = new Text(container, SWT.BORDER | SWT.SINGLE); + password.setEchoChar('*'); + fullHorizontal = new GridData(); + fullHorizontal.horizontalAlignment = GridData.FILL; + password.setLayoutData(fullHorizontal); + + this.prompt = new Button(container, SWT.CHECK); + this.prompt.setText(Messages.getString("BookmarkWizard.Prompt")); //$NON-NLS-1$ + fullHorizontal = new GridData(); + fullHorizontal.horizontalAlignment = GridData.FILL; + fullHorizontal.horizontalSpan = 2; + this.prompt.setLayoutData(fullHorizontal); + + label = new Label(container, SWT.NULL); + label.setText(Messages.getString("BookmarkWizard.Schema")); //$NON-NLS-1$ + schema = new Text(container, SWT.BORDER | SWT.SINGLE); + fullHorizontal = new GridData(); + fullHorizontal.horizontalAlignment = GridData.FILL; + schema.setLayoutData(fullHorizontal); + + label = new Label(container, SWT.NULL); + label.setText(Messages.getString("BookmarkWizard.ConnectAst")); //$NON-NLS-1$ + connect = new Text(container, SWT.BORDER | SWT.SINGLE); + fullHorizontal = new GridData(); + fullHorizontal.horizontalAlignment = GridData.FILL; + connect.setLayoutData(fullHorizontal); + + label = new Label(container, SWT.NULL); + label.setText(Messages.getString("BookmarkWizard.DriverAst")); //$NON-NLS-1$ + driver = new Text(container, SWT.BORDER | SWT.SINGLE); + fullHorizontal = new GridData(); + fullHorizontal.horizontalAlignment = GridData.FILL; + driver.setLayoutData(fullHorizontal); + + //label = new Label(container, SWT.NULL); + //fullHorizontal = new GridData(); + //fullHorizontal.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING; + //fullHorizontal.verticalSpan = 3; + //label.setLayoutData(fullHorizontal); + //label.setText("(Drivers Found in File)"); + /*driverList = new List(container, SWT.SINGLE); + fullHorizontal = new GridData(); + fullHorizontal.horizontalAlignment = GridData.FILL; + fullHorizontal.verticalAlignment = GridData.FILL; + fullHorizontal.verticalSpan = 3; + driverList.setLayoutData(fullHorizontal); + driverList.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + String[] selection = driverList.getSelection(); + if (selection != null && selection.length > 0) { + driver.setText(selection[0]); + } + } + });*/ + + label = new Label(container, SWT.NULL); + label.setText(Messages.getString("BookmarkWizard.TypeAst")); //$NON-NLS-1$ + type = new Combo(container, SWT.SIMPLE | SWT.DROP_DOWN | SWT.READ_ONLY); + String driverNames[] = new String[drivers.length]; + for (int i = 0; i < drivers.length; i++) { + driverNames[i] = drivers[i].getDisplayName(); + } + type.setItems(driverNames); + type.select(0); + fullHorizontal = new GridData(); + fullHorizontal.horizontalAlignment = GridData.FILL; + type.setLayoutData(fullHorizontal); + + label = new Label(container, SWT.NULL); + label.setText(Messages.getString("BookmarkWizard.DriverFilenameAst")); //$NON-NLS-1$ + driverFile = new Text(container, SWT.BORDER | SWT.SINGLE); + fullHorizontal = new GridData(); + fullHorizontal.horizontalAlignment = GridData.FILL; + driverFile.setLayoutData(fullHorizontal); + + Button button = new Button(container, SWT.PUSH); + button.setText(Messages.getString("BookmarkWizard.Browse")); //$NON-NLS-1$ + + button.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + // We retrieve the last saved path + dialog.setFilterPath(QuantumPlugin.getDefault().getPreferenceStore().getString("quantum.dialogs.bookmarkwizard.path")); //$NON-NLS-1$ + String filename = dialog.open(); + if (filename != null) { + driverFile.setText(filename); + // We save the used path + QuantumPlugin.getDefault().getPreferenceStore().setValue("quantum.dialogs.bookmarkwizard.path", filename); //$NON-NLS-1$ + + } + } + }); + +// if (initialData != null) { +// name.setText(initialData.getName()); +// username.setText(initialData.getUsername()); +// if (initialData.getPromptForPassword()) { +// this.password.setEditable(false); +// } else { +// password.setText(initialData.getPassword()); +// } +// connect.setText(initialData.getConnect()); +// driver.setText(initialData.getDriver()); +// String typeData = initialData.getType(); +// this.prompt.setSelection(initialData.getPromptForPassword()); +// int selectedIndex = 0; +// for (int i = 0; i < drivers.length; i++) { +// if (typeData.equals(drivers[i].getDriverType())) { +// selectedIndex = i; +// } +// } +// type.select(selectedIndex); +// driverFile.setText(initialData.getDriverFile()); +// updateDriverList(); +// } + + prompt.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + BookmarkPage.this.password.setEditable(!prompt.getSelection()); + } + }); + + setControl(container); + + setPageComplete(true); + } + public void updateDriverList() { + /*try { + JarFile file = new JarFile(driverFile.getText()); + Enumeration enum = file.entries(); + while (enum.hasMoreElements()) { + JarEntry entry = (JarEntry) enum.nextElement(); + String className = entry.getName().replace('/', '.'); + if (className.endsWith("Driver.class")) { + className = className.substring(0, className.lastIndexOf('.')); + //driverList.add(className); + } + } + } catch (IOException ex) { + //driverList.removeAll(); + }*/ + } + public void performFinish() { + if (initialData == null) { + initialData = new Bookmark(); + } + initialData.setName(name.getText()); + initialData.setUsername(username.getText()); + initialData.setPromptForPassword(this.prompt.getSelection()); + if (initialData.getPromptForPassword()) { + initialData.setPassword(""); //$NON-NLS-1$ + } else { + initialData.setPassword(password.getText()); + } + initialData.addSchema(schema.getText()); + initialData.setConnect(connect.getText()); + initialData.setDriver(driver.getText()); + int selection = type.getSelectionIndex(); + if (selection >= 0) { + initialData.setType(drivers[selection].getDriverType()); + } + initialData.setDriverFile(driverFile.getText()); + BookmarkCollection.getInstance().addBookmark(initialData); + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/DeleteRowPage.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/DeleteRowPage.java new file mode 100644 index 0000000..dc90a00 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/DeleteRowPage.java @@ -0,0 +1,139 @@ +package com.quantum.wizards; + +import com.quantum.Messages; +import com.quantum.adapters.AdapterFactory; +import com.quantum.adapters.DatabaseAdapter; +import com.quantum.model.Bookmark; +import com.quantum.model.Entity; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class DeleteRowPage extends BaseSQLPage implements SQLPage { + String[] columnNames; + Text[] values; + Button[] whereValues; + Text query; + + public DeleteRowPage(String pageName) { + super(pageName); + } + + public void createControl(Composite parent) { + System.out.println("page create control"); //$NON-NLS-1$ + Composite container = new Composite(parent, SWT.NULL); + GridLayout layout = new GridLayout(); + container.setLayout(layout); + layout.numColumns = 3; + + if (row == null) { + System.out.println("Row is null"); //$NON-NLS-1$ + } + if (row.getColumnNames() == null) { + System.out.println("Columns are null"); //$NON-NLS-1$ + } + if (row.getTableData() == null) { + System.out.println("Data is null"); //$NON-NLS-1$ + } + Entity entity = row.getEntity(); + columnNames = row.getColumnNames(); + String[] data = row.getTableData(); + for (int i = 0; i < row.getColumnCount(); i++) { + System.out.println("data = " + i + "=" + data[i]); //$NON-NLS-1$ //$NON-NLS-2$ + System.out.println("column = " + i + "=" + columnNames[i]); //$NON-NLS-1$ //$NON-NLS-2$ + } + values = new Text[row.getColumnCount()]; + whereValues = new Button[row.getColumnCount()]; + new Label(container, SWT.NULL).setText(Messages.getString("DeleteRowPage.ColumnName")); //$NON-NLS-1$ + new Label(container, SWT.NULL).setText(Messages.getString("DeleteRowPage.Value")); //$NON-NLS-1$ + new Label(container, SWT.NULL).setText(Messages.getString("DeleteRowPage.IncludeIn")); //$NON-NLS-1$ + for (int i = 0; i < row.getColumnCount(); i++) { + Label label = new Label(container, SWT.NULL); + label.setText(columnNames[i]); + values[i] = new Text(container, SWT.BORDER | SWT.SINGLE); + GridData fullHorizontal = new GridData(); + fullHorizontal.horizontalAlignment = GridData.FILL; + values[i].setLayoutData(fullHorizontal); + values[i].setText(data[i]); + + values[i].addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + updateQuery(); + } + }); + + whereValues[i] = new Button(container, SWT.CHECK); + whereValues[i].setText(Messages.getString("DeleteRowPage.WhereClause")); //$NON-NLS-1$ + // we check if it's a primary key to select it in the WHERE clause + if (entity != null && entity.getColumn(columnNames[i]).isPrimaryKey()) { + whereValues[i].setSelection(true); + } else { + whereValues[i].setSelection(false); + } + whereValues[i].addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + updateQuery(); + } + }); + } + query = new Text(container, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP); + GridData gridData = new GridData(); + gridData.horizontalSpan = layout.numColumns; + gridData.verticalSpan = 3; + gridData.horizontalAlignment = GridData.FILL; + gridData.verticalAlignment = GridData.FILL; + gridData.grabExcessHorizontalSpace = true; + gridData.grabExcessVerticalSpace = true; + query.setLayoutData(gridData); + + setControl(container); + updateQuery(); + + setPageComplete(true); + } + public void updateQuery() { + System.out.println(Messages.getString("DeleteRowPage.UpdatingQuery")); //$NON-NLS-1$ + StringBuffer whereClause = new StringBuffer(); + Bookmark bookmark = row.getBookmark(); + Entity entity = row.getEntity(); + DatabaseAdapter adapter = AdapterFactory.getInstance().getAdapter(bookmark.getType()); + + int numSelected = 0; + for (int i = 0; i < columnNames.length; i++) { + if (whereValues[i].getSelection()) { + if (numSelected > 0) whereClause.append(" AND "); //$NON-NLS-1$ + numSelected++; + whereClause.append("("); //$NON-NLS-1$ + whereClause.append(columnNames[i]); + whereClause.append(" = "); //$NON-NLS-1$ + appendColumn(whereClause, entity, columnNames[i], adapter, values[i].getText()); + whereClause.append(")"); //$NON-NLS-1$ + } + } + String query = "DELETE FROM " + row.getTable(); //$NON-NLS-1$ + if (numSelected > 0) { + query += " WHERE " + whereClause.toString(); //$NON-NLS-1$ + } + if (numSelected > 0) { + setMessage(""); //$NON-NLS-1$ + } else { + setMessage(Messages.getString("DeleteRowPage.WarningNoWhere")); //$NON-NLS-1$ + } + this.query.setText(query); + } + + protected String getQueryText() { + return query.getText(); + } +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/ExportBookmarkWizard.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/ExportBookmarkWizard.java new file mode 100644 index 0000000..3689fd6 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/ExportBookmarkWizard.java @@ -0,0 +1,34 @@ +package com.quantum.wizards; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.ui.IExportWizard; +import org.eclipse.ui.IWorkbench; + +/** + * @author BC + */ +public class ExportBookmarkWizard extends Wizard implements IExportWizard { + + private ExportBookmarkWizardPage page = new ExportBookmarkWizardPage(); + + public ExportBookmarkWizard() { + setWindowTitle("Export Bookmarks"); + } + + public boolean performFinish() { + return this.page.finish(); + } + + public void init(IWorkbench workbench, IStructuredSelection selection) { + } + + /** + * @see org.eclipse.jface.wizard.IWizard#addPages() + */ + public void addPages() { + super.addPages(); + addPage(this.page); + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/ExportBookmarkWizardPage.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/ExportBookmarkWizardPage.java new file mode 100644 index 0000000..3feed8f --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/ExportBookmarkWizardPage.java @@ -0,0 +1,283 @@ +package com.quantum.wizards; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +import javax.xml.parsers.ParserConfigurationException; + +import com.quantum.Messages; +import com.quantum.QuantumPlugin; +import com.quantum.model.Bookmark; +import com.quantum.model.BookmarkCollection; +import com.quantum.model.xml.ModelToXMLConverter; +import com.quantum.ui.dialog.ExceptionDisplayDialog; +import com.quantum.util.xml.XMLHelper; + +import org.eclipse.jface.viewers.CheckStateChangedEvent; +import org.eclipse.jface.viewers.CheckboxTreeViewer; +import org.eclipse.jface.viewers.ICheckStateListener; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.w3c.dom.Document; + +/** + * @author BC + */ +public class ExportBookmarkWizardPage extends WizardPage { + + public class ContentProvider implements ITreeContentProvider { + + public Object[] getChildren(Object parentElement) { + if (parentElement instanceof BookmarkCollection) { + return ((BookmarkCollection) parentElement).getBookmarks(); + } else { + return new Object[0]; + } + } + public Object getParent(Object element) { + if (element instanceof Bookmark) { + return BookmarkCollection.getInstance(); + } else { + return null; + } + } + public boolean hasChildren(Object element) { + if (element instanceof BookmarkCollection) { + return ((BookmarkCollection) element).getBookmarks().length > 0; + } else { + return false; + } + } + public Object[] getElements(Object inputElement) { + return getChildren(inputElement); + } + public void dispose() { + } + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + } + } + + public class LabelProvider implements ILabelProvider { + + public Image getImage(Object element) { + if (element instanceof Bookmark) { + return QuantumPlugin.getImage("bookmarks.gif"); + } else { + return null; + } + } + + public String getText(Object element) { + + if (element instanceof Bookmark) { + return ((Bookmark) element).getName(); + } else { + return element.toString(); + } + } + + public void addListener(ILabelProviderListener listener) { + } + + public void dispose() { + } + + public boolean isLabelProperty(Object element, String property) { + return false; + } + + public void removeListener(ILabelProviderListener listener) { + } + } + + private CheckboxTreeViewer treeViewer; + private Text fileNameText; + + private boolean sourceIsSelected = false; + private boolean destinationIsSelected = false; + + /** + * @param pageName + */ + protected ExportBookmarkWizardPage() { + super("page1"); + setTitle(Messages.getString(getClass(), "title")); + } + + public void createControl(Composite pageContainer) { + this.sourceIsSelected = false; + this.destinationIsSelected = false; + + Composite composite = new Composite(pageContainer, SWT.NULL); + composite.setLayout(new GridLayout()); + composite.setLayoutData( + new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL)); + + this.treeViewer = new CheckboxTreeViewer(composite, + SWT.CHECK | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); + this.treeViewer.setContentProvider(new ContentProvider()); + this.treeViewer.setLabelProvider(new LabelProvider()); + this.treeViewer.setInput(BookmarkCollection.getInstance()); + selectAll(); + + this.treeViewer.addCheckStateListener(new ICheckStateListener() { + public void checkStateChanged(CheckStateChangedEvent event) { + setSourceIsSelected( + ExportBookmarkWizardPage.this.treeViewer.getCheckedElements().length > 0); + } + }); + + GridData data = new GridData(); + data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_FILL; + data.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING; + data.grabExcessHorizontalSpace = true; + data.heightHint = 200; + data.widthHint = 400; + this.treeViewer.getControl().setLayoutData(data); + + Composite buttons = new Composite(composite, SWT.NULL); + buttons.setLayout(new GridLayout(2, false)); + buttons.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); + + Button selectAll = new Button(buttons, SWT.NONE); + selectAll.setText(Messages.getString(getClass(), "selectAll")); + selectAll.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + selectAll(); + } + }); + + Button deselectAll = new Button(buttons, SWT.NONE); + deselectAll.setText(Messages.getString(getClass(), "deselectAll")); + deselectAll.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + deselectAll(); + } + }); + + createDestinationArea(composite); + + setControl(composite); + } + + private void createDestinationArea(Composite composite) { + GridData data; + Composite fileArea = new Composite(composite, SWT.NULL); + fileArea.setLayout(new GridLayout(3, false)); + fileArea.setLayoutData( + new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL)); + Label label = new Label(fileArea, SWT.NONE); + label.setText("File name:"); + + this.fileNameText = new Text(fileArea, SWT.BORDER); + data = new GridData(); + data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_FILL; + data.widthHint = 300; + this.fileNameText.setLayoutData(data); + this.fileNameText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent event) { + String text = ((Text) event.getSource()).getText(); + setDestinationIsSelected(text != null && text.trim().length() > 0); + } + }); + + Button button = new Button(fileArea, SWT.NONE); + button.setText("Browse"); + button.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + promptForFile(); + } + }); + } + + private void setSourceIsSelected(boolean selected) { + this.sourceIsSelected = selected; + setPageComplete(selected & this.destinationIsSelected); + } + + private void setDestinationIsSelected(boolean selected) { + this.destinationIsSelected = selected; + setPageComplete(selected & this.sourceIsSelected); + } + + protected void promptForFile() { + + FileDialog dialog = new FileDialog(getShell(), SWT.SAVE); + dialog.setFilterExtensions(new String[] { "xml" }); + dialog.setFilterNames(new String[] { "XML Files (*.xml)"}); + String filename = dialog.open(); + if (filename != null) { + this.fileNameText.setText(filename); + } + } + protected void deselectAll() { + this.treeViewer.setCheckedElements(new Object[0]); + setSourceIsSelected(false); + } + + protected void selectAll() { + Bookmark[] bookmarks = BookmarkCollection.getInstance().getBookmarks(); + this.treeViewer.setCheckedElements(bookmarks); + setSourceIsSelected(bookmarks.length > 0); + } + + public boolean finish() { + + String fileName = this.fileNameText.getText(); + File file = new File(fileName); + if (file.exists()) { + // prompt for overwrite + } else if (!file.getParentFile().exists()) { + // do what? + } + + try { + Object[] bookmarks = this.treeViewer.getCheckedElements(); + Document document = XMLHelper.createEmptyDocument(); + ModelToXMLConverter.getInstance().createRoot(document); + + for (int i = 0, length = (bookmarks == null) ? 0 : bookmarks.length; + i < length; + i++) { + ModelToXMLConverter.getInstance().convert( + document.getDocumentElement(), (Bookmark) bookmarks[i]); + } + + FileWriter writer = new FileWriter(file); + try { + XMLHelper.write(writer, document); + } finally { + writer.close(); + } + } catch (IOException e) { + ExceptionDisplayDialog.openError(getShell(), + Messages.getString(getClass(), "error.IOException.title"), + Messages.getString(getClass(), "error.IOException.message", + new Object[] { fileName }), e); + } catch (ParserConfigurationException e) { + ExceptionDisplayDialog.openError(getShell(), + Messages.getString(getClass(), "error.IOException.title"), + Messages.getString(getClass(), "error.IOException.message", + new Object[] { fileName }), e); + } + + return true; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/ExportTorqueWizard.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/ExportTorqueWizard.java new file mode 100644 index 0000000..7b05084 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/ExportTorqueWizard.java @@ -0,0 +1,20 @@ +package com.quantum.wizards; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.ui.IExportWizard; +import org.eclipse.ui.IWorkbench; + +/** + * @author BC + */ +public class ExportTorqueWizard extends Wizard implements IExportWizard { + + public boolean performFinish() { + return false; + } + + public void init(IWorkbench workbench, IStructuredSelection selection) { + } + +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/InsertRowPage.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/InsertRowPage.java new file mode 100644 index 0000000..cbf7ff1 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/InsertRowPage.java @@ -0,0 +1,120 @@ +package com.quantum.wizards; + +import com.quantum.Messages; +import com.quantum.adapters.AdapterFactory; +import com.quantum.adapters.DatabaseAdapter; +import com.quantum.model.Bookmark; +import com.quantum.model.Entity; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class InsertRowPage extends BaseSQLPage implements SQLPage { + String[] columnNames; + Text[] values; + Label query; + int numColumns = 0; + + public InsertRowPage(String pageName) { + super(pageName); + } + + public void createControl(Composite parent) { + System.out.println("page create control"); //$NON-NLS-1$ + Composite container = new Composite(parent, SWT.NULL); + GridLayout layout = new GridLayout(); + container.setLayout(layout); + layout.numColumns = 2; + + if (row == null) { + System.out.println("Row is null"); //$NON-NLS-1$ + } + if (row.getColumnNames() == null) { + System.out.println("Columns are null"); //$NON-NLS-1$ + } + if (row.getTableData() == null) { + System.out.println("Data is null"); //$NON-NLS-1$ + } + columnNames = row.getColumnNames(); + String[] data = row.getTableData(); + for (int i = 0; i < row.getColumnCount(); i++) { + System.out.println("data = " + i + "=" + data[i]); //$NON-NLS-1$ //$NON-NLS-2$ + System.out.println("column = " + i + "=" + columnNames[i]); //$NON-NLS-1$ //$NON-NLS-2$ + } + values = new Text[row.getColumnCount()]; + new Label(container, SWT.NULL).setText(Messages.getString("InsertRowPage.ColumnName")); //$NON-NLS-1$ + new Label(container, SWT.NULL).setText(Messages.getString("InsertRowPage.Value")); //$NON-NLS-1$ + for (int i = 0; i < row.getColumnCount(); i++) { + Label label = new Label(container, SWT.NULL); + label.setText(columnNames[i]); + values[i] = new Text(container, SWT.BORDER | SWT.SINGLE); + GridData fullHorizontal = new GridData(); + fullHorizontal.horizontalAlignment = GridData.FILL; + values[i].setLayoutData(fullHorizontal); + + //values[i].setText(data[i]); + values[i].addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + updateQuery(); + } + }); + } + query = new Label(container, SWT.WRAP); + GridData gridData = new GridData(); + gridData.horizontalSpan = layout.numColumns; + gridData.horizontalAlignment = GridData.FILL; + gridData.verticalAlignment = GridData.FILL; + gridData.grabExcessHorizontalSpace = true; + gridData.grabExcessVerticalSpace = true; + query.setLayoutData(gridData); + + setControl(container); + updateQuery(); + + setPageComplete(true); + } + public void updateQuery() { + System.out.println("Updating query"); //$NON-NLS-1$ + StringBuffer valuesClause = new StringBuffer(); + StringBuffer namesClause = new StringBuffer(); + Bookmark bookmark = row.getBookmark(); + Entity entity = row.getEntity(); + DatabaseAdapter adapter = AdapterFactory.getInstance().getAdapter(bookmark.getType()); + + numColumns = 0; + for (int i = 0; i < columnNames.length; i++) { + String name = columnNames[i]; + String value = values[i].getText(); + if (value.length() > 0) { + if (numColumns > 0) { + valuesClause.append(", "); //$NON-NLS-1$ + namesClause.append(", "); + } + appendColumn(valuesClause, entity, name, adapter, value); + namesClause.append(name); + numColumns++; + } + } + + String query = "INSERT INTO " + row.getTable(); //$NON-NLS-1$ + if (numColumns > 0) { + query += " (" + namesClause + ")"; + query += " VALUES " + "(" + valuesClause; //$NON-NLS-1$ + query += " )"; //$NON-NLS-1$ + } + this.query.setText(query); + } + /* (non-Javadoc) + * @see com.quantum.wizards.BaseSQLPage#getQueryText() + */ + protected String getQueryText() { + return this.query.getText(); + } + +} \ No newline at end of file diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/SQLPage.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/SQLPage.java new file mode 100644 index 0000000..32b4322 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/SQLPage.java @@ -0,0 +1,11 @@ +package com.quantum.wizards; + +import com.quantum.sql.TableRow; +import com.quantum.view.tableview.TableAdapter; + +import org.eclipse.jface.wizard.IWizardPage; + +public interface SQLPage extends IWizardPage { + public void init(TableRow row, TableAdapter adapter); + public boolean performFinish(); +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/SQLRowWizard.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/SQLRowWizard.java new file mode 100644 index 0000000..bc37001 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/SQLRowWizard.java @@ -0,0 +1,28 @@ +package com.quantum.wizards; + +import com.quantum.sql.TableRow; +import com.quantum.view.tableview.TableAdapter; + +import org.eclipse.jface.wizard.Wizard; + +public class SQLRowWizard extends Wizard { + SQLPage page; + TableRow row; + TableAdapter adapter; + public void init(String title, SQLPage page, TableRow row, TableAdapter adapter) { + System.out.println("Init SQL row wizard"); //$NON-NLS-1$ + this.row = row; + this.adapter = adapter; + this.page = page; + setWindowTitle(title); + } + public boolean performFinish() { + System.out.println("Perform SQL row wizard finish"); //$NON-NLS-1$ + return page.performFinish(); + } + public void addPages() { + System.out.println("QL row wizard adding pages"); //$NON-NLS-1$ + page.init(row, adapter); + addPage(page); + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/SortFilterPage.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/SortFilterPage.java new file mode 100644 index 0000000..c23d03e --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/SortFilterPage.java @@ -0,0 +1,180 @@ +package com.quantum.wizards; + +import com.quantum.sql.FilterSort; +import com.quantum.sql.TableRow; +import com.quantum.view.tableview.TableAdapter; +import com.quantum.view.tableview.TableView; + +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class SortFilterPage extends WizardPage implements SQLPage { + TableRow row; + TableAdapter adapter; + Button[] filter; + Combo[] operator; + Text[] filterValues; + Button[] stringFlags; + Button[] sort; + Combo[] ascDesc; + + String columnNames[]; + Label query; + FilterSort filterSort = new FilterSort(); + public SortFilterPage(String pageName) { + super(pageName); + } + + public void init(TableRow row, TableAdapter adapter) { + this.row = row; + this.adapter = adapter; + } + + public void createControl(Composite parent) { + System.out.println("page create control"); //$NON-NLS-1$ + + Composite container = new Composite(parent, SWT.NULL); + GridLayout layout = new GridLayout(); + container.setLayout(layout); + int layoutColumns = 6; + layout.numColumns = layoutColumns; + + if (row == null) { + System.out.println("Row is null"); //$NON-NLS-1$ + } + if (row.getColumnNames() == null) { + System.out.println("Columns are null"); //$NON-NLS-1$ + } + if (row.getTableData() == null) { + System.out.println("Data is null"); //$NON-NLS-1$ + } + + columnNames = row.getColumnNames(); + String[] data = row.getTableData(); + for (int i = 0; i < row.getColumnCount(); i++) { + System.out.println("data = " + i + "=" + data[i]); //$NON-NLS-1$ //$NON-NLS-2$ + System.out.println("column = " + i + "=" + columnNames[i]); //$NON-NLS-1$ //$NON-NLS-2$ + } + int size = row.getColumnCount(); + filter = new Button[size]; + operator = new Combo[size]; + filterValues = new Text[size]; + stringFlags = new Button[size]; + sort = new Button[size]; + ascDesc = new Combo[size]; + for (int i = 0; i < row.getColumnCount(); i++) { + filter[i] = new Button(container, SWT.CHECK); + filter[i].setText(columnNames[i]); + filter[i].addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + updateQuery(); + } + }); + + operator[i] = new Combo(container, SWT.SINGLE | SWT.READ_ONLY); + operator[i].add("="); //$NON-NLS-1$ + operator[i].add("<>"); //$NON-NLS-1$ + operator[i].add("<"); //$NON-NLS-1$ + operator[i].add(">"); //$NON-NLS-1$ + operator[i].addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + updateQuery(); + } + }); + + filterValues[i] = new Text(container, SWT.BORDER); + filterValues[i].setText(data[i]); + filterValues[i].addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + updateQuery(); + } + }); + + stringFlags[i] = new Button(container, SWT.CHECK); + stringFlags[i].setText("String"); //$NON-NLS-1$ + stringFlags[i].addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + updateQuery(); + } + }); + + final int index = i; + sort[i] = new Button(container, SWT.CHECK); + sort[i].setText(columnNames[i]); + sort[i].addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + if (sort[index].getSelection()) { + filterSort.addSort(columnNames[index], ascDesc[index].getText()); + } else { + filterSort.removeSort(columnNames[index]); + } + updateQuery(); + } + }); + + ascDesc[i] = new Combo(container, SWT.SINGLE | SWT.READ_ONLY); + ascDesc[i].add(""); //$NON-NLS-1$ + ascDesc[i].add("ASC"); //$NON-NLS-1$ + ascDesc[i].add("DESC"); //$NON-NLS-1$ + ascDesc[i].addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + if (sort[index].getSelection()) { + filterSort.addSort(columnNames[index], ascDesc[index].getText()); + } else { + filterSort.removeSort(columnNames[index]); + } + updateQuery(); + } + }); + } + query = new Label(container, SWT.WRAP); + GridData gridData = new GridData(); + gridData.horizontalSpan = layoutColumns; + gridData.horizontalAlignment = GridData.FILL; + gridData.verticalAlignment = GridData.FILL; + gridData.grabExcessHorizontalSpace = true; + gridData.grabExcessVerticalSpace = true; + query.setLayoutData(gridData); + + setControl(container); + + setPageComplete(true); + } + + public void updateQuery() { + filterSort.clearFilters(); + for (int i = 0; i < filter.length; i++) { + if (filter[i].getSelection()) { + filterSort.addFilter(filter[i].getText(), operator[i].getText(), filterValues[i].getText(), stringFlags[i].getSelection()); + } + } + query.setText(filterSort.toString()); + } + + public boolean performFinish() { + adapter.setFilterSort(filterSort); + TableView.getInstance().refreshCurrent(); + return true; + } +} diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/UpdateRowPage.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/UpdateRowPage.java new file mode 100644 index 0000000..b057d59 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/UpdateRowPage.java @@ -0,0 +1,166 @@ +package com.quantum.wizards; + +import com.quantum.Messages; +import com.quantum.adapters.AdapterFactory; +import com.quantum.adapters.DatabaseAdapter; +import com.quantum.model.Bookmark; +import com.quantum.model.Entity; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class UpdateRowPage extends BaseSQLPage implements SQLPage { + String[] columnNames; + Text[] oldValues; + Text[] newValues; + Button[] primaryKeys; + Button[] setValues; + Label query; + public UpdateRowPage(String pageName) { + super(pageName); + } + + public void createControl(Composite parent) { + System.out.println("page create control"); //$NON-NLS-1$ + Composite container = new Composite(parent, SWT.V_SCROLL); + GridLayout layout = new GridLayout(); + container.setLayout(layout); + Entity entity = row.getEntity(); + + int layoutColumns = 5; + layout.numColumns = layoutColumns; + + if (row == null) { + System.out.println("Row is null"); //$NON-NLS-1$ + } + if (row.getColumnNames() == null) { + System.out.println("Columns are null"); //$NON-NLS-1$ + } + if (row.getTableData() == null) { + System.out.println("Data is null"); //$NON-NLS-1$ + } + columnNames = row.getColumnNames(); + String[] data = row.getTableData(); + for (int i = 0; i < row.getColumnCount(); i++) { + System.out.println("data = " + i + "=" + data[i]); //$NON-NLS-1$ //$NON-NLS-2$ + System.out.println("column = " + i + "=" + columnNames[i]); //$NON-NLS-1$ //$NON-NLS-2$ + } + oldValues = new Text[row.getColumnCount()]; + newValues = new Text[row.getColumnCount()]; + primaryKeys = new Button[row.getColumnCount()]; + setValues = new Button[row.getColumnCount()]; + Label temp = new Label(container, SWT.NULL); + temp.setText(Messages.getString("UpdateRowPage.ColumnName")); //$NON-NLS-1$ + temp = new Label(container, SWT.NULL); + temp.setText(Messages.getString("UpdateRowPage.OldValue")); //$NON-NLS-1$ + temp = new Label(container, SWT.NULL); + temp.setText(""); //$NON-NLS-1$ + temp = new Label(container, SWT.NULL); + temp.setText(Messages.getString("UpdateRowPage.NewValue")); //$NON-NLS-1$ + temp = new Label(container, SWT.NULL); + temp.setText(Messages.getString("UpdateRowPage._13")); //$NON-NLS-1$ + for (int i = 0; i < row.getColumnCount(); i++) { + Label label = new Label(container, SWT.NULL); + label.setText(columnNames[i]); + oldValues[i] = new Text(container, SWT.BORDER | SWT.SINGLE); + oldValues[i].setText(data[i]); + oldValues[i].addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + updateQuery(); + } + }); + primaryKeys[i] = new Button(container, SWT.CHECK); + primaryKeys[i].setText("Where"); //$NON-NLS-1$ + if (entity != null && entity.getColumn(columnNames[i]).isPrimaryKey()) + primaryKeys[i].setSelection(true); + primaryKeys[i].addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + updateQuery(); + } + }); + newValues[i] = new Text(container, SWT.BORDER | SWT.SINGLE); + newValues[i].setText(data[i]); + newValues[i].addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + updateQuery(); + } + }); + setValues[i] = new Button(container, SWT.CHECK); + setValues[i].setText(Messages.getString("UpdateRowPage.SetValue")); //$NON-NLS-1$ + setValues[i].addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + public void widgetSelected(SelectionEvent e) { + updateQuery(); + } + }); + } + query = new Label(container, SWT.WRAP | SWT.V_SCROLL); + GridData gridData = new GridData(); + gridData.horizontalSpan = layoutColumns; + gridData.horizontalAlignment = GridData.FILL; + gridData.verticalAlignment = GridData.FILL; + gridData.grabExcessHorizontalSpace = true; + gridData.grabExcessVerticalSpace = true; + query.setLayoutData(gridData); + + setControl(container); + updateQuery(); + + setPageComplete(true); + } + public void updateQuery() { + System.out.println("Updating query"); //$NON-NLS-1$ + StringBuffer setClause = new StringBuffer(); + StringBuffer whereClause = new StringBuffer(); + Bookmark bookmark = row.getBookmark(); + Entity entity = row.getEntity(); + DatabaseAdapter adapter = AdapterFactory.getInstance().getAdapter(bookmark.getType()); + + int numValuesSet = 0; + int numValuesWhere = 0; + for (int i = 0; i < columnNames.length; i++) { + if (primaryKeys[i].getSelection()) { + String value = oldValues[i].getText(); + if (numValuesWhere > 0) whereClause.append(" AND "); //$NON-NLS-1$ + whereClause.append("("); //$NON-NLS-1$ + whereClause.append(columnNames[i]); + whereClause.append(" = "); //$NON-NLS-1$ + appendColumn(whereClause, entity, columnNames[i], adapter, value); + whereClause.append(")"); //$NON-NLS-1$ + numValuesWhere++; + } + if (setValues[i].getSelection()) { + String value = newValues[i].getText(); + if (numValuesSet > 0) setClause.append(", "); //$NON-NLS-1$ + setClause.append(columnNames[i]); + setClause.append(" = "); //$NON-NLS-1$ + appendColumn(setClause, entity, columnNames[i], adapter, value); + numValuesSet++; + } + } + String query = "UPDATE " + row.getTable(); //$NON-NLS-1$ + query += " SET " + setClause.toString(); //$NON-NLS-1$ + query += " WHERE " + whereClause.toString(); //$NON-NLS-1$ + this.query.setText(query); + } + + /* (non-Javadoc) + * @see com.quantum.wizards.BaseSQLPage#getQueryText() + */ + protected String getQueryText() { + return query.getText(); + } + +} \ No newline at end of file -- 1.7.1